From patchwork Thu Jul 26 01:39:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Mendoza-Jonas X-Patchwork-Id: 949419 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.138; helo=whitealder.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=mendozajonas.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=mendozajonas.com header.i=@mendozajonas.com header.b="YNltAd7q"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="iOEKICLN"; dkim-atps=neutral Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41bZXD3GGQz9ryt for ; Thu, 26 Jul 2018 11:39:39 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 9AFA9863FD; Thu, 26 Jul 2018 01:39:37 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id QkPBZg4Y+l-P; Thu, 26 Jul 2018 01:39:36 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id 514D886359; Thu, 26 Jul 2018 01:39:36 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 042701C2C1B for ; Thu, 26 Jul 2018 01:39:35 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 018B386333 for ; Thu, 26 Jul 2018 01:39:35 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id KRaLjcPhdPwn for ; Thu, 26 Jul 2018 01:39:34 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by whitealder.osuosl.org (Postfix) with ESMTPS id 590E286359 for ; Thu, 26 Jul 2018 01:39:34 +0000 (UTC) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 2CA4521E59; Wed, 25 Jul 2018 21:39:33 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Wed, 25 Jul 2018 21:39:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= mendozajonas.com; h=cc:date:from:message-id:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=JPJNzSrzLJG6ISAz7 XJCpqxkAaBg6cgYG7GkoaaF1dA=; b=YNltAd7qeiRv6i2q4V/yO26eD5x2tTXj7 LK6fTHizPaE2BAqaAd3YeRVYOfVP9n++VDd6isiEXEa04w8xnXohs76DqxWIbPRw ZwZ779I6UkJzTu3yzwgjYxzZvibB0ZAyykNJ7yLYuplHDBX/1h+8B/NPLJDYNsNZ 0bXOhnJOQSDuYkq+DInWMneWGXG4sWLCoamwCtEaO2M85McL7yG61gNnxuhTeYll 9ATdS0bL/focjjMpFeaGDWpHSK6T188WADB4lNcV9p5ndaQrNl2ZOPShI/DSSFvv 8HeDBkvlWTUB1uFWLcETqLLLsjFEJbIb3rLs0qEN8cbgKZXLJZZVQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:message-id:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=JPJNzSrzLJG6ISAz7 XJCpqxkAaBg6cgYG7GkoaaF1dA=; b=iOEKICLNdoIXT+jw5hoJaQjE8kZpopeZb 7TgSCOBxsc3cfv/Bt/OZ3es4l0mWrRxHmiwQ8egp36r4DjfZ6uo1IBWngy/b0rjL K5fvZ5GAIsqs5XDNKLbZOTbgxzpkVrr++DhUhfkte1mK9TtCqc7JyYuf+cOHMy+0 /enfKjrayjYJt2WP4sPP7CaH/WMroJOi9/e+FBy56XJ6gZb41QdnhjMa6kM0VW5b H+kOZQ/QOcE2K+HBe+c+/swtEFkgCMu1v+aCn7fD9aXl9SVFJFSkOAgTm8Me2Psn hBBmHVZu65wHDfIPRZ/yS75NS+2/72311/l5hnnzGUNfqjH7FAxEQ== X-ME-Proxy: X-ME-Sender: Received: from v4.ozlabs.ibm.com (unknown [122.99.82.10]) by mail.messagingengine.com (Postfix) with ESMTPA id 314A6E4512; Wed, 25 Jul 2018 21:39:30 -0400 (EDT) From: Samuel Mendoza-Jonas To: buildroot@buildroot.org Date: Thu, 26 Jul 2018 11:39:19 +1000 Message-Id: <20180726013919.31268-1-sam@mendozajonas.com> X-Mailer: git-send-email 2.18.0 Subject: [Buildroot] [PATCH v4] busybox: Update udhcpc.script for stateful DHCPv6 X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.24 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Robert Lippert , Samuel Mendoza-Jonas MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" udhcpc6 will call the default script with the address set in the "ipv6" variable. Set "ip" to this address if present. udhcpc6 implements "stateful" DHCPv6 for explicitly requesting an address and other configuration information. A major difference between DHCPv4 and DHCPv6 is that DHCPv6 does *not* advertise a default route; this is determined by normal IPv6 autoconfiguration. Included is a change from Rob, which if handling a DHCPv6 address waits a moment for the IPv6 route to be configured; as above this doesn't come from DHCPv6 but rather the IPv6 Router Advertisement (RA) which happens independently from udhcpc6. The intent here is to try and ensure that the interface is route-able upon the script's completion as it would be if called from udhcpc. (wait for IPv6 route) From: Robert Lippert Signed-off-by: Samuel Mendoza-Jonas --- v4: Expand description of stateful DHCPv6 in commit message v3: Point out 'stateful' DHCPv6 in commit, send to the correct list... v2: Avoid bashisms package/busybox/udhcpc.script | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/package/busybox/udhcpc.script b/package/busybox/udhcpc.script index ad110d3a7f..65114b6cd0 100755 --- a/package/busybox/udhcpc.script +++ b/package/busybox/udhcpc.script @@ -8,6 +8,16 @@ RESOLV_CONF="/etc/resolv.conf" [ -e $RESOLV_CONF ] || touch $RESOLV_CONF [ -n "$broadcast" ] && BROADCAST="broadcast $broadcast" [ -n "$subnet" ] && NETMASK="netmask $subnet" +[ -n "$ipv6" ] && ip="$ipv6/128" + +wait_for_ipv6_default_route() { + attempts=10 + while [ $attempts != 0 ] && [ -z "$(ip -6 route list | grep default)" ] ; do + sleep 1 + attempts=$(($attempts-1)) + done + [ $attempts = 0 ] && echo "failed to get default ipv6 route" +} case "$1" in deconfig) @@ -37,6 +47,10 @@ case "$1" in /usr/sbin/avahi-autoipd -k $interface fi /sbin/ifconfig $interface $ip $BROADCAST $NETMASK + if [ -n "$ipv6" ] ; then + echo "waiting for default ipv6 route set" + wait_for_ipv6_default_route + fi if [ -n "$router" ] ; then echo "deleting routers"