Be careful not to break dhcpv6-pd.

I suspect the problem is actually in make_prefix() in config.c which 
unconditionally sets
onlink and autoconf.

I stared at this for some time but can't figure out how to fix this.

RFC 4861 has this which I don't think rtadvd is implementing correctly:

      Prefix Information
                     These options specify the prefixes that are on-link
                     and/or are used for stateless address
                     autoconfiguration.  A router SHOULD include all its
                     on-link prefixes (except the link-local prefix) so
                     that multihomed hosts have complete prefix
                     information about on-link destinations for the
                     links to which they attach.  If complete
                     information is lacking, a host with multiple
                     interfaces may not be able to choose the correct
                     outgoing interface when sending traffic to its
                     neighbors.

On Sun, Jun 17, 2018 at 10:57:57PM +0200, Sebastian Benoit wrote:
> Hi,
> 
> Denis Fondras([email protected]) on 2018.06.17 21:45:37 +0200:
> > On Mon, Jun 11, 2018 at 10:13:36AM +0200, Bastien Durel wrote:
> > > Because it's lower than RTP_CONNECTED and I don't know what it is. The
> > > /* local address routes (must be the highest) */ comment makes me think
> > > it MAY be 127.0.0.0/8 or ::1/128 (useless for rtadvd then), but it may
> > > be related to interface addresses; I did not check in the kernel code
> > > how this flag is set. (hence the question marks)
> > > 
> > 
> > RTP_LOCAL are local addresses, they won't pass the test at L367 of rtadvd.c
> > anyway.
> > 
> > Here is a diff if you want to try :
> > 
> > Index: if.c
> > ===================================================================
> > RCS file: /cvs/src/usr.sbin/rtadvd/if.c,v
> > retrieving revision 1.46
> > diff -u -p -r1.46 if.c
> > --- if.c    12 Aug 2017 07:38:26 -0000      1.46
> > +++ if.c    17 Jun 2018 19:37:55 -0000
> > @@ -285,6 +285,14 @@ get_ifm_flags(char *buf)
> >     return (ifm->ifm_flags);
> >  }
> >  
> > +u_char
> > +get_priority(char *buf)
> > +{
> > +   struct rt_msghdr *rtm = (struct rt_msghdr *)buf;
> > +
> > +   return (rtm->rtm_priority);
> > +}
> > +
> >  int
> >  get_prefixlen(char *buf)
> >  {
> > Index: if.h
> > ===================================================================
> > RCS file: /cvs/src/usr.sbin/rtadvd/if.h,v
> > retrieving revision 1.14
> > diff -u -p -r1.14 if.h
> > --- if.h    10 Aug 2017 19:07:14 -0000      1.14
> > +++ if.h    17 Jun 2018 19:37:55 -0000
> > @@ -45,6 +45,7 @@ struct in6_addr *get_addr(char *);
> >  int get_rtm_ifindex(char *);
> >  int get_ifm_ifindex(char *);
> >  int get_ifam_ifindex(char *);
> > +u_char get_priority(char *);
> >  int get_ifm_flags(char *);
> >  int get_prefixlen(char *);
> >  int prefixlen(u_char *, u_char *);
> > Index: rtadvd.c
> > ===================================================================
> > RCS file: /cvs/src/usr.sbin/rtadvd/rtadvd.c,v
> > retrieving revision 1.91
> > diff -u -p -r1.91 rtadvd.c
> > --- rtadvd.c        22 Aug 2017 01:44:09 -0000      1.91
> > +++ rtadvd.c        17 Jun 2018 19:37:55 -0000
> > @@ -309,7 +309,7 @@ rtsock_cb(int fd, short event, void *arg
> >  {
> >     int n, type, ifindex = 0, oldifflags, plen;
> >     char *rtm;
> > -   u_char ifname[IF_NAMESIZE];
> > +   u_char ifname[IF_NAMESIZE], prio;
> >     struct prefix *prefix;
> >     struct rainfo *rai;
> >     struct in6_addr *addr;
> > @@ -362,6 +362,11 @@ rtsock_cb(int fd, short event, void *arg
> >  
> >             addr = get_addr(rtm);
> >             plen = get_prefixlen(rtm);
> > +           prio = get_priority(rtm);
> > +
> > +           if (!(prio & RTP_CONNECTED))
> > +                   break;
> > +
> 
> 
> you have to do check
> 
>   if (rtm->rtm_flags & RTF_CONNECTED)
> 
> The priority of a connected route depends on the interface priority,
> see ifconfig(8) on the priority option and wifi and carp interfaces have a
> different default prio than other interfacs. So the prio is not an indicator
> for the type of the route.
> 
> /Benno
> 
> >             /* sanity check for plen */
> >             /* as RFC2373, prefixlen is at least 4 */
> >             if (plen < 4 || plen > 127) {
> > 
> 
> -- 
> 

-- 
I'm not entirely sure you are real.

Reply via email to