diff options
author | Philippe Guibert <philippe.guibert@6wind.com> | 2023-08-28 12:23:24 +0200 |
---|---|---|
committer | Philippe Guibert <philippe.guibert@6wind.com> | 2023-08-29 11:37:18 +0200 |
commit | 82b11d88898e1f6c6b36e7f8c379ce7282168c10 (patch) | |
tree | 69ef459c4ee6174361e48da8c671fba23c80e3c7 /bgpd/bgp_zebra.c | |
parent | Merge pull request #14276 from donaldsharp/bgp_fsm_problemos (diff) | |
download | frr-82b11d88898e1f6c6b36e7f8c379ce7282168c10.tar.xz frr-82b11d88898e1f6c6b36e7f8c379ce7282168c10.zip |
bgpd: fix redistribute table command after bgp restarts
When the BGP 'redistribute table' command is used for a given route
table, and BGP configuration is flushed and rebuilt, the redistribution
does not work.
Actually, when flushing the BGP configuration with the 'no router bgp'
command, the BGP redistribute entries related to the 'redistribute table'
entries are not flushed. Actually, at BGP deletion, the table number is
not given as parameter in bgp_redistribute_unset() function, and the
redistribution entry is not removed in zebra.
Fix this by adding some code to flush all the redistribute table
instances.
Fixes: 7c8ff89e9346 ("Multi-Instance OSPF Summary")
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Diffstat (limited to 'bgpd/bgp_zebra.c')
-rw-r--r-- | bgpd/bgp_zebra.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c index 21ccbebe6..489a9e979 100644 --- a/bgpd/bgp_zebra.c +++ b/bgpd/bgp_zebra.c @@ -2078,8 +2078,8 @@ int bgp_redistribute_unreg(struct bgp *bgp, afi_t afi, int type, } /* Unset redistribution. */ -int bgp_redistribute_unset(struct bgp *bgp, afi_t afi, int type, - unsigned short instance) +static void _bgp_redistribute_unset(struct bgp *bgp, afi_t afi, int type, + unsigned short instance) { struct bgp_redist *red; @@ -2096,7 +2096,7 @@ int bgp_redistribute_unset(struct bgp *bgp, afi_t afi, int type, red = bgp_redist_lookup(bgp, afi, type, instance); if (!red) - return CMD_SUCCESS; + return; bgp_redistribute_unreg(bgp, afi, type, instance); @@ -2110,8 +2110,23 @@ int bgp_redistribute_unset(struct bgp *bgp, afi_t afi, int type, red->redist_metric = 0; bgp_redist_del(bgp, afi, type, instance); +} - return CMD_SUCCESS; +void bgp_redistribute_unset(struct bgp *bgp, afi_t afi, int type, + unsigned short instance) +{ + struct listnode *node, *nnode; + struct bgp_redist *red; + + if (type != ZEBRA_ROUTE_TABLE || instance != 0) + return _bgp_redistribute_unset(bgp, afi, type, instance); + + /* walk over instance */ + if (!bgp->redist[afi][type]) + return; + + for (ALL_LIST_ELEMENTS(bgp->redist[afi][type], node, nnode, red)) + _bgp_redistribute_unset(bgp, afi, type, red->instance); } void bgp_redistribute_redo(struct bgp *bgp) |