On Sun, Jul 09, 2017 at 09:42:32AM +0200, Klemens Nanni wrote:
> On Wed, Jun 14, 2017 at 03:00:11AM +0200, Klemens Nanni wrote:
> > Installing -current the other day showed a broken list when picking
> > the IPv6 default route just like reported on bugs@ five days ago[1].
> 1:    http://marc.info/?l=openbsd-bugs&m=149704197715791
> > 
> > This behaviour can be reproduced manually running the code from
> > v6_defroute():
> > 
> >     $ # source/define bsort()
> >     $ _if=trunk0
> >     $ bsort $(ping6 -n -c 2 ff02::2%$_if 2>/dev/null |
> >             sed -n '/bytes from/{s/^.*from //;s/,.*$//;p;}' |
> >             sed -n 'G;s/\n/&&/;/^\(.*\n\).*\n\1/d;h;P')
> >     fe80::____:__ff:fe__:___%trunk0: hlim=64 icmp_seq=0 icmp_seq=1 ms 
> > time=0.431 time=0.802
> > 
> > The first sed filters for those lines containing the router addresses
> > and does two things:
> >     1. strip leading text up to the address
> >     2. strip trailing text after the first ','
> > 
> > However, as far as i can see 'ping6 -nc2' will never output lines that
> > would match the second criteria thus making this part of the command
> > obsolete.
> > 
> > The second sed removes duplicate addresses (not neccessarily consecutive
> > ones). This works fine for itself, but as seen above its input contains
> > more than just addresses. Besides that, sorting through sed just before
> > having bsort() cleaning the list is duplicate effort here.
> > 
> > With this patch bsort() gets passed possibly duplicate IPv6 addresses
> > one per line so _routers will eventually contain a sorted list of unique
> > router addresses; this fixes the list shown during the installer.
> > 
> > 
> > While debugging this, I noticed that stopping after two echo replies
> > would sometimes show only one router; increasing this limit to three
> > made both of my network's routers reply/show up reliably.
> I'm somewhat sursprised noone else has fixed or complained about this
> so far. This still annoys me when setting up boxes in (IPv6-only)
> networks with more than one router.
> 
> Feedback? Comments?
> 
> Marginally updated diff dropping ^ and $ from the sed command.

I'd be OK with your previous version of this diff.

Reply via email to