diff options
-rw-r--r-- | bgpd/bgp_bfd.c | 4 | ||||
-rw-r--r-- | bgpd/bgp_dump.c | 4 | ||||
-rw-r--r-- | bgpd/bgp_route.c | 6 | ||||
-rw-r--r-- | bgpd/bgp_vty.c | 263 | ||||
-rw-r--r-- | bgpd/bgp_vty.h | 7 | ||||
-rw-r--r-- | bgpd/rfapi/bgp_rfapi_cfg.c | 50 | ||||
-rw-r--r-- | bgpd/rfapi/rfapi.c | 6 | ||||
-rw-r--r-- | bgpd/rfapi/rfapi_vty.c | 4 | ||||
-rw-r--r-- | bgpd/rfapi/vnc_debug.c | 6 | ||||
-rw-r--r-- | isisd/isis_spf.c | 2 | ||||
-rw-r--r-- | lib/command.c | 4 | ||||
-rw-r--r-- | nhrpd/nhrp_vty.c | 2 | ||||
-rw-r--r-- | ospf6d/ospf6_lsa.c | 12 | ||||
-rw-r--r-- | ospf6d/ospf6_route.c | 16 | ||||
-rw-r--r-- | ospfd/ospf_vty.c | 6 | ||||
-rw-r--r-- | zebra/zebra_vty.c | 16 |
16 files changed, 151 insertions, 257 deletions
diff --git a/bgpd/bgp_bfd.c b/bgpd/bgp_bfd.c index 08cdee76f..bc0b80cde 100644 --- a/bgpd/bgp_bfd.c +++ b/bgpd/bgp_bfd.c @@ -629,9 +629,9 @@ DEFUN_HIDDEN (neighbor_bfd_type, if (!peer) return CMD_WARNING; - if (!strcmp(argv[idx_hop]->arg, "singlehop")) + if (strmatch(argv[idx_hop]->text, "singlehop")) type = BFD_TYPE_SINGLEHOP; - else if (!strcmp(argv[idx_hop]->arg, "multihop")) + else if (strmatch(argv[idx_hop]->text, "multihop")) type = BFD_TYPE_MULTIHOP; else return CMD_WARNING; diff --git a/bgpd/bgp_dump.c b/bgpd/bgp_dump.c index bf26fddf9..31f9141a8 100644 --- a/bgpd/bgp_dump.c +++ b/bgpd/bgp_dump.c @@ -753,7 +753,7 @@ DEFUN (dump_bgp_all, const struct bgp_dump_type_map *map = NULL; for (map = bgp_dump_type_map; map->str; map++) - if (strcmp(argv[idx_dump_routes]->arg, map->str) == 0) + if (strmatch(argv[idx_dump_routes]->text, map->str)) bgp_dump_type = map->type; switch (bgp_dump_type) @@ -800,7 +800,7 @@ DEFUN (no_dump_bgp_all, struct bgp_dump *bgp_dump_struct = NULL; for (map = bgp_dump_type_map; map->str; map++) - if (strcmp(argv[idx_dump_routes]->arg, map->str) == 0) + if (strmatch(argv[idx_dump_routes]->text, map->str)) bgp_dump_type = map->type; switch (bgp_dump_type) diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 52415375a..55c142272 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -8463,7 +8463,7 @@ DEFUN (show_ip_bgp_large_community_list, { afi = strmatch(argv[idx]->text, "ipv6") ? AFI_IP6 : AFI_IP; if (argv_find (argv, argc, "unicast", &idx) || argv_find (argv, argc, "multicast", &idx)) - safi = bgp_vty_safi_from_arg (argv[idx]->text); + safi = bgp_vty_safi_from_str (argv[idx]->text); } int uj = use_json (argc, argv); @@ -8508,7 +8508,7 @@ DEFUN (show_ip_bgp_large_community, { afi = strmatch(argv[idx]->text, "ipv6") ? AFI_IP6 : AFI_IP; if (argv_find (argv, argc, "unicast", &idx) || argv_find (argv, argc, "multicast", &idx)) - safi = bgp_vty_safi_from_arg (argv[idx]->text); + safi = bgp_vty_safi_from_str (argv[idx]->text); } int uj = use_json (argc, argv); @@ -8867,7 +8867,7 @@ bgp_show_community (struct vty *vty, struct bgp *bgp, int argc, buffer_putc (b, ' '); else { - if ((strcmp (argv[i]->arg, "unicast") == 0) || (strcmp (argv[i]->arg, "multicast") == 0)) + if (strmatch(argv[i]->text, "unicast") || strmatch(argv[i]->text, "multicast")) continue; first = 1; } diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 190e947c5..01422f392 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -166,34 +166,26 @@ bgp_node_safi (struct vty *vty) return safi; } -/* supports <ipv4|ipv6> */ +/** + * Converts an AFI in string form to afi_t + * + * @param afi string, one of + * - "ipv4" + * - "ipv6" + * @return the corresponding afi_t + */ afi_t -bgp_vty_afi_from_arg(const char *afi_str) +bgp_vty_afi_from_str(const char *afi_str) { - afi_t afi = AFI_MAX; /* unknown */ - if (!strcmp(afi_str, "ipv4")) { + afi_t afi = AFI_MAX; /* unknown */ + if (strmatch(afi_str, "ipv4")) afi = AFI_IP; - } - else if (!strcmp(afi_str, "ipv6")) { + else if (strmatch(afi_str, "ipv6")) afi = AFI_IP6; - } - else if (!strcmp(afi_str, "l2vpn")) { - afi = AFI_L2VPN; - } return afi; } int -bgp_parse_afi(const char *str, afi_t *afi) -{ - *afi = bgp_vty_afi_from_arg(str); - if (*afi != AFI_MAX) - return 0; - else - return -1; -} - -int argv_find_and_parse_afi(struct cmd_token **argv, int argc, int *index, afi_t *afi) { int ret = 0; @@ -214,16 +206,16 @@ argv_find_and_parse_afi(struct cmd_token **argv, int argc, int *index, afi_t *af /* supports <unicast|multicast|vpn|labeled-unicast> */ safi_t -bgp_vty_safi_from_arg(const char *safi_str) +bgp_vty_safi_from_str(const char *safi_str) { safi_t safi = SAFI_MAX; /* unknown */ - if (strncmp (safi_str, "m", 1) == 0) + if (strmatch (safi_str, "multicast")) safi = SAFI_MULTICAST; - else if (strncmp (safi_str, "u", 1) == 0) + else if (strmatch (safi_str, "unicast")) safi = SAFI_UNICAST; - else if (strncmp (safi_str, "v", 1) == 0) + else if (strmatch (safi_str, "vpn")) safi = SAFI_MPLS_VPN; - else if (strncmp (safi_str, "l", 1) == 0) + else if (strmatch (safi_str, "labeled-unicast")) safi = SAFI_LABELED_UNICAST; return safi; } @@ -256,12 +248,6 @@ argv_find_and_parse_safi (struct cmd_token **argv, int argc, int *index, safi_t if (safi) *safi = SAFI_MPLS_VPN; } - else if (argv_find (argv, argc, "evpn", index)) - { - ret = 1; - if (safi) - *safi = SAFI_EVPN; - } return ret; } @@ -819,8 +805,8 @@ DEFUN (bgp_config_type, "cisco\n" "zebra\n") { - int idx_vendor = 2; - if (strncmp (argv[idx_vendor]->arg, "c", 1) == 0) + int idx = 0; + if (argv_find (argv, argc, "cisco", &idx)) bgp_option_set (BGP_OPT_CONFIG_CISCO); else bgp_option_unset (BGP_OPT_CONFIG_CISCO); @@ -3684,11 +3670,11 @@ DEFUN (neighbor_capability_orf_prefix, int idx_send_recv = 5; u_int16_t flag = 0; - if (strncmp (argv[idx_send_recv]->arg, "s", 1) == 0) + if (strmatch (argv[idx_send_recv]->text, "send")) flag = PEER_FLAG_ORF_PREFIX_SM; - else if (strncmp (argv[idx_send_recv]->arg, "r", 1) == 0) + else if (strmatch (argv[idx_send_recv]->text, "receive")) flag = PEER_FLAG_ORF_PREFIX_RM; - else if (strncmp (argv[idx_send_recv]->arg, "b", 1) == 0) + else if (strmatch (argv[idx_send_recv]->text, "both")) flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM; else return CMD_WARNING; @@ -3726,11 +3712,11 @@ DEFUN (no_neighbor_capability_orf_prefix, int idx_send_recv = 6; u_int16_t flag = 0; - if (strncmp (argv[idx_send_recv]->arg, "s", 1) == 0) + if (strmatch (argv[idx_send_recv]->text, "send")) flag = PEER_FLAG_ORF_PREFIX_SM; - else if (strncmp (argv[idx_send_recv]->arg, "r", 1) == 0) + else if (strmatch (argv[idx_send_recv]->text, "receive")) flag = PEER_FLAG_ORF_PREFIX_RM; - else if (strncmp (argv[idx_send_recv]->arg, "b", 1) == 0) + else if (strmatch (argv[idx_send_recv]->text, "both")) flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM; else return CMD_WARNING; @@ -4178,25 +4164,28 @@ DEFUN (no_neighbor_send_community_type, "Send Large Community attributes\n") { int idx_peer = 2; - int idx_type = 4; - if (strncmp (argv[idx_type]->arg, "s", 1) == 0) + + const char *type = argv[argc - 1]->text; + + if (strmatch (type, "standard")) return peer_af_flag_unset_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), bgp_node_safi (vty), PEER_FLAG_SEND_COMMUNITY); - if (strncmp (argv[idx_type]->arg, "e", 1) == 0) + if (strmatch (type, "extended")) return peer_af_flag_unset_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), bgp_node_safi (vty), PEER_FLAG_SEND_EXT_COMMUNITY); - if (strncmp (argv[idx_type]->arg, "l", 1) == 0) + if (strmatch (type, "large")) return peer_af_flag_unset_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), bgp_node_safi (vty), PEER_FLAG_SEND_LARGE_COMMUNITY); - if (strncmp (argv[idx_type]->arg, "b", 1) == 0) + if (strmatch (type, "both")) return peer_af_flag_unset_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), bgp_node_safi (vty), PEER_FLAG_SEND_COMMUNITY | PEER_FLAG_SEND_EXT_COMMUNITY); + /* if (strmatch (type, "all")) */ return peer_af_flag_unset_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), bgp_node_safi (vty), (PEER_FLAG_SEND_COMMUNITY | @@ -4392,30 +4381,13 @@ DEFUN (no_neighbor_nexthop_local_unchanged, DEFUN (neighbor_attr_unchanged, neighbor_attr_unchanged_cmd, - "neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged\ - [<\ - as-path [<next-hop [med]|med [next-hop]>]|\ - next-hop [<as-path [med]|med [as-path]>]|\ - med [<as-path [next-hop]|next-hop [as-path]>]\ - >]", + "neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged [{as-path|next-hop|med}]", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "BGP attribute is propagated unchanged to this neighbor\n" "As-path attribute\n" "Nexthop attribute\n" - "Med attribute\n" - "Med attribute\n" - "Nexthop attribute\n" - "Nexthop attribute\n" - "As-path attribute\n" - "Med attribute\n" - "Med attribute\n" - "As-path attribute\n" - "Med attribute\n" - "As-path attribute\n" - "Nexthop attribute\n" - "Nexthop attribute\n" - "As-path attribute\n") + "Med attribute\n") { int idx = 0; char *peer = argv[1]->arg; @@ -4442,58 +4414,24 @@ DEFUN (neighbor_attr_unchanged, ALIAS_HIDDEN (neighbor_attr_unchanged, neighbor_attr_unchanged_hidden_cmd, - "neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged\ - [<\ - as-path [<next-hop [med]|med [next-hop]>]|\ - next-hop [<as-path [med]|med [as-path]>]|\ - med [<as-path [next-hop]|next-hop [as-path]>]\ - >]", + "neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged [{as-path|next-hop|med}]", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "BGP attribute is propagated unchanged to this neighbor\n" "As-path attribute\n" "Nexthop attribute\n" - "Med attribute\n" - "Med attribute\n" - "Nexthop attribute\n" - "Nexthop attribute\n" - "As-path attribute\n" - "Med attribute\n" - "Med attribute\n" - "As-path attribute\n" - "Med attribute\n" - "As-path attribute\n" - "Nexthop attribute\n" - "Nexthop attribute\n" - "As-path attribute\n") + "Med attribute\n") DEFUN (no_neighbor_attr_unchanged, no_neighbor_attr_unchanged_cmd, - "no neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged\ - [<\ - as-path [<next-hop [med]|med [next-hop]>]|\ - next-hop [<as-path [med]|med [as-path]>]|\ - med [<as-path [next-hop]|next-hop [as-path]>]\ - >]", + "no neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged [{as-path|next-hop|med}]", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "BGP attribute is propagated unchanged to this neighbor\n" "As-path attribute\n" "Nexthop attribute\n" - "Med attribute\n" - "Med attribute\n" - "Nexthop attribute\n" - "Nexthop attribute\n" - "As-path attribute\n" - "Med attribute\n" - "Med attribute\n" - "As-path attribute\n" - "Med attribute\n" - "As-path attribute\n" - "Nexthop attribute\n" - "Nexthop attribute\n" - "As-path attribute\n") + "Med attribute\n") { int idx = 0; char *peer = argv[2]->arg; @@ -4520,32 +4458,14 @@ DEFUN (no_neighbor_attr_unchanged, ALIAS_HIDDEN (no_neighbor_attr_unchanged, no_neighbor_attr_unchanged_hidden_cmd, - "no neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged\ - [<\ - as-path [<next-hop [med]|med [next-hop]>]|\ - next-hop [<as-path [med]|med [as-path]>]|\ - med [<as-path [next-hop]|next-hop [as-path]>]\ - >]", + "no neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged [{as-path|next-hop|med}]", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "BGP attribute is propagated unchanged to this neighbor\n" "As-path attribute\n" "Nexthop attribute\n" - "Med attribute\n" - "Med attribute\n" - "Nexthop attribute\n" - "Nexthop attribute\n" - "As-path attribute\n" - "Med attribute\n" - "Med attribute\n" - "As-path attribute\n" - "Med attribute\n" - "As-path attribute\n" - "Nexthop attribute\n" - "Nexthop attribute\n" - "As-path attribute\n") - + "Med attribute\n") /* EBGP multihop configuration. */ static int @@ -5312,54 +5232,6 @@ DEFUN (no_neighbor_interface, return peer_interface_vty (vty, argv[idx_peer]->arg, NULL); } -/* Set distribute list to the peer. */ -static int -peer_distribute_set_vty (struct vty *vty, const char *ip_str, - afi_t afi, safi_t safi, - const char *name_str, const char *direct_str) -{ - int ret; - struct peer *peer; - int direct = FILTER_IN; - - peer = peer_and_group_lookup_vty (vty, ip_str); - if (! peer) - return CMD_WARNING; - - /* Check filter direction. */ - if (strncmp (direct_str, "i", 1) == 0) - direct = FILTER_IN; - else if (strncmp (direct_str, "o", 1) == 0) - direct = FILTER_OUT; - - ret = peer_distribute_set (peer, afi, safi, direct, name_str); - - return bgp_vty_return (vty, ret); -} - -static int -peer_distribute_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, - safi_t safi, const char *direct_str) -{ - int ret; - struct peer *peer; - int direct = FILTER_IN; - - peer = peer_and_group_lookup_vty (vty, ip_str); - if (! peer) - return CMD_WARNING; - - /* Check filter direction. */ - if (strncmp (direct_str, "i", 1) == 0) - direct = FILTER_IN; - else if (strncmp (direct_str, "o", 1) == 0) - direct = FILTER_OUT; - - ret = peer_distribute_unset (peer, afi, safi, direct); - - return bgp_vty_return (vty, ret); -} - DEFUN (neighbor_distribute_list, neighbor_distribute_list_cmd, "neighbor <A.B.C.D|X:X::X:X|WORD> distribute-list <(1-199)|(1300-2699)|WORD> <in|out>", @@ -5374,9 +5246,22 @@ DEFUN (neighbor_distribute_list, { int idx_peer = 1; int idx_acl = 3; - int idx_in_out = 4; - return peer_distribute_set_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), - bgp_node_safi (vty), argv[idx_acl]->arg, argv[idx_in_out]->arg); + int direct, ret; + struct peer *peer; + + const char *pstr = argv[idx_peer]->arg; + const char *acl = argv[idx_acl]->arg; + const char *inout = argv[argc-1]->text; + + peer = peer_and_group_lookup_vty (vty, pstr); + if (! peer) + return CMD_WARNING; + + /* Check filter direction. */ + direct = strmatch (inout, "in") ? FILTER_IN : FILTER_OUT; + ret = peer_distribute_set (peer, bgp_node_afi (vty), bgp_node_safi (vty), direct, acl); + + return bgp_vty_return (vty, ret); } ALIAS_HIDDEN (neighbor_distribute_list, @@ -5405,9 +5290,21 @@ DEFUN (no_neighbor_distribute_list, "Filter outgoing updates\n") { int idx_peer = 2; - int idx_in_out = 5; - return peer_distribute_unset_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), - bgp_node_safi (vty), argv[idx_in_out]->arg); + int direct, ret; + struct peer *peer; + + const char *pstr = argv[idx_peer]->arg; + const char *inout = argv[argc-1]->text; + + peer = peer_and_group_lookup_vty (vty, pstr); + if (! peer) + return CMD_WARNING; + + /* Check filter direction. */ + direct = strmatch (inout, "in") ? FILTER_IN : FILTER_OUT; + ret = peer_distribute_unset (peer, bgp_node_afi (vty), bgp_node_safi (vty), direct); + + return bgp_vty_return (vty, ret); } ALIAS_HIDDEN (no_neighbor_distribute_list, @@ -6290,7 +6187,7 @@ DEFUN_NOSH (address_family_ipv4_safi, if (argc == 3) { - safi_t safi = bgp_vty_safi_from_arg(argv[2]->arg); + safi_t safi = bgp_vty_safi_from_str (argv[2]->text); vty->node = bgp_node_type(AFI_IP, safi); } else @@ -6308,7 +6205,7 @@ DEFUN_NOSH (address_family_ipv6_safi, { if (argc == 3) { - safi_t safi = bgp_vty_safi_from_arg(argv[2]->arg); + safi_t safi = bgp_vty_safi_from_str (argv[2]->text); vty->node = bgp_node_type(AFI_IP6, safi); } else @@ -6596,7 +6493,7 @@ DEFUN (clear_bgp_ipv6_safi_prefix, int idx_safi = 3; int idx_ipv6_prefixlen = 5; return bgp_clear_prefix (vty, NULL, argv[idx_ipv6_prefixlen]->arg, AFI_IP6, - bgp_vty_safi_from_arg(argv[idx_safi]->arg), NULL); + bgp_vty_safi_from_str(argv[idx_safi]->text), NULL); } DEFUN (clear_bgp_instance_ipv6_safi_prefix, @@ -6615,7 +6512,7 @@ DEFUN (clear_bgp_instance_ipv6_safi_prefix, int idx_safi = 5; int idx_ipv6_prefixlen = 7; return bgp_clear_prefix (vty, argv[idx_word]->arg, argv[idx_ipv6_prefixlen]->arg, AFI_IP6, - bgp_vty_safi_from_arg(argv[idx_safi]->arg), NULL); + bgp_vty_safi_from_str(argv[idx_safi]->text), NULL); } DEFUN (show_bgp_views, @@ -9730,8 +9627,8 @@ DEFUN (show_bgp_updgrps_afi_adj, int idx_safi = 3; int idx_type = 5; show_bgp_updgrps_adj_info_aux(vty, NULL, - bgp_vty_afi_from_arg(argv[idx_afi]->arg), - bgp_vty_safi_from_arg(argv[idx_safi]->arg), + bgp_vty_afi_from_str(argv[idx_afi]->text), + bgp_vty_safi_from_str(argv[idx_safi]->text), argv[idx_type]->arg, 0); return CMD_SUCCESS; } @@ -9841,8 +9738,8 @@ DEFUN (show_bgp_updgrps_afi_adj_s, subgrp_id = strtoull(argv[idx_subgroup_id]->arg, NULL, 10); show_bgp_updgrps_adj_info_aux(vty, NULL, - bgp_vty_afi_from_arg(argv[idx_afi]->arg), - bgp_vty_safi_from_arg(argv[idx_safi]->arg), + bgp_vty_afi_from_str(argv[idx_afi]->text), + bgp_vty_safi_from_str(argv[idx_safi]->text), argv[idx_type]->arg, subgrp_id); return CMD_SUCCESS; } diff --git a/bgpd/bgp_vty.h b/bgpd/bgp_vty.h index 1bb9cfb71..fcef4ccc0 100644 --- a/bgpd/bgp_vty.h +++ b/bgpd/bgp_vty.h @@ -48,14 +48,11 @@ extern int bgp_vty_return (struct vty *vty, int ret); extern struct peer * peer_and_group_lookup_vty (struct vty *vty, const char *peer_str); -extern int -bgp_parse_afi(const char *str, afi_t *afi); - extern afi_t -bgp_vty_afi_from_arg(const char *afi_str); +bgp_vty_afi_from_str(const char *afi_str); extern safi_t -bgp_vty_safi_from_arg(const char *safi_str); +bgp_vty_safi_from_str(const char *safi_str); extern int argv_find_and_parse_afi(struct cmd_token **argv, int argc, int *index, afi_t *afi); diff --git a/bgpd/rfapi/bgp_rfapi_cfg.c b/bgpd/rfapi/bgp_rfapi_cfg.c index c84109bc1..417620804 100644 --- a/bgpd/rfapi/bgp_rfapi_cfg.c +++ b/bgpd/rfapi/bgp_rfapi_cfg.c @@ -479,7 +479,7 @@ DEFUN (vnc_defaults_l2rd, VTY_DECLVAR_CONTEXT(bgp, bgp); uint8_t value = 0; - if (!strcmp (argv[1]->arg, "auto-vn")) + if (strmatch(argv[1]->text, "auto-vn")) { value = 0; } @@ -539,7 +539,7 @@ DEFUN (vnc_defaults_responselifetime, if (!h) return CMD_WARNING; - if (!strcmp (argv[1]->arg, "infinite")) + if (strmatch(argv[1]->text, "infinite")) { rspint = RFAPI_INFINITE_LIFETIME; } @@ -1102,7 +1102,7 @@ DEFUN (vnc_redistribute_lifetime, vnc_redistribute_prechange (bgp); - if (!strcmp (argv[3]->arg, "infinite")) + if (strmatch(argv[3]->text, "infinite")) { bgp->rfapi_cfg->redist_lifetime = RFAPI_INFINITE_LIFETIME; } @@ -1140,7 +1140,7 @@ DEFUN (vnc_redist_bgpdirect_no_prefixlist, return CMD_WARNING; } - if (!strcmp (argv[3]->arg, "bgp-direct")) + if (strmatch(argv[3]->text, "bgp-direct")) { route_type = ZEBRA_ROUTE_BGP_DIRECT; } @@ -1149,7 +1149,7 @@ DEFUN (vnc_redist_bgpdirect_no_prefixlist, route_type = ZEBRA_ROUTE_BGP_DIRECT_EXT; } - if (!strcmp (argv[4]->arg, "ipv4")) + if (strmatch(argv[4]->text, "ipv4")) { afi = AFI_IP; } @@ -1193,7 +1193,7 @@ DEFUN (vnc_redist_bgpdirect_prefixlist, return CMD_WARNING; } - if (!strcmp (argv[2]->arg, "bgp-direct")) + if (strmatch(argv[2]->text, "bgp-direct")) { route_type = ZEBRA_ROUTE_BGP_DIRECT; } @@ -1202,7 +1202,7 @@ DEFUN (vnc_redist_bgpdirect_prefixlist, route_type = ZEBRA_ROUTE_BGP_DIRECT_EXT; } - if (!strcmp (argv[3]->arg, "ipv4")) + if (strmatch(argv[3]->text, "ipv4")) { afi = AFI_IP; } @@ -1243,7 +1243,7 @@ DEFUN (vnc_redist_bgpdirect_no_routemap, return CMD_WARNING; } - if (!strcmp (argv[3]->arg, "bgp-direct")) + if (strmatch(argv[3]->text, "bgp-direct")) { route_type = ZEBRA_ROUTE_BGP_DIRECT; } @@ -1283,7 +1283,7 @@ DEFUN (vnc_redist_bgpdirect_routemap, return CMD_WARNING; } - if (!strcmp (argv[2]->arg, "bgp-direct")) + if (strmatch(argv[2]->text, "bgp-direct")) { route_type = ZEBRA_ROUTE_BGP_DIRECT; } @@ -1336,7 +1336,7 @@ DEFUN (vnc_nve_group_redist_bgpdirect_no_prefixlist, return CMD_WARNING; } - if (!strcmp (argv[3]->arg, "ipv4")) + if (strmatch(argv[3]->text, "ipv4")) { afi = AFI_IP; } @@ -1385,7 +1385,7 @@ DEFUN (vnc_nve_group_redist_bgpdirect_prefixlist, return CMD_WARNING; } - if (!strcmp (argv[2]->arg, "ipv4")) + if (strmatch(argv[2]->text, "ipv4")) { afi = AFI_IP; } @@ -1803,7 +1803,7 @@ DEFUN (vnc_nve_group_export_no_prefixlist, return CMD_WARNING; } - if (!strcmp (argv[3]->arg, "ipv4")) + if (strmatch(argv[3]->text, "ipv4")) { afi = AFI_IP; } @@ -1815,7 +1815,7 @@ DEFUN (vnc_nve_group_export_no_prefixlist, if (argv[2]->arg[0] == 'b') { if (((argc > 5) - && !strcmp (argv[5]->arg, rfg->plist_export_bgp_name[afi])) + && strmatch(argv[5]->text, rfg->plist_export_bgp_name[afi])) || (argc <= 5)) { @@ -1830,7 +1830,7 @@ DEFUN (vnc_nve_group_export_no_prefixlist, else { if (((argc > 5) - && !strcmp (argv[5]->arg, rfg->plist_export_zebra_name[afi])) + && strmatch(argv[5]->text, rfg->plist_export_zebra_name[afi])) || (argc <= 5)) { if (rfg->plist_export_zebra_name[afi]) @@ -1872,7 +1872,7 @@ DEFUN (vnc_nve_group_export_prefixlist, return CMD_WARNING; } - if (!strcmp (argv[2]->arg, "ipv4")) + if (strmatch(argv[2]->text, "ipv4")) { afi = AFI_IP; } @@ -1932,7 +1932,7 @@ DEFUN (vnc_nve_group_export_no_routemap, if (argv[2]->arg[0] == 'b') { if (((argc > 4) - && !strcmp (argv[4]->arg, rfg->routemap_export_bgp_name)) + && strmatch(argv[4]->text, rfg->routemap_export_bgp_name)) || (argc <= 4)) { @@ -1948,7 +1948,7 @@ DEFUN (vnc_nve_group_export_no_routemap, else { if (((argc > 4) - && !strcmp (argv[4]->arg, rfg->routemap_export_zebra_name)) + && strmatch(argv[4]->text, rfg->routemap_export_zebra_name)) || (argc <= 4)) { if (rfg->routemap_export_zebra_name) @@ -2031,7 +2031,7 @@ DEFUN (vnc_nve_export_no_prefixlist, return CMD_WARNING; } - if (!strcmp (argv[4]->arg, "ipv4")) + if (strmatch(argv[4]->text, "ipv4")) { afi = AFI_IP; } @@ -2044,7 +2044,7 @@ DEFUN (vnc_nve_export_no_prefixlist, { if (((argc > 6) && hc->plist_export_bgp_name[afi] - && !strcmp (argv[6]->arg, hc->plist_export_bgp_name[afi])) + && strmatch(argv[6]->text, hc->plist_export_bgp_name[afi])) || (argc <= 6)) { @@ -2058,7 +2058,7 @@ DEFUN (vnc_nve_export_no_prefixlist, { if (((argc > 6) && hc->plist_export_zebra_name[afi] - && !strcmp (argv[6]->arg, hc->plist_export_zebra_name[afi])) + && strmatch(argv[6]->text, hc->plist_export_zebra_name[afi])) || (argc <= 6)) { @@ -2093,7 +2093,7 @@ DEFUN (vnc_nve_export_prefixlist, return CMD_WARNING; } - if (!strcmp (argv[3]->arg, "ipv4")) + if (strmatch(argv[3]->text, "ipv4")) { afi = AFI_IP; } @@ -2144,7 +2144,7 @@ DEFUN (vnc_nve_export_no_routemap, { if (((argc > 5) && hc->routemap_export_bgp_name - && !strcmp (argv[5]->arg, hc->routemap_export_bgp_name)) + && strmatch(argv[5]->text, hc->routemap_export_bgp_name)) || (argc <= 5)) { @@ -2159,7 +2159,7 @@ DEFUN (vnc_nve_export_no_routemap, { if (((argc > 5) && hc->routemap_export_zebra_name - && !strcmp (argv[5]->arg, hc->routemap_export_zebra_name)) + && strmatch(argv[5]->text, hc->routemap_export_zebra_name)) || (argc <= 5)) { @@ -3049,7 +3049,7 @@ DEFUN (vnc_nve_group_l2rd, return CMD_WARNING; } - if (!strcmp (argv[1]->arg, "auto:vn")) + if (strmatch(argv[1]->text, "auto:vn")) { rfg->l2rd = 0; } @@ -3198,7 +3198,7 @@ DEFUN (vnc_nve_group_responselifetime, return CMD_WARNING; } - if (!strcmp (argv[1]->arg, "infinite")) + if (strmatch(argv[1]->text, "infinite")) { rspint = RFAPI_INFINITE_LIFETIME; } diff --git a/bgpd/rfapi/rfapi.c b/bgpd/rfapi/rfapi.c index 9e6212760..f66169c7e 100644 --- a/bgpd/rfapi/rfapi.c +++ b/bgpd/rfapi/rfapi.c @@ -3333,7 +3333,7 @@ DEFUN (debug_rfapi_register_vn_un, } rfapiQprefix2Rprefix (&pfx, &hpfx); - if (!strcmp (argv[10]->arg, "infinite")) + if (strmatch(argv[10]->text, "infinite")) { lifetime = RFAPI_INFINITE_LIFETIME; } @@ -3422,7 +3422,7 @@ DEFUN (debug_rfapi_register_vn_un_l2o, } rfapiQprefix2Rprefix (&pfx, &hpfx); - if (!strcmp (argv[10]->arg, "infinite")) + if (strmatch(argv[10]->text, "infinite")) { lifetime = RFAPI_INFINITE_LIFETIME; } @@ -3931,7 +3931,7 @@ DEFUN (debug_rfapi_response_omit_self, return CMD_WARNING; } - if (!strcmp (argv[3]->arg, "on")) + if (strmatch(argv[3]->text, "on")) SET_FLAG (bgp->rfapi_cfg->flags, BGP_VNC_CONFIG_FILTER_SELF_FROM_RSP); else UNSET_FLAG (bgp->rfapi_cfg->flags, BGP_VNC_CONFIG_FILTER_SELF_FROM_RSP); diff --git a/bgpd/rfapi/rfapi_vty.c b/bgpd/rfapi/rfapi_vty.c index 50733ff3b..88b2aae7d 100644 --- a/bgpd/rfapi/rfapi_vty.c +++ b/bgpd/rfapi/rfapi_vty.c @@ -2236,7 +2236,7 @@ register_add ( for (; argc; --argc, ++argv) { - if (!strcmp (argv[0]->arg, "local-next-hop")) + if (strmatch(argv[0]->text, "local-next-hop")) { if (arg_lnh) { @@ -2253,7 +2253,7 @@ register_add ( ++argv, --argc; arg_lnh = argv[0]->arg; } - if (!strcmp (argv[0]->arg, "local-cost")) + if (strmatch(argv[0]->text, "local-cost")) { if (arg_lnh_cost) { diff --git a/bgpd/rfapi/vnc_debug.c b/bgpd/rfapi/vnc_debug.c index cc27277a7..27c81d46d 100644 --- a/bgpd/rfapi/vnc_debug.c +++ b/bgpd/rfapi/vnc_debug.c @@ -69,7 +69,7 @@ DEFUN (debug_bgp_vnc, for (i = 0; i < (sizeof(vncdebug) / sizeof(struct vnc_debug)); ++i) { - if (!strcmp(argv[3]->arg, vncdebug[i].name)) + if (strmatch(argv[3]->text, vncdebug[i].name)) { if (vty->node == CONFIG_NODE) { @@ -104,11 +104,11 @@ DEFUN (no_debug_bgp_vnc, { size_t i; - if (!strcmp(argv[0]->arg, "no")) + if (strmatch(argv[0]->text, "no")) argc--, argv++; for (i = 0; i < (sizeof(vncdebug) / sizeof(struct vnc_debug)); ++i) { - if (!strcmp(argv[3]->arg, vncdebug[i].name)) + if (strmatch(argv[3]->text, vncdebug[i].name)) { if (vty->node == CONFIG_NODE) { diff --git a/isisd/isis_spf.c b/isisd/isis_spf.c index ca268cec7..9a1ed3200 100644 --- a/isisd/isis_spf.c +++ b/isisd/isis_spf.c @@ -1386,7 +1386,7 @@ DEFUN (show_isis_topology, if (argc < 4) levels = ISIS_LEVEL1|ISIS_LEVEL2; - else if (!strcmp(argv[3]->arg, "level-1")) + else if (strmatch(argv[3]->text, "level-1")) levels = ISIS_LEVEL1; else levels = ISIS_LEVEL2; diff --git a/lib/command.c b/lib/command.c index 56fedf091..2c022a0db 100644 --- a/lib/command.c +++ b/lib/command.c @@ -1534,8 +1534,8 @@ DEFUN (config_write, struct stat conf_stat; // if command was 'write terminal' or 'show running-config' - if (argc == 2 && (!strcmp(argv[idx_type]->text, "terminal") || - !strcmp(argv[0]->text, "show"))) + if (argc == 2 && (strmatch(argv[idx_type]->text, "terminal") || + strmatch(argv[0]->text, "show"))) { vty_write_config (vty); return CMD_SUCCESS; diff --git a/nhrpd/nhrp_vty.c b/nhrpd/nhrp_vty.c index 823a80967..fca27f26e 100644 --- a/nhrpd/nhrp_vty.c +++ b/nhrpd/nhrp_vty.c @@ -494,7 +494,7 @@ DEFUN(if_nhrp_map, if_nhrp_map_cmd, return nhrp_vty_return(vty, NHRP_ERR_FAIL); c->map = 1; - if (strcmp(argv[4]->text, "local") == 0) { + if (strmatch(argv[4]->text, "local")) { nhrp_cache_update_binding(c, NHRP_CACHE_LOCAL, 0, NULL, 0, NULL); } else{ if (str2sockunion(argv[4]->arg, &nbma_addr) < 0) diff --git a/ospf6d/ospf6_lsa.c b/ospf6d/ospf6_lsa.c index acc8fe380..624acb9c6 100644 --- a/ospf6d/ospf6_lsa.c +++ b/ospf6d/ospf6_lsa.c @@ -850,11 +850,11 @@ DEFUN (debug_ospf6_lsa_type, if (argc == 5) { - if (! strcmp (argv[idx_type]->text, "originate")) + if (strmatch(argv[idx_type]->text, "originate")) SET_FLAG (handler->debug, OSPF6_LSA_DEBUG_ORIGINATE); - else if (! strcmp (argv[idx_type]->text, "examine")) + else if (strmatch(argv[idx_type]->text, "examine")) SET_FLAG (handler->debug, OSPF6_LSA_DEBUG_EXAMIN); - else if (! strcmp (argv[idx_type]->text, "flooding")) + else if (strmatch(argv[idx_type]->text, "flooding")) SET_FLAG (handler->debug, OSPF6_LSA_DEBUG_FLOOD); } else @@ -903,11 +903,11 @@ DEFUN (no_debug_ospf6_lsa_type, if (argc == 6) { - if (! strcmp (argv[idx_type]->text, "originate")) + if (strmatch(argv[idx_type]->text, "originate")) UNSET_FLAG (handler->debug, OSPF6_LSA_DEBUG_ORIGINATE); - if (! strcmp (argv[idx_type]->text, "examine")) + if (strmatch(argv[idx_type]->text, "examine")) UNSET_FLAG (handler->debug, OSPF6_LSA_DEBUG_EXAMIN); - if (! strcmp (argv[idx_type]->text, "flooding")) + if (strmatch(argv[idx_type]->text, "flooding")) UNSET_FLAG (handler->debug, OSPF6_LSA_DEBUG_FLOOD); } else diff --git a/ospf6d/ospf6_route.c b/ospf6d/ospf6_route.c index 117f7af6e..a6bb099dd 100644 --- a/ospf6d/ospf6_route.c +++ b/ospf6d/ospf6_route.c @@ -1313,43 +1313,43 @@ ospf6_route_table_show (struct vty *vty, int argc_start, int argc, struct cmd_to for (i = argc_start; i < argc; i++) { - if (! strcmp (argv[i]->arg, "summary")) + if (strmatch(argv[i]->text, "summary")) { summary++; continue; } - if (! strcmp (argv[i]->arg, "intra-area")) + if (strmatch(argv[i]->text, "intra-area")) { type = OSPF6_PATH_TYPE_INTRA; continue; } - if (! strcmp (argv[i]->arg, "inter-area")) + if (strmatch(argv[i]->text, "inter-area")) { type = OSPF6_PATH_TYPE_INTER; continue; } - if (! strcmp (argv[i]->arg, "external-1")) + if (strmatch(argv[i]->text, "external-1")) { type = OSPF6_PATH_TYPE_EXTERNAL1; continue; } - if (! strcmp (argv[i]->arg, "external-2")) + if (strmatch(argv[i]->text, "external-2")) { type = OSPF6_PATH_TYPE_EXTERNAL2; continue; } - if (! strcmp (argv[i]->arg, "detail")) + if (strmatch(argv[i]->text, "detail")) { detail++; continue; } - if (! strcmp (argv[i]->arg, "match")) + if (strmatch(argv[i]->text, "match")) { match++; continue; @@ -1488,7 +1488,7 @@ ospf6_linkstate_table_show (struct vty *vty, int idx_ipv4, int argc, for (i = idx_ipv4; i < argc; i++) { - if (! strcmp (argv[i]->arg, "detail")) + if (strmatch(argv[i]->text, "detail")) { detail++; continue; diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index ceabb1d11..252d59c44 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -374,7 +374,7 @@ DEFUN (ospf_passive_interface, struct ospf_if_params *params; struct route_node *rn; - if (strcmp (argv[1]->text, "default") == 0) + if (strmatch(argv[1]->text, "default")) { ospf_passive_interface_default (ospf, OSPF_IF_PASSIVE); return CMD_SUCCESS; @@ -444,7 +444,7 @@ DEFUN (no_ospf_passive_interface, int ret; struct route_node *rn; - if (strcmp (argv[2]->text, "default") == 0) + if (strmatch(argv[2]->text, "default")) { ospf_passive_interface_default (ospf, OSPF_IF_ACTIVE); return CMD_SUCCESS; @@ -1090,7 +1090,7 @@ DEFUN (ospf_area_vlink, i++; } else if (strncmp (argv[i+1]->arg, "m", 1) == 0 - && strcmp (argv[i+1]->arg, "message-digest-") != 0) + && !strmatch(argv[i + 1]->text, "message-digest-")) { /* "authentication message-digest" */ vl_config.auth_type = OSPF_AUTH_CRYPTOGRAPHIC; diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index c675bea2d..c4e8634f2 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -2185,7 +2185,7 @@ DEFUN (ipv6_route, int idx_curr; char *src, *tag, *distance, *vrf; - if (!strcmp(argv[3]->text, "from")) + if (strmatch(argv[3]->text, "from")) { src = argv[4]->arg; idx_ipv6_ifname = 5; @@ -2233,7 +2233,7 @@ DEFUN (ipv6_route_flags, int idx_curr; char *src, *tag, *distance, *vrf; - if (!strcmp(argv[3]->text, "from")) + if (strmatch(argv[3]->text, "from")) { src = argv[4]->arg; idx_ipv6_ifname = 5; @@ -2282,7 +2282,7 @@ DEFUN (ipv6_route_ifname, int idx_curr = 5; char *src, *tag, *distance, *vrf; - if (!strcmp(argv[3]->text, "from")) + if (strmatch(argv[3]->text, "from")) { src = argv[4]->arg; idx_ipv6 = 5; @@ -2334,7 +2334,7 @@ DEFUN (ipv6_route_ifname_flags, int idx_curr; char *src, *tag, *distance, *vrf; - if (!strcmp(argv[3]->text, "from")) + if (strmatch(argv[3]->text, "from")) { src = argv[4]->arg; idx_ipv6 = 5; @@ -2386,7 +2386,7 @@ DEFUN (no_ipv6_route, int idx_curr; char *src, *tag, *distance, *vrf; - if (!strcmp(argv[4]->text, "from")) + if (strmatch(argv[4]->text, "from")) { src = argv[5]->arg; idx_ipv6_ifname = 6; @@ -2435,7 +2435,7 @@ DEFUN (no_ipv6_route_flags, int idx_curr; char *src, *tag, *distance, *vrf; - if (!strcmp(argv[4]->text, "from")) + if (strmatch(argv[4]->text, "from")) { src = argv[5]->arg; idx_ipv6_ifname = 6; @@ -2485,7 +2485,7 @@ DEFUN (no_ipv6_route_ifname, int idx_curr; char *src, *tag, *distance, *vrf; - if (!strcmp(argv[4]->text, "from")) + if (strmatch(argv[4]->text, "from")) { src = argv[5]->arg; idx_ipv6 = 6; @@ -2538,7 +2538,7 @@ DEFUN (no_ipv6_route_ifname_flags, int idx_curr; char *src, *tag, *distance, *vrf; - if (!strcmp(argv[4]->text, "from")) + if (strmatch(argv[4]->text, "from")) { src = argv[5]->arg; idx_ipv6 = 6; |