From patchwork Thu Apr 28 11:40:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Dedecker X-Patchwork-Id: 616132 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from arrakis.dune.hu (caladan.dune.hu [78.24.191.180]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3qwZdX5shpz9t50 for ; Thu, 28 Apr 2016 21:40:32 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=oSatKemi; dkim-atps=neutral Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 49FB5B8023F; Thu, 28 Apr 2016 13:40:25 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on arrakis.dune.hu X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.1 Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP; Thu, 28 Apr 2016 13:40:25 +0200 (CEST) Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 44CB7B8021F for ; Thu, 28 Apr 2016 13:40:23 +0200 (CEST) X-policyd-weight: using cached result; rate: -7 Received: from mail-wm0-f67.google.com (mail-wm0-f67.google.com [74.125.82.67]) by arrakis.dune.hu (Postfix) with ESMTPS for ; Thu, 28 Apr 2016 13:40:22 +0200 (CEST) Received: by mail-wm0-f67.google.com with SMTP id n129so13223889wmn.1 for ; Thu, 28 Apr 2016 04:40:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=tepmUcq3oKNRFeRtmHNCno2sQE8DQZKOUXzSNSDb74g=; b=oSatKemiPGkmWdy4xeD3mlwVQQY6LgugUJtwZ4Ihafy9Huj7/I/AmgjNI88GPT0MyA XTmTIBCgk53rTeh0gE1Q0cIkhZu8dRpnTGkBHWoCAK1ughLbiAmCnFFi3CARxiJjERs0 5MVQf47I2HhuP+syZB6FakL9tXT/P5Z7i4BVjLmTtb4W/ErXRH4AJNYUxCoJXXMerR9W CruNHsunji8x/MOHkUMXGwqbMFvILtbrYWUQTHWrf4f+S3xqwkvLl8m2ib4vYZu/19SV 83Sth3yxnWHHoXZm+EBZj5WA9e3/FAMy3cD3WeK45ooQeKtRjsEq9jGUt4WtgIm6cyaA ooPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=tepmUcq3oKNRFeRtmHNCno2sQE8DQZKOUXzSNSDb74g=; b=gPd5F1hd7a5xPMm0JykiHfweaMuzG8uGfhqI85yZnlDeMrQLew7PznKjpewvKJ622w tRLISVBZuzUHVCc1UA1cUa3f7B1pdXLEbaG2z8aQUFNbJMxdNr2dDBMiZBac6SKAUItM N4HEhCLUqEqmtpx670Lhtyr96yqn9EZY+UY1fOsZ4YlBNZ5Wn+EYbuKUF85LoSAHtvAO Jke4aXdnztYI4ogG31oFoG8IDiGIYc5kx0gw6/bqfz5Z9Od4Mq4n5GRK7bSSV+58R/5e VxQIH4xcE+ukiX1GxZbX+SNvo4p0tbzD7HeXRf/RMEaJYUHD7zwj/PS7BTLmJlHG9ywr d/tA== X-Gm-Message-State: AOPr4FVmFRMeaoTwEBUyRIL+9LXy3YrmrKDjEyG+0pygxXdOaGc9qem0Bg2WQpDr7PzxYw== X-Received: by 10.28.104.131 with SMTP id d125mr29145554wmc.99.1461843622385; Thu, 28 Apr 2016 04:40:22 -0700 (PDT) Received: from cplx43.eu.thmulti.com ([141.11.62.7]) by smtp.gmail.com with ESMTPSA id m14sm13653160wmc.4.2016.04.28.04.40.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 28 Apr 2016 04:40:21 -0700 (PDT) From: Hans Dedecker To: openwrt-devel@lists.openwrt.org Date: Thu, 28 Apr 2016 13:40:17 +0200 Message-Id: <1461843617-11681-1-git-send-email-dedeckeh@gmail.com> X-Mailer: git-send-email 1.9.1 Subject: [OpenWrt-Devel] [PATCH] netifd: Add configurable DHCP release behavior X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Hans Dedecker , cyrus@openwrt.org MIME-Version: 1.0 Errors-To: openwrt-devel-bounces@lists.openwrt.org Sender: "openwrt-devel" Make sending a DHCP release configurable when the client exits allowing to clean up IP/mac state info in intermediate devices. Signed-off-by: Hans Dedecker --- v1 -> v2 : Make sending DHCP release configurable via uci package/network/config/netifd/files/lib/netifd/proto/dhcp.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 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..7085bd2 100755 --- a/package/network/config/netifd/files/lib/netifd/proto/dhcp.sh +++ b/package/network/config/netifd/files/lib/netifd/proto/dhcp.sh @@ -12,6 +12,7 @@ proto_dhcp_init_config() { proto_config_add_string clientid proto_config_add_string vendorid proto_config_add_boolean 'broadcast:bool' + proto_config_add_boolean 'release:bool' proto_config_add_string 'reqopts:list(string)' proto_config_add_string iface6rd proto_config_add_string sendopts @@ -26,8 +27,8 @@ 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 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 opt dhcpopts for opt in $reqopts; do @@ -39,6 +40,7 @@ proto_dhcp_setup() { done [ "$broadcast" = 1 ] && broadcast="-B" || broadcast= + [ "$release" = 1 ] && release="-R" || release= [ -n "$clientid" ] && clientid="-x 0x3d:${clientid//:/}" || clientid="-C" [ -n "$iface6rd" ] && proto_export "IFACE6RD=$iface6rd" [ "$iface6rd" != 0 -a -f /lib/netifd/proto/6rd.sh ] && append dhcpopts "-O 212" @@ -56,7 +58,7 @@ proto_dhcp_setup() { ${ipaddr:+-r $ipaddr} \ ${hostname:+-H $hostname} \ ${vendorid:+-V $vendorid} \ - $clientid $broadcast $dhcpopts + $clientid $broadcast $release $dhcpopts } proto_dhcp_renew() {