busybox: udhcpc: no MSG_DONTROUTE when sending packet
authorAdi Shammout <adi.shammout@outlook.com>
Wed, 6 Jun 2018 19:53:24 +0000 (22:53 +0300)
committerHans Dedecker <dedeckeh@gmail.com>
Thu, 7 Jun 2018 19:44:04 +0000 (21:44 +0200)
This reverts a change made in Sep 2017 [1] which introduced
MSG_DONTROUTE flag to prevent udhcpc from reaching out to servers on a
different subnet. That change violates RFC2131 by forcing fully
configured clients, who got their configurations through an offer
relayed by a DHCP relay, from renewing through a unicast request
directly to the DHCP server, resulting in the client resorting to
boradcasting lease extension requests instead of unicasting them,
further breaking RFC2131.

The problem with MSG_DONTROUTE appears when talking to a properly
configured DHCP server that rejects non-compliant requests. Such server
will reject lease extension attempts sent via broadcast rather than
unicast, as is the case with Finnish ISPs Telia and DNA as well as
Estonian ISP Starman. Once the lease expires without renewal, udhcpc
enters init mode, taking down the interfaces with it, and thus causing
interruption on every lease expiry. On some ISPs (such as the ones
mentioned above) that can be once every 10-20 minutes. The interruptions
appear in the logs as such:
----
udhcpc: sending renew to x.x.x.x
udhcpc: send: Network unreachable
udhcpc: sending renew to 0.0.0.0
udhcpc: sending renew to 0.0.0.0
...
udhcpc: lease lost, entering init state
Interface 'wan' has lost the connection
Interface 'wan' is now down
Network alias 'eth0' link is down
udhcpc: sending select for y.y.y.y
udhcpc: lease of y.y.y.y obtained, lease time 1200
Network alias 'eth0' link is up
Interface 'wan' is now up
----

During lease extension, a fully configured client should be able to
reach out to the server from which it recieved the lease for extension,
regardless in which network it is; that's up to the gateway to find. [2]
This patch ensures that.

[1]
http://lists.busybox.net/pipermail/busybox-cvs/2017-September/037402.html
[2]
https://www.netmanias.com/en/post/techdocs/6000/dhcp-network-protocol/
understanding-dhcp-relay-agents

Signed-off-by: Adi Shammout <adi.shammout@outlook.com>
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com> [PKG_RELEASE increase]
package/utils/busybox/Makefile
package/utils/busybox/patches/204-udhcpc_no_msg_dontroute.patch [new file with mode: 0644]

index 1238bc83f0009cae4942a0474384aa03c73db07f..77e76af7cda998ba244e53c5e7b25ffe8ca5a4c9 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=busybox
 PKG_VERSION:=1.28.3
-PKG_RELEASE:=2
+PKG_RELEASE:=3
 PKG_FLAGS:=essential
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
diff --git a/package/utils/busybox/patches/204-udhcpc_no_msg_dontroute.patch b/package/utils/busybox/patches/204-udhcpc_no_msg_dontroute.patch
new file mode 100644 (file)
index 0000000..e70c412
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/networking/udhcp/dhcpc.c
++++ b/networking/udhcp/dhcpc.c
+@@ -700,7 +700,7 @@
+               return udhcp_send_kernel_packet(packet,
+                       ciaddr, CLIENT_PORT,
+                       server, SERVER_PORT,
+-                      /*send_flags: "to hosts only on directly connected networks" */ MSG_DONTROUTE
++                      0 /*Was MSG_DONTROUTE here. It prevented unicast renewal requests to server in different subnet*/
+               );
+       }
+       return raw_bcast_from_client_config_ifindex(packet, ciaddr);