[source] netifd: Request DHCP option 121 (classless route) by default

LEDE Commits lede-commits at lists.infradead.org
Wed Oct 26 06:22:31 PDT 2016


blogic pushed a commit to source.git, branch master:
https://git.lede-project.org/89817614bb4f275996b72fc76e41acf3a031e716

commit 89817614bb4f275996b72fc76e41acf3a031e716
Author: Baptiste Jonglez <git at bitsofnetworks.org>
AuthorDate: Sun Oct 9 11:23:27 2016 +0200

    netifd: Request DHCP option 121 (classless route) by default
    
    This option, defined by RFC3442, allows a DHCP server to send static
    routes to a client.  But the client has to request this option
    explicitely.
    
    Static routes are useful when the gateway configured by DHCP cannot be
    in the same subnet as the client.  This happens, for instance, when
    using DHCP to hand out addresses in /32 subnets.
    
    A new configuration option "classlessroute" is available, allowing
    users to disable this feature (the option defaults to true).
    
    Other DHCP clients already request this option by default (dhcpcd, for
    instance, and possibly Windows).  If a DHCP server does not support
    this option, it will simply ignore it.
    
    Signed-off-by: Baptiste Jonglez <git at bitsofnetworks.org>
---
 package/network/config/netifd/files/lib/netifd/proto/dhcp.sh | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/package/network/config/netifd/files/lib/netifd/proto/dhcp.sh b/package/network/config/netifd/files/lib/netifd/proto/dhcp.sh
index 1d3a209..ea02d68 100755
--- a/package/network/config/netifd/files/lib/netifd/proto/dhcp.sh
+++ b/package/network/config/netifd/files/lib/netifd/proto/dhcp.sh
@@ -21,14 +21,15 @@ proto_dhcp_init_config() {
 	proto_config_add_string zone
 	proto_config_add_string mtu6rd
 	proto_config_add_string customroutes
+	proto_config_add_boolean classlessroute
 }
 
 proto_dhcp_setup() {
 	local config="$1"
 	local iface="$2"
 
-	local ipaddr hostname clientid vendorid broadcast release reqopts iface6rd sendopts delegate zone6rd zone mtu6rd customroutes
-	json_get_vars ipaddr hostname clientid vendorid broadcast release reqopts iface6rd sendopts delegate zone6rd zone mtu6rd customroutes
+	local ipaddr hostname clientid vendorid broadcast release reqopts iface6rd sendopts delegate zone6rd zone mtu6rd customroutes classlessroute
+	json_get_vars ipaddr hostname clientid vendorid broadcast release reqopts iface6rd sendopts delegate zone6rd zone mtu6rd customroutes classlessroute
 
 	local opt dhcpopts
 	for opt in $reqopts; do
@@ -49,6 +50,8 @@ proto_dhcp_setup() {
 	[ -n "$mtu6rd" ] && proto_export "MTU6RD=$mtu6rd"
 	[ -n "$customroutes" ] && proto_export "CUSTOMROUTES=$customroutes"
 	[ "$delegate" = "0" ] && proto_export "IFACE6RD_DELEGATE=0"
+	# Request classless route option (see RFC 3442) by default
+	[ "$classlessroute" = "0" ] || append dhcpopts "-O 121"
 
 	proto_export "INTERFACE=$config"
 	proto_run_command "$config" udhcpc \



More information about the lede-commits mailing list