diff options
| -rw-r--r-- | bgpd/bgp_clist.c | 5 | ||||
| -rw-r--r-- | bgpd/bgp_community_alias.c | 40 | ||||
| -rw-r--r-- | bgpd/bgp_community_alias.h | 2 | ||||
| -rw-r--r-- | bgpd/bgp_io.c | 3 | ||||
| -rw-r--r-- | bgpd/bgp_routemap.c | 7 | ||||
| -rw-r--r-- | bgpd/bgpd.h | 1 | ||||
| -rw-r--r-- | doc/developer/scripting.rst | 17 | ||||
| -rw-r--r-- | doc/developer/workflow.rst | 55 | ||||
| -rw-r--r-- | doc/user/ospf6d.rst | 170 | ||||
| -rw-r--r-- | doc/user/zebra.rst | 2 | ||||
| -rw-r--r-- | lib/frrscript.c | 5 | ||||
| -rw-r--r-- | lib/frrscript.h | 16 | ||||
| -rw-r--r-- | lib/frrstr.c | 22 | ||||
| -rw-r--r-- | lib/frrstr.h | 20 | ||||
| -rw-r--r-- | ospf6d/ospf6_asbr.c | 2 | ||||
| -rw-r--r-- | ospf6d/ospf6_lsa.c | 55 | ||||
| -rw-r--r-- | ospfd/ospf_interface.h | 116 | ||||
| -rw-r--r-- | ospfd/ospfd.c | 8 | ||||
| -rw-r--r-- | redhat/frr.spec.in | 21 | ||||
| -rw-r--r-- | staticd/static_nb_config.c | 14 | ||||
| -rw-r--r-- | staticd/static_routes.c | 3 | ||||
| -rw-r--r-- | tests/lib/test_frrscript.c | 8 | ||||
| -rw-r--r-- | tests/subdir.am | 4 | ||||
| -rw-r--r-- | tests/topotests/bgp_community_alias/r1/bgpd.conf | 2 | ||||
| -rw-r--r-- | tests/topotests/bgp_community_alias/test_bgp-community-alias.py | 11 | ||||
| -rw-r--r-- | tests/topotests/bgp_evpn_overlay_index_gateway/PE1/bgp_vni_routes_base.json (renamed from tests/topotests/bgp-evpn-overlay-index-gateway/PE1/bgp_vni_routes_base.json) | 0 | ||||
| -rw-r--r-- | tests/topotests/bgp_evpn_overlay_index_gateway/PE1/bgp_vni_routes_no_rt2.json (renamed from tests/topotests/bgp-evpn-overlay-index-gateway/PE1/bgp_vni_routes_no_rt2.json) | 0 | ||||
| -rw-r--r-- | tests/topotests/bgp_evpn_overlay_index_gateway/PE1/bgp_vni_routes_no_rt5.json (renamed from tests/topotests/bgp-evpn-overlay-index-gateway/PE1/bgp_vni_routes_no_rt5.json) | 0 | ||||
| -rw-r--r-- | tests/topotests/bgp_evpn_overlay_index_gateway/PE1/bgp_vrf_ipv4_base.json (renamed from tests/topotests/bgp-evpn-overlay-index-gateway/PE1/bgp_vrf_ipv4_base.json) | 0 | ||||
| -rw-r--r-- | tests/topotests/bgp_evpn_overlay_index_gateway/PE1/bgp_vrf_ipv4_no_rt2.json (renamed from tests/topotests/bgp-evpn-overlay-index-gateway/PE1/bgp_vrf_ipv4_no_rt2.json) | 0 | ||||
| -rw-r--r-- | tests/topotests/bgp_evpn_overlay_index_gateway/PE1/bgp_vrf_ipv4_no_rt5.json (renamed from tests/topotests/bgp-evpn-overlay-index-gateway/PE1/bgp_vrf_ipv4_no_rt5.json) | 0 | ||||
| -rw-r--r-- | tests/topotests/bgp_evpn_overlay_index_gateway/PE1/bgp_vrf_ipv6_base.json (renamed from tests/topotests/bgp-evpn-overlay-index-gateway/PE1/bgp_vrf_ipv6_base.json) | 0 | ||||
| -rw-r--r-- | tests/topotests/bgp_evpn_overlay_index_gateway/PE1/bgp_vrf_ipv6_no_rt2.json (renamed from tests/topotests/bgp-evpn-overlay-index-gateway/PE1/bgp_vrf_ipv6_no_rt2.json) | 0 | ||||
| -rw-r--r-- | tests/topotests/bgp_evpn_overlay_index_gateway/PE1/bgp_vrf_ipv6_no_rt5.json (renamed from tests/topotests/bgp-evpn-overlay-index-gateway/PE1/bgp_vrf_ipv6_no_rt5.json) | 0 | ||||
| -rw-r--r-- | tests/topotests/bgp_evpn_overlay_index_gateway/PE1/bgpd.conf (renamed from tests/topotests/bgp-evpn-overlay-index-gateway/PE1/bgpd.conf) | 0 | ||||
| -rw-r--r-- | tests/topotests/bgp_evpn_overlay_index_gateway/PE1/zebra.conf (renamed from tests/topotests/bgp-evpn-overlay-index-gateway/PE1/zebra.conf) | 0 | ||||
| -rw-r--r-- | tests/topotests/bgp_evpn_overlay_index_gateway/PE1/zebra_vrf_ipv4_base.json (renamed from tests/topotests/bgp-evpn-overlay-index-gateway/PE1/zebra_vrf_ipv4_base.json) | 0 | ||||
| -rw-r--r-- | tests/topotests/bgp_evpn_overlay_index_gateway/PE1/zebra_vrf_ipv4_no_rt2.json (renamed from tests/topotests/bgp-evpn-overlay-index-gateway/PE1/zebra_vrf_ipv4_no_rt2.json) | 0 | ||||
| -rw-r--r-- | tests/topotests/bgp_evpn_overlay_index_gateway/PE1/zebra_vrf_ipv4_no_rt5.json (renamed from tests/topotests/bgp-evpn-overlay-index-gateway/PE1/zebra_vrf_ipv4_no_rt5.json) | 0 | ||||
| -rw-r--r-- | tests/topotests/bgp_evpn_overlay_index_gateway/PE1/zebra_vrf_ipv6_base.json (renamed from tests/topotests/bgp-evpn-overlay-index-gateway/PE1/zebra_vrf_ipv6_base.json) | 0 | ||||
| -rw-r--r-- | tests/topotests/bgp_evpn_overlay_index_gateway/PE1/zebra_vrf_ipv6_no_rt2.json (renamed from tests/topotests/bgp-evpn-overlay-index-gateway/PE1/zebra_vrf_ipv6_no_rt2.json) | 0 | ||||
| -rw-r--r-- | tests/topotests/bgp_evpn_overlay_index_gateway/PE1/zebra_vrf_ipv6_no_rt5.json (renamed from tests/topotests/bgp-evpn-overlay-index-gateway/PE1/zebra_vrf_ipv6_no_rt5.json) | 0 | ||||
| -rw-r--r-- | tests/topotests/bgp_evpn_overlay_index_gateway/PE2/bgp_vni_routes_base.json (renamed from tests/topotests/bgp-evpn-overlay-index-gateway/PE2/bgp_vni_routes_base.json) | 0 | ||||
| -rw-r--r-- | tests/topotests/bgp_evpn_overlay_index_gateway/PE2/bgp_vni_routes_no_rt2.json (renamed from tests/topotests/bgp-evpn-overlay-index-gateway/PE2/bgp_vni_routes_no_rt2.json) | 0 | ||||
| -rw-r--r-- | tests/topotests/bgp_evpn_overlay_index_gateway/PE2/bgp_vni_routes_no_rt5.json (renamed from tests/topotests/bgp-evpn-overlay-index-gateway/PE2/bgp_vni_routes_no_rt5.json) | 0 | ||||
| -rw-r--r-- | tests/topotests/bgp_evpn_overlay_index_gateway/PE2/bgp_vrf_ipv4_base.json (renamed from tests/topotests/bgp-evpn-overlay-index-gateway/PE2/bgp_vrf_ipv4_base.json) | 0 | ||||
| -rw-r--r-- | tests/topotests/bgp_evpn_overlay_index_gateway/PE2/bgp_vrf_ipv4_no_rt2.json (renamed from tests/topotests/bgp-evpn-overlay-index-gateway/PE2/bgp_vrf_ipv4_no_rt2.json) | 0 | ||||
| -rw-r--r-- | tests/topotests/bgp_evpn_overlay_index_gateway/PE2/bgp_vrf_ipv4_no_rt5.json (renamed from tests/topotests/bgp-evpn-overlay-index-gateway/PE2/bgp_vrf_ipv4_no_rt5.json) | 0 | ||||
| -rw-r--r-- | tests/topotests/bgp_evpn_overlay_index_gateway/PE2/bgp_vrf_ipv6_base.json (renamed from tests/topotests/bgp-evpn-overlay-index-gateway/PE2/bgp_vrf_ipv6_base.json) | 0 | ||||
| -rw-r--r-- | tests/topotests/bgp_evpn_overlay_index_gateway/PE2/bgp_vrf_ipv6_no_rt2.json (renamed from tests/topotests/bgp-evpn-overlay-index-gateway/PE2/bgp_vrf_ipv6_no_rt2.json) | 0 | ||||
| -rw-r--r-- | tests/topotests/bgp_evpn_overlay_index_gateway/PE2/bgp_vrf_ipv6_no_rt5.json (renamed from tests/topotests/bgp-evpn-overlay-index-gateway/PE2/bgp_vrf_ipv6_no_rt5.json) | 0 | ||||
| -rw-r--r-- | tests/topotests/bgp_evpn_overlay_index_gateway/PE2/bgpd.conf (renamed from tests/topotests/bgp-evpn-overlay-index-gateway/PE2/bgpd.conf) | 0 | ||||
| -rw-r--r-- | tests/topotests/bgp_evpn_overlay_index_gateway/PE2/zebra.conf (renamed from tests/topotests/bgp-evpn-overlay-index-gateway/PE2/zebra.conf) | 0 | ||||
| -rw-r--r-- | tests/topotests/bgp_evpn_overlay_index_gateway/PE2/zebra_vrf_ipv4_base.json (renamed from tests/topotests/bgp-evpn-overlay-index-gateway/PE2/zebra_vrf_ipv4_base.json) | 0 | ||||
| -rw-r--r-- | tests/topotests/bgp_evpn_overlay_index_gateway/PE2/zebra_vrf_ipv4_no_rt2.json (renamed from tests/topotests/bgp-evpn-overlay-index-gateway/PE2/zebra_vrf_ipv4_no_rt2.json) | 0 | ||||
| -rw-r--r-- | tests/topotests/bgp_evpn_overlay_index_gateway/PE2/zebra_vrf_ipv4_no_rt5.json (renamed from tests/topotests/bgp-evpn-overlay-index-gateway/PE2/zebra_vrf_ipv4_no_rt5.json) | 0 | ||||
| -rw-r--r-- | tests/topotests/bgp_evpn_overlay_index_gateway/PE2/zebra_vrf_ipv6_base.json (renamed from tests/topotests/bgp-evpn-overlay-index-gateway/PE2/zebra_vrf_ipv6_base.json) | 0 | ||||
| -rw-r--r-- | tests/topotests/bgp_evpn_overlay_index_gateway/PE2/zebra_vrf_ipv6_no_rt2.json (renamed from tests/topotests/bgp-evpn-overlay-index-gateway/PE2/zebra_vrf_ipv6_no_rt2.json) | 0 | ||||
| -rw-r--r-- | tests/topotests/bgp_evpn_overlay_index_gateway/PE2/zebra_vrf_ipv6_no_rt5.json (renamed from tests/topotests/bgp-evpn-overlay-index-gateway/PE2/zebra_vrf_ipv6_no_rt5.json) | 0 | ||||
| -rw-r--r-- | tests/topotests/bgp_evpn_overlay_index_gateway/__init__.py (renamed from tests/topotests/bgp-evpn-overlay-index-gateway/__init__.py) | 0 | ||||
| -rw-r--r-- | tests/topotests/bgp_evpn_overlay_index_gateway/host1/bgpd.conf (renamed from tests/topotests/bgp-evpn-overlay-index-gateway/host1/bgpd.conf) | 0 | ||||
| -rw-r--r-- | tests/topotests/bgp_evpn_overlay_index_gateway/host1/zebra.conf (renamed from tests/topotests/bgp-evpn-overlay-index-gateway/host1/zebra.conf) | 0 | ||||
| -rw-r--r-- | tests/topotests/bgp_evpn_overlay_index_gateway/host2/bgpd.conf (renamed from tests/topotests/bgp-evpn-overlay-index-gateway/host2/bgpd.conf) | 0 | ||||
| -rw-r--r-- | tests/topotests/bgp_evpn_overlay_index_gateway/host2/zebra.conf (renamed from tests/topotests/bgp-evpn-overlay-index-gateway/host2/zebra.conf) | 0 | ||||
| -rwxr-xr-x | tests/topotests/bgp_evpn_overlay_index_gateway/test_bgp_evpn_overlay_index_gateway.py (renamed from tests/topotests/bgp-evpn-overlay-index-gateway/test_bgp_evpn_overlay_index_gateway.py) | 0 | ||||
| -rw-r--r-- | tests/topotests/ospf_sr_te_topo1/dst/zebra.conf (renamed from tests/topotests/ospf-sr-te-topo1/dst/zebra.conf) | 0 | ||||
| -rw-r--r-- | tests/topotests/ospf_sr_te_topo1/rt1/bgpd.conf (renamed from tests/topotests/ospf-sr-te-topo1/rt1/bgpd.conf) | 0 | ||||
| -rw-r--r-- | tests/topotests/ospf_sr_te_topo1/rt1/ospfd.conf (renamed from tests/topotests/ospf-sr-te-topo1/rt1/ospfd.conf) | 0 | ||||
| -rw-r--r-- | tests/topotests/ospf_sr_te_topo1/rt1/pathd.conf (renamed from tests/topotests/ospf-sr-te-topo1/rt1/pathd.conf) | 0 | ||||
| -rw-r--r-- | tests/topotests/ospf_sr_te_topo1/rt1/step2/show_operational_data.ref (renamed from tests/topotests/ospf-sr-te-topo1/rt1/step2/show_operational_data.ref) | 0 | ||||
| -rw-r--r-- | tests/topotests/ospf_sr_te_topo1/rt1/step2/show_operational_data_with_candidate.ref (renamed from tests/topotests/ospf-sr-te-topo1/rt1/step2/show_operational_data_with_candidate.ref) | 0 | ||||
| -rw-r--r-- | tests/topotests/ospf_sr_te_topo1/rt1/step3/show_operational_data_with_single_candidate.ref (renamed from tests/topotests/ospf-sr-te-topo1/rt1/step3/show_operational_data_with_single_candidate.ref) | 0 | ||||
| -rw-r--r-- | tests/topotests/ospf_sr_te_topo1/rt1/step3/show_operational_data_with_two_candidates.ref (renamed from tests/topotests/ospf-sr-te-topo1/rt1/step3/show_operational_data_with_two_candidates.ref) | 0 | ||||
| -rw-r--r-- | tests/topotests/ospf_sr_te_topo1/rt1/zebra.conf (renamed from tests/topotests/ospf-sr-te-topo1/rt1/zebra.conf) | 0 | ||||
| -rw-r--r-- | tests/topotests/ospf_sr_te_topo1/rt2/ospfd.conf (renamed from tests/topotests/ospf-sr-te-topo1/rt2/ospfd.conf) | 0 | ||||
| -rw-r--r-- | tests/topotests/ospf_sr_te_topo1/rt2/zebra.conf (renamed from tests/topotests/ospf-sr-te-topo1/rt2/zebra.conf) | 0 | ||||
| -rw-r--r-- | tests/topotests/ospf_sr_te_topo1/rt3/ospfd.conf (renamed from tests/topotests/ospf-sr-te-topo1/rt3/ospfd.conf) | 0 | ||||
| -rw-r--r-- | tests/topotests/ospf_sr_te_topo1/rt3/zebra.conf (renamed from tests/topotests/ospf-sr-te-topo1/rt3/zebra.conf) | 0 | ||||
| -rw-r--r-- | tests/topotests/ospf_sr_te_topo1/rt4/ospfd.conf (renamed from tests/topotests/ospf-sr-te-topo1/rt4/ospfd.conf) | 0 | ||||
| -rw-r--r-- | tests/topotests/ospf_sr_te_topo1/rt4/zebra.conf (renamed from tests/topotests/ospf-sr-te-topo1/rt4/zebra.conf) | 0 | ||||
| -rw-r--r-- | tests/topotests/ospf_sr_te_topo1/rt5/ospfd.conf (renamed from tests/topotests/ospf-sr-te-topo1/rt5/ospfd.conf) | 0 | ||||
| -rw-r--r-- | tests/topotests/ospf_sr_te_topo1/rt5/zebra.conf (renamed from tests/topotests/ospf-sr-te-topo1/rt5/zebra.conf) | 0 | ||||
| -rw-r--r-- | tests/topotests/ospf_sr_te_topo1/rt6/bgpd.conf (renamed from tests/topotests/ospf-sr-te-topo1/rt6/bgpd.conf) | 0 | ||||
| -rw-r--r-- | tests/topotests/ospf_sr_te_topo1/rt6/ospfd.conf (renamed from tests/topotests/ospf-sr-te-topo1/rt6/ospfd.conf) | 0 | ||||
| -rw-r--r-- | tests/topotests/ospf_sr_te_topo1/rt6/pathd.conf (renamed from tests/topotests/ospf-sr-te-topo1/rt6/pathd.conf) | 0 | ||||
| -rw-r--r-- | tests/topotests/ospf_sr_te_topo1/rt6/step2/show_operational_data.ref (renamed from tests/topotests/ospf-sr-te-topo1/rt6/step2/show_operational_data.ref) | 0 | ||||
| -rw-r--r-- | tests/topotests/ospf_sr_te_topo1/rt6/step2/show_operational_data_with_candidate.ref (renamed from tests/topotests/ospf-sr-te-topo1/rt6/step2/show_operational_data_with_candidate.ref) | 0 | ||||
| -rw-r--r-- | tests/topotests/ospf_sr_te_topo1/rt6/step3/show_operational_data_with_single_candidate.ref (renamed from tests/topotests/ospf-sr-te-topo1/rt6/step3/show_operational_data_with_single_candidate.ref) | 0 | ||||
| -rw-r--r-- | tests/topotests/ospf_sr_te_topo1/rt6/step3/show_operational_data_with_two_candidates.ref (renamed from tests/topotests/ospf-sr-te-topo1/rt6/step3/show_operational_data_with_two_candidates.ref) | 0 | ||||
| -rw-r--r-- | tests/topotests/ospf_sr_te_topo1/rt6/zebra.conf (renamed from tests/topotests/ospf-sr-te-topo1/rt6/zebra.conf) | 0 | ||||
| -rwxr-xr-x | tests/topotests/ospf_sr_te_topo1/test_ospf_sr_te_topo1.py (renamed from tests/topotests/ospf-sr-te-topo1/test_ospf_sr_te_topo1.py) | 0 | ||||
| -rw-r--r-- | tools/etc/frr/support_bundle_commands.conf | 72 | ||||
| -rw-r--r-- | tools/releasedate.py | 59 | ||||
| -rw-r--r-- | vtysh/vtysh.c | 12 | ||||
| -rw-r--r-- | zebra/debug.c | 12 | ||||
| -rw-r--r-- | zebra/if_netlink.c | 8 | ||||
| -rw-r--r-- | zebra/rib.h | 8 | ||||
| -rw-r--r-- | zebra/rt_netlink.c | 6 | ||||
| -rw-r--r-- | zebra/zapi_msg.c | 22 | ||||
| -rw-r--r-- | zebra/zebra_dplane.c | 12 | ||||
| -rw-r--r-- | zebra/zebra_evpn_mh.c | 19 | ||||
| -rw-r--r-- | zebra/zebra_rib.c | 287 | ||||
| -rw-r--r-- | zebra/zebra_vxlan.c | 23 |
103 files changed, 660 insertions, 489 deletions
diff --git a/bgpd/bgp_clist.c b/bgpd/bgp_clist.c index 1fb55ddf7d..d6ac88c09b 100644 --- a/bgpd/bgp_clist.c +++ b/bgpd/bgp_clist.c @@ -33,6 +33,7 @@ #include "bgpd/bgp_community.h" #include "bgpd/bgp_ecommunity.h" #include "bgpd/bgp_lcommunity.h" +#include "bgpd/bgp_community_alias.h" #include "bgpd/bgp_aspath.h" #include "bgpd/bgp_regex.h" #include "bgpd/bgp_clist.h" @@ -557,7 +558,7 @@ static bool community_regexp_match(struct community *com, regex_t *reg) str = community_str(com, false); /* Regular expression match. */ - if (regexec(reg, str, 0, NULL, 0) == 0) + if (regexec(reg, bgp_alias2community_str(str), 0, NULL, 0) == 0) return true; /* No match. */ @@ -627,7 +628,7 @@ static bool lcommunity_regexp_match(struct lcommunity *com, regex_t *reg) str = lcommunity_str(com, false); /* Regular expression match. */ - if (regexec(reg, str, 0, NULL, 0) == 0) + if (regexec(reg, bgp_alias2community_str(str), 0, NULL, 0) == 0) return true; /* No match. */ diff --git a/bgpd/bgp_community_alias.c b/bgpd/bgp_community_alias.c index f770ebdd5d..5f45e19a3b 100644 --- a/bgpd/bgp_community_alias.c +++ b/bgpd/bgp_community_alias.c @@ -20,6 +20,7 @@ #include "memory.h" #include "lib/jhash.h" +#include "frrstr.h" #include "bgpd/bgpd.h" #include "bgpd/bgp_community_alias.h" @@ -153,6 +154,45 @@ const char *bgp_community2alias(char *community) return community; } +const char *bgp_alias2community(char *alias) +{ + struct community_alias ca; + struct community_alias *find; + + memset(&ca, 0, sizeof(ca)); + strlcpy(ca.alias, alias, sizeof(ca.alias)); + + find = bgp_ca_alias_lookup(&ca); + if (find) + return find->community; + + return alias; +} + +/* Communities structs have `->str` which is used + * for vty outputs and extended BGP community lists + * with regexp. + * This is a helper to convert already aliased version + * of communities into numerical-only format. + */ +const char *bgp_alias2community_str(const char *str) +{ + char **aliases; + int num; + + frrstr_split(str, " ", &aliases, &num); + const char *communities[num + 1]; + + for (int i = 0; i < num; i++) { + communities[i] = + XSTRDUP(MTYPE_TMP, bgp_alias2community(aliases[i])); + XFREE(MTYPE_TMP, aliases[i]); + } + XFREE(MTYPE_TMP, aliases); + + return frrstr_join(communities, num, " "); +} + static int bgp_community_alias_vector_walker(struct hash_bucket *bucket, void *data) { diff --git a/bgpd/bgp_community_alias.h b/bgpd/bgp_community_alias.h index ab8ed06ee6..fc9eb9f9e4 100644 --- a/bgpd/bgp_community_alias.h +++ b/bgpd/bgp_community_alias.h @@ -42,6 +42,8 @@ extern void bgp_ca_community_delete(struct community_alias *ca); extern void bgp_ca_alias_delete(struct community_alias *ca); extern int bgp_community_alias_write(struct vty *vty); extern const char *bgp_community2alias(char *community); +extern const char *bgp_alias2community(char *alias); +extern const char *bgp_alias2community_str(const char *str); extern void bgp_community_alias_command_completion_setup(void); #endif /* FRR_BGP_COMMUNITY_ALIAS_H */ diff --git a/bgpd/bgp_io.c b/bgpd/bgp_io.c index e9b0f9e46a..9b5a31f289 100644 --- a/bgpd/bgp_io.c +++ b/bgpd/bgp_io.c @@ -111,6 +111,7 @@ void bgp_reads_off(struct peer *peer) thread_cancel_async(fpt->master, &peer->t_read, NULL); THREAD_OFF(peer->t_process_packet); + THREAD_OFF(peer->t_process_packet_error); UNSET_FLAG(peer->thread_flags, PEER_THREAD_READS_ON); } @@ -208,7 +209,7 @@ static int bgp_process_reads(struct thread *thread) * specific state change from 'bgp_read'. */ thread_add_event(bm->master, bgp_packet_process_error, - peer, code, NULL); + peer, code, &peer->t_process_packet_error); } while (more) { diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c index 09dd71c020..a85dccae2f 100644 --- a/bgpd/bgp_routemap.c +++ b/bgpd/bgp_routemap.c @@ -2038,9 +2038,8 @@ route_set_aspath_prepend(void *rule, const struct prefix *prefix, void *object) aspath_prepend(aspath, new); } else { as_t as = aspath_leftmost(new); - if (!as) - as = path->peer->as; - new = aspath_add_seq_n(new, as, (uintptr_t)rule); + if (as) + new = aspath_add_seq_n(new, as, (uintptr_t)rule); } path->attr->aspath = new; @@ -5208,7 +5207,7 @@ DEFUN_YANG (set_aspath_prepend_lastas, SET_STR "Transform BGP AS_PATH attribute\n" "Prepend to the as-path\n" - "Use the peer's AS-number\n" + "Use the last AS-number in the as-path\n" "Number of times to insert\n") { int idx_num = 4; diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h index 867062a88b..d39743a152 100644 --- a/bgpd/bgpd.h +++ b/bgpd/bgpd.h @@ -1415,6 +1415,7 @@ struct peer { struct thread *t_gr_stale; struct thread *t_generate_updgrp_packets; struct thread *t_process_packet; + struct thread *t_process_packet_error; struct thread *t_refresh_stalepath; /* Thread flags. */ diff --git a/doc/developer/scripting.rst b/doc/developer/scripting.rst index d543ed3560..202f0036f8 100644 --- a/doc/developer/scripting.rst +++ b/doc/developer/scripting.rst @@ -117,6 +117,7 @@ Load The function to be called must first be loaded. Use ``frrscript_load()`` which takes a ``frrscript`` object, the name of the Lua function and a callback function. +The script file will be read to load and compile the function. For example, to load the Lua function ``on_foo`` in ``/etc/frr/scripts/bingus.lua``: @@ -138,7 +139,7 @@ should not be able to write the scripts directory anyway. Call ^^^^ -After loading, Lua functions may be called. +After loading, a Lua function can be called any number of times. Input """"" @@ -231,6 +232,18 @@ In the example, ``d`` is a "new" value in C space, so memory allocation might take place. Hence the caller is responsible for memory deallocation. +``frrscript_call()`` may be called multiple times without re-loading with +``frrscript_load()``. Results are not preserved between consecutive calls. + +.. code-block:: c + + frrscript_load(fs, "on_foo"); + + frrscript_call(fs, "on_foo"); + frrscript_get_result(fs, "on_foo", ...); + frrscript_call(fs, "on_foo"); + frrscript_get_result(fs, "on_foo", ...); + Delete ^^^^^^ @@ -385,7 +398,7 @@ Again, for ``struct prefix *``: { lua_getfield(L, idx, "network"); (void)str2prefix(lua_tostring(L, -1), prefix); - /* pop the netork string */ + /* pop the network string */ lua_pop(L, 1); /* pop the prefix table */ lua_pop(L, 1); diff --git a/doc/developer/workflow.rst b/doc/developer/workflow.rst index dae175a732..b6fde2b283 100644 --- a/doc/developer/workflow.rst +++ b/doc/developer/workflow.rst @@ -88,22 +88,45 @@ FRR employs a ``<MAJOR>.<MINOR>.<BUGFIX>`` versioning scheme. ``BUGFIX`` Fixes for actual bugs and/or security issues. Fully compatible. -We will pull a new development branch for the next release every 4 months. The -current schedule is Feb/June/October 1. The decision for a ``MAJOR/MINOR`` -release is made at the time of branch pull based on what has been received the -previous 4 months. The branch name will be ``dev/MAJOR.MINOR``. At this point -in time the master branch and this new branch, :file:`configure.ac`, -documentation and packaging systems will be updated to reflect the next -possible release name to allow for easy distinguishing. - -After one month the development branch will be renamed to -``stable/MAJOR.MINOR``. The branch is a stable branch. This process is not -held up unless a crash or security issue has been found and needs to -be addressed. Issues being fixed will not cause a delay. - -Bugfix releases are made as needed at 1 month intervals until the next -``MAJOR.MINOR`` release branch is pulled. Depending on the severity of the bugs, -bugfix releases may occur sooner. +Releases are scheduled in a 4-month cycle on the first Tuesday each +March/July/November. Walking backwards from this date: + + - 6 weeks earlier, ``master`` is frozen for new features, and feature PRs + are considered lowest priority (regardless of when they were opened.) + + - 4 weeks earlier, the stable branch separates from master (named + ``dev/MAJOR.MINOR`` at this point) and a ``rc1`` release candidate is + tagged. Master is unfrozen and new features may again proceed. + + - 2 weeks earlier, a ``rc2`` release candidate is tagged. + + - on release date, the branch is renamed to ``stable/MAJOR.MINOR``. + +The 2 week window between each of these events should be used to run any and +all testing possible for the release in progress. However, the current +intention is to stick to the schedule even if known issues remain. This would +hopefully occur only after all avenues of fixing issues are exhausted, but to +achieve this, an as exhaustive as possible list of issues needs to be available +as early as possible, i.e. the first 2-week window. + +For reference, the expected release schedule according to the above is: + ++------------+------------+------------+------------+------------+------------+ +| Release | 2021-11-02 | 2022-03-01 | 2022-07-05 | 2022-11-01 | 2023-03-07 | ++------------+------------+------------+------------+------------+------------+ +| rc2 | 2021-10-19 | 2022-02-15 | 2022-06-21 | 2022-10-18 | 2023-02-21 | ++------------+------------+------------+------------+------------+------------+ +| rc1/branch | 2021-10-05 | 2022-02-01 | 2022-06-07 | 2022-10-04 | 2023-02-07 | ++------------+------------+------------+------------+------------+------------+ +| freeze | 2021-09-21 | 2022-01-18 | 2022-05-24 | 2022-09-20 | 2023-01-24 | ++------------+------------+------------+------------+------------+------------+ + +Each release is managed by one or more volunteer release managers from the FRR +community. To spread and distribute this workload, this should be rotated for +subsequent releases. The release managers are currently assumed/expected to +run a release management meeting during the weeks listed above. Barring other +constraints, this would be scheduled before the regular weekly FRR community +call such that important items can be carried over into that call. Bugfixes are applied to the two most recent releases. However, backporting of bug fixes to older than the two most recent releases will not be prevented, if acked diff --git a/doc/user/ospf6d.rst b/doc/user/ospf6d.rst index 948527d774..55ab493873 100644 --- a/doc/user/ospf6d.rst +++ b/doc/user/ospf6d.rst @@ -70,20 +70,6 @@ OSPF6 router Use this command to control the maximum number of parallel routes that OSPFv3 can support. The default is 64. -.. clicmd:: area A.B.C.D range X:X::X:X/M [<advertise|not-advertise|cost (0-16777215)>] - -.. clicmd:: area (0-4294967295) range X:X::X:X/M [<advertise|not-advertise|cost (0-16777215)>] - - Summarize a group of internal subnets into a single Inter-Area-Prefix LSA. - This command can only be used at the area boundary (ABR router). - - By default, the metric of the summary route is calculated as the highest - metric among the summarized routes. The `cost` option, however, can be used - to set an explicit metric. - - The `not-advertise` option, when present, prevents the summary route from - being advertised, effectively filtering the summarized routes. - .. clicmd:: write-multiplier (1-100) Use this command to tune the amount of work done in the packet read and @@ -171,89 +157,42 @@ ASBR Summarisation Support in OSPFv3 When detail option is used, it shows all the prefixes falling under each summary-configuration apart from other information. -.. clicmd:: debug ospf6 lsa aggregation - - This command can be used to enable the debugs related to the summarisation - of these LSAs. - -.. _ospf6-debugging: - -OSPFv3 Debugging -================ - -The following debug commands are supported: - -.. clicmd:: debug ospf6 abr - - Toggle OSPFv3 ABR debugging messages. - -.. clicmd:: debug ospf6 asbr - - Toggle OSPFv3 ASBR debugging messages. - -.. clicmd:: debug ospf6 border-routers - - Toggle OSPFv3 border router debugging messages. - -.. clicmd:: debug ospf6 flooding - - Toggle OSPFv3 flooding debugging messages. - -.. clicmd:: debug ospf6 interface - - Toggle OSPFv3 interface related debugging messages. - -.. clicmd:: debug ospf6 lsa - - Toggle OSPFv3 Link State Advertisements debugging messages. - -.. clicmd:: debug ospf6 message - - Toggle OSPFv3 message exchange debugging messages. - -.. clicmd:: debug ospf6 neighbor - - Toggle OSPFv3 neighbor interaction debugging messages. - -.. clicmd:: debug ospf6 nssa - - Toggle OSPFv3 Not So Stubby Area (NSSA) debugging messages. - -.. clicmd:: debug ospf6 route - - Toggle OSPFv3 routes debugging messages. +.. _ospf6-area: -.. clicmd:: debug ospf6 spf +OSPF6 area +========== - Toggle OSPFv3 Shortest Path calculation debugging messages. +.. clicmd:: area A.B.C.D range X:X::X:X/M [<advertise|not-advertise|cost (0-16777215)>] -.. clicmd:: debug ospf6 zebra +.. clicmd:: area (0-4294967295) range X:X::X:X/M [<advertise|not-advertise|cost (0-16777215)>] - Toggle OSPFv3 zebra interaction debugging messages. + Summarize a group of internal subnets into a single Inter-Area-Prefix LSA. + This command can only be used at the area boundary (ABR router). -.. _ospf6-area: + By default, the metric of the summary route is calculated as the highest + metric among the summarized routes. The `cost` option, however, can be used + to set an explicit metric. -OSPF6 area -========== + The `not-advertise` option, when present, prevents the summary route from + being advertised, effectively filtering the summarized routes. .. clicmd:: area A.B.C.D nssa -NSSA Support in OSPFv3 -======================= +.. clicmd:: area (0-4294967295) nssa + + Configure the area to be a NSSA (Not-So-Stubby Area). -The configuration of NSSA areas in OSPFv3 is supported using the CLI command -``area A.B.C.D nssa`` in ospf6 router configuration mode. -The following functionalities are implemented as per RFC 3101: + The following functionalities are implemented as per RFC 3101: -1. Advertising Type-7 LSA into NSSA area when external route is redistributed - into OSPFv3 -2. Processing Type-7 LSA received from neighbor and installing route in the - route table -3. Support for NSSA ABR functionality which is generating Type-5 LSA when - backbone area is configured. Currently translation of Type-7 LSA to Type-5 LSA - is enabled by default. -4. Support for NSSA Translator functionality when there are multiple NSSA ABR - in an area + 1. Advertising Type-7 LSA into NSSA area when external route is + redistributed into OSPFv3. + 2. Processing Type-7 LSA received from neighbor and installing route in the + route table. + 3. Support for NSSA ABR functionality which is generating Type-5 LSA when + backbone area is configured. Currently translation of Type-7 LSA to + Type-5 LSA is enabled by default. + 4. Support for NSSA Translator functionality when there are multiple NSSA + ABR in an area. .. _ospf6-interface: @@ -413,6 +352,65 @@ Showing OSPF6 information arguments. +.. _ospf6-debugging: + +OSPFv3 Debugging +================ + +The following debug commands are supported: + +.. clicmd:: debug ospf6 abr + + Toggle OSPFv3 ABR debugging messages. + +.. clicmd:: debug ospf6 asbr + + Toggle OSPFv3 ASBR debugging messages. + +.. clicmd:: debug ospf6 border-routers + + Toggle OSPFv3 border router debugging messages. + +.. clicmd:: debug ospf6 flooding + + Toggle OSPFv3 flooding debugging messages. + +.. clicmd:: debug ospf6 interface + + Toggle OSPFv3 interface related debugging messages. + +.. clicmd:: debug ospf6 lsa + + Toggle OSPFv3 Link State Advertisements debugging messages. + +.. clicmd:: debug ospf6 lsa aggregation + + Toggle OSPFv3 Link State Advertisements summarization debugging messages. + +.. clicmd:: debug ospf6 message + + Toggle OSPFv3 message exchange debugging messages. + +.. clicmd:: debug ospf6 neighbor + + Toggle OSPFv3 neighbor interaction debugging messages. + +.. clicmd:: debug ospf6 nssa + + Toggle OSPFv3 Not So Stubby Area (NSSA) debugging messages. + +.. clicmd:: debug ospf6 route + + Toggle OSPFv3 routes debugging messages. + +.. clicmd:: debug ospf6 spf + + Toggle OSPFv3 Shortest Path calculation debugging messages. + +.. clicmd:: debug ospf6 zebra + + Toggle OSPFv3 zebra interaction debugging messages. + Sample configuration ==================== diff --git a/doc/user/zebra.rst b/doc/user/zebra.rst index 8b4e2c8bdc..79036320b8 100644 --- a/doc/user/zebra.rst +++ b/doc/user/zebra.rst @@ -222,7 +222,7 @@ Link Parameters Commands Bandwidth for each 0-7 priority and Admin Group (ISIS) or Resource Class/Color (OSPF). - Note that BANDIWDTH is specified in IEEE floating point format and express + Note that BANDWIDTH is specified in IEEE floating point format and express in Bytes/second. .. clicmd:: delay (0-16777215) [min (0-16777215) | max (0-16777215)] diff --git a/lib/frrscript.c b/lib/frrscript.c index c9fc938997..0e0d3c030c 100644 --- a/lib/frrscript.c +++ b/lib/frrscript.c @@ -288,13 +288,16 @@ int frrscript_load(struct frrscript *fs, const char *function_name, goto fail; } - /* Push the Lua function we want */ + /* To check the Lua function, we get it from the global table */ lua_getglobal(L, function_name); if (lua_isfunction(L, lua_gettop(L)) == 0) { zlog_err("frrscript: loaded script '%s.lua' but %s not found", script_name, function_name); goto fail; } + /* Then pop the function (frrscript_call will push it when it needs it) + */ + lua_pop(L, 1); if (load_cb && (*load_cb)(fs) != 0) { zlog_err( diff --git a/lib/frrscript.h b/lib/frrscript.h index 540676c099..c089df61fc 100644 --- a/lib/frrscript.h +++ b/lib/frrscript.h @@ -203,8 +203,18 @@ const struct prefix * : lua_decode_noop \ int _frrscript_call_lua(struct lua_function_state *lfs, int nargs); /* - * Wrapper for calling Lua function state. Maps values passed in to their - * encoder and decoder types. + * Wrapper for calling Lua function state. + * + * The Lua function name (f) to run should have already been checked by + * frrscript_load. So this wrapper will: + * 1) Find the Lua function state, which contains the Lua state + * 2) Clear the Lua state (there may be leftovers items from previous call) + * 3) Push the Lua function (f) + * 4) Map frrscript_call arguments onto their encoder and decoders, push those + * 5) Call _frrscript_call_lua (Lua execution takes place) + * 6) Write back to frrscript_call arguments using their decoders + * + * This wrapper can be called multiple times (after one frrscript_load). * * fs * The struct frrscript in which the Lua fuction was loaded into @@ -226,6 +236,8 @@ int _frrscript_call_lua(struct lua_function_state *lfs, int nargs); 1; \ }) \ : ({ \ + lua_settop(lfs->L, 0); \ + lua_getglobal(lfs->L, f); \ MAP_LISTS(ENCODE_ARGS, ##__VA_ARGS__); \ _frrscript_call_lua( \ lfs, PP_NARG(__VA_ARGS__)); \ diff --git a/lib/frrstr.c b/lib/frrstr.c index 7ef5fffd12..1b98b224cc 100644 --- a/lib/frrstr.c +++ b/lib/frrstr.c @@ -18,9 +18,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif +#include "zebra.h" #include <string.h> #include <ctype.h> @@ -217,3 +215,21 @@ int all_digit(const char *str) return 0; return 1; } + + +char *frrstr_hex(char *buff, size_t bufsiz, const uint8_t *str, size_t num) +{ + if (bufsiz == 0) + return buff; + + char tmp[3]; + + buff[0] = '\0'; + + for (size_t i = 0; i < num; i++) { + snprintf(tmp, sizeof(tmp), "%02x", (unsigned char)str[i]); + strlcat(buff, tmp, bufsiz); + } + + return buff; +} diff --git a/lib/frrstr.h b/lib/frrstr.h index 441d7b8670..d52d6a4482 100644 --- a/lib/frrstr.h +++ b/lib/frrstr.h @@ -154,6 +154,26 @@ bool frrstr_endswith(const char *str, const char *suffix); */ int all_digit(const char *str); +/* + * Copy the hexadecimal representation of the string to a buffer. + * + * buff + * Buffer to copy result into with size of at least (2 * num) + 1. + * + * bufsiz + * Size of destination buffer. + * + * str + * String to represent as hexadecimal. + * + * num + * Number of characters to copy. + * + * Returns: + * Pointer to buffer containing resulting hexadecimal representation. + */ +char *frrstr_hex(char *buff, size_t bufsiz, const uint8_t *str, size_t num); + #ifdef __cplusplus } #endif diff --git a/ospf6d/ospf6_asbr.c b/ospf6d/ospf6_asbr.c index 165e409eed..b7cbc13b72 100644 --- a/ospf6d/ospf6_asbr.c +++ b/ospf6d/ospf6_asbr.c @@ -811,7 +811,7 @@ void ospf6_asbr_lsa_remove(struct ospf6_lsa *lsa, /* Compare LSA cost with current * route info. */ - if (!asbr_entry + if (asbr_entry && (o_path->cost != route_to_del->path.cost || o_path->u.cost_e2 != route_to_del->path.u diff --git a/ospf6d/ospf6_lsa.c b/ospf6d/ospf6_lsa.c index 9c03ce21ed..1bc1ce9cdf 100644 --- a/ospf6d/ospf6_lsa.c +++ b/ospf6d/ospf6_lsa.c @@ -29,6 +29,7 @@ #include "memory.h" #include "thread.h" #include "checksum.h" +#include "frrstr.h" #include "ospf6_proto.h" #include "ospf6_lsa.h" @@ -80,7 +81,6 @@ static int ospf6_unknown_lsa_show(struct vty *vty, struct ospf6_lsa *lsa, json_object *json_obj, bool use_json) { uint8_t *start, *end, *current; - char byte[4]; start = (uint8_t *)lsa->header + sizeof(struct ospf6_lsa_header); end = (uint8_t *)lsa->header + ntohs(lsa->header->length); @@ -95,8 +95,7 @@ static int ospf6_unknown_lsa_show(struct vty *vty, struct ospf6_lsa *lsa, else if ((current - start) % 4 == 0) vty_out(vty, " "); - snprintf(byte, sizeof(byte), "%02x", *current); - vty_out(vty, "%s", byte); + vty_out(vty, "%02x", *current); } vty_out(vty, "\n\n"); @@ -553,29 +552,51 @@ void ospf6_lsa_show_summary(struct vty *vty, struct ospf6_lsa *lsa, void ospf6_lsa_show_dump(struct vty *vty, struct ospf6_lsa *lsa, json_object *json_array, bool use_json) { - uint8_t *start, *end, *current; + uint8_t *start = NULL; + uint8_t *end = NULL; + uint8_t *current = NULL; char byte[4]; + char *header_str = NULL; + char adv_router[INET6_ADDRSTRLEN]; + char id[INET6_ADDRSTRLEN]; + json_object *json = NULL; start = (uint8_t *)lsa->header; end = (uint8_t *)lsa->header + ntohs(lsa->header->length); - if (use_json) - return; + if (use_json) { + json = json_object_new_object(); + size_t header_str_sz = (2 * (end - start)) + 1; - vty_out(vty, "\n"); - vty_out(vty, "%s:\n", lsa->name); + header_str = XMALLOC(MTYPE_TMP, header_str_sz); - for (current = start; current < end; current++) { - if ((current - start) % 16 == 0) - vty_out(vty, "\n "); - else if ((current - start) % 4 == 0) - vty_out(vty, " "); + inet_ntop(AF_INET, &lsa->header->id, id, sizeof(id)); + inet_ntop(AF_INET, &lsa->header->adv_router, adv_router, + sizeof(adv_router)); - snprintf(byte, sizeof(byte), "%02x", *current); - vty_out(vty, "%s", byte); - } + frrstr_hex(header_str, header_str_sz, start, end - start); + + json_object_string_add(json, "linkStateId", id); + json_object_string_add(json, "advertisingRouter", adv_router); + json_object_string_add(json, "header", header_str); + json_object_array_add(json_array, json); + + XFREE(MTYPE_TMP, header_str); + } else { + vty_out(vty, "\n%s:\n", lsa->name); + + for (current = start; current < end; current++) { + if ((current - start) % 16 == 0) + vty_out(vty, "\n "); + else if ((current - start) % 4 == 0) + vty_out(vty, " "); - vty_out(vty, "\n\n"); + snprintf(byte, sizeof(byte), "%02x", *current); + vty_out(vty, "%s", byte); + } + + vty_out(vty, "\n\n"); + } return; } diff --git a/ospfd/ospf_interface.h b/ospfd/ospf_interface.h index 7ba6a2b6d7..e441016406 100644 --- a/ospfd/ospf_interface.h +++ b/ospfd/ospf_interface.h @@ -273,74 +273,78 @@ struct ospf_interface { DECLARE_QOBJ_TYPE(ospf_interface); /* Prototypes. */ -extern char *ospf_if_name(struct ospf_interface *); -extern struct ospf_interface *ospf_if_new(struct ospf *, struct interface *, - struct prefix *); -extern void ospf_if_cleanup(struct ospf_interface *); -extern void ospf_if_free(struct ospf_interface *); -extern int ospf_if_up(struct ospf_interface *); -extern int ospf_if_down(struct ospf_interface *); - -extern int ospf_if_is_up(struct ospf_interface *); -extern struct ospf_interface *ospf_if_exists(struct ospf_interface *); -extern struct ospf_interface *ospf_if_lookup_by_lsa_pos(struct ospf_area *, - int); +extern char *ospf_if_name(struct ospf_interface *oi); extern struct ospf_interface * -ospf_if_lookup_by_local_addr(struct ospf *, struct interface *, struct in_addr); -extern struct ospf_interface *ospf_if_lookup_by_prefix(struct ospf *, - struct prefix_ipv4 *); -extern struct ospf_interface *ospf_if_table_lookup(struct interface *, - struct prefix *); -extern struct ospf_interface *ospf_if_addr_local(struct in_addr); +ospf_if_new(struct ospf *ospf, struct interface *ifp, struct prefix *p); +extern void ospf_if_cleanup(struct ospf_interface *oi); +extern void ospf_if_free(struct ospf_interface *oi); +extern int ospf_if_up(struct ospf_interface *oi); +extern int ospf_if_down(struct ospf_interface *oi); + +extern int ospf_if_is_up(struct ospf_interface *oi); +extern struct ospf_interface *ospf_if_exists(struct ospf_interface *oi); +extern struct ospf_interface *ospf_if_lookup_by_lsa_pos(struct ospf_area *area, + int lsa_pos); extern struct ospf_interface * -ospf_if_lookup_recv_if(struct ospf *, struct in_addr, struct interface *); -extern struct ospf_interface *ospf_if_is_configured(struct ospf *, - struct in_addr *); - -extern struct ospf_if_params *ospf_lookup_if_params(struct interface *, - struct in_addr); -extern struct ospf_if_params *ospf_get_if_params(struct interface *, - struct in_addr); -extern void ospf_free_if_params(struct interface *, struct in_addr); -extern void ospf_if_update_params(struct interface *, struct in_addr); - -extern int ospf_if_new_hook(struct interface *); +ospf_if_lookup_by_local_addr(struct ospf *ospf, struct interface *ifp, + struct in_addr addr); +extern struct ospf_interface *ospf_if_lookup_by_prefix(struct ospf *ospf, + struct prefix_ipv4 *p); +extern struct ospf_interface *ospf_if_table_lookup(struct interface *ifp, + struct prefix *p); +extern struct ospf_interface *ospf_if_addr_local(struct in_addr addr); +extern struct ospf_interface *ospf_if_lookup_recv_if(struct ospf *ospf, + struct in_addr addr, + struct interface *ifp); +extern struct ospf_interface *ospf_if_is_configured(struct ospf *ospf, + struct in_addr *addr); + +extern struct ospf_if_params *ospf_lookup_if_params(struct interface *ifp, + struct in_addr addr); +extern struct ospf_if_params *ospf_get_if_params(struct interface *ifp, + struct in_addr addr); +extern void ospf_free_if_params(struct interface *ifp, struct in_addr addr); +extern void ospf_if_update_params(struct interface *ifp, struct in_addr addr); + +extern int ospf_if_new_hook(struct interface *ifp); extern void ospf_if_init(void); -extern void ospf_if_stream_unset(struct ospf_interface *); -extern void ospf_if_reset_variables(struct ospf_interface *); -extern int ospf_if_is_enable(struct ospf_interface *); -extern int ospf_if_get_output_cost(struct ospf_interface *); -extern void ospf_if_recalculate_output_cost(struct interface *); +extern void ospf_if_stream_unset(struct ospf_interface *oi); +extern void ospf_if_reset_variables(struct ospf_interface *oi); +extern int ospf_if_is_enable(struct ospf_interface *oi); +extern int ospf_if_get_output_cost(struct ospf_interface *oi); +extern void ospf_if_recalculate_output_cost(struct interface *ifp); /* Simulate down/up on the interface. */ -extern void ospf_if_reset(struct interface *); - -extern struct ospf_interface *ospf_vl_new(struct ospf *, struct ospf_vl_data *); -extern struct ospf_vl_data *ospf_vl_data_new(struct ospf_area *, - struct in_addr); -extern struct ospf_vl_data *ospf_vl_lookup(struct ospf *, struct ospf_area *, - struct in_addr); +extern void ospf_if_reset(struct interface *ifp); + +extern struct ospf_interface *ospf_vl_new(struct ospf *ospf, + struct ospf_vl_data *vl_data); +extern struct ospf_vl_data *ospf_vl_data_new(struct ospf_area *area, + struct in_addr addr); +extern struct ospf_vl_data * +ospf_vl_lookup(struct ospf *ospf, struct ospf_area *area, struct in_addr addr); extern int ospf_vl_count(struct ospf *ospf, struct ospf_area *area); -extern void ospf_vl_data_free(struct ospf_vl_data *); -extern void ospf_vl_add(struct ospf *, struct ospf_vl_data *); -extern void ospf_vl_delete(struct ospf *, struct ospf_vl_data *); -extern void ospf_vl_up_check(struct ospf_area *, struct in_addr, - struct vertex *); -extern void ospf_vl_unapprove(struct ospf *); -extern void ospf_vl_shut_unapproved(struct ospf *); -extern int ospf_full_virtual_nbrs(struct ospf_area *); -extern int ospf_vls_in_area(struct ospf_area *); - -extern struct crypt_key *ospf_crypt_key_lookup(struct list *, uint8_t); +extern void ospf_vl_data_free(struct ospf_vl_data *vl_data); +extern void ospf_vl_add(struct ospf *ospf, struct ospf_vl_data *vl_data); +extern void ospf_vl_delete(struct ospf *ospf, struct ospf_vl_data *vl_data); +extern void ospf_vl_up_check(struct ospf_area *area, struct in_addr addr, + struct vertex *vertex); +extern void ospf_vl_unapprove(struct ospf *ospf); +extern void ospf_vl_shut_unapproved(struct ospf *ospf); +extern int ospf_full_virtual_nbrs(struct ospf_area *area); +extern int ospf_vls_in_area(struct ospf_area *area); + +extern struct crypt_key *ospf_crypt_key_lookup(struct list *list, + uint8_t key_id); extern struct crypt_key *ospf_crypt_key_new(void); -extern void ospf_crypt_key_add(struct list *, struct crypt_key *); -extern int ospf_crypt_key_delete(struct list *, uint8_t); +extern void ospf_crypt_key_add(struct list *list, struct crypt_key *key); +extern int ospf_crypt_key_delete(struct list *list, uint8_t key_id); extern uint8_t ospf_default_iftype(struct interface *ifp); extern int ospf_interface_neighbor_count(struct ospf_interface *oi); /* Set all multicast memberships appropriately based on the type and state of the interface. */ -extern void ospf_if_set_multicast(struct ospf_interface *); +extern void ospf_if_set_multicast(struct ospf_interface *oi); extern void ospf_if_interface(struct interface *ifp); diff --git a/ospfd/ospfd.c b/ospfd/ospfd.c index 3226d66444..21fa625311 100644 --- a/ospfd/ospfd.c +++ b/ospfd/ospfd.c @@ -1130,8 +1130,8 @@ static void update_redistributed(struct ospf *ospf, int add_to_ospf) if (add_to_ospf) { if (ospf_external_info_find_lsa(ospf, &ei->p)) - if (!ospf_distribute_check_connected( - ospf, ei)) + if (!ospf_redistribute_check( + ospf, ei, NULL)) ospf_external_lsa_flush( ospf, ei->type, &ei->p, @@ -1139,8 +1139,8 @@ static void update_redistributed(struct ospf *ospf, int add_to_ospf) } else { if (!ospf_external_info_find_lsa( ospf, &ei->p)) - if (ospf_distribute_check_connected( - ospf, ei)) + if (ospf_redistribute_check( + ospf, ei, NULL)) ospf_external_lsa_originate( ospf, ei); } diff --git a/redhat/frr.spec.in b/redhat/frr.spec.in index fbe4c4a1f1..066c45f55c 100644 --- a/redhat/frr.spec.in +++ b/redhat/frr.spec.in @@ -451,7 +451,7 @@ ln -s %{_sbindir}/frrinit.sh %{buildroot}%{_initddir}/frr %endif install %{zeb_src}/tools/etc/frr/daemons %{buildroot}%{_sysconfdir}/frr -install %{zeb_src}/tools/etc/frr/frr.conf %{buildroot}%{_sysconfdir}/frr +install %{zeb_src}/tools/etc/frr/frr.conf %{buildroot}%{_sysconfdir}/frr/frr.conf.template install -m644 %{zeb_rh_src}/frr.pam %{buildroot}%{_sysconfdir}/pam.d/frr install -m644 %{zeb_rh_src}/frr.logrotate %{buildroot}%{_sysconfdir}/logrotate.d/frr install -d -m750 %{buildroot}%{rundir} @@ -558,24 +558,15 @@ zebra_spec_add_service fabricd 2618/tcp "Fabricd vty" /sbin/install-info %{_infodir}/frr.info.gz %{_infodir}/dir -# Create dummy files if they don't exist so basic functions can be used. +# Create dummy config file if they don't exist so basic functions can be used. if [ ! -e %{configdir}/zebra.conf ]; then - echo "hostname `hostname`" > %{configdir}/zebra.conf + # per daemon configs exist + mv %{configdir}/frr.conf.template %{configdir}/frr.conf %if 0%{?frr_user:1} - chown %{frr_user}:%{frr_user} %{configdir}/zebra.conf* + chown %{frr_user}:%{frr_user} %{configdir}/frr.conf %endif - chmod 640 %{configdir}/zebra.conf* + chmod 640 %{configdir}/frr.conf fi -for daemon in %{all_daemons} ; do - if [ x"${daemon}" != x"" ] ; then - if [ ! -e %{configdir}/${daemon}.conf ]; then - touch %{configdir}/${daemon}.conf - %if 0%{?frr_user:1} - chown %{frr_user}:%{frr_user} %{configdir}/${daemon}.conf* - %endif - fi - fi -done %if 0%{?frr_user:1} chown %{frr_user}:%{frr_user} %{configdir}/daemons %endif diff --git a/staticd/static_nb_config.c b/staticd/static_nb_config.c index 582b838ce4..deeca97b0e 100644 --- a/staticd/static_nb_config.c +++ b/staticd/static_nb_config.c @@ -471,13 +471,6 @@ int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_cr yang_afi_safi_identity2value(afi_safi, &afi, &safi); rn = static_add_route(afi, safi, &prefix, NULL, s_vrf); - if (!rn) { - flog_warn( - EC_LIB_NB_CB_CONFIG_APPLY, - "route node %s creation failed", - yang_dnode_get_string(args->dnode, "./prefix")); - return NB_ERR; - } if (vrf->vrf_id == VRF_UNKNOWN) snprintf( args->errmsg, args->errmsg_len, @@ -752,13 +745,6 @@ int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_sr afi = family2afi(src_prefix.family); src_rn = static_add_route(afi, safi, &rn->p, &src_prefix, s_vrf); - if (!src_rn) { - flog_warn(EC_LIB_NB_CB_CONFIG_APPLY, - "src rn %s creation failed", - yang_dnode_get_string(args->dnode, - "./src-prefix")); - return NB_ERR; - } nb_running_set_entry(args->dnode, src_rn); break; } diff --git a/staticd/static_routes.c b/staticd/static_routes.c index 0ca0011d00..77a10092f8 100644 --- a/staticd/static_routes.c +++ b/staticd/static_routes.c @@ -126,8 +126,7 @@ struct route_node *static_add_route(afi_t afi, safi_t safi, struct prefix *p, struct static_route_info *si; struct route_table *stable = svrf->stable[afi][safi]; - if (!stable) - return NULL; + assert(stable); /* Lookup static route prefix. */ rn = srcdest_rnode_get(stable, p, src_p); diff --git a/tests/lib/test_frrscript.c b/tests/lib/test_frrscript.c index 7b23045978..4c5d8d2928 100644 --- a/tests/lib/test_frrscript.c +++ b/tests/lib/test_frrscript.c @@ -62,6 +62,14 @@ int main(int argc, char **argv) long long *ansptr = frrscript_get_result(fs, "fact", "ans", lua_tointegerp); assert(*ansptr == 120); + + /* check consecutive call + get_result without re-loading */ + n = 4; + result = frrscript_call(fs, "fact", ("n", &n)); + assert(result == 0); + ansptr = frrscript_get_result(fs, "fact", "ans", lua_tointegerp); + assert(*ansptr == 24); + XFREE(MTYPE_SCRIPT_RES, ansptr); /* Negative testing */ diff --git a/tests/subdir.am b/tests/subdir.am index 45236287cf..b0be63c695 100644 --- a/tests/subdir.am +++ b/tests/subdir.am @@ -35,8 +35,10 @@ if OSPFD TESTS_OSPFD = \ tests/ospfd/test_ospf_spf \ # end +IGNORE_OSPFD = else TESTS_OSPFD = +IGNORE_OSPFD = --ignore=ospfd/ endif if OSPF6D @@ -486,7 +488,7 @@ endif .PHONY: tests/tests.xml tests/tests.xml: $(check_PROGRAMS) - ( cd tests; $(PYTHON) ../$(srcdir)/tests/runtests.py --junitxml=tests.xml -v ../$(srcdir)/tests $(IGNORE_BGPD) $(IGNORE_ISISD) $(IGNORE_OSPF6D); ) + ( cd tests; $(PYTHON) ../$(srcdir)/tests/runtests.py --junitxml=tests.xml -v ../$(srcdir)/tests $(IGNORE_BGPD) $(IGNORE_ISISD) $(IGNORE_OSPFD) $(IGNORE_OSPF6D); ) check: tests/tests.xml clean-local: clean-tests diff --git a/tests/topotests/bgp_community_alias/r1/bgpd.conf b/tests/topotests/bgp_community_alias/r1/bgpd.conf index a6366204e8..13b57ad243 100644 --- a/tests/topotests/bgp_community_alias/r1/bgpd.conf +++ b/tests/topotests/bgp_community_alias/r1/bgpd.conf @@ -3,6 +3,8 @@ bgp community alias 65001:1 community-r2-1 bgp community alias 65002:2 community-r2-2 bgp community alias 65001:1:1 large-community-r2-1 ! +bgp large-community-list expanded r2 seq 5 permit _65001:1:1_ +! router bgp 65001 no bgp ebgp-requires-policy neighbor 192.168.1.2 remote-as external diff --git a/tests/topotests/bgp_community_alias/test_bgp-community-alias.py b/tests/topotests/bgp_community_alias/test_bgp-community-alias.py index 6aadff1cfa..26933a7992 100644 --- a/tests/topotests/bgp_community_alias/test_bgp-community-alias.py +++ b/tests/topotests/bgp_community_alias/test_bgp-community-alias.py @@ -138,6 +138,17 @@ def test_bgp_community_alias(): success, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5) assert result is None, "Cannot see BGP prefixes by community alias at r1" + def _bgp_show_prefixes_by_large_community_list(router): + output = json.loads( + router.vtysh_cmd("show bgp ipv4 unicast large-community-list r2 json") + ) + expected = {"routes": {"172.16.16.1/32": [{"valid": True}]}} + return topotest.json_cmp(output, expected) + + test_func = functools.partial(_bgp_show_prefixes_by_large_community_list, router) + success, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5) + assert result is None, "Cannot see BGP prefixes by large community list at r1" + if __name__ == "__main__": args = ["-s"] + sys.argv[1:] diff --git a/tests/topotests/bgp-evpn-overlay-index-gateway/PE1/bgp_vni_routes_base.json b/tests/topotests/bgp_evpn_overlay_index_gateway/PE1/bgp_vni_routes_base.json index 2eeebad4b0..2eeebad4b0 100644 --- a/tests/topotests/bgp-evpn-overlay-index-gateway/PE1/bgp_vni_routes_base.json +++ b/tests/topotests/bgp_evpn_overlay_index_gateway/PE1/bgp_vni_routes_base.json diff --git a/tests/topotests/bgp-evpn-overlay-index-gateway/PE1/bgp_vni_routes_no_rt2.json b/tests/topotests/bgp_evpn_overlay_index_gateway/PE1/bgp_vni_routes_no_rt2.json index 419bcc3dd9..419bcc3dd9 100644 --- a/tests/topotests/bgp-evpn-overlay-index-gateway/PE1/bgp_vni_routes_no_rt2.json +++ b/tests/topotests/bgp_evpn_overlay_index_gateway/PE1/bgp_vni_routes_no_rt2.json diff --git a/tests/topotests/bgp-evpn-overlay-index-gateway/PE1/bgp_vni_routes_no_rt5.json b/tests/topotests/bgp_evpn_overlay_index_gateway/PE1/bgp_vni_routes_no_rt5.json index 2eeebad4b0..2eeebad4b0 100644 --- a/tests/topotests/bgp-evpn-overlay-index-gateway/PE1/bgp_vni_routes_no_rt5.json +++ b/tests/topotests/bgp_evpn_overlay_index_gateway/PE1/bgp_vni_routes_no_rt5.json diff --git a/tests/topotests/bgp-evpn-overlay-index-gateway/PE1/bgp_vrf_ipv4_base.json b/tests/topotests/bgp_evpn_overlay_index_gateway/PE1/bgp_vrf_ipv4_base.json index 833f98657b..833f98657b 100644 --- a/tests/topotests/bgp-evpn-overlay-index-gateway/PE1/bgp_vrf_ipv4_base.json +++ b/tests/topotests/bgp_evpn_overlay_index_gateway/PE1/bgp_vrf_ipv4_base.json diff --git a/tests/topotests/bgp-evpn-overlay-index-gateway/PE1/bgp_vrf_ipv4_no_rt2.json b/tests/topotests/bgp_evpn_overlay_index_gateway/PE1/bgp_vrf_ipv4_no_rt2.json index 833f98657b..833f98657b 100644 --- a/tests/topotests/bgp-evpn-overlay-index-gateway/PE1/bgp_vrf_ipv4_no_rt2.json +++ b/tests/topotests/bgp_evpn_overlay_index_gateway/PE1/bgp_vrf_ipv4_no_rt2.json diff --git a/tests/topotests/bgp-evpn-overlay-index-gateway/PE1/bgp_vrf_ipv4_no_rt5.json b/tests/topotests/bgp_evpn_overlay_index_gateway/PE1/bgp_vrf_ipv4_no_rt5.json index 4a292bddbe..4a292bddbe 100644 --- a/tests/topotests/bgp-evpn-overlay-index-gateway/PE1/bgp_vrf_ipv4_no_rt5.json +++ b/tests/topotests/bgp_evpn_overlay_index_gateway/PE1/bgp_vrf_ipv4_no_rt5.json diff --git a/tests/topotests/bgp-evpn-overlay-index-gateway/PE1/bgp_vrf_ipv6_base.json b/tests/topotests/bgp_evpn_overlay_index_gateway/PE1/bgp_vrf_ipv6_base.json index 3dc3fcf9cb..3dc3fcf9cb 100644 --- a/tests/topotests/bgp-evpn-overlay-index-gateway/PE1/bgp_vrf_ipv6_base.json +++ b/tests/topotests/bgp_evpn_overlay_index_gateway/PE1/bgp_vrf_ipv6_base.json diff --git a/tests/topotests/bgp-evpn-overlay-index-gateway/PE1/bgp_vrf_ipv6_no_rt2.json b/tests/topotests/bgp_evpn_overlay_index_gateway/PE1/bgp_vrf_ipv6_no_rt2.json index 3dc3fcf9cb..3dc3fcf9cb 100644 --- a/tests/topotests/bgp-evpn-overlay-index-gateway/PE1/bgp_vrf_ipv6_no_rt2.json +++ b/tests/topotests/bgp_evpn_overlay_index_gateway/PE1/bgp_vrf_ipv6_no_rt2.json diff --git a/tests/topotests/bgp-evpn-overlay-index-gateway/PE1/bgp_vrf_ipv6_no_rt5.json b/tests/topotests/bgp_evpn_overlay_index_gateway/PE1/bgp_vrf_ipv6_no_rt5.json index 6c11d894eb..6c11d894eb 100644 --- a/tests/topotests/bgp-evpn-overlay-index-gateway/PE1/bgp_vrf_ipv6_no_rt5.json +++ b/tests/topotests/bgp_evpn_overlay_index_gateway/PE1/bgp_vrf_ipv6_no_rt5.json diff --git a/tests/topotests/bgp-evpn-overlay-index-gateway/PE1/bgpd.conf b/tests/topotests/bgp_evpn_overlay_index_gateway/PE1/bgpd.conf index 63aa99a832..63aa99a832 100644 --- a/tests/topotests/bgp-evpn-overlay-index-gateway/PE1/bgpd.conf +++ b/tests/topotests/bgp_evpn_overlay_index_gateway/PE1/bgpd.conf diff --git a/tests/topotests/bgp-evpn-overlay-index-gateway/PE1/zebra.conf b/tests/topotests/bgp_evpn_overlay_index_gateway/PE1/zebra.conf index 99a2e89ef3..99a2e89ef3 100644 --- a/tests/topotests/bgp-evpn-overlay-index-gateway/PE1/zebra.conf +++ b/tests/topotests/bgp_evpn_overlay_index_gateway/PE1/zebra.conf diff --git a/tests/topotests/bgp-evpn-overlay-index-gateway/PE1/zebra_vrf_ipv4_base.json b/tests/topotests/bgp_evpn_overlay_index_gateway/PE1/zebra_vrf_ipv4_base.json index 2dcf35d91b..2dcf35d91b 100644 --- a/tests/topotests/bgp-evpn-overlay-index-gateway/PE1/zebra_vrf_ipv4_base.json +++ b/tests/topotests/bgp_evpn_overlay_index_gateway/PE1/zebra_vrf_ipv4_base.json diff --git a/tests/topotests/bgp-evpn-overlay-index-gateway/PE1/zebra_vrf_ipv4_no_rt2.json b/tests/topotests/bgp_evpn_overlay_index_gateway/PE1/zebra_vrf_ipv4_no_rt2.json index 2dcf35d91b..2dcf35d91b 100644 --- a/tests/topotests/bgp-evpn-overlay-index-gateway/PE1/zebra_vrf_ipv4_no_rt2.json +++ b/tests/topotests/bgp_evpn_overlay_index_gateway/PE1/zebra_vrf_ipv4_no_rt2.json diff --git a/tests/topotests/bgp-evpn-overlay-index-gateway/PE1/zebra_vrf_ipv4_no_rt5.json b/tests/topotests/bgp_evpn_overlay_index_gateway/PE1/zebra_vrf_ipv4_no_rt5.json index 9c3091dc50..9c3091dc50 100644 --- a/tests/topotests/bgp-evpn-overlay-index-gateway/PE1/zebra_vrf_ipv4_no_rt5.json +++ b/tests/topotests/bgp_evpn_overlay_index_gateway/PE1/zebra_vrf_ipv4_no_rt5.json diff --git a/tests/topotests/bgp-evpn-overlay-index-gateway/PE1/zebra_vrf_ipv6_base.json b/tests/topotests/bgp_evpn_overlay_index_gateway/PE1/zebra_vrf_ipv6_base.json index 229c927656..229c927656 100644 --- a/tests/topotests/bgp-evpn-overlay-index-gateway/PE1/zebra_vrf_ipv6_base.json +++ b/tests/topotests/bgp_evpn_overlay_index_gateway/PE1/zebra_vrf_ipv6_base.json diff --git a/tests/topotests/bgp-evpn-overlay-index-gateway/PE1/zebra_vrf_ipv6_no_rt2.json b/tests/topotests/bgp_evpn_overlay_index_gateway/PE1/zebra_vrf_ipv6_no_rt2.json index 229c927656..229c927656 100644 --- a/tests/topotests/bgp-evpn-overlay-index-gateway/PE1/zebra_vrf_ipv6_no_rt2.json +++ b/tests/topotests/bgp_evpn_overlay_index_gateway/PE1/zebra_vrf_ipv6_no_rt2.json diff --git a/tests/topotests/bgp-evpn-overlay-index-gateway/PE1/zebra_vrf_ipv6_no_rt5.json b/tests/topotests/bgp_evpn_overlay_index_gateway/PE1/zebra_vrf_ipv6_no_rt5.json index 94f82e6d4c..94f82e6d4c 100644 --- a/tests/topotests/bgp-evpn-overlay-index-gateway/PE1/zebra_vrf_ipv6_no_rt5.json +++ b/tests/topotests/bgp_evpn_overlay_index_gateway/PE1/zebra_vrf_ipv6_no_rt5.json diff --git a/tests/topotests/bgp-evpn-overlay-index-gateway/PE2/bgp_vni_routes_base.json b/tests/topotests/bgp_evpn_overlay_index_gateway/PE2/bgp_vni_routes_base.json index 7b8d38e492..7b8d38e492 100644 --- a/tests/topotests/bgp-evpn-overlay-index-gateway/PE2/bgp_vni_routes_base.json +++ b/tests/topotests/bgp_evpn_overlay_index_gateway/PE2/bgp_vni_routes_base.json diff --git a/tests/topotests/bgp-evpn-overlay-index-gateway/PE2/bgp_vni_routes_no_rt2.json b/tests/topotests/bgp_evpn_overlay_index_gateway/PE2/bgp_vni_routes_no_rt2.json index 6273b3e728..6273b3e728 100644 --- a/tests/topotests/bgp-evpn-overlay-index-gateway/PE2/bgp_vni_routes_no_rt2.json +++ b/tests/topotests/bgp_evpn_overlay_index_gateway/PE2/bgp_vni_routes_no_rt2.json diff --git a/tests/topotests/bgp-evpn-overlay-index-gateway/PE2/bgp_vni_routes_no_rt5.json b/tests/topotests/bgp_evpn_overlay_index_gateway/PE2/bgp_vni_routes_no_rt5.json index 7b8d38e492..7b8d38e492 100644 --- a/tests/topotests/bgp-evpn-overlay-index-gateway/PE2/bgp_vni_routes_no_rt5.json +++ b/tests/topotests/bgp_evpn_overlay_index_gateway/PE2/bgp_vni_routes_no_rt5.json diff --git a/tests/topotests/bgp-evpn-overlay-index-gateway/PE2/bgp_vrf_ipv4_base.json b/tests/topotests/bgp_evpn_overlay_index_gateway/PE2/bgp_vrf_ipv4_base.json index c03d70195f..c03d70195f 100644 --- a/tests/topotests/bgp-evpn-overlay-index-gateway/PE2/bgp_vrf_ipv4_base.json +++ b/tests/topotests/bgp_evpn_overlay_index_gateway/PE2/bgp_vrf_ipv4_base.json diff --git a/tests/topotests/bgp-evpn-overlay-index-gateway/PE2/bgp_vrf_ipv4_no_rt2.json b/tests/topotests/bgp_evpn_overlay_index_gateway/PE2/bgp_vrf_ipv4_no_rt2.json index 7f1b8d2ef4..7f1b8d2ef4 100644 --- a/tests/topotests/bgp-evpn-overlay-index-gateway/PE2/bgp_vrf_ipv4_no_rt2.json +++ b/tests/topotests/bgp_evpn_overlay_index_gateway/PE2/bgp_vrf_ipv4_no_rt2.json diff --git a/tests/topotests/bgp-evpn-overlay-index-gateway/PE2/bgp_vrf_ipv4_no_rt5.json b/tests/topotests/bgp_evpn_overlay_index_gateway/PE2/bgp_vrf_ipv4_no_rt5.json index 52e4311635..52e4311635 100644 --- a/tests/topotests/bgp-evpn-overlay-index-gateway/PE2/bgp_vrf_ipv4_no_rt5.json +++ b/tests/topotests/bgp_evpn_overlay_index_gateway/PE2/bgp_vrf_ipv4_no_rt5.json diff --git a/tests/topotests/bgp-evpn-overlay-index-gateway/PE2/bgp_vrf_ipv6_base.json b/tests/topotests/bgp_evpn_overlay_index_gateway/PE2/bgp_vrf_ipv6_base.json index 1d90c9c798..1d90c9c798 100644 --- a/tests/topotests/bgp-evpn-overlay-index-gateway/PE2/bgp_vrf_ipv6_base.json +++ b/tests/topotests/bgp_evpn_overlay_index_gateway/PE2/bgp_vrf_ipv6_base.json diff --git a/tests/topotests/bgp-evpn-overlay-index-gateway/PE2/bgp_vrf_ipv6_no_rt2.json b/tests/topotests/bgp_evpn_overlay_index_gateway/PE2/bgp_vrf_ipv6_no_rt2.json index a0e63c6e25..a0e63c6e25 100644 --- a/tests/topotests/bgp-evpn-overlay-index-gateway/PE2/bgp_vrf_ipv6_no_rt2.json +++ b/tests/topotests/bgp_evpn_overlay_index_gateway/PE2/bgp_vrf_ipv6_no_rt2.json diff --git a/tests/topotests/bgp-evpn-overlay-index-gateway/PE2/bgp_vrf_ipv6_no_rt5.json b/tests/topotests/bgp_evpn_overlay_index_gateway/PE2/bgp_vrf_ipv6_no_rt5.json index 789fe69b28..789fe69b28 100644 --- a/tests/topotests/bgp-evpn-overlay-index-gateway/PE2/bgp_vrf_ipv6_no_rt5.json +++ b/tests/topotests/bgp_evpn_overlay_index_gateway/PE2/bgp_vrf_ipv6_no_rt5.json diff --git a/tests/topotests/bgp-evpn-overlay-index-gateway/PE2/bgpd.conf b/tests/topotests/bgp_evpn_overlay_index_gateway/PE2/bgpd.conf index 59fee15dfc..59fee15dfc 100644 --- a/tests/topotests/bgp-evpn-overlay-index-gateway/PE2/bgpd.conf +++ b/tests/topotests/bgp_evpn_overlay_index_gateway/PE2/bgpd.conf diff --git a/tests/topotests/bgp-evpn-overlay-index-gateway/PE2/zebra.conf b/tests/topotests/bgp_evpn_overlay_index_gateway/PE2/zebra.conf index b78cdcc512..b78cdcc512 100644 --- a/tests/topotests/bgp-evpn-overlay-index-gateway/PE2/zebra.conf +++ b/tests/topotests/bgp_evpn_overlay_index_gateway/PE2/zebra.conf diff --git a/tests/topotests/bgp-evpn-overlay-index-gateway/PE2/zebra_vrf_ipv4_base.json b/tests/topotests/bgp_evpn_overlay_index_gateway/PE2/zebra_vrf_ipv4_base.json index b3a3640be4..b3a3640be4 100644 --- a/tests/topotests/bgp-evpn-overlay-index-gateway/PE2/zebra_vrf_ipv4_base.json +++ b/tests/topotests/bgp_evpn_overlay_index_gateway/PE2/zebra_vrf_ipv4_base.json diff --git a/tests/topotests/bgp-evpn-overlay-index-gateway/PE2/zebra_vrf_ipv4_no_rt2.json b/tests/topotests/bgp_evpn_overlay_index_gateway/PE2/zebra_vrf_ipv4_no_rt2.json index 996fe52f44..996fe52f44 100644 --- a/tests/topotests/bgp-evpn-overlay-index-gateway/PE2/zebra_vrf_ipv4_no_rt2.json +++ b/tests/topotests/bgp_evpn_overlay_index_gateway/PE2/zebra_vrf_ipv4_no_rt2.json diff --git a/tests/topotests/bgp-evpn-overlay-index-gateway/PE2/zebra_vrf_ipv4_no_rt5.json b/tests/topotests/bgp_evpn_overlay_index_gateway/PE2/zebra_vrf_ipv4_no_rt5.json index 996fe52f44..996fe52f44 100644 --- a/tests/topotests/bgp-evpn-overlay-index-gateway/PE2/zebra_vrf_ipv4_no_rt5.json +++ b/tests/topotests/bgp_evpn_overlay_index_gateway/PE2/zebra_vrf_ipv4_no_rt5.json diff --git a/tests/topotests/bgp-evpn-overlay-index-gateway/PE2/zebra_vrf_ipv6_base.json b/tests/topotests/bgp_evpn_overlay_index_gateway/PE2/zebra_vrf_ipv6_base.json index d5be22a2ba..d5be22a2ba 100644 --- a/tests/topotests/bgp-evpn-overlay-index-gateway/PE2/zebra_vrf_ipv6_base.json +++ b/tests/topotests/bgp_evpn_overlay_index_gateway/PE2/zebra_vrf_ipv6_base.json diff --git a/tests/topotests/bgp-evpn-overlay-index-gateway/PE2/zebra_vrf_ipv6_no_rt2.json b/tests/topotests/bgp_evpn_overlay_index_gateway/PE2/zebra_vrf_ipv6_no_rt2.json index 94f82e6d4c..94f82e6d4c 100644 --- a/tests/topotests/bgp-evpn-overlay-index-gateway/PE2/zebra_vrf_ipv6_no_rt2.json +++ b/tests/topotests/bgp_evpn_overlay_index_gateway/PE2/zebra_vrf_ipv6_no_rt2.json diff --git a/tests/topotests/bgp-evpn-overlay-index-gateway/PE2/zebra_vrf_ipv6_no_rt5.json b/tests/topotests/bgp_evpn_overlay_index_gateway/PE2/zebra_vrf_ipv6_no_rt5.json index 94f82e6d4c..94f82e6d4c 100644 --- a/tests/topotests/bgp-evpn-overlay-index-gateway/PE2/zebra_vrf_ipv6_no_rt5.json +++ b/tests/topotests/bgp_evpn_overlay_index_gateway/PE2/zebra_vrf_ipv6_no_rt5.json diff --git a/tests/topotests/bgp-evpn-overlay-index-gateway/__init__.py b/tests/topotests/bgp_evpn_overlay_index_gateway/__init__.py index e69de29bb2..e69de29bb2 100644 --- a/tests/topotests/bgp-evpn-overlay-index-gateway/__init__.py +++ b/tests/topotests/bgp_evpn_overlay_index_gateway/__init__.py diff --git a/tests/topotests/bgp-evpn-overlay-index-gateway/host1/bgpd.conf b/tests/topotests/bgp_evpn_overlay_index_gateway/host1/bgpd.conf index 7608ec95c3..7608ec95c3 100644 --- a/tests/topotests/bgp-evpn-overlay-index-gateway/host1/bgpd.conf +++ b/tests/topotests/bgp_evpn_overlay_index_gateway/host1/bgpd.conf diff --git a/tests/topotests/bgp-evpn-overlay-index-gateway/host1/zebra.conf b/tests/topotests/bgp_evpn_overlay_index_gateway/host1/zebra.conf index c8c832e9d8..c8c832e9d8 100644 --- a/tests/topotests/bgp-evpn-overlay-index-gateway/host1/zebra.conf +++ b/tests/topotests/bgp_evpn_overlay_index_gateway/host1/zebra.conf diff --git a/tests/topotests/bgp-evpn-overlay-index-gateway/host2/bgpd.conf b/tests/topotests/bgp_evpn_overlay_index_gateway/host2/bgpd.conf index cdf4cb4feb..cdf4cb4feb 100644 --- a/tests/topotests/bgp-evpn-overlay-index-gateway/host2/bgpd.conf +++ b/tests/topotests/bgp_evpn_overlay_index_gateway/host2/bgpd.conf diff --git a/tests/topotests/bgp-evpn-overlay-index-gateway/host2/zebra.conf b/tests/topotests/bgp_evpn_overlay_index_gateway/host2/zebra.conf index 9135545c58..9135545c58 100644 --- a/tests/topotests/bgp-evpn-overlay-index-gateway/host2/zebra.conf +++ b/tests/topotests/bgp_evpn_overlay_index_gateway/host2/zebra.conf diff --git a/tests/topotests/bgp-evpn-overlay-index-gateway/test_bgp_evpn_overlay_index_gateway.py b/tests/topotests/bgp_evpn_overlay_index_gateway/test_bgp_evpn_overlay_index_gateway.py index a411f13d2e..a411f13d2e 100755 --- a/tests/topotests/bgp-evpn-overlay-index-gateway/test_bgp_evpn_overlay_index_gateway.py +++ b/tests/topotests/bgp_evpn_overlay_index_gateway/test_bgp_evpn_overlay_index_gateway.py diff --git a/tests/topotests/ospf-sr-te-topo1/dst/zebra.conf b/tests/topotests/ospf_sr_te_topo1/dst/zebra.conf index 4cb50fdb27..4cb50fdb27 100644 --- a/tests/topotests/ospf-sr-te-topo1/dst/zebra.conf +++ b/tests/topotests/ospf_sr_te_topo1/dst/zebra.conf diff --git a/tests/topotests/ospf-sr-te-topo1/rt1/bgpd.conf b/tests/topotests/ospf_sr_te_topo1/rt1/bgpd.conf index efc03701b5..efc03701b5 100644 --- a/tests/topotests/ospf-sr-te-topo1/rt1/bgpd.conf +++ b/tests/topotests/ospf_sr_te_topo1/rt1/bgpd.conf diff --git a/tests/topotests/ospf-sr-te-topo1/rt1/ospfd.conf b/tests/topotests/ospf_sr_te_topo1/rt1/ospfd.conf index 225ac93528..225ac93528 100644 --- a/tests/topotests/ospf-sr-te-topo1/rt1/ospfd.conf +++ b/tests/topotests/ospf_sr_te_topo1/rt1/ospfd.conf diff --git a/tests/topotests/ospf-sr-te-topo1/rt1/pathd.conf b/tests/topotests/ospf_sr_te_topo1/rt1/pathd.conf index 55d5857f5d..55d5857f5d 100644 --- a/tests/topotests/ospf-sr-te-topo1/rt1/pathd.conf +++ b/tests/topotests/ospf_sr_te_topo1/rt1/pathd.conf diff --git a/tests/topotests/ospf-sr-te-topo1/rt1/step2/show_operational_data.ref b/tests/topotests/ospf_sr_te_topo1/rt1/step2/show_operational_data.ref index 4ef8d946f2..4ef8d946f2 100644 --- a/tests/topotests/ospf-sr-te-topo1/rt1/step2/show_operational_data.ref +++ b/tests/topotests/ospf_sr_te_topo1/rt1/step2/show_operational_data.ref diff --git a/tests/topotests/ospf-sr-te-topo1/rt1/step2/show_operational_data_with_candidate.ref b/tests/topotests/ospf_sr_te_topo1/rt1/step2/show_operational_data_with_candidate.ref index 9b28f6a42b..9b28f6a42b 100644 --- a/tests/topotests/ospf-sr-te-topo1/rt1/step2/show_operational_data_with_candidate.ref +++ b/tests/topotests/ospf_sr_te_topo1/rt1/step2/show_operational_data_with_candidate.ref diff --git a/tests/topotests/ospf-sr-te-topo1/rt1/step3/show_operational_data_with_single_candidate.ref b/tests/topotests/ospf_sr_te_topo1/rt1/step3/show_operational_data_with_single_candidate.ref index 9b28f6a42b..9b28f6a42b 100644 --- a/tests/topotests/ospf-sr-te-topo1/rt1/step3/show_operational_data_with_single_candidate.ref +++ b/tests/topotests/ospf_sr_te_topo1/rt1/step3/show_operational_data_with_single_candidate.ref diff --git a/tests/topotests/ospf-sr-te-topo1/rt1/step3/show_operational_data_with_two_candidates.ref b/tests/topotests/ospf_sr_te_topo1/rt1/step3/show_operational_data_with_two_candidates.ref index 249117198a..249117198a 100644 --- a/tests/topotests/ospf-sr-te-topo1/rt1/step3/show_operational_data_with_two_candidates.ref +++ b/tests/topotests/ospf_sr_te_topo1/rt1/step3/show_operational_data_with_two_candidates.ref diff --git a/tests/topotests/ospf-sr-te-topo1/rt1/zebra.conf b/tests/topotests/ospf_sr_te_topo1/rt1/zebra.conf index dd686ea3da..dd686ea3da 100644 --- a/tests/topotests/ospf-sr-te-topo1/rt1/zebra.conf +++ b/tests/topotests/ospf_sr_te_topo1/rt1/zebra.conf diff --git a/tests/topotests/ospf-sr-te-topo1/rt2/ospfd.conf b/tests/topotests/ospf_sr_te_topo1/rt2/ospfd.conf index f6a7bbb621..f6a7bbb621 100644 --- a/tests/topotests/ospf-sr-te-topo1/rt2/ospfd.conf +++ b/tests/topotests/ospf_sr_te_topo1/rt2/ospfd.conf diff --git a/tests/topotests/ospf-sr-te-topo1/rt2/zebra.conf b/tests/topotests/ospf_sr_te_topo1/rt2/zebra.conf index ddd50ba520..ddd50ba520 100644 --- a/tests/topotests/ospf-sr-te-topo1/rt2/zebra.conf +++ b/tests/topotests/ospf_sr_te_topo1/rt2/zebra.conf diff --git a/tests/topotests/ospf-sr-te-topo1/rt3/ospfd.conf b/tests/topotests/ospf_sr_te_topo1/rt3/ospfd.conf index 5f71cd8484..5f71cd8484 100644 --- a/tests/topotests/ospf-sr-te-topo1/rt3/ospfd.conf +++ b/tests/topotests/ospf_sr_te_topo1/rt3/ospfd.conf diff --git a/tests/topotests/ospf-sr-te-topo1/rt3/zebra.conf b/tests/topotests/ospf_sr_te_topo1/rt3/zebra.conf index 0825b5c8bf..0825b5c8bf 100644 --- a/tests/topotests/ospf-sr-te-topo1/rt3/zebra.conf +++ b/tests/topotests/ospf_sr_te_topo1/rt3/zebra.conf diff --git a/tests/topotests/ospf-sr-te-topo1/rt4/ospfd.conf b/tests/topotests/ospf_sr_te_topo1/rt4/ospfd.conf index d4862cd233..d4862cd233 100644 --- a/tests/topotests/ospf-sr-te-topo1/rt4/ospfd.conf +++ b/tests/topotests/ospf_sr_te_topo1/rt4/ospfd.conf diff --git a/tests/topotests/ospf-sr-te-topo1/rt4/zebra.conf b/tests/topotests/ospf_sr_te_topo1/rt4/zebra.conf index c6d1f4f40e..c6d1f4f40e 100644 --- a/tests/topotests/ospf-sr-te-topo1/rt4/zebra.conf +++ b/tests/topotests/ospf_sr_te_topo1/rt4/zebra.conf diff --git a/tests/topotests/ospf-sr-te-topo1/rt5/ospfd.conf b/tests/topotests/ospf_sr_te_topo1/rt5/ospfd.conf index fdc0dcfdb7..fdc0dcfdb7 100644 --- a/tests/topotests/ospf-sr-te-topo1/rt5/ospfd.conf +++ b/tests/topotests/ospf_sr_te_topo1/rt5/ospfd.conf diff --git a/tests/topotests/ospf-sr-te-topo1/rt5/zebra.conf b/tests/topotests/ospf_sr_te_topo1/rt5/zebra.conf index 96b732d398..96b732d398 100644 --- a/tests/topotests/ospf-sr-te-topo1/rt5/zebra.conf +++ b/tests/topotests/ospf_sr_te_topo1/rt5/zebra.conf diff --git a/tests/topotests/ospf-sr-te-topo1/rt6/bgpd.conf b/tests/topotests/ospf_sr_te_topo1/rt6/bgpd.conf index e72ee52fce..e72ee52fce 100644 --- a/tests/topotests/ospf-sr-te-topo1/rt6/bgpd.conf +++ b/tests/topotests/ospf_sr_te_topo1/rt6/bgpd.conf diff --git a/tests/topotests/ospf-sr-te-topo1/rt6/ospfd.conf b/tests/topotests/ospf_sr_te_topo1/rt6/ospfd.conf index c06565be0b..c06565be0b 100644 --- a/tests/topotests/ospf-sr-te-topo1/rt6/ospfd.conf +++ b/tests/topotests/ospf_sr_te_topo1/rt6/ospfd.conf diff --git a/tests/topotests/ospf-sr-te-topo1/rt6/pathd.conf b/tests/topotests/ospf_sr_te_topo1/rt6/pathd.conf index 696df2214b..696df2214b 100644 --- a/tests/topotests/ospf-sr-te-topo1/rt6/pathd.conf +++ b/tests/topotests/ospf_sr_te_topo1/rt6/pathd.conf diff --git a/tests/topotests/ospf-sr-te-topo1/rt6/step2/show_operational_data.ref b/tests/topotests/ospf_sr_te_topo1/rt6/step2/show_operational_data.ref index 241c80bdd7..241c80bdd7 100644 --- a/tests/topotests/ospf-sr-te-topo1/rt6/step2/show_operational_data.ref +++ b/tests/topotests/ospf_sr_te_topo1/rt6/step2/show_operational_data.ref diff --git a/tests/topotests/ospf-sr-te-topo1/rt6/step2/show_operational_data_with_candidate.ref b/tests/topotests/ospf_sr_te_topo1/rt6/step2/show_operational_data_with_candidate.ref index 20ea69e386..20ea69e386 100644 --- a/tests/topotests/ospf-sr-te-topo1/rt6/step2/show_operational_data_with_candidate.ref +++ b/tests/topotests/ospf_sr_te_topo1/rt6/step2/show_operational_data_with_candidate.ref diff --git a/tests/topotests/ospf-sr-te-topo1/rt6/step3/show_operational_data_with_single_candidate.ref b/tests/topotests/ospf_sr_te_topo1/rt6/step3/show_operational_data_with_single_candidate.ref index 20ea69e386..20ea69e386 100644 --- a/tests/topotests/ospf-sr-te-topo1/rt6/step3/show_operational_data_with_single_candidate.ref +++ b/tests/topotests/ospf_sr_te_topo1/rt6/step3/show_operational_data_with_single_candidate.ref diff --git a/tests/topotests/ospf-sr-te-topo1/rt6/step3/show_operational_data_with_two_candidates.ref b/tests/topotests/ospf_sr_te_topo1/rt6/step3/show_operational_data_with_two_candidates.ref index 10cafe9091..10cafe9091 100644 --- a/tests/topotests/ospf-sr-te-topo1/rt6/step3/show_operational_data_with_two_candidates.ref +++ b/tests/topotests/ospf_sr_te_topo1/rt6/step3/show_operational_data_with_two_candidates.ref diff --git a/tests/topotests/ospf-sr-te-topo1/rt6/zebra.conf b/tests/topotests/ospf_sr_te_topo1/rt6/zebra.conf index 360837c4ca..360837c4ca 100644 --- a/tests/topotests/ospf-sr-te-topo1/rt6/zebra.conf +++ b/tests/topotests/ospf_sr_te_topo1/rt6/zebra.conf diff --git a/tests/topotests/ospf-sr-te-topo1/test_ospf_sr_te_topo1.py b/tests/topotests/ospf_sr_te_topo1/test_ospf_sr_te_topo1.py index 6c1122ab72..6c1122ab72 100755 --- a/tests/topotests/ospf-sr-te-topo1/test_ospf_sr_te_topo1.py +++ b/tests/topotests/ospf_sr_te_topo1/test_ospf_sr_te_topo1.py diff --git a/tools/etc/frr/support_bundle_commands.conf b/tools/etc/frr/support_bundle_commands.conf index 732470f828..750fa6b39f 100644 --- a/tools/etc/frr/support_bundle_commands.conf +++ b/tools/etc/frr/support_bundle_commands.conf @@ -83,9 +83,35 @@ show version CMD_LIST_END # OSPF Support Bundle Command List -# PROC_NAME:ospf -# CMD_LIST_START -# CMD_LIST_END +PROC_NAME:ospf +CMD_LIST_START +show ip ospf +show ip ospf vrfs +show ip ospf vrf all +show ip ospf vrf all interface +show ip ospf vrf all neighbor +show ip ospf vrf all neighbor detail +show ip ospf vrf all database +show ip ospf vrf all database router +show ip ospf vrf all database network +show ip ospf vrf all database summary +show ip ospf vrf all database asbr-summary +show ip ospf vrf all database external +show ip ospf vrf all database opaque-area +show ip ospf vrf all database opaque-as +show ip ospf vrf all database opaque-link +show ip ospf vrf all database nssa-external +show ip ospf vrf all database max-age +show ip ospf vrf all database self-originate +show ip ospf vrf all route +show ip ospf vrf all mpls-te interface +show ip ospf vrf all interface traffic +show ip ospf mpls-te router +show ip ospf router-info +show ip ospf router-info pce +show ip ospf database segment-routing +show debugging +CMD_LIST_END # RIP Support Bundle Command List # PROC_NAME:rip @@ -130,3 +156,43 @@ show ip pim state show ip pim statistics show ip pim rpf CMD_LIST_END + +# OSPFv3 Support Bundle Command List +PROC_NAME:ospf6 +CMD_LIST_START +show ipv6 ospf6 vrf all +show ipv6 ospf6 vrfs +show ipv6 ospf6 vrf all border-routers +show ipv6 ospf6 vrf all border-routers detail +show ipv6 ospf6 vrf all database +show ipv6 ospf6 vrf all database detail +show ipv6 ospf6 vrf all database dump +show ipv6 ospf6 vrf all database internal +show ipv6 ospf6 vrf all database router detail +show ipv6 ospf6 vrf all database network detail +show ipv6 ospf6 vrf all database inter-prefix detail +show ipv6 ospf6 vrf all database inter-router detail +show ipv6 ospf6 vrf all database intra-prefix detail +show ipv6 ospf6 vrf all database link detail +show ipv6 ospf6 vrf all database as-external detail +show ipv6 ospf6 vrf all database self-originate detail +show ipv6 ospf6 vrf all database type-7 detail +show ipv6 ospf6 vrf all interface +show ipv6 ospf6 vrf all interface prefix +show ipv6 ospf6 vrf all interface traffic +show ipv6 ospf6 vrf all linkstate detail +show ipv6 ospf6 vrf all neighbor +show ipv6 ospf6 vrf all neighbor drchoice +show ipv6 ospf6 vrf all neighbor detail +show ipv6 ospf6 vrf all redistribute +show ipv6 ospf6 vrf all route +show ipv6 ospf6 vrf all route external-1 +show ipv6 ospf6 vrf all route external-2 +show ipv6 ospf6 vrf all route inter-area +show ipv6 ospf6 vrf all route intra-area +show ipv6 ospf6 vrf all route detail +show ipv6 ospf6 vrf all route summary +show ipv6 ospf6 vrf all spf tree +show ipv6 ospf6 vrf all summary-address detail +show ipv6 ospf6 zebra +CMD_LIST_END diff --git a/tools/releasedate.py b/tools/releasedate.py new file mode 100644 index 0000000000..37780501c3 --- /dev/null +++ b/tools/releasedate.py @@ -0,0 +1,59 @@ +#!/usr/bin/python3 +# +# print FRR release schedule dates + +from datetime import datetime, date, timedelta + +w2 = timedelta(days=14) + + +def year_gen(year): + for month in [3, 7, 11]: + d = date(year, month, 1) + if d.weekday() == 0: + d += timedelta(days=1) + elif d.weekday() >= 2: + d += timedelta(days=8 - d.weekday()) + yield d + + +def calc(refdate): + year = refdate.year + + prev = list(year_gen(year - 1))[-1] + releases = list(year_gen(year)) + list(year_gen(year + 1)) + + while refdate > releases[0]: + prev = releases.pop(0) + + return (prev, releases) + + +if __name__ == "__main__": + now = datetime.now().date() + last, upcoming = calc(now) + + print("Last release was (scheduled) on %s" % last.isoformat()) + + rel = upcoming.pop(0) + freeze, rc1, rc2 = rel - w2 * 3, rel - w2 * 2, rel - w2 + + if now == rel: + print("It's release day! 🎉") + elif now >= rc2: + print( + "%d days until release! (rc2 since %s)" + % ((rel - now).days, rc2.isoformat()) + ) + elif now >= rc1: + print("%d days until rc2. (rc1 since %s)" % ((rc2 - now).days, rc1.isoformat())) + elif now >= freeze: + print( + "%d days until rc1, master is frozen since %s" + % ((rc1 - now).days, freeze.isoformat()) + ) + else: + print( + "%d days of hacking time left! (Freeze on %s)" + % ((freeze - now).days, freeze.isoformat()) + ) diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c index 5cee0aaa3f..4d8b6062ac 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -1691,7 +1691,7 @@ DEFUNSH(VTYSH_REALLYALL, vtysh_end_all, vtysh_end_all_cmd, "end", return vtysh_end(); } -DEFUNSH(VTYSH_SR, srv6, srv6_cmd, +DEFUNSH(VTYSH_ZEBRA, srv6, srv6_cmd, "srv6", "Segment-Routing SRv6 configration\n") { @@ -1699,7 +1699,7 @@ DEFUNSH(VTYSH_SR, srv6, srv6_cmd, return CMD_SUCCESS; } -DEFUNSH(VTYSH_SR, srv6_locators, srv6_locators_cmd, +DEFUNSH(VTYSH_ZEBRA, srv6_locators, srv6_locators_cmd, "locators", "Segment-Routing SRv6 locators configration\n") { @@ -1707,7 +1707,7 @@ DEFUNSH(VTYSH_SR, srv6_locators, srv6_locators_cmd, return CMD_SUCCESS; } -DEFUNSH(VTYSH_SR, srv6_locator, srv6_locator_cmd, +DEFUNSH(VTYSH_ZEBRA, srv6_locator, srv6_locator_cmd, "locator WORD", "Segment Routing SRv6 locator\n" "Specify locator-name\n") @@ -2456,7 +2456,7 @@ DEFUNSH(VTYSH_VRF, exit_vrf_config, exit_vrf_config_cmd, "exit-vrf", return CMD_SUCCESS; } -DEFUNSH(VTYSH_SR, exit_srv6_config, exit_srv6_config_cmd, "exit", +DEFUNSH(VTYSH_ZEBRA, exit_srv6_config, exit_srv6_config_cmd, "exit", "Exit from SRv6 configuration mode\n") { if (vty->node == SRV6_NODE) @@ -2464,7 +2464,7 @@ DEFUNSH(VTYSH_SR, exit_srv6_config, exit_srv6_config_cmd, "exit", return CMD_SUCCESS; } -DEFUNSH(VTYSH_SR, exit_srv6_locs_config, exit_srv6_locs_config_cmd, "exit", +DEFUNSH(VTYSH_ZEBRA, exit_srv6_locs_config, exit_srv6_locs_config_cmd, "exit", "Exit from SRv6-locator configuration mode\n") { if (vty->node == SRV6_LOCS_NODE) @@ -2472,7 +2472,7 @@ DEFUNSH(VTYSH_SR, exit_srv6_locs_config, exit_srv6_locs_config_cmd, "exit", return CMD_SUCCESS; } -DEFUNSH(VTYSH_SR, exit_srv6_loc_config, exit_srv6_loc_config_cmd, "exit", +DEFUNSH(VTYSH_ZEBRA, exit_srv6_loc_config, exit_srv6_loc_config_cmd, "exit", "Exit from SRv6-locators configuration mode\n") { if (vty->node == SRV6_LOC_NODE) diff --git a/zebra/debug.c b/zebra/debug.c index 88a3d98815..525180d4ee 100644 --- a/zebra/debug.c +++ b/zebra/debug.c @@ -244,6 +244,7 @@ DEFUN (debug_zebra_kernel, return CMD_SUCCESS; } +#if defined(HAVE_NETLINK) DEFUN (debug_zebra_kernel_msgdump, debug_zebra_kernel_msgdump_cmd, "debug zebra kernel msgdump [<recv|send>]", @@ -267,6 +268,7 @@ DEFUN (debug_zebra_kernel_msgdump, return CMD_SUCCESS; } +#endif DEFUN (debug_zebra_rib, debug_zebra_rib_cmd, @@ -465,6 +467,7 @@ DEFUN (no_debug_zebra_kernel, return CMD_SUCCESS; } +#if defined(HAVE_NETLINK) DEFUN (no_debug_zebra_kernel_msgdump, no_debug_zebra_kernel_msgdump_cmd, "no debug zebra kernel msgdump [<recv|send>]", @@ -489,6 +492,7 @@ DEFUN (no_debug_zebra_kernel_msgdump, return CMD_SUCCESS; } +#endif DEFUN (no_debug_zebra_rib, no_debug_zebra_rib_cmd, @@ -721,7 +725,9 @@ void zebra_debug_init(void) install_element(ENABLE_NODE, &debug_zebra_pw_cmd); install_element(ENABLE_NODE, &debug_zebra_packet_cmd); install_element(ENABLE_NODE, &debug_zebra_kernel_cmd); +#if defined(HAVE_NETLINK) install_element(ENABLE_NODE, &debug_zebra_kernel_msgdump_cmd); +#endif install_element(ENABLE_NODE, &debug_zebra_rib_cmd); install_element(ENABLE_NODE, &debug_zebra_fpm_cmd); install_element(ENABLE_NODE, &debug_zebra_dplane_cmd); @@ -734,7 +740,9 @@ void zebra_debug_init(void) install_element(ENABLE_NODE, &no_debug_zebra_vxlan_cmd); install_element(ENABLE_NODE, &no_debug_zebra_packet_cmd); install_element(ENABLE_NODE, &no_debug_zebra_kernel_cmd); +#if defined(HAVE_NETLINK) install_element(ENABLE_NODE, &no_debug_zebra_kernel_msgdump_cmd); +#endif install_element(ENABLE_NODE, &no_debug_zebra_rib_cmd); install_element(ENABLE_NODE, &no_debug_zebra_fpm_cmd); install_element(ENABLE_NODE, &no_debug_zebra_dplane_cmd); @@ -748,7 +756,9 @@ void zebra_debug_init(void) install_element(CONFIG_NODE, &debug_zebra_pw_cmd); install_element(CONFIG_NODE, &debug_zebra_packet_cmd); install_element(CONFIG_NODE, &debug_zebra_kernel_cmd); +#if defined(HAVE_NETLINK) install_element(CONFIG_NODE, &debug_zebra_kernel_msgdump_cmd); +#endif install_element(CONFIG_NODE, &debug_zebra_rib_cmd); install_element(CONFIG_NODE, &debug_zebra_fpm_cmd); install_element(CONFIG_NODE, &debug_zebra_dplane_cmd); @@ -761,7 +771,9 @@ void zebra_debug_init(void) install_element(CONFIG_NODE, &no_debug_zebra_vxlan_cmd); install_element(CONFIG_NODE, &no_debug_zebra_packet_cmd); install_element(CONFIG_NODE, &no_debug_zebra_kernel_cmd); +#if defined(HAVE_NETLINK) install_element(CONFIG_NODE, &no_debug_zebra_kernel_msgdump_cmd); +#endif install_element(CONFIG_NODE, &no_debug_zebra_rib_cmd); install_element(CONFIG_NODE, &no_debug_zebra_fpm_cmd); install_element(CONFIG_NODE, &no_debug_zebra_dplane_cmd); diff --git a/zebra/if_netlink.c b/zebra/if_netlink.c index a51e0b82cb..2a9fff2666 100644 --- a/zebra/if_netlink.c +++ b/zebra/if_netlink.c @@ -1527,6 +1527,14 @@ int netlink_link_change(struct nlmsghdr *h, ns_id_t ns_id, int startup) return -1; name = (char *)RTA_DATA(tb[IFLA_IFNAME]); + /* Must be valid string. */ + len = RTA_PAYLOAD(tb[IFLA_IFNAME]); + if (len < 2 || name[len - 1] != '\0') { + if (IS_ZEBRA_DEBUG_KERNEL) + zlog_debug("%s: invalid intf name", __func__); + return -1; + } + if (tb[IFLA_LINKINFO]) { netlink_parse_rtattr_nested(linkinfo, IFLA_INFO_MAX, tb[IFLA_LINKINFO]); diff --git a/zebra/rib.h b/zebra/rib.h index 31d9dfd265..8887053a4c 100644 --- a/zebra/rib.h +++ b/zebra/rib.h @@ -371,9 +371,6 @@ extern void _route_entry_dump(const char *func, union prefixconstptr pp, union prefixconstptr src_pp, const struct route_entry *re); -extern void rib_lookup_and_dump(struct prefix_ipv4 *p, vrf_id_t vrf_id); -extern void rib_lookup_and_pushup(struct prefix_ipv4 *p, vrf_id_t vrf_id); - #define ZEBRA_RIB_LOOKUP_ERROR -1 #define ZEBRA_RIB_FOUND_EXACT 0 #define ZEBRA_RIB_FOUND_NOGATE 1 @@ -403,6 +400,11 @@ extern int rib_add(afi_t afi, safi_t safi, vrf_id_t vrf_id, int type, extern int rib_add_multipath(afi_t afi, safi_t safi, struct prefix *p, struct prefix_ipv6 *src_p, struct route_entry *re, struct nexthop_group *ng); +/* + * -1 -> some sort of error + * 0 -> an add + * 1 -> an update + */ extern int rib_add_multipath_nhe(afi_t afi, safi_t safi, struct prefix *p, struct prefix_ipv6 *src_p, struct route_entry *re, diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c index a64ec52dda..48ccf91ec7 100644 --- a/zebra/rt_netlink.c +++ b/zebra/rt_netlink.c @@ -861,6 +861,12 @@ static int netlink_route_change_read_unicast(struct nlmsghdr *h, ns_id_t ns_id, } memcpy(&src_p.prefix, src, 16); src_p.prefixlen = rtm->rtm_src_len; + } else { + /* We only handle the AFs we handle... */ + if (IS_ZEBRA_DEBUG_KERNEL) + zlog_debug("%s: unknown address-family %u", __func__, + rtm->rtm_family); + return 0; } /* diff --git a/zebra/zapi_msg.c b/zebra/zapi_msg.c index 27fb5d7c22..66208bfd80 100644 --- a/zebra/zapi_msg.c +++ b/zebra/zapi_msg.c @@ -1937,6 +1937,11 @@ static void zread_nhg_add(ZAPI_HANDLER_ARGS) flog_warn(EC_ZEBRA_NEXTHOP_CREATION_FAILED, "%s: Nexthop Group Creation failed", __func__); + + /* Free any local allocations */ + nexthop_group_delete(&nhg); + zebra_nhg_backup_free(&bnhg); + return; } @@ -2110,6 +2115,15 @@ static void zread_route_add(ZAPI_HANDLER_ARGS) ret = rib_add_multipath_nhe(afi, api.safi, &api.prefix, src_p, re, &nhe); + /* + * rib_add_multipath_nhe only fails in a couple spots + * and in those spots we have not freed memory + */ + if (ret == -1) { + client->error_cnt++; + XFREE(MTYPE_RE, re); + } + /* At this point, these allocations are not needed: 're' has been * retained or freed, and if 're' still exists, it is using * a reference to a shared group object. @@ -2121,15 +2135,15 @@ static void zread_route_add(ZAPI_HANDLER_ARGS) /* Stats */ switch (api.prefix.family) { case AF_INET: - if (ret > 0) + if (ret == 0) client->v4_route_add_cnt++; - else if (ret < 0) + else if (ret == 1) client->v4_route_upd8_cnt++; break; case AF_INET6: - if (ret > 0) + if (ret == 0) client->v6_route_add_cnt++; - else if (ret < 0) + else if (ret == 1) client->v6_route_upd8_cnt++; break; } diff --git a/zebra/zebra_dplane.c b/zebra/zebra_dplane.c index 0760b2ebb3..a547a97c24 100644 --- a/zebra/zebra_dplane.c +++ b/zebra/zebra_dplane.c @@ -3495,18 +3495,6 @@ enum zebra_dplane_result dplane_intf_addr_set(const struct interface *ifp, return ZEBRA_DPLANE_REQUEST_FAILURE; } - - /* Ensure that no existing installed v4 route conflicts with - * the new interface prefix. This check must be done in the - * zebra pthread context, and any route delete (if needed) - * is enqueued before the interface address programming attempt. - */ - if (ifc->address->family == AF_INET) { - struct prefix_ipv4 *p; - - p = (struct prefix_ipv4 *)ifc->address; - rib_lookup_and_pushup(p, ifp->vrf_id); - } #endif return intf_addr_update_internal(ifp, ifc, DPLANE_OP_ADDR_INSTALL); diff --git a/zebra/zebra_evpn_mh.c b/zebra/zebra_evpn_mh.c index f44b19b781..c0cc57fc69 100644 --- a/zebra/zebra_evpn_mh.c +++ b/zebra/zebra_evpn_mh.c @@ -3920,8 +3920,18 @@ void zebra_evpn_proc_remote_nh(ZAPI_HANDLER_ARGS) struct ipaddr nh; struct ethaddr rmac; struct prefix_evpn dummy_prefix; + size_t min_len = 4 + sizeof(nh); s = msg; + + /* + * Ensure that the stream sent to us is long enough + */ + if (hdr->command == ZEBRA_EVPN_REMOTE_NH_ADD) + min_len += sizeof(rmac); + if (hdr->length < min_len) + return; + vrf_id = stream_getl(s); stream_get(&nh, s, sizeof(nh)); @@ -3929,17 +3939,20 @@ void zebra_evpn_proc_remote_nh(ZAPI_HANDLER_ARGS) dummy_prefix.family = AF_EVPN; dummy_prefix.prefixlen = (sizeof(struct evpn_addr) * 8); dummy_prefix.prefix.route_type = 1; /* XXX - fixup to type-1 def */ + dummy_prefix.prefix.ead_addr.ip.ipa_type = nh.ipa_type; if (hdr->command == ZEBRA_EVPN_REMOTE_NH_ADD) { stream_get(&rmac, s, sizeof(rmac)); if (IS_ZEBRA_DEBUG_EVPN_MH_ES) - zlog_debug("evpn remote nh %d %pIA rmac %pEA add", - vrf_id, &nh, &rmac); + zlog_debug( + "evpn remote nh %d %pIA rmac %pEA add pfx %pFX", + vrf_id, &nh, &rmac, &dummy_prefix); zebra_rib_queue_evpn_route_add(vrf_id, &rmac, &nh, (struct prefix *)&dummy_prefix); } else { if (IS_ZEBRA_DEBUG_EVPN_MH_ES) - zlog_debug("evpn remote nh %d %pIA del", vrf_id, &nh); + zlog_debug("evpn remote nh %d %pIA del pfx %pFX", + vrf_id, &nh, &dummy_prefix); zebra_rib_queue_evpn_route_del(vrf_id, &nh, (struct prefix *)&dummy_prefix); } diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index c51dd759a6..1fb4e5e6fc 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -605,12 +605,9 @@ void rib_install_kernel(struct route_node *rn, struct route_entry *re, break; case ZEBRA_DPLANE_REQUEST_FAILURE: { - char str[SRCDEST2STR_BUFFER]; - - srcdest_rnode2str(rn, str, sizeof(str)); flog_err(EC_ZEBRA_DP_INSTALL_FAIL, - "%u:%u:%s: Failed to enqueue dataplane install", - re->vrf_id, re->table, str); + "%u:%u:%pRN: Failed to enqueue dataplane install", + re->vrf_id, re->table, rn); break; } case ZEBRA_DPLANE_REQUEST_SUCCESS: @@ -648,15 +645,10 @@ void rib_uninstall_kernel(struct route_node *rn, struct route_entry *re) zvrf->removals_queued++; break; case ZEBRA_DPLANE_REQUEST_FAILURE: - { - char str[SRCDEST2STR_BUFFER]; - - srcdest_rnode2str(rn, str, sizeof(str)); flog_err(EC_ZEBRA_DP_INSTALL_FAIL, - "%u:%s: Failed to enqueue dataplane uninstall", - re->vrf_id, str); + "%u:%pRN: Failed to enqueue dataplane uninstall", + re->vrf_id, rn); break; - } case ZEBRA_DPLANE_REQUEST_SUCCESS: if (zvrf) zvrf->removals++; @@ -666,46 +658,6 @@ void rib_uninstall_kernel(struct route_node *rn, struct route_entry *re) return; } -/* Uninstall the route from kernel. */ -static void rib_uninstall(struct route_node *rn, struct route_entry *re) -{ - struct rib_table_info *info = srcdest_rnode_table_info(rn); - rib_dest_t *dest = rib_dest_from_rnode(rn); - struct nexthop *nexthop; - - if (dest && dest->selected_fib == re) { - if (info->safi == SAFI_UNICAST) - hook_call(rib_update, rn, "rib_uninstall"); - - /* If labeled-unicast route, uninstall transit LSP. */ - if (zebra_rib_labeled_unicast(re)) - zebra_mpls_lsp_uninstall(info->zvrf, rn, re); - - rib_uninstall_kernel(rn, re); - - dest->selected_fib = NULL; - - /* Free FIB nexthop group, if present */ - if (re->fib_ng.nexthop) { - nexthops_free(re->fib_ng.nexthop); - re->fib_ng.nexthop = NULL; - } - UNSET_FLAG(re->status, ROUTE_ENTRY_USE_FIB_NHG); - - for (ALL_NEXTHOPS(re->nhe->nhg, nexthop)) - UNSET_FLAG(nexthop->flags, NEXTHOP_FLAG_FIB); - } - - if (CHECK_FLAG(re->flags, ZEBRA_FLAG_SELECTED)) { - const struct prefix *p, *src_p; - - srcdest_rnode_prefixes(rn, &p, &src_p); - - redistribute_delete(p, src_p, re, NULL); - UNSET_FLAG(re->flags, ZEBRA_FLAG_SELECTED); - } -} - /* * rib_can_delete_dest * @@ -753,15 +705,12 @@ void zebra_rib_evaluate_rn_nexthops(struct route_node *rn, uint32_t seq) * would match a more specific route */ while (rn) { - if (IS_ZEBRA_DEBUG_NHT_DETAILED) { - char buf[PREFIX_STRLEN]; - + if (IS_ZEBRA_DEBUG_NHT_DETAILED) zlog_debug( - "%s: %s Being examined for Nexthop Tracking Count: %zd", - __func__, - srcdest_rnode2str(rn, buf, sizeof(buf)), + "%s: %pRN Being examined for Nexthop Tracking Count: %zd", + __func__, rn, dest ? rnh_list_count(&dest->nht) : 0); - } + if (!dest) { rn = rn->parent; if (rn) @@ -779,17 +728,12 @@ void zebra_rib_evaluate_rn_nexthops(struct route_node *rn, uint32_t seq) zebra_vrf_lookup_by_id(rnh->vrf_id); struct prefix *p = &rnh->node->p; - if (IS_ZEBRA_DEBUG_NHT_DETAILED) { - char buf1[PREFIX_STRLEN]; - + if (IS_ZEBRA_DEBUG_NHT_DETAILED) zlog_debug( - "%s(%u):%s has Nexthop(%pFX) Type: %s depending on it, evaluating %u:%u", + "%s(%u):%pRN has Nexthop(%pFX) Type: %s depending on it, evaluating %u:%u", zvrf_name(zvrf), zvrf_id(zvrf), - srcdest_rnode2str(rn, buf1, - sizeof(buf1)), - p, rnh_type2str(rnh->type), seq, + rn, p, rnh_type2str(rnh->type), seq, rnh->seqno); - } /* * If we have evaluated this node on this pass @@ -890,13 +834,10 @@ static void rib_process_add_fib(struct zebra_vrf *zvrf, struct route_node *rn, return; } - if (IS_ZEBRA_DEBUG_RIB) { - char buf[SRCDEST2STR_BUFFER]; - srcdest_rnode2str(rn, buf, sizeof(buf)); - zlog_debug("%s(%u:%u):%s: Adding route rn %p, re %p (%s)", - zvrf_name(zvrf), zvrf_id(zvrf), new->table, buf, rn, + if (IS_ZEBRA_DEBUG_RIB) + zlog_debug("%s(%u:%u):%pRN: Adding route rn %p, re %p (%s)", + zvrf_name(zvrf), zvrf_id(zvrf), new->table, rn, rn, new, zebra_route_string(new->type)); - } /* If labeled-unicast route, install transit LSP. */ if (zebra_rib_labeled_unicast(new)) @@ -913,13 +854,10 @@ static void rib_process_del_fib(struct zebra_vrf *zvrf, struct route_node *rn, hook_call(rib_update, rn, "removing existing route"); /* Uninstall from kernel. */ - if (IS_ZEBRA_DEBUG_RIB) { - char buf[SRCDEST2STR_BUFFER]; - srcdest_rnode2str(rn, buf, sizeof(buf)); - zlog_debug("%s(%u:%u):%s: Deleting route rn %p, re %p (%s)", - zvrf_name(zvrf), zvrf_id(zvrf), old->table, buf, rn, + if (IS_ZEBRA_DEBUG_RIB) + zlog_debug("%s(%u:%u):%pRN: Deleting route rn %p, re %p (%s)", + zvrf_name(zvrf), zvrf_id(zvrf), old->table, rn, rn, old, zebra_route_string(old->type)); - } /* If labeled-unicast route, uninstall transit LSP. */ if (zebra_rib_labeled_unicast(old)) @@ -965,22 +903,19 @@ static void rib_process_update_fib(struct zebra_vrf *zvrf, */ if (nh_active) { if (IS_ZEBRA_DEBUG_RIB) { - char buf[SRCDEST2STR_BUFFER]; - - srcdest_rnode2str(rn, buf, sizeof(buf)); if (new != old) zlog_debug( - "%s(%u:%u):%s: Updating route rn %p, re %p (%s) old %p (%s)", + "%s(%u:%u):%pRN: Updating route rn %p, re %p (%s) old %p (%s)", zvrf_name(zvrf), zvrf_id(zvrf), - new->table, buf, rn, new, + new->table, rn, rn, new, zebra_route_string(new->type), old, zebra_route_string(old->type)); else zlog_debug( - "%s(%u:%u):%s: Updating route rn %p, re %p (%s)", + "%s(%u:%u):%pRN: Updating route rn %p, re %p (%s)", zvrf_name(zvrf), zvrf_id(zvrf), - new->table, buf, rn, new, + new->table, rn, rn, new, zebra_route_string(new->type)); } @@ -1006,21 +941,19 @@ static void rib_process_update_fib(struct zebra_vrf *zvrf, */ if (!nh_active) { if (IS_ZEBRA_DEBUG_RIB) { - char buf[SRCDEST2STR_BUFFER]; - srcdest_rnode2str(rn, buf, sizeof(buf)); if (new != old) zlog_debug( - "%s(%u:%u):%s: Deleting route rn %p, re %p (%s) old %p (%s) - nexthop inactive", + "%s(%u:%u):%pRN: Deleting route rn %p, re %p (%s) old %p (%s) - nexthop inactive", zvrf_name(zvrf), zvrf_id(zvrf), - new->table, buf, rn, new, + new->table, rn, rn, new, zebra_route_string(new->type), old, zebra_route_string(old->type)); else zlog_debug( - "%s(%u:%u):%s: Deleting route rn %p, re %p (%s) - nexthop inactive", + "%s(%u:%u):%pRN: Deleting route rn %p, re %p (%s) - nexthop inactive", zvrf_name(zvrf), zvrf_id(zvrf), - new->table, buf, rn, new, + new->table, rn, rn, new, zebra_route_string(new->type)); } @@ -1137,7 +1070,6 @@ static void rib_process(struct route_node *rn) struct route_entry *old_fib = NULL; struct route_entry *new_fib = NULL; struct route_entry *best = NULL; - char buf[SRCDEST2STR_BUFFER]; rib_dest_t *dest; struct zebra_vrf *zvrf = NULL; struct vrf *vrf; @@ -1149,15 +1081,17 @@ static void rib_process(struct route_node *rn) assert(rn); dest = rib_dest_from_rnode(rn); - if (dest) { - zvrf = rib_dest_vrf(dest); - vrf_id = zvrf_id(zvrf); - } + /* + * We have an enqueued node with nothing to process here + * let's just finish up and return; + */ + if (!dest) + return; - vrf = vrf_lookup_by_id(vrf_id); + zvrf = rib_dest_vrf(dest); + vrf_id = zvrf_id(zvrf); - if (IS_ZEBRA_DEBUG_RIB) - srcdest_rnode2str(rn, buf, sizeof(buf)); + vrf = vrf_lookup_by_id(vrf_id); /* * we can have rn's that have a NULL info pointer @@ -1165,26 +1099,24 @@ static void rib_process(struct route_node *rn) * additionally we know RNODE_FOREACH_RE_SAFE * will not iterate so we are ok. */ - if (dest) { - if (IS_ZEBRA_DEBUG_RIB_DETAILED) { - struct route_entry *re = re_list_first(&dest->routes); - - zlog_debug("%s(%u:%u):%s: Processing rn %p", - VRF_LOGNAME(vrf), vrf_id, re->table, buf, - rn); - } + if (IS_ZEBRA_DEBUG_RIB_DETAILED) { + struct route_entry *re = re_list_first(&dest->routes); - old_fib = dest->selected_fib; + zlog_debug("%s(%u:%u):%pRN: Processing rn %p", + VRF_LOGNAME(vrf), vrf_id, re->table, rn, + rn); } + old_fib = dest->selected_fib; + RNODE_FOREACH_RE_SAFE (rn, re, next) { if (IS_ZEBRA_DEBUG_RIB_DETAILED) { char flags_buf[128]; char status_buf[128]; zlog_debug( - "%s(%u:%u):%s: Examine re %p (%s) status: %sflags: %sdist %d metric %d", - VRF_LOGNAME(vrf), vrf_id, re->table, buf, re, + "%s(%u:%u):%pRN: Examine re %p (%s) status: %sflags: %sdist %d metric %d", + VRF_LOGNAME(vrf), vrf_id, re->table, rn, re, zebra_route_string(re->type), _dump_re_status(re, status_buf, sizeof(status_buf)), @@ -1234,11 +1166,11 @@ static void rib_process(struct route_node *rn) if (re != old_selected) { if (IS_ZEBRA_DEBUG_RIB) zlog_debug( - "%s: %s(%u):%s: imported via import-table but denied by the ip protocol table route-map", + "%s: %s(%u):%pRN: imported via import-table but denied by the ip protocol table route-map", __func__, VRF_LOGNAME( vrf), - vrf_id, buf); + vrf_id, rn); rib_unlink(rn, re); } else SET_FLAG(re->status, @@ -1313,8 +1245,8 @@ static void rib_process(struct route_node *rn) : new_fib ? new_fib : NULL; zlog_debug( - "%s(%u:%u):%s: After processing: old_selected %p new_selected %p old_fib %p new_fib %p", - VRF_LOGNAME(vrf), vrf_id, entry ? entry->table : 0, buf, + "%s(%u:%u):%pRN: After processing: old_selected %p new_selected %p old_fib %p new_fib %p", + VRF_LOGNAME(vrf), vrf_id, entry ? entry->table : 0, rn, (void *)old_selected, (void *)new_selected, (void *)old_fib, (void *)new_fib); } @@ -2469,7 +2401,6 @@ static void process_subq_route(struct listnode *lnode, uint8_t qindex) if (IS_ZEBRA_DEBUG_RIB_DETAILED) { struct route_entry *re = NULL; - char buf[SRCDEST2STR_BUFFER]; /* * rib_process may have freed the dest @@ -2480,10 +2411,9 @@ static void process_subq_route(struct listnode *lnode, uint8_t qindex) if (dest) re = re_list_first(&dest->routes); - srcdest_rnode2str(rnode, buf, sizeof(buf)); - zlog_debug("%s(%u:%u):%s: rn %p dequeued from sub-queue %u", + zlog_debug("%s(%u:%u):%pRN rn %p dequeued from sub-queue %u", zvrf_name(zvrf), zvrf_id(zvrf), re ? re->table : 0, - buf, rnode, qindex); + rnode, rnode, qindex); } if (rnode->info) @@ -3190,13 +3120,10 @@ void rib_delnode(struct route_node *rn, struct route_entry *re) zebra_del_import_table_entry(zvrf, rn, re); /* Just clean up if non main table */ - if (IS_ZEBRA_DEBUG_RIB) { - char buf[SRCDEST2STR_BUFFER]; - srcdest_rnode2str(rn, buf, sizeof(buf)); - zlog_debug("%s(%u):%s: Freeing route rn %p, re %p (%s)", - vrf_id_to_name(re->vrf_id), re->vrf_id, buf, + if (IS_ZEBRA_DEBUG_RIB) + zlog_debug("%s(%u):%pRN: Freeing route rn %p, re %p (%s)", + vrf_id_to_name(re->vrf_id), re->vrf_id, rn, rn, re, zebra_route_string(re->type)); - } rib_unlink(rn, re); } else { @@ -3347,112 +3274,15 @@ void _route_entry_dump(const char *func, union prefixconstptr pp, } /* - * This is an exported helper to rtm_read() to dump the strange - * RE entry found by rib_lookup_ipv4_route() - */ -void rib_lookup_and_dump(struct prefix_ipv4 *p, vrf_id_t vrf_id) -{ - struct route_table *table; - struct route_node *rn; - struct route_entry *re; - struct vrf *vrf; - - vrf = vrf_lookup_by_id(vrf_id); - - /* Lookup table. */ - table = zebra_vrf_table(AFI_IP, SAFI_UNICAST, vrf_id); - if (!table) { - flog_err(EC_ZEBRA_TABLE_LOOKUP_FAILED, - "%s:%s(%u) zebra_vrf_table() returned NULL", __func__, - VRF_LOGNAME(vrf), vrf_id); - return; - } - - /* Scan the RIB table for exactly matching RE entry. */ - rn = route_node_lookup(table, (struct prefix *)p); - - /* No route for this prefix. */ - if (!rn) { - zlog_debug("%s:%s(%u) lookup failed for %pFX", __func__, - VRF_LOGNAME(vrf), vrf_id, (struct prefix *)p); - return; - } - - /* Unlock node. */ - route_unlock_node(rn); - - /* let's go */ - RNODE_FOREACH_RE (rn, re) { - zlog_debug("%s:%s(%u) rn %p, re %p: %s, %s", __func__, - VRF_LOGNAME(vrf), vrf_id, (void *)rn, (void *)re, - (CHECK_FLAG(re->status, ROUTE_ENTRY_REMOVED) - ? "removed" - : "NOT removed"), - (CHECK_FLAG(re->flags, ZEBRA_FLAG_SELECTED) - ? "selected" - : "NOT selected")); - route_entry_dump(p, NULL, re); - } -} - -/* Check if requested address assignment will fail due to another - * route being installed by zebra in FIB already. Take necessary - * actions, if needed: remove such a route from FIB and deSELECT - * corresponding RE entry. Then put affected RN into RIBQ head. - */ -void rib_lookup_and_pushup(struct prefix_ipv4 *p, vrf_id_t vrf_id) -{ - struct route_table *table; - struct route_node *rn; - rib_dest_t *dest; - - if (NULL == (table = zebra_vrf_table(AFI_IP, SAFI_UNICAST, vrf_id))) { - struct vrf *vrf = vrf_lookup_by_id(vrf_id); - - flog_err(EC_ZEBRA_TABLE_LOOKUP_FAILED, - "%s:%s(%u) zebra_vrf_table() returned NULL", __func__, - VRF_LOGNAME(vrf), vrf_id); - return; - } - - /* No matches would be the simplest case. */ - if (NULL == (rn = route_node_lookup(table, (struct prefix *)p))) - return; - - /* Unlock node. */ - route_unlock_node(rn); - - dest = rib_dest_from_rnode(rn); - /* Check all RE entries. In case any changes have to be done, requeue - * the RN into RIBQ head. If the routing message about the new connected - * route (generated by the IP address we are going to assign very soon) - * comes before the RIBQ is processed, the new RE entry will join - * RIBQ record already on head. This is necessary for proper - * revalidation - * of the rest of the RE. - */ - if (dest->selected_fib) { - if (IS_ZEBRA_DEBUG_RIB) { - struct vrf *vrf = - vrf_lookup_by_id(dest->selected_fib->vrf_id); - - zlog_debug( - "%s(%u):%pFX: freeing way for connected prefix", - VRF_LOGNAME(vrf), dest->selected_fib->vrf_id, - &rn->p); - route_entry_dump(&rn->p, NULL, dest->selected_fib); - } - rib_uninstall(rn, dest->selected_fib); - rib_queue_add(rn); - } -} - -/* * Internal route-add implementation; there are a couple of different public * signatures. Callers in this path are responsible for the memory they * allocate: if they allocate a nexthop_group or backup nexthop info, they * must free those objects. If this returns < 0, an error has occurred and the * route_entry 're' has not been captured; the caller should free that also. + * + * -1 -> error + * 0 -> Add + * 1 -> update */ int rib_add_multipath_nhe(afi_t afi, safi_t safi, struct prefix *p, struct prefix_ipv6 *src_p, struct route_entry *re, @@ -3567,11 +3397,12 @@ int rib_add_multipath_nhe(afi_t afi, safi_t safi, struct prefix *p, SET_FLAG(re->status, ROUTE_ENTRY_CHANGED); rib_addnode(rn, re, 1); - ret = 1; /* Free implicit route.*/ - if (same) + if (same) { + ret = 1; rib_delnode(rn, same); + } /* See if we can remove some RE entries that are queued for * removal, but won't be considered in rib processing. diff --git a/zebra/zebra_vxlan.c b/zebra/zebra_vxlan.c index 1660792221..2fcaefdfbf 100644 --- a/zebra/zebra_vxlan.c +++ b/zebra/zebra_vxlan.c @@ -150,9 +150,28 @@ static int host_rb_entry_compare(const struct host_rb_entry *hle1, return memcmp(&hle1->p.u.prefix6, &hle2->p.u.prefix6, IPV6_MAX_BYTELEN); } else if (hle1->p.family == AF_EVPN) { - /* a single dummy prefix of route_type BGP_EVPN_AD_ROUTE is - * used for all nexthops associated with a non-zero ESI + uint8_t family1; + uint8_t family2; + + /* two (v4/v6) dummy prefixes of route_type BGP_EVPN_AD_ROUTE + * are used for all nexthops associated with a non-zero ESI */ + family1 = is_evpn_prefix_ipaddr_v4( + (const struct prefix_evpn *)&hle1->p) + ? AF_INET + : AF_INET6; + family2 = is_evpn_prefix_ipaddr_v4( + (const struct prefix_evpn *)&hle2->p) + ? AF_INET + : AF_INET6; + + + if (family1 < family2) + return -1; + + if (family1 > family2) + return 1; + return 0; } else { zlog_debug("%s: Unexpected family type: %d", __func__, |
