On Thu, Jun 02, 2022 at 11:13:31AM +0200, Theo Buehler wrote:
> On Thu, Jun 02, 2022 at 11:05:26AM +0200, Claudio Jeker wrote:
> > When setting the default routing table for bgpd make sure that
> > ktable_exists() does not fail.
> > Also improve the warning message in ktable_exists() a bit.
> 
> Sure, ok.
> 
> The existing checks in parse.y do 'if (ktable_exists(..) != 1)' and the
> check in kroute.c uses 'if (!ktable_exists(..))'. Maybe make them all
> use the same variant?

I will switch them all to if (!ktable_exists(..)) which is more natural
then the != 1 version. That is also how the kroute.c code uses it.
 
> > 
> > -- 
> > :wq Claudio
> > 
> > Index: kroute.c
> > ===================================================================
> > RCS file: /cvs/src/usr.sbin/bgpd/kroute.c,v
> > retrieving revision 1.246
> > diff -u -p -r1.246 kroute.c
> > --- kroute.c        23 May 2022 13:40:12 -0000      1.246
> > +++ kroute.c        2 Jun 2022 08:59:10 -0000
> > @@ -440,7 +440,7 @@ ktable_exists(u_int rtableid, u_int *rdo
> >             if (errno == ENOENT)
> >                     /* table nonexistent */
> >                     return (0);
> > -           log_warn("%s: sysctl", __func__);
> > +           log_warn("sysctl net.route.rtableid");
> >             /* must return 0 so that the table is considered non-existent */
> >             return (0);
> >     }
> > Index: parse.y
> > ===================================================================
> > RCS file: /cvs/src/usr.sbin/bgpd/parse.y,v
> > retrieving revision 1.425
> > diff -u -p -r1.425 parse.y
> > --- parse.y 31 May 2022 09:45:33 -0000      1.425
> > +++ parse.y 2 Jun 2022 08:53:43 -0000
> > @@ -3496,7 +3496,9 @@ init_config(struct bgpd_config *c)
> >     c->bgpid = get_bgpid();
> >     c->fib_priority = RTP_BGP;
> >     c->default_tableid = getrtable();
> > -   ktable_exists(c->default_tableid, &rdomid);
> > +   if (!ktable_exists(c->default_tableid, &rdomid))
> > +           fatalx("current routing table %u does not exist",
> > +               c->default_tableid);
> >     if (rdomid != c->default_tableid)
> >             fatalx("current routing table %u is not a routing domain",
> >                 c->default_tableid);
> > 
> 

-- 
:wq Claudio

Reply via email to