From patchwork Fri Nov 20 22:50:56 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baptiste Jonglez X-Patchwork-Id: 547071 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from arrakis.dune.hu (arrakis.dune.hu [78.24.191.176]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 86FF81402C2 for ; Sat, 21 Nov 2015 09:51:21 +1100 (AEDT) Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 83F8A280618; Fri, 20 Nov 2015 23:49:10 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on arrakis.dune.hu X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00, T_RP_MATCHES_RCVD autolearn=unavailable version=3.3.2 Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 25A382805AA for ; Fri, 20 Nov 2015 23:49:04 +0100 (CET) X-policyd-weight: using cached result; rate: -8.5 Received: from archminux.polyno.me (archminux.polyno.me [89.234.140.144]) by arrakis.dune.hu (Postfix) with ESMTPS for ; Fri, 20 Nov 2015 23:49:03 +0100 (CET) Received: from zorun by archminux.polyno.me with local (Exim 4.80) (envelope-from ) id 1ZzuWF-0002W9-Qy; Fri, 20 Nov 2015 23:51:03 +0100 From: Baptiste Jonglez To: openwrt-devel@lists.openwrt.org Date: Fri, 20 Nov 2015 23:50:56 +0100 Message-Id: <1448059856-8493-1-git-send-email-baptiste@bitsofnetworks.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1447803237-14107-1-git-send-email-baptiste@bitsofnetworks.org> References: <1447803237-14107-1-git-send-email-baptiste@bitsofnetworks.org> Cc: Baptiste Jonglez Subject: [OpenWrt-Devel] [PATCH v2] netifd: Request DHCP option 121 (classless route) by default X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: openwrt-devel-bounces@lists.openwrt.org Sender: "openwrt-devel" From: Baptiste Jonglez This option is 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). Signed-off-by: Baptiste Jonglez --- 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 0e88af9..aae0e44 100755 --- a/package/network/config/netifd/files/lib/netifd/proto/dhcp.sh +++ b/package/network/config/netifd/files/lib/netifd/proto/dhcp.sh @@ -20,14 +20,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 reqopts iface6rd sendopts delegate zone6rd zone mtu6rd customroutes - json_get_vars ipaddr hostname clientid vendorid broadcast reqopts iface6rd sendopts delegate zone6rd zone mtu6rd customroutes + local ipaddr hostname clientid vendorid broadcast reqopts iface6rd sendopts delegate zone6rd zone mtu6rd customroutes classlessroute + json_get_vars ipaddr hostname clientid vendorid broadcast reqopts iface6rd sendopts delegate zone6rd zone mtu6rd customroutes classlessroute local opt dhcpopts for opt in $reqopts; do @@ -47,6 +48,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 \