On Wed, Mar 02, 2016 at 06:03:47PM +0100, Matthieu Herrb wrote:
> On Sat, Feb 27, 2016 at 04:45:09PM +0100, Matthieu Herrb wrote:
> > On Sat, Feb 27, 2016 at 03:20:49PM +0100, Martin Pieuchot wrote:
> > > 
> > > Instead of adding a "link" entry I would add a cloning route that will
> > > generate it.  The first diff below changes route(8) to not add a
> > > RTF_GATEWAY flag when creating a RTF_CLONING entry.  With it you should
> > > be able to add a working cloning route with:
> > > 
> > > # route add 91.224.148.0 -netmask 255.255.255.255 -cloning 92.224.149.DDD
> > > 
> > > Note that the CIDR notation wont work due to another route(8)
> > > limitation.
> > 
> > Yes with your first patch that works.
> > > 
> > > If this approach is acceptable, the second diff makes sure RTF_CLONING
> > > is never set with RTF_GATEWAY or RTF_HOST.  Claudio do you think this
> > > could have any drawback?
> > 
> > I've also included it in the kernel on that machine for testing.
> 
> Still no problems with this setup. Is there some concern(s) preventing
> you from committing this ?

One more data point: I've checked with 5.8, the patch is not needed
there. (the "route add .../32 -link -iface if" stays and renews the
arp entry when needed).

> 
> > 
> > > 
> > > Index: route.c
> > > ===================================================================
> > > RCS file: /cvs/src/sbin/route/route.c,v
> > > retrieving revision 1.182
> > > diff -u -p -r1.182 route.c
> > > --- route.c       3 Dec 2015 08:00:49 -0000       1.182
> > > +++ route.c       27 Feb 2016 14:02:56 -0000
> > > @@ -629,7 +629,7 @@ newroute(int argc, char **argv)
> > >   flags |= RTF_UP;
> > >   if (ishost)
> > >           flags |= RTF_HOST;
> > > - if (iflag == 0)
> > > + if (iflag == 0 && !(flags & RTF_CLONING))
> > >           flags |= RTF_GATEWAY;
> > >   for (attempts = 1; ; attempts++) {
> > >           errno = 0;
> > > 
> > > 
> > > 
> > > 
> > > Index: net/rtsock.c
> > > ===================================================================
> > > RCS file: /cvs/src/sys/net/rtsock.c,v
> > > retrieving revision 1.186
> > > diff -u -p -r1.186 rtsock.c
> > > --- net/rtsock.c  12 Jan 2016 09:27:46 -0000      1.186
> > > +++ net/rtsock.c  27 Feb 2016 14:09:56 -0000
> > > @@ -558,6 +558,12 @@ route_output(struct mbuf *m, ...)
> > >   rtm->rtm_flags &= ~(RTF_DONE|RTF_CLONED);
> > >   rtm->rtm_fmask &= RTF_FMASK;
> > >  
> > > + if ((rtm->rtm_flags & (RTF_CLONING|RTF_GATEWAY|RTF_HOST)) ==
> > > +     (RTF_CLONING|RTF_GATEWAY|RTF_HOST)) {
> > > +         error = EINVAL;
> > > +         goto fail;
> > > + }
> > > +
> > >   if (rtm->rtm_priority != 0) {
> > >           if (rtm->rtm_priority > RTP_MAX ||
> > >               rtm->rtm_priority == RTP_LOCAL) {
> > 
> > -- 
> > Matthieu Herrb
> 
> 
> 
> -- 
> Matthieu Herrb



-- 
Matthieu Herrb

Attachment: signature.asc
Description: PGP signature

Reply via email to