* [Buildroot] Question on udhcpc script
@ 2021-02-01 10:30 Bhattiprolu RaviKumar
2021-02-01 12:24 ` Peter Korsgaard
0 siblings, 1 reply; 7+ messages in thread
From: Bhattiprolu RaviKumar @ 2021-02-01 10:30 UTC (permalink / raw)
To: buildroot
All,
We are using busybox to get DHCPv6 address. However, I am bit confused
on the part of the script /etc/udhcpc.d/50default:
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"
}
The print says "Waiting for IPv6 default route to appear". However the if
statement is checking for "$(ip -6 route list | grep default)"to be null
(-z check) which means default route is not present.
In our case, after DHCP, default route gets setup and "$(ip -6 route list |
grep default)"returns an entry starting with default and since check is -z,
it continues in the loop and finally prints "timeout".
I am confused here. Am I missing something here?
regards,
Ravi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20210201/a7aa2cbc/attachment-0001.html>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Buildroot] Question on udhcpc script
2021-02-01 10:30 [Buildroot] Question on udhcpc script Bhattiprolu RaviKumar
@ 2021-02-01 12:24 ` Peter Korsgaard
2021-02-01 13:20 ` Bhattiprolu RaviKumar
0 siblings, 1 reply; 7+ messages in thread
From: Peter Korsgaard @ 2021-02-01 12:24 UTC (permalink / raw)
To: buildroot
>>>>> "Bhattiprolu" == Bhattiprolu RaviKumar <ravikumar.bhattiprolu@gmail.com> writes:
> All,
> We are using busybox to get DHCPv6 address. However, I am bit confused
> on the part of the script /etc/udhcpc.d/50default:
We don't have have such a script in Buildroot? It looks like yocto does
though:
https://git.yoctoproject.org/cgit.cgi/poky/commit/?id=763b11d0fd6b804c73f0f645a3025c8f82f5aaf1&context=6
Please direct yocto questions to yocto.
--
Bye, Peter Korsgaard
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Buildroot] Question on udhcpc script
2021-02-01 12:24 ` Peter Korsgaard
@ 2021-02-01 13:20 ` Bhattiprolu RaviKumar
2021-02-01 13:56 ` Peter Korsgaard
0 siblings, 1 reply; 7+ messages in thread
From: Bhattiprolu RaviKumar @ 2021-02-01 13:20 UTC (permalink / raw)
To: buildroot
Peter,
The script in yocto seems to be derived from
package/busybox/udhcpc.script in buildroot. It also had the same
"wait_for_ipv6_default_route" function and same check.
regards,
Ravi
On Mon, Feb 1, 2021 at 5:54 PM Peter Korsgaard <peter@korsgaard.com> wrote:
> >>>>> "Bhattiprolu" == Bhattiprolu RaviKumar <
> ravikumar.bhattiprolu at gmail.com> writes:
>
> > All,
> > We are using busybox to get DHCPv6 address. However, I am bit
> confused
> > on the part of the script /etc/udhcpc.d/50default:
>
> We don't have have such a script in Buildroot? It looks like yocto does
> though:
>
>
> https://git.yoctoproject.org/cgit.cgi/poky/commit/?id=763b11d0fd6b804c73f0f645a3025c8f82f5aaf1&context=6
>
> Please direct yocto questions to yocto.
>
> --
> Bye, Peter Korsgaard
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20210201/afb928a1/attachment-0001.html>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Buildroot] Question on udhcpc script
2021-02-01 13:20 ` Bhattiprolu RaviKumar
@ 2021-02-01 13:56 ` Peter Korsgaard
2021-02-02 1:33 ` Samuel Mendoza-Jonas
0 siblings, 1 reply; 7+ messages in thread
From: Peter Korsgaard @ 2021-02-01 13:56 UTC (permalink / raw)
To: buildroot
>>>>> "Bhattiprolu" == Bhattiprolu RaviKumar <ravikumar.bhattiprolu@gmail.com> writes:
> Peter,
> All,
> We are using busybox to get DHCPv6 address. However, I am bit confused
> on the part of the script /etc/udhcpc.d/50default:
> 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"
> }
> The print says "Waiting for IPv6 default route to appear". However the if
> statement is checking for "$(ip -6 route list | grep default)"to be null
> (-z check) which means default route is not present.
> In our case, after DHCP, default route gets setup and "$(ip -6 route list |
> grep default)"returns an entry starting with default and since check is -z,
> it continues in the loop and finally prints "timeout".
> I am confused here. Am I missing something here?
> The script in yocto seems to be derived from
> package/busybox/udhcpc.script in buildroot. It also had the same
> "wait_for_ipv6_default_route" function and same check.
Ok, but please be specific when you ask questions. So your question is
really about the code in package/busybox/udhcpc.script which got added
by:
commit 2d458a2d7c7f3418242aae52464306ef9f4a407f
Author: Samuel Mendoza-Jonas <sam@mendozajonas.com>
Date: Tue May 21 12:54:28 2019 +1000
package/busybox: udhcpc.script: wait for ipv6 default route from RA for stateful DHCPv6
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.
Add logic to wait up to IF_WAIT_DELAY seconds 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 <sam@mendozajonas.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
The test indeed seems to be inverted. Samuel, any comments?
--
Bye, Peter Korsgaard
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Buildroot] Question on udhcpc script
2021-02-01 13:56 ` Peter Korsgaard
@ 2021-02-02 1:33 ` Samuel Mendoza-Jonas
2021-02-02 1:56 ` Samuel Mendoza-Jonas
0 siblings, 1 reply; 7+ messages in thread
From: Samuel Mendoza-Jonas @ 2021-02-02 1:33 UTC (permalink / raw)
To: buildroot
On Mon, 2021-02-01 at 14:56 +0100, Peter Korsgaard wrote:
> > > > >
> The test indeed seems to be inverted. Samuel, any comments?
Only that I'm curious to know how this happened! I agree, that logic
looks inverted, the line could be simplified to something like
diff --git a/package/busybox/udhcpc.script
b/package/busybox/udhcpc.script
index ec4d9f6185..c73ad6c2ef 100755
--- a/package/busybox/udhcpc.script
+++ b/package/busybox/udhcpc.script
@@ -18,7 +18,7 @@ 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
+ if ip -6 route list | grep -q default; then
printf "\n"
return
fi
I can send a quick proper patch if you'd like.
Sam
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [Buildroot] Question on udhcpc script
2021-02-02 1:33 ` Samuel Mendoza-Jonas
@ 2021-02-02 1:56 ` Samuel Mendoza-Jonas
2021-02-02 4:50 ` Bhattiprolu RaviKumar
0 siblings, 1 reply; 7+ messages in thread
From: Samuel Mendoza-Jonas @ 2021-02-02 1:56 UTC (permalink / raw)
To: buildroot
On Mon, 2021-02-01 at 17:33 -0800, Samuel Mendoza-Jonas wrote:
> On Mon, 2021-02-01 at 14:56 +0100, Peter Korsgaard wrote:
> > > > > >
> > The test indeed seems to be inverted. Samuel, any comments?
>
> Only that I'm curious to know how this happened! I agree, that logic
> looks inverted, the line could be simplified to something like
>
> diff --git a/package/busybox/udhcpc.script
> b/package/busybox/udhcpc.script
> index ec4d9f6185..c73ad6c2ef 100755
> --- a/package/busybox/udhcpc.script
> +++ b/package/busybox/udhcpc.script
> @@ -18,7 +18,7 @@ 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
> +?????????????? if ip -6 route list | grep -q default; then
> ??????????????????????? printf "\n"
> ??????????????????????? return
> ??????????????? fi
>
> I can send a quick proper patch if you'd like.
>
> Sam
In fact, here we go:
https://patchwork.ozlabs.org/project/buildroot/patch/20210202015452.98002-1-sam at mendozajonas.com/
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Buildroot] Question on udhcpc script
2021-02-02 1:56 ` Samuel Mendoza-Jonas
@ 2021-02-02 4:50 ` Bhattiprolu RaviKumar
0 siblings, 0 replies; 7+ messages in thread
From: Bhattiprolu RaviKumar @ 2021-02-02 4:50 UTC (permalink / raw)
To: buildroot
Thanks Sam,Peter for quick closure.
regards,
Ravi
On Tue, Feb 2, 2021 at 7:26 AM Samuel Mendoza-Jonas <sam@mendozajonas.com>
wrote:
> On Mon, 2021-02-01 at 17:33 -0800, Samuel Mendoza-Jonas wrote:
> > On Mon, 2021-02-01 at 14:56 +0100, Peter Korsgaard wrote:
> > > > > > >
> > > The test indeed seems to be inverted. Samuel, any comments?
> >
> > Only that I'm curious to know how this happened! I agree, that logic
> > looks inverted, the line could be simplified to something like
> >
> > diff --git a/package/busybox/udhcpc.script
> > b/package/busybox/udhcpc.script
> > index ec4d9f6185..c73ad6c2ef 100755
> > --- a/package/busybox/udhcpc.script
> > +++ b/package/busybox/udhcpc.script
> > @@ -18,7 +18,7 @@ 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
> > + if ip -6 route list | grep -q default; then
> > printf "\n"
> > return
> > fi
> >
> > I can send a quick proper patch if you'd like.
> >
> > Sam
>
> In fact, here we go:
>
> https://patchwork.ozlabs.org/project/buildroot/patch/20210202015452.98002-1-sam at mendozajonas.com/
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20210202/3792c609/attachment-0001.html>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2021-02-02 4:50 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-01 10:30 [Buildroot] Question on udhcpc script Bhattiprolu RaviKumar
2021-02-01 12:24 ` Peter Korsgaard
2021-02-01 13:20 ` Bhattiprolu RaviKumar
2021-02-01 13:56 ` Peter Korsgaard
2021-02-02 1:33 ` Samuel Mendoza-Jonas
2021-02-02 1:56 ` Samuel Mendoza-Jonas
2021-02-02 4:50 ` Bhattiprolu RaviKumar
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.