All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v2] busybox: Update udhcpc.script for DHCPv6
       [not found] <20180619005233.10531-1-sam@mendozajonas.com>
@ 2018-06-19  7:57 ` Peter Korsgaard
  2018-06-20  0:24   ` Samuel Mendoza-Jonas
       [not found] ` <CAK1hOcN68edmb_n53YhR5ZMShgGo0W9UWzPi=p3nHDFosNEQ+g@mail.gmail.com>
  1 sibling, 1 reply; 3+ messages in thread
From: Peter Korsgaard @ 2018-06-19  7:57 UTC (permalink / raw
  To: buildroot

>>>>> "Samuel" == Samuel Mendoza-Jonas <sam@mendozajonas.com> writes:

Hi,

 > 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 <rlippert@google.com>
 > Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
 > ---
 > 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

You are sending this to the busybox list, but it looks to be a Buildroot
patch?

> 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"

Why /128?

I'm far from an IPv6 expert, but I take it this is for stateful DHCPv6,
right? Please mention that in the commit message.

> +
 > +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"
 > -- 
 > 2.17.1

 > _______________________________________________
 > busybox mailing list
 > busybox at busybox.net
 > http://lists.busybox.net/mailman/listinfo/busybox

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Buildroot] [PATCH v2] busybox: Update udhcpc.script for DHCPv6
  2018-06-19  7:57 ` [Buildroot] [PATCH v2] busybox: Update udhcpc.script for DHCPv6 Peter Korsgaard
@ 2018-06-20  0:24   ` Samuel Mendoza-Jonas
  0 siblings, 0 replies; 3+ messages in thread
From: Samuel Mendoza-Jonas @ 2018-06-20  0:24 UTC (permalink / raw
  To: buildroot

On Tue, 2018-06-19 at 09:57 +0200, Peter Korsgaard wrote:
> > > > > > "Samuel" == Samuel Mendoza-Jonas <sam@mendozajonas.com> writes:
> 
> Hi,
> 
>  > 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 <rlippert@google.com>
>  > Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
>  > ---
>  > 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
> 
> You are sending this to the busybox list, but it looks to be a Buildroot
> patch?

Ugh, thank you for noticing - must have fat-fingered the --to option.

> 
> > 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"
> 
> Why /128?
> 
> I'm far from an IPv6 expert, but I take it this is for stateful DHCPv6,
> right? Please mention that in the commit message.

Yes this is stateful DHCPv6 - I'll update the commit message since I need to
send it to the correct list anyway :)
I can hardly claim the title of IPv6 expert either, but my understanding is
that a DHCPv6 server will not supply a subnet mask like a DHCPv4 server would,
but rather the address is implicitly a global '/128' address (and indeed udhcpc6
does not supply a subnet variable).

Cheers,
Sam

> 
> > +
> 
>  > +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"
>  > -- 
>  > 2.17.1
> 
>  > _______________________________________________
>  > busybox mailing list
>  > busybox at busybox.net
>  > http://lists.busybox.net/mailman/listinfo/busybox
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Buildroot] [PATCH v2] busybox: Update udhcpc.script for DHCPv6
       [not found] ` <CAK1hOcN68edmb_n53YhR5ZMShgGo0W9UWzPi=p3nHDFosNEQ+g@mail.gmail.com>
@ 2018-06-25  1:30   ` Samuel Mendoza-Jonas
  0 siblings, 0 replies; 3+ messages in thread
From: Samuel Mendoza-Jonas @ 2018-06-25  1:30 UTC (permalink / raw
  To: buildroot

On Sun, 2018-06-24 at 21:32 +0200, Denys Vlasenko wrote:
> On Tue, Jun 19, 2018 at 2:52 AM, Samuel Mendoza-Jonas
> <sam@mendozajonas.com> wrote:
> > 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 <rlippert@google.com>
> > Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
> > ---
> > 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
> 
> Please explain "wait_for_ipv6_default_route" logic.

I believe Rob's aim here was to be as close to DHCPv4 behaviour as
possible, ie. once this script completes the interface is set up and able
to route packets. Since routing information doesn't come from the DHCPv6
response this waits a moment to make sure the routing information from
the IPv6 RA has arrived, which happens automatically.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-06-25  1:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20180619005233.10531-1-sam@mendozajonas.com>
2018-06-19  7:57 ` [Buildroot] [PATCH v2] busybox: Update udhcpc.script for DHCPv6 Peter Korsgaard
2018-06-20  0:24   ` Samuel Mendoza-Jonas
     [not found] ` <CAK1hOcN68edmb_n53YhR5ZMShgGo0W9UWzPi=p3nHDFosNEQ+g@mail.gmail.com>
2018-06-25  1:30   ` Samuel Mendoza-Jonas

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.