Commit 47f8d079 authored by Vladimir Bashkirtsev's avatar Vladimir Bashkirtsev

Fix DHCP client to work with qmi_wwan RawIP interface

parent 9b2f1b87
......@@ -5,6 +5,7 @@ all: systemd-user-sessions network-config
patch -Np1 -d systemd-248 < systemd-248-fix_timesyncd.patch
patch -Np1 -d systemd-248 < systemd-248-fix_test-udev.patch
patch -Np1 -d systemd-248 < systemd-248-fix_test-path-util.patch
patch -Np1 -d systemd-248 < systemd-248-fix_wwan_dhcp.patch
patch -Np1 -d systemd-248 < systemd-248-increase_test_timeouts.patch
ln -s /tools/bin/true /usr/bin/xsltproc
cd systemd-248 && sed -i 's/GROUP="render", //' rules.d/50-udev-default.rules.in
......
diff -uNr systemd-248/src/libsystemd-network/sd-dhcp-client.c systemd-248-wwan_dhcp_fix/src/libsystemd-network/sd-dhcp-client.c
--- systemd-248/src/libsystemd-network/sd-dhcp-client.c 2021-03-31 07:29:02.000000000 +1030
+++ systemd-248-wwan_dhcp_fix/src/libsystemd-network/sd-dhcp-client.c 2026-03-21 23:25:24.603956799 +1030
@@ -293,16 +293,33 @@
bool need_restart = false;
int r;
+ static const uint8_t default_eth_bcast[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff },
+ default_eth_addr[6] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
assert_return(client, -EINVAL);
- assert_return(addr, -EINVAL);
- assert_return(addr_len > 0 && addr_len <= MAX_MAC_ADDR_LEN, -EINVAL);
- assert_return(arp_type > 0, -EINVAL);
if (arp_type == ARPHRD_ETHER)
assert_return(addr_len == ETH_ALEN, -EINVAL);
else if (arp_type == ARPHRD_INFINIBAND)
assert_return(addr_len == INFINIBAND_ALEN, -EINVAL);
- else
+ else if (arp_type == ARPHRD_RAWIP || arp_type == ARPHRD_NONE) {
+ /* Linux cellular modem drivers (e.g. qmi_wwan) present a
+ * network interface of type ARPHRD_RAWIP(519) or
+ * ARPHRD_NONE(65534) when in point-to-point mode, but these
+ * are not valid DHCP hardware-type values.
+ *
+ * Apparently, it's best to just pretend that these are ethernet
+ * devices. Other approaches have been tried, but resulted in
+ * incompatibilities with some server software. See
+ * https://lore.kernel.org/netdev/cover.1228948072.git.inaky@linux.intel.com/
+ */
+ arp_type = ARPHRD_ETHER;
+ if (addr_len == 0) {
+ addr = default_eth_addr;
+ bcast_addr = default_eth_bcast;
+ addr_len = ETH_ALEN;
+ }
+ } else
return -EINVAL;
if (client->mac_addr_len == addr_len &&
diff -uNr systemd-248/src/network/networkd-dhcp-common.c systemd-248-wwan_dhcp_fix/src/network/networkd-dhcp-common.c
--- systemd-248/src/network/networkd-dhcp-common.c 2021-03-31 07:29:02.000000000 +1030
+++ systemd-248-wwan_dhcp_fix/src/network/networkd-dhcp-common.c 2026-03-21 22:26:30.850421741 +1030
@@ -21,6 +21,12 @@
assert(link);
assert(IN_SET(family, AF_INET, AF_INET6));
+ /* Currently, sd-dhcp-client supports only ethernet and infiniband.
+ * (ARMHRD_RAWIP and ARMHRD_NONE are typically wwan modems and will be
+ * treated as ethernet devices.) */
+ if (family == AF_INET && !IN_SET(link->iftype, ARPHRD_ETHER, ARPHRD_INFINIBAND, ARPHRD_RAWIP, ARPHRD_NONE))
+ return false;
+
if (family == AF_INET6 && !socket_ipv6_is_supported())
return false;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment