From patchwork Tue May 21 02:54:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Mendoza-Jonas X-Patchwork-Id: 1102497 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.133; helo=hemlock.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="TNlr3sZk"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="yWi/gLOH"; dkim-atps=neutral Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 457L312HKnz9s5c for ; Tue, 21 May 2019 12:54:52 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 56DE486FF9; Tue, 21 May 2019 02:54:49 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id D1FGDcxopDkW; Tue, 21 May 2019 02:54:48 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id AD0EA86EB1; Tue, 21 May 2019 02:54:48 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id 497CA1BF345 for ; Tue, 21 May 2019 02:54:48 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 4637585DC0 for ; Tue, 21 May 2019 02:54:48 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id IIi0B-H5gBTi for ; Tue, 21 May 2019 02:54:47 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by fraxinus.osuosl.org (Postfix) with ESMTPS id 630EF852CF for ; Tue, 21 May 2019 02:54:47 +0000 (UTC) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id B825724055; Mon, 20 May 2019 22:54:45 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Mon, 20 May 2019 22:54:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= mendozajonas.com; h=from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; s=fm3; bh=E5sFtV3WnZZr3h/BcqOyBsZNWJdLzbbQHSE/kuoFXcE=; b=TNlr3 sZkCChT9SebUu/HzRBXqDCNlKlrbi3N+TkQyAPg2AKfz0qa7a6mKyk0oPrUIn3SX QupA/dzVI0EOITfzVUQKRrSQo0FD0XnVmoYEvZOFQRpeL0erVRbhDSqKIxUU5B7y hbXyn3GNkAkoTXYNigFGaoEBevh2JA4rNgnV5k4n89+BaayaDx5a5vm7pSkD7+0v 9p9b20d2sS4XbGXAEOds1T2uFhJjOq7gQzvKZVvmMrXfCv6NAw4vSzYsht52YfeY VzG4Fan1emORwb0G5gROTGdsDDFVtTpD6+ULGxEc518bN2UPcVAOeTc724wwI5ve BIknisYOsxqwjg5gQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=E5sFtV3WnZZr3h/BcqOyBsZNWJdLzbbQHSE/kuoFXcE=; b=yWi/gLOH fFuRMg2zGiRCgtYztuuSQYDmR16LHyDeFA/YuvAprf7kXxZ8ZB3hmntjPyTzuziQ zit6KjIGaPwn4o1yVMg8SJxqMnNtMPcsHXyw9NQ5naP7VInPIPa/QcJ319c3Iw6p n8/m+xZEkG6rffUEQve0E4RlkwXvXuwtXU8uAIq9QPnOX6QkDfikSqNmbagq5zy8 bqCyC5N4aZ5AjezaQaTtTNrjYRkdO1Ta0f1B1sl6LU/5XJw8LiEcEEeYD6h/lmc5 JGTgDLVwZkBv/2TS54p6gpmr4rHDBZP5Ev3rQ6Z1Otw3IjLOx6XjNP8aWD4Ajk1C ze17LBg1JT2s3Q== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduuddruddtledgieegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekre dtredttdenucfhrhhomhepufgrmhhuvghlucfovghnughoiigrqdflohhnrghsuceoshgr mhesmhgvnhguohiirghjohhnrghsrdgtohhmqeenucfkphepuddvvddrleelrdekvddrud dtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehsrghmsehmvghnughoiigrjhhonhgrshdr tghomhenucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: Received: from v4.ozlabs.ibm.com (unknown [122.99.82.10]) by mail.messagingengine.com (Postfix) with ESMTPA id 176CB80061; Mon, 20 May 2019 22:54:43 -0400 (EDT) From: Samuel Mendoza-Jonas To: buildroot@buildroot.org Date: Tue, 21 May 2019 12:54:28 +1000 Message-Id: <20190521025428.9409-2-sam@mendozajonas.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190521025428.9409-1-sam@mendozajonas.com> References: <20190521025428.9409-1-sam@mendozajonas.com> MIME-Version: 1.0 Subject: [Buildroot] [PATCH v5 2/2] busybox: wait for ipv6 default route in udhcpc6 X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Samuel Mendoza-Jonas , matthew.weber@collins.com Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" 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. Signed-off-by: Samuel Mendoza-Jonas --- v5: Split into two patches, modify the wait_for_ipv6_default_route loop to resemble the loop in package/ifupdown-scripts/network/if-pre-up.d/wait_iface 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 | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/package/busybox/udhcpc.script b/package/busybox/udhcpc.script index 90cc6b62ba..69e0be68a1 100755 --- a/package/busybox/udhcpc.script +++ b/package/busybox/udhcpc.script @@ -11,6 +11,23 @@ RESOLV_CONF="/etc/resolv.conf" # Busybox's udhcpc only supports stateful DHCPv6 for now [ -n "$ipv6" ] && ip="$ipv6/128" +if [ -z "${IF_WAIT_DELAY}" ]; then + IF_WAIT_DELAY=10 +fi +wait_for_ipv6_default_route() { + printf "Waiting for IPv6 default route to appear" + while [ $IF_WAIT_DELAY -gt 0 ]; do + if [ -z "$(ip -6 route list | grep default)" ]; then + printf "\n" + return + fi + sleep 1 + printf "." + : $((IF_WAIT_DELAY -= 1)) + done + printf " timeout!\n" +} + case "$1" in deconfig) /sbin/ifconfig $interface up @@ -39,6 +56,9 @@ case "$1" in /usr/sbin/avahi-autoipd -k $interface fi /sbin/ifconfig $interface $ip $BROADCAST $NETMASK + if [ -n "$ipv6" ] ; then + wait_for_ipv6_default_route + fi if [ -n "$router" ] ; then echo "deleting routers"