diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2010-05-18 12:21:34 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2010-05-18 12:21:34 +0000 |
commit | 3958e6e16b8692f3465ec456a898f021ebdf8496 (patch) | |
tree | 40c8000e0db5f8ff9306ad25706e538d2f36a270 /usr.sbin/bgpd | |
parent | 5e9cbc8c20e0937417ddbe60737c90e261fac85b (diff) |
Be more careful in ktable_update() and ktable_new() and the fib sync flag.
Only existing tables should keep their fib sync state, new ones should set
the current fib sync flag to the configured one at the end of the config
load. Found the hard way by sthen@, OK sthen@
Diffstat (limited to 'usr.sbin/bgpd')
-rw-r--r-- | usr.sbin/bgpd/kroute.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/usr.sbin/bgpd/kroute.c b/usr.sbin/bgpd/kroute.c index 9dbe2a13ce7..99ac8fbc2c5 100644 --- a/usr.sbin/bgpd/kroute.c +++ b/usr.sbin/bgpd/kroute.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kroute.c,v 1.179 2010/05/17 15:49:29 claudio Exp $ */ +/* $OpenBSD: kroute.c,v 1.180 2010/05/18 12:21:33 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -274,7 +274,6 @@ ktable_new(u_int rtableid, u_int rdomid, char *name, char *ifname, int fs) strlcpy(kt->ifmpe, ifname, IFNAMSIZ); kt->ifindex = if_nametoindex(ifname); } - kt->state = RECONF_REINIT; /* ... and load it */ if (fetchtable(kt) == -1) @@ -283,8 +282,8 @@ ktable_new(u_int rtableid, u_int rdomid, char *name, char *ifname, int fs) return (-1); /* everything is up and running */ + kt->state = RECONF_REINIT; log_debug("new ktable %s for rtableid %d", name, rtableid); - kt->state = RECONF_KEEP; return (0); } @@ -359,9 +358,10 @@ ktable_update(u_int rtableid, char *name, char *ifname, int flags) /* there is no need for full fib synchronisation if * the table is only used for nexthop lookups. */ - if (rkt->state == RECONF_DELETE) + if (rkt->state == RECONF_DELETE) { rkt->fib_conf = 0; - rkt->state = RECONF_KEEP; + rkt->state = RECONF_KEEP; + } } } @@ -376,12 +376,13 @@ ktable_update(u_int rtableid, char *name, char *ifname, int flags) return (-1); } else { /* fib sync has higher preference then no sync */ - if (kt->state == RECONF_DELETE) + if (kt->state == RECONF_DELETE) { kt->fib_conf = !(flags & F_RIB_NOFIBSYNC); - else if (!kt->fib_conf) + kt->state = RECONF_KEEP; + } else if (!kt->fib_conf) kt->fib_conf = !(flags & F_RIB_NOFIBSYNC); - kt->state = RECONF_KEEP; + strlcpy(kt->descr, name, sizeof(kt->descr)); } return (0); } @@ -410,6 +411,8 @@ ktable_postload(void) continue; if (kt->state == RECONF_DELETE) ktable_free(i - 1); + else if (kt->state == RECONF_REINIT) + kt->fib_sync = kt->fib_conf; } } |