From patchwork Mon Jul 2 01:08:17 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: 937634 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.136; helo=silver.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="iNhx4f3N"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="cljblLze"; dkim-atps=neutral Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41Jpzm6kZwz9s3q for ; Mon, 2 Jul 2018 11:08:51 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id B113122D10; Mon, 2 Jul 2018 01:08:46 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id sr9LMPYbTXUs; Mon, 2 Jul 2018 01:08:44 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id D6B18227CE; Mon, 2 Jul 2018 01:08:44 +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 157881C2C82 for ; Mon, 2 Jul 2018 01:08:44 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 125C385B58 for ; Mon, 2 Jul 2018 01:08:44 +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 VTBWwDaeOQbF for ; Mon, 2 Jul 2018 01:08:42 +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 BCB4985D45 for ; Mon, 2 Jul 2018 01:08:39 +0000 (UTC) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 7040B2112B; Sun, 1 Jul 2018 21:08:38 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Sun, 01 Jul 2018 21:08:38 -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=o3cdq+Jkca7sixedZ PTD3cDoEiLkepI9BQtGMs/m/pE=; b=iNhx4f3NdmRlCPlS+Whw2WskJNHcu5gal pTbHdDSqz/H7hRNwf11FTezesxdUxFuSmUKSXPcxffFl3+/dY2dLuatRTL8T8SMB llvIePG5VStbBZeUYFTmlLZ+c2umcl1+Fttm30NSSQOJLOhAhrkuKLR8Jcr4+P3e PQyiMNNECB3lQqtef05jKL1hQAUH6lv2tfvym9IsZ67u+2hj6BYlZda9NAI0FvCW pewRqat8AUpax/VK60dfan6wd/zZhJ30Sv5oUYeJ2tSvaxSeMkYqe1sSU0BAmrf4 IUPbtQX5LHVg+IxF2OEI/5LWTcqF7D27zIvxvj3Ba1vLU2gHTM2aA== 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=o3cdq+Jkca7sixedZ PTD3cDoEiLkepI9BQtGMs/m/pE=; b=cljblLzebNAL1usowhLvEV15C6ATAuWKB fbZZSxZBvVWqmChWr41E2Jw5/sQwi5wm9+uXgqnNzbxau+FA7DOmBhx3kWAQObvu 661KVFoGwYQoJYSMgoiGzhXhdCf+wYyXZNfMv8IkRvFLO9iURVnbb9HXLSXs6zIK qAwPHPJmDMkg+DFvpKkJAJb/1r/ozRSzaS553bOdxnrS261izcpq71tyk1CuJLTd gQzLxJ5RtIuixjXsCSARXIWxyixLiVr0hSfM6htNNjInIv6svf2fwz1nVk8Ij7+x MjPY5J+hLJO9esJxPjRkPqO8nfSU9jnAnsaeGUfj+tX1VHCEg9S9g== 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 997CB10261; Sun, 1 Jul 2018 21:08:36 -0400 (EDT) From: Samuel Mendoza-Jonas To: buildroot@buildroot.org Date: Mon, 2 Jul 2018 11:08:17 +1000 Message-Id: <20180702010817.3711-1-sam@mendozajonas.com> X-Mailer: git-send-email 2.18.0 Subject: [Buildroot] [PATCH v3] 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. Also from Rob, if handling a DHCPv6 address wait a moment for the IPv6 route to be configured; this doesn't come from DHCPv6 but rather the IPv6 Router Advertisement (RA). (wait for IPv6 route) From: Robert Lippert Signed-off-by: Samuel Mendoza-Jonas --- 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"