diff options
| -rw-r--r-- | bgpd/bgp_route.c | 9 | ||||
| -rw-r--r-- | bgpd/bgpd.c | 3 | ||||
| -rw-r--r-- | doc/user/overview.rst | 73 | ||||
| -rw-r--r-- | lib/routemap.c | 1 | ||||
| -rw-r--r-- | ospfd/ospf_vty.c | 45 | ||||
| -rw-r--r-- | pathd/path_ted.c | 16 | ||||
| -rw-r--r-- | pimd/pim6_mld.c | 2 | ||||
| -rw-r--r-- | tests/topotests/bgp_conditional_advertisement/test_bgp_conditional_advertisement.py | 144 | ||||
| -rw-r--r-- | zebra/rib.h | 1 | ||||
| -rw-r--r-- | zebra/zebra_fpm.c | 27 | ||||
| -rw-r--r-- | zebra/zebra_rib.c | 5 |
11 files changed, 212 insertions, 114 deletions
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index e692d8f39f..a8e016a890 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -5620,8 +5620,8 @@ void bgp_set_stale_route(struct peer *peer, afi_t afi, safi_t safi) if (bgp_debug_neighbor_events( peer)) zlog_debug( - "%s: route-refresh for %s/%s, marking prefix %pFX as stale", - peer->host, + "%pBP route-refresh for %s/%s, marking prefix %pFX as stale", + peer, afi2str(afi), safi2str(safi), bgp_dest_get_prefix( @@ -5649,9 +5649,8 @@ void bgp_set_stale_route(struct peer *peer, afi_t afi, safi_t safi) BGP_PATH_UNUSEABLE)) { if (bgp_debug_neighbor_events(peer)) zlog_debug( - "%s: route-refresh for %s/%s, marking prefix %pFX as stale", - peer->host, - afi2str(afi), + "%pBP route-refresh for %s/%s, marking prefix %pFX as stale", + peer, afi2str(afi), safi2str(safi), bgp_dest_get_prefix( dest)); diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index b64445f1a5..dd10a1a24a 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -7248,6 +7248,9 @@ static void peer_advertise_map_filter_update(struct peer *peer, afi_t afi, if (filter_exists) bgp_conditional_adv_disable(peer, afi, safi); + /* Process peer route updates. */ + peer_on_policy_change(peer, afi, safi, 1); + return; } diff --git a/doc/user/overview.rst b/doc/user/overview.rst index 70bfee2835..4a24fa52be 100644 --- a/doc/user/overview.rst +++ b/doc/user/overview.rst @@ -310,41 +310,64 @@ BGP :t:`Autonomous System Confederations for BGP. P. Traina. June 1996.` - :rfc:`1997` :t:`BGP Communities Attribute. R. Chandra, P. Traina & T. Li. August 1996.` +- :rfc:`1998` + :t:`An Application of the BGP Community Attribute in Multi-home Routing. E. Chen, T. Bates. August 1996.` +- :rfc:`2385` + :t:`Protection of BGP Sessions via the TCP MD5 Signature Option. A. Heffernan. August 1998.` - :rfc:`2439` :t:`BGP Route Flap Damping. C. Villamizar, R. Chandra, R. Govindan. November 1998.` - :rfc:`2545` - :t:`Use of BGP-4 Multiprotocol Extensions for IPv6 Inter-Domain Routing. P. - Marques, F. Dupont. March 1999.` + :t:`Use of BGP-4 Multiprotocol Extensions for IPv6 Inter-Domain Routing. P. Marques, F. Dupont. March 1999.` - :rfc:`2796` :t:`BGP Route Reflection An alternative to full mesh IBGP. T. Bates & R. Chandrasekeran. June 1996.` - :rfc:`2842` :t:`Capabilities Advertisement with BGP-4. R. Chandra, J. Scudder. May 2000.` - :rfc:`2858` - :t:`Multiprotocol Extensions for BGP-4. T. Bates, Y. Rekhter, R. Chandra, D.` + :t:`Multiprotocol Extensions for BGP-4. T. Bates, Y. Rekhter, R. Chandra, D. Katz. June 2000.` +- :rfc:`2918` + :t:`Route Refresh Capability for BGP-4. E. Chen, September 2000.` - :rfc:`3107` :t:`Carrying Label Information in BGP-4. Y. Rekhter & E. Rosen. May 2001.` - :rfc:`3765` - :t:`NOPEER Community for Border Gateway Protocol (BGP) Route Scope Control. G.Huston, April 2001.` + :t:`NOPEER Community for Border Gateway Protocol (BGP) Route Scope Control. G.Huston. April 2001.` - :rfc:`4271` :t:`A Border Gateway Protocol 4 (BGP-4). Updates RFC1771. Y. Rekhter, T. Li & S. Hares. January 2006.` +- :rfc:`4360` + :t:`BGP Extended Communities Attribute. S. Sangli, D. Tappan, Y. Rekhter. February 2006.` - :rfc:`4364` - :t:`BGP/MPLS IP Virtual Private Networks (VPNs). Y. Rekhter. Feb 2006.` + :t:`BGP/MPLS IP Virtual Private Networks (VPNs). Y. Rekhter. February 2006.` +- :rfc:`4456` + :t:`BGP Route Reflection An alternative to full mesh IBGP. T. Bates, E. Chen, R. Chandra. April 2006.` - :rfc:`4486` :t:`Subcodes for BGP Cease Notification Message. E. Chen, V. Gillet. April 2006.` - :rfc:`4659` :t:`BGP-MPLS IP Virtual Private Network (VPN) Extension for IPv6 VPN. J. De Clercq, D. Ooms, M. Carugi, F. Le Faucheur. September 2006.` +- :rfc:`4724` + :t:`Graceful Restart Mechanism for BGP. S. Sangli, E. Chen, R. Fernando, J. Scudder, Y. Rekhter. January 2007.` +- :rfc:`4760` + :t:`Multiprotocol Extensions for BGP-4. T. Bates, R. Chandra, D. Katz, Y. Rekhter. January 2007.` - :rfc:`4893` :t:`BGP Support for Four-octet AS Number Space. Q. Vohra, E. Chen May 2007.` - :rfc:`5004` :t:`Avoid BGP Best Path Transitions from One External to Another. E. Chen & S. Sangli. September 2007 (Partial support).` +- :rfc:`5065` + :t:`Autonomous System Confederations for BGP. P. Traina, D. McPherson, J. Scudder. August 2007.` - :rfc:`5082` :t:`The Generalized TTL Security Mechanism (GTSM). V. Gill, J. Heasley, D. Meyer, P. Savola, C. Pingnataro. October 2007.` +- :rfc:`5291` + :t:`Outbound Route Filtering Capability. E. Chen, Y. Rekhter. August 2008.` +- :rfc:`5292` + :t:`Address-Prefix-Based Outbound Route Filter for BGP-4. E. Chen, S. Sangli. August 2008.` +- :rfc:`5492` + :t:`Capabilities Advertisement with BGP-4. J. Scudder, R. Chandra. February 2009.` - :rfc:`5575` - :t:`Dissemination of Flow Specification Rules. P. Marques, N. Sheth, R. Raszuk, B. Greene, J. Mauch, D. McPherson. August 2009` + :t:`Dissemination of Flow Specification Rules. P. Marques, N. Sheth, R. Raszuk, B. Greene, J. Mauch, D. McPherson. August 2009.` - :rfc:`5668` - :t:`4-Octet AS Specific BGP Extended Community. Y. Rekhter, S. Sangli, D. Tappan October 2009` + :t:`4-Octet AS Specific BGP Extended Community. Y. Rekhter, S. Sangli, D. Tappan October 2009.` - :rfc:`6286` - :t:`Autonomous-System-Wide Unique BGP Identifier for BGP-4. E. Chen, J. Yuan, June 2011.` + :t:`Autonomous-System-Wide Unique BGP Identifier for BGP-4. E. Chen, J. Yuan. June 2011.` +- :rfc:`6472` + :t:`Recommendation for Not Using AS_SET and AS_CONFED_SET in BGP. W. Kumari, K. Sriram. December 2011.` - :rfc:`6608` :t:`Subcodes for BGP Finite State Machine Error. J. Dong, M. Chen, Huawei Technologies, A. Suryanarayana, Cisco Systems. May 2012.` - :rfc:`6810` @@ -353,6 +376,8 @@ BGP :t:`BGP Prefix Origin Validation. P. Mohapatra, J. Scudder, D. Ward, R. Bush, R. Austein. January 2013.` - :rfc:`6938` :t:`Deprecation of BGP Path Attributes: DPA, ADVERTISER, and RCID_PATH / CLUSTER_ID. J. Scudder. May 2013.` +- :rfc:`6996` + :t:`Autonomous System (AS) Reservation for Private Use. J. Mitchell. July 2013.` - :rfc:`7196` :t:`Making Route Flap Damping Usable. C. Pelsser, R. Bush, K. Patel, P. Mohapatra, O. Maennel. May 2014.` - :rfc:`7300` @@ -365,30 +390,40 @@ BGP :t:`Codification of AS 0 Processing. W. Kumari, R. Bush, H. Schiller, K. Patel. August 2015.` - :rfc:`7611` :t:`BGP ACCEPT_OWN Community Attribute. J. Uttaro, P. Mohapatra, D. Smith, R. Raszuk, J. Scudder. August 2015.` +- :rfc:`7911` + :t:`Advertisement of Multiple Paths in BGP. D. Walton, A. Retana, E. Chen, J. Scudder. July 2016.` +- :rfc:`7947` + :t:`Internet Exchange BGP Route Server. E. Jasinska, N. Hilliard, R. Raszuk, N. Bakker. September 2016.` - :rfc:`7999` - :t:`BLACKHOLE Community. T. King, C. Dietzel, J. Snijders, G. Doering, G. Hankins. Oct 2016.` + :t:`BLACKHOLE Community. T. King, C. Dietzel, J. Snijders, G. Doering, G. Hankins. October 2016.` +- :rfc:`8050` + :t:`Multi-Threaded Routing Toolkit (MRT) Routing Information Export Format with BGP Additional Path Extensions. C. Petrie, T. King. May 2017.` - :rfc:`8092` - :t:`BGP Large Communities Attribute. J. Heitz, Ed., J. Snijders, Ed, K. Patel, I. Bagdonas, N. Hilliard. February 2017` + :t:`BGP Large Communities Attribute. J. Heitz, Ed., J. Snijders, Ed, K. Patel, I. Bagdonas, N. Hilliard. February 2017.` +- :rfc:`8093` + :t:`Deprecation of BGP Path Attribute Values 30, 31, 129, 241, 242, and 243. J. Snijders. February 2017.` - :rfc:`8097` - :t:`BGP Prefix Origin Validation State Extended Community. P. Mohapatra, K. Patel, J. Scudder, D. Ward, R. Bush. March 2017` + :t:`BGP Prefix Origin Validation State Extended Community. P. Mohapatra, K. Patel, J. Scudder, D. Ward, R. Bush. March 2017.` - :rfc:`8195` - :t:`Use of BGP Large Communities. J. Snijders, J. Heasley, M. Schmidt, June 2017` + :t:`Use of BGP Large Communities. J. Snijders, J. Heasley, M. Schmidt. June 2017.` - :rfc:`8203` :t:`BGP Administrative Shutdown Communication. J. Snijders, J. Heitz, J. Scudder. July 2017.` - :rfc:`8212` - :t:`Default External BGP (EBGP) Route Propagation Behavior without Policies. J. Mauch, J. Snijders, G. Hankins. July 2017` + :t:`Default External BGP (EBGP) Route Propagation Behavior without Policies. J. Mauch, J. Snijders, G. Hankins. July 2017.` - :rfc:`8277` - :t:`Using BGP to Bind MPLS Labels to Address Prefixes. E. Rosen. October 2017` + :t:`Using BGP to Bind MPLS Labels to Address Prefixes. E. Rosen. October 2017.` - :rfc:`8538` - :t:`Notification Message Support for BGP Graceful Restart. K. Patel, R. Fernando, J. Scudder, J. Haas. March 2019` + :t:`Notification Message Support for BGP Graceful Restart. K. Patel, R. Fernando, J. Scudder, J. Haas. March 2019.` - :rfc:`8654` - :t:`Extended Message Support for BGP. R. Bush, K. Patel, D. Ward. October 2019` + :t:`Extended Message Support for BGP. R. Bush, K. Patel, D. Ward. October 2019.` - :rfc:`9003` - :t:`Extended BGP Administrative Shutdown Communication. J. Snijders, J. Heitz, J. Scudder, A. Azimov. January 2021` + :t:`Extended BGP Administrative Shutdown Communication. J. Snijders, J. Heitz, J. Scudder, A. Azimov. January 2021.` +- :rfc:`9012` + :t:`The BGP Tunnel Encapsulation Attribute. K. Patel, G. Van de Velde, S. Sangli, J. Scudder. April 2021.` - :rfc:`9072` - :t:`Extended Optional Parameters Length for BGP OPEN Message. E. Chen, J. Scudder. July 2021` + :t:`Extended Optional Parameters Length for BGP OPEN Message. E. Chen, J. Scudder. July 2021.` - :rfc:`9234` - :t:`Route Leak Prevention and Detection Using Roles in UPDATE and OPEN Messages. A. Azimov, E. Bogomazov, R. Bush, K. Patel, K. Sriram. May 2022` + :t:`Route Leak Prevention and Detection Using Roles in UPDATE and OPEN Messages. A. Azimov, E. Bogomazov, R. Bush, K. Patel, K. Sriram. May 2022.` OSPF ---- diff --git a/lib/routemap.c b/lib/routemap.c index e6310465e3..3cc010c148 100644 --- a/lib/routemap.c +++ b/lib/routemap.c @@ -1059,7 +1059,6 @@ static int vty_show_route_map(struct vty *vty, const char *name, bool use_json) if (map) { vty_show_route_map_entry(vty, map, json_proto); - return CMD_SUCCESS; } else if (!use_json) { vty_out(vty, "%s: 'route-map %s' not found\n", frr_protonameinst, name); diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index 2a0016ea19..c957c8c014 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -9892,49 +9892,6 @@ DEFPY(no_ospf_gr_helper_enable, return CMD_SUCCESS; } -#if CONFDATE > 20220921 -CPP_NOTICE( - "Time to remove the deprecated \"[no] graceful-restart helper-only\" commands") -#endif - -DEFPY_HIDDEN(ospf_gr_helper_only, ospf_gr_helper_only_cmd, - "graceful-restart helper-only [A.B.C.D]", - "OSPF Graceful Restart\n" - "Enable Helper support\n" - "Advertising router id\n") -{ - VTY_DECLVAR_INSTANCE_CONTEXT(ospf, ospf); - struct in_addr addr; - int ret; - - vty_out(vty, - "%% This command is deprecated. Please, use `graceful-restart helper enable` instead.\n"); - - if (argc == 3) { - ret = inet_aton(argv[2]->arg, &addr); - if (!ret) { - vty_out(vty, - "Please specify the valid routerid address.\n"); - return CMD_WARNING_CONFIG_FAILED; - } - - ospf_gr_helper_support_set_per_routerid(ospf, &addr, OSPF_GR_TRUE); - return CMD_SUCCESS; - } - - ospf_gr_helper_support_set(ospf, OSPF_GR_TRUE); - - return CMD_SUCCESS; -} - -ALIAS_HIDDEN(no_ospf_gr_helper_enable, - no_ospf_gr_helper_only_cmd, - "no graceful-restart helper-only [A.B.C.D]", - NO_STR - "OSPF Graceful Restart\n" - "Disable Helper support\n" - "Advertising router id\n") - DEFPY(ospf_gr_helper_enable_lsacheck, ospf_gr_helper_enable_lsacheck_cmd, "graceful-restart helper strict-lsa-checking", @@ -12862,8 +12819,6 @@ static void ospf_vty_zebra_init(void) /*Ospf garcefull restart helper configurations */ install_element(OSPF_NODE, &ospf_gr_helper_enable_cmd); install_element(OSPF_NODE, &no_ospf_gr_helper_enable_cmd); - install_element(OSPF_NODE, &ospf_gr_helper_only_cmd); - install_element(OSPF_NODE, &no_ospf_gr_helper_only_cmd); install_element(OSPF_NODE, &ospf_gr_helper_enable_lsacheck_cmd); install_element(OSPF_NODE, &no_ospf_gr_helper_enable_lsacheck_cmd); install_element(OSPF_NODE, &ospf_gr_helper_supported_grace_time_cmd); diff --git a/pathd/path_ted.c b/pathd/path_ted.c index 7afa1468a1..aaa8317d36 100644 --- a/pathd/path_ted.c +++ b/pathd/path_ted.c @@ -243,16 +243,16 @@ uint32_t path_ted_query_type_f(struct ipaddr *local, struct ipaddr *remote) } break; case IPADDR_V6: - key = (uint64_t)(local->ip._v6_addr.s6_addr32[0] & 0xffffffff) - | ((uint64_t)local->ip._v6_addr.s6_addr32[1] << 32); + key = (uint64_t)ntohl(local->ip._v6_addr.s6_addr32[2]) << 32 | + (uint64_t)ntohl(local->ip._v6_addr.s6_addr32[3]); edge = ls_find_edge_by_key(ted_state_g.ted, key); if (edge) { - if ((memcmp(&edge->attributes->standard.remote6, - &remote->ip._v6_addr, - sizeof(remote->ip._v6_addr)) - && CHECK_FLAG(edge->attributes->flags, - LS_ATTR_ADJ_SID))) { - sid = edge->attributes->adj_sid[0] + if ((0 == memcmp(&edge->attributes->standard.remote6, + &remote->ip._v6_addr, + sizeof(remote->ip._v6_addr)) && + CHECK_FLAG(edge->attributes->flags, + LS_ATTR_ADJ_SID6))) { + sid = edge->attributes->adj_sid[ADJ_PRI_IPV6] .sid; /* from primary */ break; } diff --git a/pimd/pim6_mld.c b/pimd/pim6_mld.c index ee5c715eae..23042ef14e 100644 --- a/pimd/pim6_mld.c +++ b/pimd/pim6_mld.c @@ -2430,6 +2430,8 @@ static void gm_show_if_one(struct vty *vty, struct interface *ifp, gm_ifp->t_other_querier); json_object_int_add(js_if, "timerRobustnessValue", gm_ifp->cur_qrv); + json_object_int_add(js_if, "lastMemberQueryCount", + gm_ifp->cur_lmqc); json_object_int_add(js_if, "timerQueryIntervalMsec", gm_ifp->cur_query_intv); json_object_int_add(js_if, "timerQueryResponseTimerMsec", diff --git a/tests/topotests/bgp_conditional_advertisement/test_bgp_conditional_advertisement.py b/tests/topotests/bgp_conditional_advertisement/test_bgp_conditional_advertisement.py index 1097be3d70..0e16b97e4a 100644 --- a/tests/topotests/bgp_conditional_advertisement/test_bgp_conditional_advertisement.py +++ b/tests/topotests/bgp_conditional_advertisement/test_bgp_conditional_advertisement.py @@ -43,10 +43,15 @@ TC21: exist-map routes present in R2's BGP table. advertise-map routes present in R2's BGP table are advertised to R3. TC22: exist-map routes not present in R2's BGP table advertise-map routes present in R2's BGP table are withdrawn from R3. +TC23: advertise-map with exist-map configuration is removed from a peer + send normal BGP update to advertise previously withdrawn routes if any. + TC31: non-exist-map routes not present in R2's BGP table advertise-map routes present in R2's BGP table are advertised to R3. TC32: non-exist-map routes present in R2's BGP table advertise-map routes present in R2's BGP table are withdrawn from R3. +TC33: advertise-map with non-exist-map configuration is removed from a peer + send normal BGP update to advertisepreviously withdrawn routes if any. TC41: non-exist-map route-map configuration removed in R2. advertise-map routes present in R2's BGP table are advertised to R3. @@ -221,6 +226,18 @@ def all_routes_withdrawn(router): return topotest.json_cmp(output, expected) +def default_route_withdrawn(router): + output = json.loads(router.vtysh_cmd("show ip route json")) + expected = { + "0.0.0.0/0": None, + "192.0.2.1/32": [{"protocol": "bgp"}], + "192.0.2.5/32": [{"protocol": "bgp"}], + "10.139.224.0/20": [{"protocol": "bgp"}], + "203.0.113.1/32": [{"protocol": "bgp"}], + } + return topotest.json_cmp(output, expected) + + # BGP conditional advertisement with route-maps # EXIST-MAP, ADV-MAP-1 and RMAP-1 def exist_map_routes_present(router): @@ -252,15 +269,7 @@ def non_exist_map_routes_present(router): def non_exist_map_routes_not_present(router): - output = json.loads(router.vtysh_cmd("show ip route json")) - expected = { - "0.0.0.0/0": None, - "192.0.2.1/32": [{"protocol": "bgp"}], - "192.0.2.5/32": [{"protocol": "bgp"}], - "10.139.224.0/20": [{"protocol": "bgp"}], - "203.0.113.1/32": [{"protocol": "bgp"}], - } - return topotest.json_cmp(output, expected) + return default_route_withdrawn(router) def exist_map_no_condition_route_map(router): @@ -389,7 +398,7 @@ passed = "PASSED!!!" failed = "FAILED!!!" -def test_bgp_conditional_advertisement_step1(): +def test_bgp_conditional_advertisement_tc_1_1(): tgen = get_topogen() if tgen.routers_have_failure(): pytest.skip(tgen.errors) @@ -409,7 +418,7 @@ def test_bgp_conditional_advertisement_step1(): logger.info(msg + passed) -def test_bgp_conditional_advertisement_step2(): +def test_bgp_conditional_advertisement_tc_2_1(): tgen = get_topogen() if tgen.routers_have_failure(): pytest.skip(tgen.errors) @@ -438,7 +447,7 @@ def test_bgp_conditional_advertisement_step2(): logger.info(msg + passed) -def test_bgp_conditional_advertisement_step3(): +def test_bgp_conditional_advertisement_tc_2_2(): tgen = get_topogen() if tgen.routers_have_failure(): pytest.skip(tgen.errors) @@ -467,7 +476,36 @@ def test_bgp_conditional_advertisement_step3(): logger.info(msg + passed) -def test_bgp_conditional_advertisement_step4(): +def test_bgp_conditional_advertisement_tc_2_3(): + tgen = get_topogen() + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + router1 = tgen.gears["r1"] + router2 = tgen.gears["r2"] + router3 = tgen.gears["r3"] + + # TC23: advertise-map with exist-map configuration is removed from a peer + # send normal BGP update to advertise previously withdrawn routes if any. + router2.vtysh_cmd( + """ + configure terminal + router bgp 2 + address-family ipv4 unicast + no neighbor 10.10.20.3 advertise-map ADV-MAP-1 exist-map EXIST-MAP + """ + ) + + test_func = functools.partial(default_route_withdrawn, router3) + success, result = topotest.run_and_expect(test_func, None, count=90, wait=1) + + msg = "TC23: advertise-map with exist-map configuration is removed from peer - " + assert result is None, msg + failed + + logger.info(msg + passed) + + +def test_bgp_conditional_advertisement_tc_3_1(): tgen = get_topogen() if tgen.routers_have_failure(): pytest.skip(tgen.errors) @@ -496,7 +534,7 @@ def test_bgp_conditional_advertisement_step4(): logger.info(msg + passed) -def test_bgp_conditional_advertisement_step5(): +def test_bgp_conditional_advertisement_tc_3_2(): tgen = get_topogen() if tgen.routers_have_failure(): pytest.skip(tgen.errors) @@ -525,7 +563,38 @@ def test_bgp_conditional_advertisement_step5(): logger.info(msg + passed) -def test_bgp_conditional_advertisement_step6(): +def test_bgp_conditional_advertisement_tc_3_3(): + tgen = get_topogen() + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + router1 = tgen.gears["r1"] + router2 = tgen.gears["r2"] + router3 = tgen.gears["r3"] + + # TC33: advertise-map with non-exist-map configuration is removed from a peer + # send normal BGP update to advertisepreviously withdrawn routes if any. + router2.vtysh_cmd( + """ + configure terminal + router bgp 2 + address-family ipv4 unicast + no neighbor 10.10.20.3 advertise-map ADV-MAP-1 non-exist-map EXIST-MAP + """ + ) + + test_func = functools.partial(all_routes_advertised, router3) + success, result = topotest.run_and_expect(test_func, None, count=90, wait=1) + + msg = ( + "TC33: advertise-map with non-exist-map configuration is removed from a peer - " + ) + assert result is None, msg + failed + + logger.info(msg + passed) + + +def test_bgp_conditional_advertisement_tc_4_1(): tgen = get_topogen() if tgen.routers_have_failure(): pytest.skip(tgen.errors) @@ -539,6 +608,9 @@ def test_bgp_conditional_advertisement_step6(): router2.vtysh_cmd( """ configure terminal + router bgp 2 + address-family ipv4 unicast + neighbor 10.10.20.3 advertise-map ADV-MAP-1 non-exist-map EXIST-MAP no route-map EXIST-MAP permit 10 """ ) @@ -552,7 +624,7 @@ def test_bgp_conditional_advertisement_step6(): logger.info(msg + passed) -def test_bgp_conditional_advertisement_step7(): +def test_bgp_conditional_advertisement_tc_4_2(): tgen = get_topogen() if tgen.routers_have_failure(): pytest.skip(tgen.errors) @@ -581,7 +653,7 @@ def test_bgp_conditional_advertisement_step7(): logger.info(msg + passed) -def test_bgp_conditional_advertisement_step8(): +def test_bgp_conditional_advertisement_tc_5_1(): tgen = get_topogen() if tgen.routers_have_failure(): pytest.skip(tgen.errors) @@ -614,7 +686,7 @@ def test_bgp_conditional_advertisement_step8(): logger.info(msg + passed) -def test_bgp_conditional_advertisement_step9(): +def test_bgp_conditional_advertisement_tc_5_2(): tgen = get_topogen() if tgen.routers_have_failure(): pytest.skip(tgen.errors) @@ -643,7 +715,7 @@ def test_bgp_conditional_advertisement_step9(): logger.info(msg + passed) -def test_bgp_conditional_advertisement_step10(): +def test_bgp_conditional_advertisement_tc_5_3(): tgen = get_topogen() if tgen.routers_have_failure(): pytest.skip(tgen.errors) @@ -673,7 +745,7 @@ def test_bgp_conditional_advertisement_step10(): logger.info(msg + passed) -def test_bgp_conditional_advertisement_step11(): +def test_bgp_conditional_advertisement_tc_5_4(): tgen = get_topogen() if tgen.routers_have_failure(): pytest.skip(tgen.errors) @@ -702,7 +774,7 @@ def test_bgp_conditional_advertisement_step11(): logger.info(msg + passed) -def test_bgp_conditional_advertisement_step12(): +def test_bgp_conditional_advertisement_tc_6_1(): tgen = get_topogen() if tgen.routers_have_failure(): pytest.skip(tgen.errors) @@ -740,7 +812,7 @@ def test_bgp_conditional_advertisement_step12(): logger.info(msg + passed) -def test_bgp_conditional_advertisement_step13(): +def test_bgp_conditional_advertisement_tc_6_2(): tgen = get_topogen() if tgen.routers_have_failure(): pytest.skip(tgen.errors) @@ -769,7 +841,7 @@ def test_bgp_conditional_advertisement_step13(): logger.info(msg + passed) -def test_bgp_conditional_advertisement_step14(): +def test_bgp_conditional_advertisement_tc_6_3(): tgen = get_topogen() if tgen.routers_have_failure(): pytest.skip(tgen.errors) @@ -799,7 +871,7 @@ def test_bgp_conditional_advertisement_step14(): logger.info(msg + passed) -def test_bgp_conditional_advertisement_step15(): +def test_bgp_conditional_advertisement_tc_6_4(): tgen = get_topogen() if tgen.routers_have_failure(): pytest.skip(tgen.errors) @@ -830,7 +902,7 @@ def test_bgp_conditional_advertisement_step15(): logger.info(msg + passed) -def test_bgp_conditional_advertisement_step16(): +def test_bgp_conditional_advertisement_tc_7_1(): tgen = get_topogen() if tgen.routers_have_failure(): pytest.skip(tgen.errors) @@ -868,7 +940,7 @@ def test_bgp_conditional_advertisement_step16(): logger.info(msg + passed) -def test_bgp_conditional_advertisement_step17(): +def test_bgp_conditional_advertisement_tc_7_2(): tgen = get_topogen() if tgen.routers_have_failure(): pytest.skip(tgen.errors) @@ -897,7 +969,7 @@ def test_bgp_conditional_advertisement_step17(): logger.info(msg + passed) -def test_bgp_conditional_advertisement_step18(): +def test_bgp_conditional_advertisement_tc_7_3(): tgen = get_topogen() if tgen.routers_have_failure(): pytest.skip(tgen.errors) @@ -927,7 +999,7 @@ def test_bgp_conditional_advertisement_step18(): logger.info(msg + passed) -def test_bgp_conditional_advertisement_step19(): +def test_bgp_conditional_advertisement_tc_7_4(): tgen = get_topogen() if tgen.routers_have_failure(): pytest.skip(tgen.errors) @@ -956,7 +1028,7 @@ def test_bgp_conditional_advertisement_step19(): logger.info(msg + passed) -def test_bgp_conditional_advertisement_step20(): +def test_bgp_conditional_advertisement_tc_8_1(): tgen = get_topogen() if tgen.routers_have_failure(): pytest.skip(tgen.errors) @@ -994,7 +1066,7 @@ def test_bgp_conditional_advertisement_step20(): logger.info(msg + passed) -def test_bgp_conditional_advertisement_step21(): +def test_bgp_conditional_advertisement_tc_8_2(): tgen = get_topogen() if tgen.routers_have_failure(): pytest.skip(tgen.errors) @@ -1023,7 +1095,7 @@ def test_bgp_conditional_advertisement_step21(): logger.info(msg + passed) -def test_bgp_conditional_advertisement_step22(): +def test_bgp_conditional_advertisement_tc_8_3(): tgen = get_topogen() if tgen.routers_have_failure(): pytest.skip(tgen.errors) @@ -1055,7 +1127,7 @@ def test_bgp_conditional_advertisement_step22(): logger.info(msg + passed) -def test_bgp_conditional_advertisement_step23(): +def test_bgp_conditional_advertisement_tc_8_4(): tgen = get_topogen() if tgen.routers_have_failure(): pytest.skip(tgen.errors) @@ -1086,7 +1158,7 @@ def test_bgp_conditional_advertisement_step23(): logger.info(msg + passed) -def test_bgp_conditional_advertisement_step24(): +def test_bgp_conditional_advertisement_tc_9_1(): tgen = get_topogen() if tgen.routers_have_failure(): pytest.skip(tgen.errors) @@ -1124,7 +1196,7 @@ def test_bgp_conditional_advertisement_step24(): logger.info(msg + passed) -def test_bgp_conditional_advertisement_step25(): +def test_bgp_conditional_advertisement_tc_9_2(): tgen = get_topogen() if tgen.routers_have_failure(): pytest.skip(tgen.errors) @@ -1153,7 +1225,7 @@ def test_bgp_conditional_advertisement_step25(): logger.info(msg + passed) -def test_bgp_conditional_advertisement_step26(): +def test_bgp_conditional_advertisement_tc_9_3(): tgen = get_topogen() if tgen.routers_have_failure(): pytest.skip(tgen.errors) @@ -1193,7 +1265,7 @@ def test_bgp_conditional_advertisement_step26(): logger.info(msg + passed) -def test_bgp_conditional_advertisement_step27(): +def test_bgp_conditional_advertisement_tc_9_4(): tgen = get_topogen() if tgen.routers_have_failure(): pytest.skip(tgen.errors) diff --git a/zebra/rib.h b/zebra/rib.h index dec5b2b8d6..99f52bcd4e 100644 --- a/zebra/rib.h +++ b/zebra/rib.h @@ -585,6 +585,7 @@ static inline void rib_tables_iter_cleanup(rib_tables_iter_t *iter) DECLARE_HOOK(rib_update, (struct route_node * rn, const char *reason), (rn, reason)); +DECLARE_HOOK(rib_shutdown, (struct route_node * rn), (rn)); /* * Access installed/fib nexthops, which may be a subset of the diff --git a/zebra/zebra_fpm.c b/zebra/zebra_fpm.c index 21acaa823c..1b2753377b 100644 --- a/zebra/zebra_fpm.c +++ b/zebra/zebra_fpm.c @@ -1478,6 +1478,32 @@ static int zfpm_trigger_update(struct route_node *rn, const char *reason) } /* + * zfpm_trigger_remove + * + * The zebra code invokes this function to indicate that we should + * send an remove to the FPM about the given route_node. + */ + +static int zfpm_trigger_remove(struct route_node *rn) +{ + rib_dest_t *dest; + + if (!zfpm_conn_is_up()) + return 0; + + dest = rib_dest_from_rnode(rn); + if (!CHECK_FLAG(dest->flags, RIB_DEST_UPDATE_FPM)) + return 0; + + zfpm_debug("%pRN Removing from update queue shutting down", rn); + + UNSET_FLAG(dest->flags, RIB_DEST_UPDATE_FPM); + TAILQ_REMOVE(&zfpm_g->dest_q, dest, fpm_q_entries); + + return 0; +} + +/* * Generate Key for FPM MAC info hash entry */ static unsigned int zfpm_mac_info_hash_keymake(const void *p) @@ -2036,6 +2062,7 @@ static int zfpm_fini(void) static int zebra_fpm_module_init(void) { hook_register(rib_update, zfpm_trigger_update); + hook_register(rib_shutdown, zfpm_trigger_remove); hook_register(zebra_rmac_update, zfpm_trigger_rmac_update); hook_register(frr_late_init, zfpm_init); hook_register(frr_early_fini, zfpm_fini); diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index bd7e8bbbd0..fceaaaa9f0 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -76,6 +76,8 @@ static struct dplane_ctx_q rib_dplane_q; DEFINE_HOOK(rib_update, (struct route_node * rn, const char *reason), (rn, reason)); +DEFINE_HOOK(rib_shutdown, (struct route_node * rn), (rn)); + /* Meta Q's specific names */ enum meta_queue_indexes { @@ -944,6 +946,9 @@ void zebra_rtable_node_cleanup(struct route_table *table, if (node->info) { rib_dest_t *dest = node->info; + /* Remove from update queue of FPM module */ + hook_call(rib_shutdown, node); + rnh_list_fini(&dest->nht); XFREE(MTYPE_RIB_DEST, node->info); } |
