diff options
| -rw-r--r-- | babeld/babeld.c | 8 | ||||
| -rw-r--r-- | bfdd/bfdd_vty.c | 5 | ||||
| -rw-r--r-- | bgpd/bgp_label.h | 4 | ||||
| -rw-r--r-- | bgpd/bgp_route.c | 65 | ||||
| -rw-r--r-- | bgpd/bgp_route.h | 2 | ||||
| -rw-r--r-- | bgpd/bgp_routemap.c | 8 | ||||
| -rw-r--r-- | bgpd/bgp_vty.c | 8 | ||||
| -rw-r--r-- | doc/user/bgp.rst | 4 | ||||
| -rw-r--r-- | eigrpd/eigrp_routemap.c | 12 | ||||
| -rw-r--r-- | isisd/isis_cli.c | 4 | ||||
| -rw-r--r-- | ldpd/ldp_vty_cmds.c | 10 | ||||
| -rw-r--r-- | lib/filter.c | 58 | ||||
| -rw-r--r-- | lib/filter_cli.c | 14 | ||||
| -rw-r--r-- | lib/routemap_cli.c | 12 | ||||
| -rw-r--r-- | ospf6d/ospf6_area.c | 12 | ||||
| -rw-r--r-- | ospf6d/ospf6_gr.h | 2 | ||||
| -rw-r--r-- | ospf6d/ospf6_gr_helper.c | 26 | ||||
| -rw-r--r-- | ospfd/ospf_vty.c | 534 | ||||
| -rw-r--r-- | pimd/pim_cmd.c | 2 | ||||
| -rw-r--r-- | pimd/pim_msdp.c | 7 | ||||
| -rw-r--r-- | pimd/pim_upstream.c | 4 | ||||
| -rw-r--r-- | ripd/rip_cli.c | 6 | ||||
| -rw-r--r-- | ripngd/ripng_cli.c | 6 | ||||
| -rw-r--r-- | tests/topotests/lib/bgprib.py | 2 | ||||
| -rw-r--r-- | tests/topotests/ospf_gr_helper/test_ospf_gr_helper.py | 2 | ||||
| -rwxr-xr-x | tests/topotests/ospf_gr_topo1/test_ospf_gr_topo1.py | 2 | ||||
| -rw-r--r-- | zebra/rtadv.c | 4 |
27 files changed, 216 insertions, 607 deletions
diff --git a/babeld/babeld.c b/babeld/babeld.c index f61eac000f..0104620cd5 100644 --- a/babeld/babeld.c +++ b/babeld/babeld.c @@ -716,7 +716,7 @@ DEFUN (babel_set_smoothing_half_life, DEFUN (babel_distribute_list, babel_distribute_list_cmd, - "distribute-list [prefix] WORD <in|out> [WORD]", + "distribute-list [prefix] ACCESSLIST4_NAME <in|out> [WORD]", "Filter networks in routing updates\n" "Specify a prefix\n" "Access-list name\n" @@ -736,7 +736,7 @@ DEFUN (babel_distribute_list, DEFUN (babel_no_distribute_list, babel_no_distribute_list_cmd, - "no distribute-list [prefix] WORD <in|out> [WORD]", + "no distribute-list [prefix] ACCESSLIST4_NAME <in|out> [WORD]", NO_STR "Filter networks in routing updates\n" "Specify a prefix\n" @@ -758,7 +758,7 @@ DEFUN (babel_no_distribute_list, DEFUN (babel_ipv6_distribute_list, babel_ipv6_distribute_list_cmd, - "ipv6 distribute-list [prefix] WORD <in|out> [WORD]", + "ipv6 distribute-list [prefix] ACCESSLIST6_NAME <in|out> [WORD]", "IPv6\n" "Filter networks in routing updates\n" "Specify a prefix\n" @@ -779,7 +779,7 @@ DEFUN (babel_ipv6_distribute_list, DEFUN (babel_no_ipv6_distribute_list, babel_no_ipv6_distribute_list_cmd, - "no ipv6 distribute-list [prefix] WORD <in|out> [WORD]", + "no ipv6 distribute-list [prefix] ACCESSLIST6_NAME <in|out> [WORD]", NO_STR "IPv6\n" "Filter networks in routing updates\n" diff --git a/bfdd/bfdd_vty.c b/bfdd/bfdd_vty.c index a03fb9f216..4091ab9caa 100644 --- a/bfdd/bfdd_vty.c +++ b/bfdd/bfdd_vty.c @@ -579,7 +579,7 @@ _find_peer_or_error(struct vty *vty, int argc, struct cmd_token **argv, pl = pl_find(label); if (pl) bs = pl->pl_bs; - } else { + } else if (peer_str) { strtosa(peer_str, &psa); if (local_str) { strtosa(local_str, &lsa); @@ -599,6 +599,9 @@ _find_peer_or_error(struct vty *vty, int argc, struct cmd_token **argv, } bs = bs_peer_find(&bpc); + } else { + vty_out(vty, "%% Invalid arguments\n"); + return NULL; } /* Find peer data. */ diff --git a/bgpd/bgp_label.h b/bgpd/bgp_label.h index d227cf7241..cafcc8e9c7 100644 --- a/bgpd/bgp_label.h +++ b/bgpd/bgp_label.h @@ -65,7 +65,7 @@ static inline int bgp_is_withdraw_label(mpls_label_t *label) return 0; } -static inline int bgp_is_valid_label(mpls_label_t *label) +static inline int bgp_is_valid_label(const mpls_label_t *label) { uint8_t *t = (uint8_t *)label; if (!t) @@ -99,7 +99,7 @@ static inline void bgp_unregister_for_label(struct bgp_dest *dest) } /* Label stream to value */ -static inline uint32_t label_pton(mpls_label_t *label) +static inline uint32_t label_pton(const mpls_label_t *label) { uint8_t *t = (uint8_t *)label; return ((((unsigned int)t[0]) << 12) | (((unsigned int)t[1]) << 4) diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index ffd8a8118c..fdaee9b600 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -102,6 +102,10 @@ DEFINE_HOOK(bgp_rpki_prefix_status, const struct prefix *prefix), (peer, attr, prefix)); +/* Render dest to prefix_rd based on safi */ +static const struct prefix_rd *bgp_rd_from_dest(const struct bgp_dest *dest, + safi_t safi); + /* Extern from bgp_dump.c */ extern const char *bgp_origin_str[]; extern const char *bgp_origin_long_str[]; @@ -10712,14 +10716,15 @@ static int bgp_show_community(struct vty *vty, struct bgp *bgp, static int bgp_show_table(struct vty *vty, struct bgp *bgp, safi_t safi, struct bgp_table *table, enum bgp_show_type type, - void *output_arg, char *rd, int is_last, + void *output_arg, const char *rd, int is_last, unsigned long *output_cum, unsigned long *total_cum, unsigned long *json_header_depth, uint16_t show_flags, enum rpki_states rpki_target_state) { struct bgp_path_info *pi; struct bgp_dest *dest; - int header = 1; + bool header = true; + bool json_detail_header = false; int display; unsigned long output_count = 0; unsigned long total_count = 0; @@ -10731,7 +10736,7 @@ static int bgp_show_table(struct vty *vty, struct bgp *bgp, safi_t safi, bool all = CHECK_FLAG(show_flags, BGP_SHOW_OPT_AFI_ALL); if (output_cum && *output_cum != 0) - header = 0; + header = false; if (use_json && !*json_header_depth) { if (all) @@ -10761,10 +10766,19 @@ static int bgp_show_table(struct vty *vty, struct bgp *bgp, safi_t safi, vty_out(vty, " \"%s\" : { ", rd); } + /* Check for 'json detail', where we need header output once per dest */ + if (use_json && CHECK_FLAG(show_flags, BGP_SHOW_OPT_DETAIL) && + type != bgp_show_type_dampend_paths && + type != bgp_show_type_damp_neighbor && + type != bgp_show_type_flap_statistics && + type != bgp_show_type_flap_neighbor) + json_detail_header = true; + /* Start processing of routes. */ for (dest = bgp_table_top(table); dest; dest = bgp_route_next(dest)) { const struct prefix *dest_p = bgp_dest_get_prefix(dest); enum rpki_states rpki_curr_state = RPKI_NOT_BEING_USED; + bool json_detail = json_detail_header; pi = bgp_dest_get_bgp_path_info(dest); if (pi == NULL) @@ -11016,8 +11030,28 @@ static int bgp_show_table(struct vty *vty, struct bgp *bgp, safi_t safi, else vty_out(vty, (wide ? BGP_SHOW_HEADER_WIDE : BGP_SHOW_HEADER)); - header = 0; + header = false; + + } else if (json_detail && json_paths != NULL) { + const struct prefix_rd *prd; + json_object *jtemp; + + /* Use common detail header, for most types; + * need a json 'object'. + */ + + jtemp = json_object_new_object(); + prd = bgp_rd_from_dest(dest, safi); + + route_vty_out_detail_header( + vty, bgp, dest, prd, table->afi, + safi, jtemp); + + json_object_array_add(json_paths, jtemp); + + json_detail = false; } + if (rd != NULL && !display && !output_count) { if (!use_json) vty_out(vty, @@ -11176,6 +11210,7 @@ int bgp_show_table_rd(struct vty *vty, struct bgp *bgp, safi_t safi, } return CMD_SUCCESS; } + static int bgp_show(struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi, enum bgp_show_type type, void *output_arg, uint16_t show_flags, enum rpki_states rpki_target_state) @@ -11260,7 +11295,8 @@ static void bgp_show_all_instances_routes_vty(struct vty *vty, afi_t afi, /* Header of detailed BGP route information */ void route_vty_out_detail_header(struct vty *vty, struct bgp *bgp, - struct bgp_dest *dest, struct prefix_rd *prd, + struct bgp_dest *dest, + const struct prefix_rd *prd, afi_t afi, safi_t safi, json_object *json) { struct bgp_path_info *pi; @@ -11470,7 +11506,7 @@ void route_vty_out_detail_header(struct vty *vty, struct bgp *bgp, } } -static void bgp_show_path_info(struct prefix_rd *pfx_rd, +static void bgp_show_path_info(const struct prefix_rd *pfx_rd, struct bgp_dest *bgp_node, struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi, json_object *json, enum bgp_path_type pathtype, @@ -11530,6 +11566,23 @@ static void bgp_show_path_info(struct prefix_rd *pfx_rd, } } +/* + * Return rd based on safi + */ +static const struct prefix_rd *bgp_rd_from_dest(const struct bgp_dest *dest, + safi_t safi) +{ + switch (safi) { + case SAFI_MPLS_VPN: + case SAFI_ENCAP: + case SAFI_EVPN: + return (struct prefix_rd *)(bgp_dest_get_prefix(dest)); + default: + return NULL; + + } +} + /* Display specified route of BGP table. */ static int bgp_show_route_in_table(struct vty *vty, struct bgp *bgp, struct bgp_table *rib, const char *ip_str, diff --git a/bgpd/bgp_route.h b/bgpd/bgp_route.h index 46802d0d14..2fd80495d9 100644 --- a/bgpd/bgp_route.h +++ b/bgpd/bgp_route.h @@ -784,7 +784,7 @@ extern bool bgp_zebra_has_route_changed(struct bgp_path_info *selected); extern void route_vty_out_detail_header(struct vty *vty, struct bgp *bgp, struct bgp_dest *dest, - struct prefix_rd *prd, afi_t afi, + const struct prefix_rd *prd, afi_t afi, safi_t safi, json_object *json); extern void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct bgp_dest *bn, diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c index 3fc478bc97..aa59499b04 100644 --- a/bgpd/bgp_routemap.c +++ b/bgpd/bgp_routemap.c @@ -4004,7 +4004,7 @@ static void bgp_route_map_event(const char *rmap_name) DEFUN_YANG (match_mac_address, match_mac_address_cmd, - "match mac address WORD", + "match mac address ACCESSLIST_MAC_NAME", MATCH_STR "mac address\n" "Match address of route\n" @@ -4024,7 +4024,7 @@ DEFUN_YANG (match_mac_address, DEFUN_YANG (no_match_mac_address, no_match_mac_address_cmd, - "no match mac address WORD", + "no match mac address ACCESSLIST_MAC_NAME", NO_STR MATCH_STR "mac\n" @@ -4576,7 +4576,7 @@ DEFUN_YANG (no_match_probability, DEFPY_YANG (match_ip_route_source, match_ip_route_source_cmd, - "match ip route-source WORD", + "match ip route-source ACCESSLIST4_NAME", MATCH_STR IP_STR "Match advertising source address of route\n" @@ -4600,7 +4600,7 @@ DEFPY_YANG (match_ip_route_source, DEFUN_YANG (no_match_ip_route_source, no_match_ip_route_source_cmd, - "no match ip route-source [WORD]", + "no match ip route-source [ACCESSLIST4_NAME]", NO_STR MATCH_STR IP_STR diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 65806bb5f4..3725f242e1 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -7048,7 +7048,7 @@ DEFUN (no_neighbor_interface, DEFUN (neighbor_distribute_list, neighbor_distribute_list_cmd, - "neighbor <A.B.C.D|X:X::X:X|WORD> distribute-list WORD <in|out>", + "neighbor <A.B.C.D|X:X::X:X|WORD> distribute-list ACCESSLIST_NAME <in|out>", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Filter updates to/from this neighbor\n" @@ -7079,7 +7079,7 @@ DEFUN (neighbor_distribute_list, ALIAS_HIDDEN( neighbor_distribute_list, neighbor_distribute_list_hidden_cmd, - "neighbor <A.B.C.D|X:X::X:X|WORD> distribute-list WORD <in|out>", + "neighbor <A.B.C.D|X:X::X:X|WORD> distribute-list ACCESSLIST_NAME <in|out>", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Filter updates to/from this neighbor\n" "IP Access-list name\n" @@ -7088,7 +7088,7 @@ ALIAS_HIDDEN( DEFUN (no_neighbor_distribute_list, no_neighbor_distribute_list_cmd, - "no neighbor <A.B.C.D|X:X::X:X|WORD> distribute-list WORD <in|out>", + "no neighbor <A.B.C.D|X:X::X:X|WORD> distribute-list ACCESSLIST_NAME <in|out>", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 @@ -7118,7 +7118,7 @@ DEFUN (no_neighbor_distribute_list, ALIAS_HIDDEN( no_neighbor_distribute_list, no_neighbor_distribute_list_hidden_cmd, - "no neighbor <A.B.C.D|X:X::X:X|WORD> distribute-list WORD <in|out>", + "no neighbor <A.B.C.D|X:X::X:X|WORD> distribute-list ACCESSLIST_NAME <in|out>", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Filter updates to/from this neighbor\n" "IP Access-list name\n" diff --git a/doc/user/bgp.rst b/doc/user/bgp.rst index 68b4d74dd6..db59c42773 100644 --- a/doc/user/bgp.rst +++ b/doc/user/bgp.rst @@ -3006,8 +3006,8 @@ following zebra command - .. clicmd:: evpn mh startup-delay (0-3600) -+Support with VRF network namespace backend -+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Support with VRF network namespace backend +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ It is possible to separate overlay networks contained in VXLAN interfaces from underlay networks by using VRFs. VRF-lite and VRF-netns backends can be used for that. In the latter case, it is necessary to set both bridge and vxlan interface diff --git a/eigrpd/eigrp_routemap.c b/eigrpd/eigrp_routemap.c index 65fa95b652..d9b500a8fd 100644 --- a/eigrpd/eigrp_routemap.c +++ b/eigrpd/eigrp_routemap.c @@ -858,7 +858,7 @@ ALIAS(no_match_interface, no_match_interface_val_cmd, "no match interface WORD", DEFUN (match_ip_next_hop, match_ip_next_hop_cmd, - "match ip next-hop WORD", + "match ip next-hop ACCESSLIST4_NAME", MATCH_STR IP_STR "Match next-hop address of route\n" @@ -884,7 +884,7 @@ DEFUN (no_match_ip_next_hop, } ALIAS(no_match_ip_next_hop, no_match_ip_next_hop_val_cmd, - "no match ip next-hop WORD", NO_STR MATCH_STR IP_STR + "no match ip next-hop ACCESSLIST4_NAME", NO_STR MATCH_STR IP_STR "Match next-hop address of route\n" "IP Access-list name\n") @@ -927,7 +927,7 @@ ALIAS(no_match_ip_next_hop_prefix_list, DEFUN (match_ip_address, match_ip_address_cmd, - "match ip address WORD", + "match ip address ACCESSLIST4_NAME", MATCH_STR IP_STR "Match address of route\n" @@ -952,7 +952,7 @@ DEFUN (no_match_ip_address, } ALIAS(no_match_ip_address, no_match_ip_address_val_cmd, - "no match ip address WORD", NO_STR MATCH_STR IP_STR + "no match ip address ACCESSLIST4_NAME", NO_STR MATCH_STR IP_STR "Match address of route\n" "IP Access-list name\n") @@ -1124,7 +1124,7 @@ ALIAS(no_set_tag, no_set_tag_val_cmd, "no set tag (0-65535)", NO_STR SET_STR DEFUN (eigrp_distribute_list, eigrp_distribute_list_cmd, - "distribute-list [prefix] WORD <in|out> [WORD]", + "distribute-list [prefix] ACCESSLIST_NAME <in|out> [WORD]", "Filter networks in routing updates\n" "Specify a prefix\n" "Access-list name\n" @@ -1144,7 +1144,7 @@ DEFUN (eigrp_distribute_list, DEFUN (eigrp_no_distribute_list, eigrp_no_distribute_list_cmd, - "no distribute-list [prefix] WORD <in|out> [WORD]", + "no distribute-list [prefix] ACCESSLIST_NAME <in|out> [WORD]", NO_STR "Filter networks in routing updates\n" "Specify a prefix\n" diff --git a/isisd/isis_cli.c b/isisd/isis_cli.c index b543c2d3ec..bf03d0a050 100644 --- a/isisd/isis_cli.c +++ b/isisd/isis_cli.c @@ -1011,7 +1011,7 @@ void cli_show_isis_spf_ietf_backoff(struct vty *vty, * XPath: /frr-isisd:isis/instance/spf/prefix-priorities/medium/access-list-name */ DEFPY_YANG(spf_prefix_priority, spf_prefix_priority_cmd, - "spf prefix-priority <critical|high|medium>$priority WORD$acl_name", + "spf prefix-priority <critical|high|medium>$priority ACCESSLIST_NAME$acl_name", "SPF configuration\n" "Configure a prefix priority list\n" "Specify critical priority prefixes\n" @@ -1029,7 +1029,7 @@ DEFPY_YANG(spf_prefix_priority, spf_prefix_priority_cmd, } DEFPY_YANG(no_spf_prefix_priority, no_spf_prefix_priority_cmd, - "no spf prefix-priority <critical|high|medium>$priority [WORD]", + "no spf prefix-priority <critical|high|medium>$priority [ACCESSLIST_NAME]", NO_STR "SPF configuration\n" "Configure a prefix priority list\n" diff --git a/ldpd/ldp_vty_cmds.c b/ldpd/ldp_vty_cmds.c index 9d3d1a606e..11d6930f06 100644 --- a/ldpd/ldp_vty_cmds.c +++ b/ldpd/ldp_vty_cmds.c @@ -253,7 +253,7 @@ DEFPY (ldp_allow_broken_lsps, DEFPY (ldp_discovery_targeted_hello_accept, ldp_discovery_targeted_hello_accept_cmd, - "[no] discovery targeted-hello accept [from WORD$from_acl]", + "[no] discovery targeted-hello accept [from ACCESSLIST_NAME$from_acl]", NO_STR "Configure discovery parameters\n" "LDP Targeted Hellos\n" @@ -288,7 +288,7 @@ DEFPY (ldp_discovery_transport_address_ipv6, DEFPY (ldp_label_local_advertise, ldp_label_local_advertise_cmd, - "[no] label local advertise [{to WORD$to_acl|for WORD$for_acl}]", + "[no] label local advertise [{to ACCESSLIST_NAME$to_acl|for ACCESSLIST_NAME$for_acl}]", NO_STR "Configure label control and policies\n" "Configure local label control and policies\n" @@ -303,7 +303,7 @@ DEFPY (ldp_label_local_advertise, DEFPY (ldp_label_local_advertise_explicit_null, ldp_label_local_advertise_explicit_null_cmd, - "[no] label local advertise explicit-null [for WORD$for_acl]", + "[no] label local advertise explicit-null [for ACCESSLIST_NAME$for_acl]", NO_STR "Configure label control and policies\n" "Configure local label control and policies\n" @@ -317,7 +317,7 @@ DEFPY (ldp_label_local_advertise_explicit_null, DEFPY (ldp_label_local_allocate, ldp_label_local_allocate_cmd, - "[no] label local allocate <host-routes$host_routes|for WORD$for_acl>", + "[no] label local allocate <host-routes$host_routes|for ACCESSLIST_NAME$for_acl>", NO_STR "Configure label control and policies\n" "Configure local label control and policies\n" @@ -331,7 +331,7 @@ DEFPY (ldp_label_local_allocate, DEFPY (ldp_label_remote_accept, ldp_label_remote_accept_cmd, - "[no] label remote accept {from WORD$from_acl|for WORD$for_acl}", + "[no] label remote accept {from ACCESSLIST_NAME$from_acl|for ACCESSLIST_NAME$for_acl}", NO_STR "Configure label control and policies\n" "Configure remote/peer label control and policies\n" diff --git a/lib/filter.c b/lib/filter.c index 3a86fbce93..9c80808fe8 100644 --- a/lib/filter.c +++ b/lib/filter.c @@ -612,7 +612,7 @@ DEFUN (show_mac_access_list, DEFUN (show_mac_access_list_name, show_mac_access_list_name_cmd, - "show mac access-list WORD", + "show mac access-list ACCESSLIST_MAC_NAME", SHOW_STR "mac access lists\n" "List mac access lists\n" @@ -635,7 +635,7 @@ DEFUN (show_ip_access_list, DEFUN (show_ip_access_list_name, show_ip_access_list_name_cmd, - "show ip access-list WORD [json]", + "show ip access-list ACCESSLIST4_NAME [json]", SHOW_STR IP_STR "List IP access lists\n" @@ -661,7 +661,7 @@ DEFUN (show_ipv6_access_list, DEFUN (show_ipv6_access_list_name, show_ipv6_access_list_name_cmd, - "show ipv6 access-list WORD [json]", + "show ipv6 access-list ACCESSLIST6_NAME [json]", SHOW_STR IPV6_STR "List IPv6 access lists\n" @@ -839,12 +839,62 @@ static void access_list_init_ipv4(void) install_element(ENABLE_NODE, &show_ip_access_list_name_cmd); } +static void access_list_autocomplete_afi(afi_t afi, vector comps, + struct cmd_token *token) +{ + struct access_list *access; + struct access_list *next; + struct access_master *master; + + master = access_master_get(afi); + if (master == NULL) + return; + + for (access = master->str.head; access; access = next) { + next = access->next; + vector_set(comps, XSTRDUP(MTYPE_COMPLETION, access->name)); + } +} + static struct cmd_node access_ipv6_node = { .name = "ipv6 access list", .node = ACCESS_IPV6_NODE, .prompt = "", }; +static void access_list_autocomplete(vector comps, struct cmd_token *token) +{ + access_list_autocomplete_afi(AFI_IP, comps, token); + access_list_autocomplete_afi(AFI_IP6, comps, token); + access_list_autocomplete_afi(AFI_L2VPN, comps, token); +} + +static void access_list4_autocomplete(vector comps, struct cmd_token *token) +{ + access_list_autocomplete_afi(AFI_IP, comps, token); +} + +static void access_list6_autocomplete(vector comps, struct cmd_token *token) +{ + access_list_autocomplete_afi(AFI_IP6, comps, token); +} + +static void access_list_mac_autocomplete(vector comps, struct cmd_token *token) +{ + access_list_autocomplete_afi(AFI_L2VPN, comps, token); +} + +static const struct cmd_variable_handler access_list_handlers[] = { + {.tokenname = "ACCESSLIST_NAME", + .completions = access_list_autocomplete}, + {.tokenname = "ACCESSLIST4_NAME", + .completions = access_list4_autocomplete}, + {.tokenname = "ACCESSLIST6_NAME", + .completions = access_list6_autocomplete}, + {.tokenname = "ACCESSLIST_MAC_NAME", + .completions = access_list_mac_autocomplete}, + {.completions = NULL}}; + static void access_list_reset_ipv6(void) { struct access_list *access; @@ -874,6 +924,8 @@ static void access_list_init_ipv6(void) void access_list_init(void) { + cmd_variable_handler_register(access_list_handlers); + access_list_init_ipv4(); access_list_init_ipv6(); access_list_init_mac(); diff --git a/lib/filter_cli.c b/lib/filter_cli.c index 43618094ac..fb40c527dd 100644 --- a/lib/filter_cli.c +++ b/lib/filter_cli.c @@ -822,7 +822,7 @@ DEFPY_YANG( ALIAS( no_ipv6_access_list_remark, no_ipv6_access_list_remark_line_cmd, - "no ipv6 access-list WORD$name remark LINE...", + "no ipv6 access-list ACCESSLIST6_NAME$name remark LINE...", NO_STR IPV6_STR ACCESS_LIST_STR @@ -832,7 +832,7 @@ ALIAS( DEFPY_YANG( mac_access_list, mac_access_list_cmd, - "mac access-list WORD$name [seq (1-4294967295)$seq] <deny|permit>$action <X:X:X:X:X:X$mac|any>", + "mac access-list ACCESSLIST_MAC_NAME$name [seq (1-4294967295)$seq] <deny|permit>$action <X:X:X:X:X:X$mac|any>", MAC_STR ACCESS_LIST_STR ACCESS_LIST_ZEBRA_STR @@ -898,7 +898,7 @@ DEFPY_YANG( DEFPY_YANG( no_mac_access_list, no_mac_access_list_cmd, - "no mac access-list WORD$name [seq (1-4294967295)$seq] <deny|permit>$action <X:X:X:X:X:X$mac|any>", + "no mac access-list ACCESSLIST_MAC_NAME$name [seq (1-4294967295)$seq] <deny|permit>$action <X:X:X:X:X:X$mac|any>", NO_STR MAC_STR ACCESS_LIST_STR @@ -938,7 +938,7 @@ DEFPY_YANG( DEFPY_YANG( no_mac_access_list_all, no_mac_access_list_all_cmd, - "no mac access-list WORD$name", + "no mac access-list ACCESSLIST_MAC_NAME$name", NO_STR MAC_STR ACCESS_LIST_STR @@ -955,7 +955,7 @@ DEFPY_YANG( DEFPY_YANG( mac_access_list_remark, mac_access_list_remark_cmd, - "mac access-list WORD$name remark LINE...", + "mac access-list ACCESSLIST_MAC_NAME$name remark LINE...", MAC_STR ACCESS_LIST_STR ACCESS_LIST_ZEBRA_STR @@ -980,7 +980,7 @@ DEFPY_YANG( DEFPY_YANG( no_mac_access_list_remark, no_mac_access_list_remark_cmd, - "no mac access-list WORD$name remark", + "no mac access-list ACCESSLIST_MAC_NAME$name remark", NO_STR MAC_STR ACCESS_LIST_STR @@ -1004,7 +1004,7 @@ DEFPY_YANG( ALIAS( no_mac_access_list_remark, no_mac_access_list_remark_line_cmd, - "no mac access-list WORD$name remark LINE...", + "no mac access-list ACCESSLIST_MAC_NAME$name remark LINE...", NO_STR MAC_STR ACCESS_LIST_STR diff --git a/lib/routemap_cli.c b/lib/routemap_cli.c index 918a2ebdcb..d7d4a9a81f 100644 --- a/lib/routemap_cli.c +++ b/lib/routemap_cli.c @@ -166,7 +166,7 @@ DEFPY_YANG( DEFPY_YANG( match_ip_address, match_ip_address_cmd, - "match ip address WORD$name", + "match ip address ACCESSLIST4_NAME$name", MATCH_STR IP_STR "Match address of route\n" @@ -186,7 +186,7 @@ DEFPY_YANG( DEFPY_YANG( no_match_ip_address, no_match_ip_address_cmd, - "no match ip address [WORD]", + "no match ip address [ACCESSLIST4_NAME]", NO_STR MATCH_STR IP_STR @@ -243,7 +243,7 @@ DEFPY_YANG( DEFPY_YANG( match_ip_next_hop, match_ip_next_hop_cmd, - "match ip next-hop WORD$name", + "match ip next-hop ACCESSLIST4_NAME$name", MATCH_STR IP_STR "Match next-hop address of route\n" @@ -263,7 +263,7 @@ DEFPY_YANG( DEFPY_YANG( no_match_ip_next_hop, no_match_ip_next_hop_cmd, - "no match ip next-hop [WORD]", + "no match ip next-hop [ACCESSLIST4_NAME]", NO_STR MATCH_STR IP_STR @@ -358,7 +358,7 @@ DEFPY_YANG( DEFPY_YANG( match_ipv6_address, match_ipv6_address_cmd, - "match ipv6 address WORD$name", + "match ipv6 address ACCESSLIST6_NAME$name", MATCH_STR IPV6_STR "Match IPv6 address of route\n" @@ -378,7 +378,7 @@ DEFPY_YANG( DEFPY_YANG( no_match_ipv6_address, no_match_ipv6_address_cmd, - "no match ipv6 address [WORD]", + "no match ipv6 address [ACCESSLIST6_NAME]", NO_STR MATCH_STR IPV6_STR diff --git a/ospf6d/ospf6_area.c b/ospf6d/ospf6_area.c index 6caee259b6..f35971ba8c 100644 --- a/ospf6d/ospf6_area.c +++ b/ospf6d/ospf6_area.c @@ -879,12 +879,12 @@ void ospf6_plist_update(struct prefix_list *plist) DEFUN (area_import_list, area_import_list_cmd, - "area <A.B.C.D|(0-4294967295)> import-list NAME", + "area <A.B.C.D|(0-4294967295)> import-list ACCESSLIST6_NAME", "OSPF6 area parameters\n" "OSPF6 area ID in IP address format\n" "OSPF6 area ID as a decimal value\n" "Set the filter for networks from other areas announced to the specified one\n" - "Name of the acess-list\n") + "Name of the access-list\n") { int idx_ipv4 = 1; int idx_name = 3; @@ -911,7 +911,7 @@ DEFUN (area_import_list, DEFUN (no_area_import_list, no_area_import_list_cmd, - "no area <A.B.C.D|(0-4294967295)> import-list NAME", + "no area <A.B.C.D|(0-4294967295)> import-list ACCESSLIST6_NAME", NO_STR "OSPF6 area parameters\n" "OSPF6 area ID in IP address format\n" @@ -940,12 +940,12 @@ DEFUN (no_area_import_list, DEFUN (area_export_list, area_export_list_cmd, - "area <A.B.C.D|(0-4294967295)> export-list NAME", + "area <A.B.C.D|(0-4294967295)> export-list ACCESSLIST6_NAME", "OSPF6 area parameters\n" "OSPF6 area ID in IP address format\n" "OSPF6 area ID as a decimal value\n" "Set the filter for networks announced to other areas\n" - "Name of the acess-list\n") + "Name of the access-list\n") { int idx_ipv4 = 1; int idx_name = 3; @@ -974,7 +974,7 @@ DEFUN (area_export_list, DEFUN (no_area_export_list, no_area_export_list_cmd, - "no area <A.B.C.D|(0-4294967295)> export-list NAME", + "no area <A.B.C.D|(0-4294967295)> export-list ACCESSLIST6_NAME", NO_STR "OSPF6 area parameters\n" "OSPF6 area ID in IP address format\n" diff --git a/ospf6d/ospf6_gr.h b/ospf6d/ospf6_gr.h index 6406e8efee..28798d8717 100644 --- a/ospf6d/ospf6_gr.h +++ b/ospf6d/ospf6_gr.h @@ -93,7 +93,7 @@ struct tlv_header { #define TLV_BODY_SIZE(tlvh) (ROUNDUP(ntohs((tlvh)->length), sizeof(uint32_t))) -#define TLV_SIZE(tlvh) (TLV_HDR_SIZE + TLV_BODY_SIZE(tlvh)) +#define TLV_SIZE(tlvh) (uint32_t)(TLV_HDR_SIZE + TLV_BODY_SIZE(tlvh)) #define TLV_HDR_TOP(lsah) \ (struct tlv_header *)((char *)(lsah) + OSPF6_LSA_HEADER_SIZE) diff --git a/ospf6d/ospf6_gr_helper.c b/ospf6d/ospf6_gr_helper.c index 78f842db6c..4dc2d8af83 100644 --- a/ospf6d/ospf6_gr_helper.c +++ b/ospf6d/ospf6_gr_helper.c @@ -157,8 +157,18 @@ static int ospf6_extract_grace_lsa_fields(struct ospf6_lsa *lsa, length = ntohs(lsah->length) - OSPF6_LSA_HEADER_SIZE; - for (tlvh = TLV_HDR_TOP(lsah); sum < length; + for (tlvh = TLV_HDR_TOP(lsah); sum < length && tlvh; tlvh = TLV_HDR_NEXT(tlvh)) { + + /* Check TLV len against overall LSA */ + if (sum + TLV_SIZE(tlvh) > length) { + if (IS_DEBUG_OSPF6_GR) + zlog_debug( + "%s: Malformed packet: Invalid TLV len:%d", + __func__, TLV_SIZE(tlvh)); + return OSPF6_FAILURE; + } + switch (ntohs(tlvh->type)) { case GRACE_PERIOD_TYPE: gracePeriod = (struct grace_tlv_graceperiod *)tlvh; @@ -1235,8 +1245,20 @@ static int ospf6_grace_lsa_show_info(struct vty *vty, struct ospf6_lsa *lsa, zlog_debug(" TLV info:"); } - for (tlvh = TLV_HDR_TOP(lsah); sum < length; + for (tlvh = TLV_HDR_TOP(lsah); sum < length && tlvh; tlvh = TLV_HDR_NEXT(tlvh)) { + + /* Check TLV len */ + if (sum + TLV_SIZE(tlvh) > length) { + if (vty) + vty_out(vty, "%% Invalid TLV length: %d\n", + TLV_SIZE(tlvh)); + else if (IS_DEBUG_OSPF6_GR) + zlog_debug("%% Invalid TLV length: %d", + TLV_SIZE(tlvh)); + return OSPF6_FAILURE; + } + switch (ntohs(tlvh->type)) { case GRACE_PERIOD_TYPE: gracePeriod = (struct grace_tlv_graceperiod *)tlvh; diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index bbb458d8ef..e7f18ae79c 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -1775,7 +1775,7 @@ DEFUN (no_ospf_area_default_cost, DEFUN (ospf_area_export_list, ospf_area_export_list_cmd, - "area <A.B.C.D|(0-4294967295)> export-list NAME", + "area <A.B.C.D|(0-4294967295)> export-list ACCESSLIST4_NAME", "OSPF area parameters\n" "OSPF area ID in IP address format\n" "OSPF area ID as a decimal value\n" @@ -1799,7 +1799,7 @@ DEFUN (ospf_area_export_list, DEFUN (no_ospf_area_export_list, no_ospf_area_export_list_cmd, - "no area <A.B.C.D|(0-4294967295)> export-list NAME", + "no area <A.B.C.D|(0-4294967295)> export-list ACCESSLIST4_NAME", NO_STR "OSPF area parameters\n" "OSPF area ID in IP address format\n" @@ -1827,7 +1827,7 @@ DEFUN (no_ospf_area_export_list, DEFUN (ospf_area_import_list, ospf_area_import_list_cmd, - "area <A.B.C.D|(0-4294967295)> import-list NAME", + "area <A.B.C.D|(0-4294967295)> import-list ACCESSLIST4_NAME", "OSPF area parameters\n" "OSPF area ID in IP address format\n" "OSPF area ID as a decimal value\n" @@ -1851,7 +1851,7 @@ DEFUN (ospf_area_import_list, DEFUN (no_ospf_area_import_list, no_ospf_area_import_list_cmd, - "no area <A.B.C.D|(0-4294967295)> import-list NAME", + "no area <A.B.C.D|(0-4294967295)> import-list ACCESSLIST4_NAME", NO_STR "OSPF area parameters\n" "OSPF area ID in IP address format\n" @@ -9347,7 +9347,7 @@ DEFUN (no_ospf_redistribute_instance_source, DEFUN (ospf_distribute_list_out, ospf_distribute_list_out_cmd, - "distribute-list WORD out " FRR_REDIST_STR_OSPFD, + "distribute-list ACCESSLIST4_NAME out " FRR_REDIST_STR_OSPFD, "Filter networks in routing updates\n" "Access-list name\n" OUT_STR @@ -9369,7 +9369,7 @@ DEFUN (ospf_distribute_list_out, DEFUN (no_ospf_distribute_list_out, no_ospf_distribute_list_out_cmd, - "no distribute-list WORD out " FRR_REDIST_STR_OSPFD, + "no distribute-list ACCESSLIST4_NAME out " FRR_REDIST_STR_OSPFD, NO_STR "Filter networks in routing updates\n" "Access-list name\n" @@ -9863,161 +9863,10 @@ DEFUN (no_ospf_proactive_arp, return CMD_SUCCESS; } -/* Graceful Restart HELPER Commands */ -DEFPY(ospf_gr_helper_enable, ospf_gr_helper_enable_cmd, - "graceful-restart helper enable [A.B.C.D$address]", - "OSPF Graceful Restart\n" - "OSPF GR Helper\n" - "Enable Helper support\n" - "Advertising Router-ID\n") -{ - VTY_DECLVAR_INSTANCE_CONTEXT(ospf, ospf); - - if (address_str) { - ospf_gr_helper_support_set_per_routerid(ospf, &address, - OSPF_GR_TRUE); - return CMD_SUCCESS; - } - - ospf_gr_helper_support_set(ospf, OSPF_GR_TRUE); - - return CMD_SUCCESS; -} - -DEFPY(no_ospf_gr_helper_enable, - no_ospf_gr_helper_enable_cmd, - "no graceful-restart helper enable [A.B.C.D$address]", - NO_STR - "OSPF Graceful Restart\n" - "OSPF GR Helper\n" - "Enable Helper support\n" - "Advertising Router-ID\n") -{ - VTY_DECLVAR_INSTANCE_CONTEXT(ospf, ospf); - - if (address_str) { - ospf_gr_helper_support_set_per_routerid(ospf, &address, - OSPF_GR_FALSE); - return CMD_SUCCESS; - } - - ospf_gr_helper_support_set(ospf, OSPF_GR_FALSE); - return CMD_SUCCESS; -} - -#if CONFDATE > 20220921 -CPP_NOTICE( - "Time to remove the deprecated \"[no] graceful-restart helper-only\" commands") +#if CONFDATE > 20211209 +CPP_NOTICE("Time to remove broken OSPF GR helper") #endif -DEFPY_HIDDEN(ospf_gr_helper_only, ospf_gr_helper_only_cmd, - "graceful-restart helper-only [A.B.C.D]", - "OSPF Graceful Restart\n" - "Enable Helper support\n" - "Advertising router id\n") -{ - VTY_DECLVAR_INSTANCE_CONTEXT(ospf, ospf); - struct in_addr addr; - int ret; - - vty_out(vty, - "%% This command is deprecated. Please, use `graceful-restart helper enable` instead.\n"); - - if (argc == 3) { - ret = inet_aton(argv[2]->arg, &addr); - if (!ret) { - vty_out(vty, - "Please specify the valid routerid address.\n"); - return CMD_WARNING_CONFIG_FAILED; - } - - ospf_gr_helper_support_set_per_routerid(ospf, &addr, OSPF_GR_TRUE); - return CMD_SUCCESS; - } - - ospf_gr_helper_support_set(ospf, OSPF_GR_TRUE); - - return CMD_SUCCESS; -} - -ALIAS_HIDDEN(no_ospf_gr_helper_enable, - no_ospf_gr_helper_only_cmd, - "no graceful-restart helper-only [A.B.C.D]", - NO_STR - "OSPF Graceful Restart\n" - "Disable Helper support\n" - "Advertising router id\n") - -DEFPY(ospf_gr_helper_enable_lsacheck, - ospf_gr_helper_enable_lsacheck_cmd, - "graceful-restart helper strict-lsa-checking", - "OSPF Graceful Restart\n" - "OSPF GR Helper\n" - "Enable strict LSA check\n") -{ - VTY_DECLVAR_INSTANCE_CONTEXT(ospf, ospf); - - ospf_gr_helper_lsa_check_set(ospf, OSPF_GR_TRUE); - return CMD_SUCCESS; -} - -DEFPY(no_ospf_gr_helper_enable_lsacheck, - no_ospf_gr_helper_enable_lsacheck_cmd, - "no graceful-restart helper strict-lsa-checking", - NO_STR - "OSPF Graceful Restart\n" - "OSPF GR Helper\n" - "Disable strict LSA check\n") -{ - VTY_DECLVAR_INSTANCE_CONTEXT(ospf, ospf); - - ospf_gr_helper_lsa_check_set(ospf, OSPF_GR_FALSE); - return CMD_SUCCESS; -} - -DEFPY(ospf_gr_helper_supported_grace_time, - ospf_gr_helper_supported_grace_time_cmd, - "graceful-restart helper supported-grace-time (10-1800)$interval", - "OSPF Graceful Restart\n" - "OSPF GR Helper\n" - "Supported grace timer\n" - "Grace interval(in seconds)\n") -{ - VTY_DECLVAR_INSTANCE_CONTEXT(ospf, ospf); - - ospf_gr_helper_supported_gracetime_set(ospf, interval); - return CMD_SUCCESS; -} - -DEFPY(no_ospf_gr_helper_supported_grace_time, - no_ospf_gr_helper_supported_grace_time_cmd, - "no graceful-restart helper supported-grace-time (10-1800)$interval", - NO_STR - "OSPF Graceful Restart\n" - "OSPF GR Helper\n" - "Supported grace timer\n" - "Grace interval(in seconds)\n") -{ - VTY_DECLVAR_INSTANCE_CONTEXT(ospf, ospf); - - ospf_gr_helper_supported_gracetime_set(ospf, OSPF_MAX_GRACE_INTERVAL); - return CMD_SUCCESS; -} - -DEFPY(ospf_gr_helper_planned_only, - ospf_gr_helper_planned_only_cmd, - "graceful-restart helper planned-only", - "OSPF Graceful Restart\n" - "OSPF GR Helper\n" - "Supported only planned restart\n") -{ - VTY_DECLVAR_INSTANCE_CONTEXT(ospf, ospf); - - ospf_gr_helper_set_supported_planned_only_restart(ospf, OSPF_GR_TRUE); - - return CMD_SUCCESS; -} - /* External Route Aggregation */ DEFUN (ospf_external_route_aggregation, ospf_external_route_aggregation_cmd, @@ -10100,256 +9949,6 @@ DEFUN (no_ospf_external_route_aggregation, return CMD_SUCCESS; } -DEFPY(no_ospf_gr_helper_planned_only, - no_ospf_gr_helper_planned_only_cmd, - "no graceful-restart helper planned-only", - NO_STR - "OSPF Graceful Restart\n" - "OSPF GR Helper\n" - "Supported only for planned restart\n") -{ - VTY_DECLVAR_INSTANCE_CONTEXT(ospf, ospf); - - ospf_gr_helper_set_supported_planned_only_restart(ospf, OSPF_GR_FALSE); - - return CMD_SUCCESS; -} - -static int ospf_print_vty_helper_dis_rtr_walkcb(struct hash_bucket *bucket, - void *arg) -{ - struct advRtr *rtr = bucket->data; - struct vty *vty = (struct vty *)arg; - static unsigned int count; - - vty_out(vty, "%-6pI4,", &rtr->advRtrAddr); - count++; - - if (count % 5 == 0) - vty_out(vty, "\n"); - - return HASHWALK_CONTINUE; -} - -static int ospf_show_gr_helper_details(struct vty *vty, struct ospf *ospf, - uint8_t use_vrf, json_object *json, - bool uj, bool detail) -{ - struct listnode *node; - struct ospf_interface *oi; - char buf[PREFIX_STRLEN]; - json_object *json_vrf = NULL; - - if (uj) { - if (use_vrf) - json_vrf = json_object_new_object(); - else - json_vrf = json; - } - - if (ospf->instance) { - if (uj) - json_object_int_add(json, "ospfInstance", - ospf->instance); - else - vty_out(vty, "\nOSPF Instance: %d\n\n", ospf->instance); - } - - ospf_show_vrf_name(ospf, vty, json_vrf, use_vrf); - - if (uj) { - if (use_vrf) - json_object_object_add(json, ospf_get_name(ospf), - json_vrf); - } else - vty_out(vty, "\n"); - - /* Show Router ID. */ - if (uj) { - json_object_string_add(json_vrf, "routerId", - inet_ntop(AF_INET, &ospf->router_id, - buf, sizeof(buf))); - } else { - vty_out(vty, "\n OSPF Router with ID (%pI4)\n\n", - &ospf->router_id); - } - - if (!uj) { - - if (ospf->is_helper_supported) - vty_out(vty, - " Graceful restart helper support enabled.\n"); - else - vty_out(vty, - " Graceful restart helper support disabled.\n"); - - if (ospf->strict_lsa_check) - vty_out(vty, " Strict LSA check is enabled.\n"); - else - vty_out(vty, " Strict LSA check is disabled.\n"); - - if (ospf->only_planned_restart) - vty_out(vty, - " Helper supported for planned restarts only.\n"); - else - vty_out(vty, - " Helper supported for Planned and Unplanned Restarts.\n"); - - vty_out(vty, - " Supported Graceful restart interval: %d(in seconds).\n", - ospf->supported_grace_time); - - if (OSPF_HELPER_ENABLE_RTR_COUNT(ospf)) { - vty_out(vty, " Enable Router list:\n"); - vty_out(vty, " "); - hash_walk(ospf->enable_rtr_list, - ospf_print_vty_helper_dis_rtr_walkcb, vty); - vty_out(vty, "\n\n"); - } - - if (ospf->last_exit_reason != OSPF_GR_HELPER_EXIT_NONE) { - vty_out(vty, " Last Helper exit Reason :%s\n", - ospf_exit_reason2str(ospf->last_exit_reason)); - } - - if (ospf->active_restarter_cnt) - vty_out(vty, - " Number of Active neighbours in graceful restart: %d\n", - ospf->active_restarter_cnt); - else - vty_out(vty, "\n"); - - } else { - json_object_string_add( - json_vrf, "helperSupport", - (ospf->is_helper_supported) ? "Enabled" : "Disabled"); - json_object_string_add(json_vrf, "strictLsaCheck", - (ospf->strict_lsa_check) ? "Enabled" - : "Disabled"); - json_object_string_add( - json_vrf, "restartSupoort", - (ospf->only_planned_restart) - ? "Planned Restart only" - : "Planned and Unplanned Restarts"); - - json_object_int_add(json_vrf, "supportedGracePeriod", - ospf->supported_grace_time); - - if (ospf->last_exit_reason != OSPF_GR_HELPER_EXIT_NONE) - json_object_string_add( - json_vrf, "LastExitReason", - ospf_exit_reason2str(ospf->last_exit_reason)); - - if (ospf->active_restarter_cnt) - json_object_int_add(json_vrf, "activeRestarterCnt", - ospf->active_restarter_cnt); - } - - - if (detail) { - int cnt = 1; - json_object *json_neighbors = NULL; - - for (ALL_LIST_ELEMENTS_RO(ospf->oiflist, node, oi)) { - struct route_node *rn; - struct ospf_neighbor *nbr; - json_object *json_neigh; - - if (ospf_interface_neighbor_count(oi) == 0) - continue; - - if (uj) { - json_object_object_get_ex(json_vrf, "Neighbors", - &json_neighbors); - if (!json_neighbors) { - json_neighbors = - json_object_new_object(); - json_object_object_add(json_vrf, - "Neighbors", - json_neighbors); - } - } - - for (rn = route_top(oi->nbrs); rn; - rn = route_next(rn)) { - - if (!rn->info) - continue; - - nbr = rn->info; - - if (!OSPF_GR_IS_ACTIVE_HELPER(nbr)) - continue; - - if (!uj) { - vty_out(vty, " Neighbour %d :\n", cnt); - vty_out(vty, " Address : %pI4\n", - &nbr->address.u.prefix4); - vty_out(vty, " Routerid : %pI4\n", - &nbr->router_id); - vty_out(vty, - " Received Grace period : %d(in seconds).\n", - nbr->gr_helper_info - .recvd_grace_period); - vty_out(vty, - " Actual Grace period : %d(in seconds)\n", - nbr->gr_helper_info - .actual_grace_period); - vty_out(vty, - " Remaining GraceTime:%ld(in seconds).\n", - thread_timer_remain_second( - nbr->gr_helper_info - .t_grace_timer)); - vty_out(vty, - " Graceful Restart reason: %s.\n\n", - ospf_restart_reason2str( - nbr->gr_helper_info - .gr_restart_reason)); - cnt++; - } else { - json_neigh = json_object_new_object(); - json_object_string_add( - json_neigh, "srcAddr", - inet_ntop(AF_INET, &nbr->src, - buf, sizeof(buf))); - - json_object_string_add( - json_neigh, "routerid", - inet_ntop(AF_INET, - &nbr->router_id, - buf, sizeof(buf))); - json_object_int_add( - json_neigh, - "recvdGraceInterval", - nbr->gr_helper_info - .recvd_grace_period); - json_object_int_add( - json_neigh, - "actualGraceInterval", - nbr->gr_helper_info - .actual_grace_period); - json_object_int_add( - json_neigh, "remainGracetime", - thread_timer_remain_second( - nbr->gr_helper_info - .t_grace_timer)); - json_object_string_add( - json_neigh, "restartReason", - ospf_restart_reason2str( - nbr->gr_helper_info - .gr_restart_reason)); - json_object_object_add( - json_neighbors, - inet_ntop(AF_INET, &nbr->src, - buf, sizeof(buf)), - json_neigh); - } - } - } - } - return CMD_SUCCESS; -} - DEFUN (ospf_external_route_aggregation_no_adrvertise, ospf_external_route_aggregation_no_adrvertise_cmd, "summary-address A.B.C.D/M no-advertise", @@ -10438,108 +10037,6 @@ DEFUN (ospf_route_aggregation_timer, return CMD_SUCCESS; } -DEFPY (show_ip_ospf_gr_helper, - show_ip_ospf_gr_helper_cmd, - "show ip ospf [vrf <NAME|all>] graceful-restart helper [detail] [json]", - SHOW_STR - IP_STR - "OSPF information\n" - VRF_CMD_HELP_STR - "All VRFs\n" - "OSPF Graceful Restart\n" - "Helper details in the router\n" - "Detailed informtion\n" - JSON_STR) -{ - char *vrf_name = NULL; - bool all_vrf = false; - int ret = CMD_SUCCESS; - int idx_vrf = 0; - int idx = 0; - uint8_t use_vrf = 0; - bool uj = use_json(argc, argv); - struct ospf *ospf = NULL; - json_object *json = NULL; - struct listnode *node = NULL; - int inst = 0; - bool detail = false; - - OSPF_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf); - - if (argv_find(argv, argc, "detail", &idx)) - detail = true; - - if (uj) - json = json_object_new_object(); - - /* vrf input is provided */ - if (vrf_name) { - use_vrf = 1; - - if (all_vrf) { - for (ALL_LIST_ELEMENTS_RO(om->ospf, node, ospf)) { - if (!ospf->oi_running) - continue; - - ret = ospf_show_gr_helper_details( - vty, ospf, use_vrf, json, uj, detail); - } - - if (uj) { - vty_out(vty, "%s\n", - json_object_to_json_string_ext( - json, JSON_C_TO_STRING_PRETTY)); - json_object_free(json); - } - - return ret; - } - - ospf = ospf_lookup_by_inst_name(inst, vrf_name); - - if (ospf == NULL || !ospf->oi_running) { - - if (uj) { - vty_out(vty, "%s\n", - json_object_to_json_string_ext( - json, JSON_C_TO_STRING_PRETTY)); - json_object_free(json); - } else - vty_out(vty, "%% OSPF instance not found\n"); - - return CMD_SUCCESS; - } - - } else { - /* Default Vrf */ - ospf = ospf_lookup_by_vrf_id(VRF_DEFAULT); - - if (ospf == NULL || !ospf->oi_running) { - - if (uj) { - vty_out(vty, "%s\n", - json_object_to_json_string_ext( - json, JSON_C_TO_STRING_PRETTY)); - json_object_free(json); - } else - vty_out(vty, "%% OSPF instance not found\n"); - - return CMD_SUCCESS; - } - - ospf_show_gr_helper_details(vty, ospf, use_vrf, json, uj, - detail); - } - - if (uj) { - vty_out(vty, "%s\n", json_object_to_json_string_ext( - json, JSON_C_TO_STRING_PRETTY)); - json_object_free(json); - } - - return CMD_SUCCESS; -} -/* Graceful Restart HELPER commands end */ DEFUN (no_ospf_route_aggregation_timer, no_ospf_route_aggregation_timer_cmd, "no aggregation timer", @@ -12608,9 +12105,6 @@ void ospf_vty_show_init(void) /* "show ip ospf vrfs" commands. */ install_element(VIEW_NODE, &show_ip_ospf_vrfs_cmd); - /* "show ip ospf gr-helper details" command */ - install_element(VIEW_NODE, &show_ip_ospf_gr_helper_cmd); - /* "show ip ospf summary-address" command */ install_element(VIEW_NODE, &show_ip_ospf_external_aggregator_cmd); } @@ -12721,18 +12215,6 @@ static void ospf_vty_zebra_init(void) install_element(OSPF_NODE, &no_ospf_distance_ospf_cmd); install_element(OSPF_NODE, &ospf_distance_ospf_cmd); - /*Ospf garcefull restart helper configurations */ - install_element(OSPF_NODE, &ospf_gr_helper_enable_cmd); - install_element(OSPF_NODE, &no_ospf_gr_helper_enable_cmd); - install_element(OSPF_NODE, &ospf_gr_helper_only_cmd); - install_element(OSPF_NODE, &no_ospf_gr_helper_only_cmd); - install_element(OSPF_NODE, &ospf_gr_helper_enable_lsacheck_cmd); - install_element(OSPF_NODE, &no_ospf_gr_helper_enable_lsacheck_cmd); - install_element(OSPF_NODE, &ospf_gr_helper_supported_grace_time_cmd); - install_element(OSPF_NODE, &no_ospf_gr_helper_supported_grace_time_cmd); - install_element(OSPF_NODE, &ospf_gr_helper_planned_only_cmd); - install_element(OSPF_NODE, &no_ospf_gr_helper_planned_only_cmd); - /* External LSA summarisation config commands.*/ install_element(OSPF_NODE, &ospf_external_route_aggregation_cmd); install_element(OSPF_NODE, &no_ospf_external_route_aggregation_cmd); diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c index 4cd94e0df9..e5ee7a82ad 100644 --- a/pimd/pim_cmd.c +++ b/pimd/pim_cmd.c @@ -2446,8 +2446,6 @@ static const char *pim_reg_state2brief_str(enum pim_reg_state reg_state, case PIM_REG_PRUNE: strlcpy(state_str, "RegP", state_str_len); break; - default: - strlcpy(state_str, "Unk", state_str_len); } return state_str; } diff --git a/pimd/pim_msdp.c b/pimd/pim_msdp.c index ddba33ff9d..fa7f1da79a 100644 --- a/pimd/pim_msdp.c +++ b/pimd/pim_msdp.c @@ -1304,7 +1304,6 @@ int pim_msdp_config_write(struct pim_instance *pim, struct vty *vty, struct pim_msdp_mg *mg; struct listnode *mbrnode; struct pim_msdp_mg_mbr *mbr; - char mbr_str[INET_ADDRSTRLEN]; char src_str[INET_ADDRSTRLEN]; int count = 0; @@ -1321,10 +1320,8 @@ int pim_msdp_config_write(struct pim_instance *pim, struct vty *vty, } for (ALL_LIST_ELEMENTS_RO(mg->mbr_list, mbrnode, mbr)) { - pim_inet4_dump("<mbr?>", mbr->mbr_ip, mbr_str, - sizeof(mbr_str)); - vty_out(vty, "%sip msdp mesh-group %s member %s\n", - spaces, mg->mesh_group_name, mbr_str); + vty_out(vty, "%sip msdp mesh-group %s member %pI4\n", + spaces, mg->mesh_group_name, &mbr->mbr_ip); ++count; } } diff --git a/pimd/pim_upstream.c b/pimd/pim_upstream.c index d21c7b4008..d0d120523d 100644 --- a/pimd/pim_upstream.c +++ b/pimd/pim_upstream.c @@ -1720,8 +1720,6 @@ const char *pim_reg_state2str(enum pim_reg_state reg_state, char *state_str, case PIM_REG_PRUNE: strlcpy(state_str, "RegPrune", state_str_len); break; - default: - strlcpy(state_str, "RegUnknown", state_str_len); } return state_str; } @@ -1785,7 +1783,7 @@ static int pim_upstream_register_stop_timer(struct thread *t) } pim_null_register_send(up); break; - default: + case PIM_REG_NOINFO: break; } diff --git a/ripd/rip_cli.c b/ripd/rip_cli.c index 5590b1833d..58c28e54c0 100644 --- a/ripd/rip_cli.c +++ b/ripd/rip_cli.c @@ -327,7 +327,7 @@ void cli_show_rip_network_interface(struct vty *vty, */ DEFPY_YANG (rip_offset_list, rip_offset_list_cmd, - "[no] offset-list WORD$acl <in|out>$direction (0-16)$metric [IFNAME]", + "[no] offset-list ACCESSLIST4_NAME$acl <in|out>$direction (0-16)$metric [IFNAME]", NO_STR "Modify RIP metric\n" "Access-list name\n" @@ -1026,7 +1026,7 @@ DEFPY_YANG (clear_ip_rip, DEFUN (rip_distribute_list, rip_distribute_list_cmd, - "distribute-list [prefix] WORD <in|out> [WORD]", + "distribute-list [prefix] ACCESSLIST4_NAME <in|out> [WORD]", "Filter networks in routing updates\n" "Specify a prefix\n" "Access-list name\n" @@ -1046,7 +1046,7 @@ DEFUN (rip_distribute_list, DEFUN (rip_no_distribute_list, rip_no_distribute_list_cmd, - "no distribute-list [prefix] WORD <in|out> [WORD]", + "no distribute-list [prefix] ACCESSLIST4_NAME <in|out> [WORD]", NO_STR "Filter networks in routing updates\n" "Specify a prefix\n" diff --git a/ripngd/ripng_cli.c b/ripngd/ripng_cli.c index 63b75e723d..5bf3103a78 100644 --- a/ripngd/ripng_cli.c +++ b/ripngd/ripng_cli.c @@ -233,7 +233,7 @@ void cli_show_ripng_network_interface(struct vty *vty, */ DEFPY_YANG (ripng_offset_list, ripng_offset_list_cmd, - "[no] offset-list WORD$acl <in|out>$direction (0-16)$metric [IFNAME]", + "[no] offset-list ACCESSLIST6_NAME$acl <in|out>$direction (0-16)$metric [IFNAME]", NO_STR "Modify RIPng metric\n" "Access-list name\n" @@ -511,7 +511,7 @@ DEFPY_YANG (clear_ipv6_rip, DEFUN (ripng_ipv6_distribute_list, ripng_ipv6_distribute_list_cmd, - "ipv6 distribute-list [prefix] WORD <in|out> [WORD]", + "ipv6 distribute-list [prefix] ACCESSLIST6_NAME <in|out> [WORD]", "IPv6\n" "Filter networks in routing updates\n" "Specify a prefix\n" @@ -532,7 +532,7 @@ DEFUN (ripng_ipv6_distribute_list, DEFUN (ripng_no_ipv6_distribute_list, ripng_no_ipv6_distribute_list_cmd, - "no ipv6 distribute-list [prefix] WORD <in|out> [WORD]", + "no ipv6 distribute-list [prefix] ACCESSLIST6_NAME <in|out> [WORD]", NO_STR "IPv6\n" "Filter networks in routing updates\n" diff --git a/tests/topotests/lib/bgprib.py b/tests/topotests/lib/bgprib.py index a216e3588e..35a57d0a99 100644 --- a/tests/topotests/lib/bgprib.py +++ b/tests/topotests/lib/bgprib.py @@ -122,7 +122,7 @@ class BgpRib: luResult(target, True, title, logstr) def RequireUnicastRoutes(self, target, afi, vrf, title, wantroutes, debug=0): - logstr = "RequireVpnRoutes %s" % str(wantroutes) + logstr = "RequireUnicastRoutes %s" % str(wantroutes) vrfstr = "" if vrf != "": vrfstr = "vrf %s" % (vrf) diff --git a/tests/topotests/ospf_gr_helper/test_ospf_gr_helper.py b/tests/topotests/ospf_gr_helper/test_ospf_gr_helper.py index 2c7c6df37e..b7a10d630a 100644 --- a/tests/topotests/ospf_gr_helper/test_ospf_gr_helper.py +++ b/tests/topotests/ospf_gr_helper/test_ospf_gr_helper.py @@ -100,6 +100,8 @@ TC8. Verify helper functionality when dut is helping RR and new grace lsa def setup_module(mod): + return pytest.skip("OSPF GR helper mode is currently broken") + """ Sets up the pytest environment diff --git a/tests/topotests/ospf_gr_topo1/test_ospf_gr_topo1.py b/tests/topotests/ospf_gr_topo1/test_ospf_gr_topo1.py index debf7ad766..4b69d82887 100755 --- a/tests/topotests/ospf_gr_topo1/test_ospf_gr_topo1.py +++ b/tests/topotests/ospf_gr_topo1/test_ospf_gr_topo1.py @@ -139,6 +139,8 @@ def build_topo(tgen): def setup_module(mod): + return pytest.skip("OSPF GR helper mode is currently broken") + "Sets up the pytest environment" tgen = Topogen(build_topo, mod.__name__) tgen.start_topology() diff --git a/zebra/rtadv.c b/zebra/rtadv.c index 9610f71d09..ab3e55d100 100644 --- a/zebra/rtadv.c +++ b/zebra/rtadv.c @@ -493,8 +493,8 @@ static int rtadv_timer(struct thread *thread) RB_FOREACH (vrf, vrf_id_head, &vrfs_by_id) FOR_ALL_INTERFACES (vrf, ifp) { - if (if_is_loopback_or_vrf(ifp) - || !if_is_operative(ifp)) + if (if_is_loopback_or_vrf(ifp) || !if_is_operative(ifp) + || (vrf_is_backend_netns() && ifp->vrf_id != zvrf->vrf->vrf_id)) continue; zif = ifp->info; |
