diff options
-rw-r--r-- | bgpd/bgp_evpn_vty.c | 34 | ||||
-rw-r--r-- | bgpd/bgp_mplsvpn.c | 2 | ||||
-rw-r--r-- | bgpd/bgp_routemap.c | 6 | ||||
-rw-r--r-- | bgpd/rfapi/bgp_rfapi_cfg.c | 16 | ||||
-rw-r--r-- | bgpd/rfapi/rfapi_vty.c | 8 | ||||
-rw-r--r-- | ospfd/ospf_vty.c | 2 | ||||
-rw-r--r-- | pimd/pim_cmd.c | 10 | ||||
-rw-r--r-- | zebra/debug.c | 7 | ||||
-rw-r--r-- | zebra/interface.c | 2 | ||||
-rw-r--r-- | zebra/zebra_vty.c | 2 |
10 files changed, 54 insertions, 35 deletions
diff --git a/bgpd/bgp_evpn_vty.c b/bgpd/bgp_evpn_vty.c index 97ce7ee96..c133d7ba3 100644 --- a/bgpd/bgp_evpn_vty.c +++ b/bgpd/bgp_evpn_vty.c @@ -300,10 +300,12 @@ DEFUN(show_ip_bgp_l2vpn_evpn_rd, "Display information for a route distinguisher\n" "VPN Route Distinguisher\n" JSON_STR) { - int idx_ext_community = 6; + int idx_ext_community = 0; int ret; struct prefix_rd prd; + argv_find (argv, argc, "ASN:nn_or_IP-address:nn", &idx_ext_community); + ret = str2prefix_rd(argv[idx_ext_community]->arg, &prd); if (!ret) { vty_out(vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); @@ -339,10 +341,12 @@ DEFUN(show_ip_bgp_l2vpn_evpn_rd_tags, "Display information for a route distinguisher\n" "VPN Route Distinguisher\n" "Display BGP tags for prefixes\n") { - int idx_ext_community = 6; + int idx_ext_community = 0; int ret; struct prefix_rd prd; + argv_find (argv, argc, "ASN:nn_or_IP-address:nn", &idx_ext_community); + ret = str2prefix_rd(argv[idx_ext_community]->arg, &prd); if (!ret) { vty_out(vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); @@ -365,12 +369,14 @@ DEFUN(show_ip_bgp_l2vpn_evpn_all_neighbor_routes, "Neighbor to display information about\n" "Display routes learned from neighbor\n" JSON_STR) { - int idx_ipv4 = 6; + int idx_ipv4 = 0; union sockunion su; struct peer *peer; int ret; u_char uj = use_json(argc, argv); + argv_find (argv, argc, "A.B.C.D", &idx_ipv4); + ret = str2sockunion(argv[idx_ipv4]->arg, &su); if (ret < 0) { if (uj) { @@ -423,14 +429,17 @@ DEFUN(show_ip_bgp_l2vpn_evpn_rd_neighbor_routes, "Neighbor to display information about\n" "Display routes learned from neighbor\n" JSON_STR) { - int idx_ext_community = 6; - int idx_ipv4 = 8; + int idx_ext_community = 0; + int idx_ipv4 = 0; int ret; union sockunion su; struct peer *peer; struct prefix_rd prd; u_char uj = use_json(argc, argv); + argv_find (argv, argc, "ASN:nn_or_IP-address:nn", &idx_ext_community); + argv_find (argv, argc, "A.B.C.D", &idx_ipv4); + ret = str2prefix_rd(argv[idx_ext_community]->arg, &prd); if (!ret) { if (uj) { @@ -499,12 +508,14 @@ DEFUN(show_ip_bgp_l2vpn_evpn_all_neighbor_advertised_routes, "Neighbor to display information about\n" "Display the routes advertised to a BGP neighbor\n" JSON_STR) { - int idx_ipv4 = 7; + int idx_ipv4 = 0; int ret; struct peer *peer; union sockunion su; u_char uj = use_json(argc, argv); + argv_find (argv, argc, "A.B.C.D", &idx_ipv4); + ret = str2sockunion(argv[idx_ipv4]->arg, &su); if (ret < 0) { if (uj) { @@ -555,14 +566,17 @@ DEFUN(show_ip_bgp_l2vpn_evpn_rd_neighbor_advertised_routes, "Neighbor to display information about\n" "Display the routes advertised to a BGP neighbor\n" JSON_STR) { - int idx_ext_community = 6; - int idx_ipv4 = 8; + int idx_ext_community = 0; + int idx_ipv4 = 0; int ret; struct peer *peer; struct prefix_rd prd; union sockunion su; u_char uj = use_json(argc, argv); + argv_find (argv, argc, "ASN:nn_or_IP-address:nn", &idx_ext_community); + argv_find (argv, argc, "A.B.C.D", &idx_ipv4); + ret = str2sockunion(argv[idx_ipv4]->arg, &su); if (ret < 0) { if (uj) { @@ -644,10 +658,12 @@ DEFUN(show_ip_bgp_evpn_rd_overlay, "VPN Route Distinguisher\n" "Display BGP Overlay Information for prefixes\n") { - int idx_ext_community = 6; + int idx_ext_community = 0; int ret; struct prefix_rd prd; + argv_find (argv, argc, "ASN:nn_or_IP-address:nn", &idx_ext_community); + ret = str2prefix_rd(argv[idx_ext_community]->arg, &prd); if (!ret) { vty_out(vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); diff --git a/bgpd/bgp_mplsvpn.c b/bgpd/bgp_mplsvpn.c index 88cde15e8..421b62fba 100644 --- a/bgpd/bgp_mplsvpn.c +++ b/bgpd/bgp_mplsvpn.c @@ -531,7 +531,7 @@ DEFUN (vpnv6_network, int idx_ext_community = 3; int idx_word = 5; int idx_word_2 = 7; - if (argv[idx_word_2]) + if (argc == 8) return bgp_static_set_safi (SAFI_MPLS_VPN, vty, argv[idx_ipv6_prefix]->arg, argv[idx_ext_community]->arg, argv[idx_word]->arg, argv[idx_word_2]->arg, 0, NULL, NULL, NULL, NULL); else return bgp_static_set_safi (SAFI_MPLS_VPN, vty, argv[idx_ipv6_prefix]->arg, argv[idx_ext_community]->arg, argv[idx_word]->arg, NULL, 0, NULL, NULL, NULL, NULL); diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c index 9b5a7a5eb..9b3a6a513 100644 --- a/bgpd/bgp_routemap.c +++ b/bgpd/bgp_routemap.c @@ -4333,7 +4333,7 @@ DEFUN (no_set_ipv6_nexthop_global, #ifdef KEEP_OLD_VPN_COMMANDS DEFUN (set_vpn_nexthop, set_vpn_nexthop_cmd, - "set <vpnv4|vpnv6> next-hop [A.B.C.D|X:X::X:X]", + "set <vpnv4|vpnv6> next-hop <A.B.C.D|X:X::X:X>", SET_STR "VPNv4 information\n" "VPNv6 information\n" @@ -4359,7 +4359,7 @@ DEFUN (set_vpn_nexthop, DEFUN (no_set_vpn_nexthop, no_set_vpn_nexthop_cmd, - "no set vpn next-hop [A.B.C.D|X:X::X:X]", + "no set vpn next-hop <A.B.C.D|X:X::X:X>", NO_STR SET_STR "VPN information\n" @@ -4444,7 +4444,7 @@ DEFUN (no_set_ipx_vpn_nexthop, "ip vpn next-hop", arg); else return generic_set_delete (vty, VTY_GET_CONTEXT(route_map_index), - "ipv6 vpn next-hop", argv[idx_ip]->arg); + "ipv6 vpn next-hop", arg); } return CMD_SUCCESS; } diff --git a/bgpd/rfapi/bgp_rfapi_cfg.c b/bgpd/rfapi/bgp_rfapi_cfg.c index aa48b4924..5ddccc906 100644 --- a/bgpd/rfapi/bgp_rfapi_cfg.c +++ b/bgpd/rfapi/bgp_rfapi_cfg.c @@ -2046,12 +2046,12 @@ DEFUN (vnc_nve_export_no_prefixlist, if (argv[3]->arg[0] == 'b') { if (((argc > 6) + && hc->plist_export_bgp_name[afi] && !strcmp (argv[6]->arg, hc->plist_export_bgp_name[afi])) || (argc <= 6)) { - if (hc->plist_export_bgp_name[afi]) - free (hc->plist_export_bgp_name[afi]); + free (hc->plist_export_bgp_name[afi]); hc->plist_export_bgp_name[afi] = NULL; hc->plist_export_bgp[afi] = NULL; vnc_direct_bgp_reexport (bgp, afi); @@ -2060,12 +2060,12 @@ DEFUN (vnc_nve_export_no_prefixlist, else { if (((argc > 6) + && hc->plist_export_zebra_name[afi] && !strcmp (argv[6]->arg, hc->plist_export_zebra_name[afi])) || (argc <= 6)) { - if (hc->plist_export_zebra_name[afi]) - free (hc->plist_export_zebra_name[afi]); + free (hc->plist_export_zebra_name[afi]); hc->plist_export_zebra_name[afi] = NULL; hc->plist_export_zebra[afi] = NULL; /* TBD vnc_zebra_rh_reexport(bgp, afi); */ @@ -2146,12 +2146,12 @@ DEFUN (vnc_nve_export_no_routemap, if (argv[3]->arg[0] == 'b') { if (((argc > 5) + && hc->routemap_export_bgp_name && !strcmp (argv[5]->arg, hc->routemap_export_bgp_name)) || (argc <= 5)) { - if (hc->routemap_export_bgp_name) - free (hc->routemap_export_bgp_name); + free (hc->routemap_export_bgp_name); hc->routemap_export_bgp_name = NULL; hc->routemap_export_bgp = NULL; vnc_direct_bgp_reexport (bgp, AFI_IP); @@ -2161,12 +2161,12 @@ DEFUN (vnc_nve_export_no_routemap, else { if (((argc > 5) + && hc->routemap_export_zebra_name && !strcmp (argv[5]->arg, hc->routemap_export_zebra_name)) || (argc <= 5)) { - if (hc->routemap_export_zebra_name) - free (hc->routemap_export_zebra_name); + free (hc->routemap_export_zebra_name); hc->routemap_export_zebra_name = NULL; hc->routemap_export_zebra = NULL; /* TBD vnc_zebra_rh_reexport(bgp, AFI_IP); */ diff --git a/bgpd/rfapi/rfapi_vty.c b/bgpd/rfapi/rfapi_vty.c index c52026e8e..3de79dac0 100644 --- a/bgpd/rfapi/rfapi_vty.c +++ b/bgpd/rfapi/rfapi_vty.c @@ -2190,9 +2190,9 @@ register_add ( int argc, struct cmd_token **argv) { - const char *arg_prefix = carg_prefix->arg; - const char *arg_vn = carg_vn->arg; - const char *arg_un = carg_un->arg; + const char *arg_prefix = carg_prefix ? carg_prefix->arg : NULL; + const char *arg_vn = carg_vn ? carg_vn->arg : NULL; + const char *arg_un = carg_un ? carg_un->arg : NULL; const char *arg_cost = carg_cost ? carg_cost->arg : NULL; const char *arg_lifetime = carg_lifetime ? carg_lifetime->arg : NULL; const char *arg_macaddr = carg_macaddr ? carg_macaddr->arg : NULL; @@ -3906,7 +3906,7 @@ DEFUN (clear_vnc_nve_un, struct rfapi_local_reg_delete_arg cda; int rc; - if ((rc = parse_deleter_tokens (vty, NULL, NULL, NULL, argv[6], NULL, NULL, NULL, NULL, &cda))) + if ((rc = parse_deleter_tokens (vty, NULL, NULL, NULL, argv[4], NULL, NULL, NULL, NULL, &cda))) return rc; cda.vty = vty; diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index cdee15304..f5880ca9e 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -1539,7 +1539,7 @@ ospf_area_nssa_cmd_handler (struct vty *vty, int argc, struct cmd_token **argv, return CMD_WARNING; } - if (argc > 1) + if (argc > 3) { if (strncmp (argv[3]->text, "translate-c", 11) == 0) ospf_area_nssa_translator_role_set (ospf, area_id, diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c index 63554797c..d40ff0fe3 100644 --- a/pimd/pim_cmd.c +++ b/pimd/pim_cmd.c @@ -4003,7 +4003,7 @@ DEFUN (ip_ssmpingd, int idx_ipv4 = 2; int result; struct in_addr source_addr; - const char *source_str = (argc == idx_ipv4) ? argv[idx_ipv4]->arg : "0.0.0.0"; + const char *source_str = (argc == 3) ? argv[idx_ipv4]->arg : "0.0.0.0"; result = inet_pton(AF_INET, source_str, &source_addr); if (result <= 0) { @@ -4033,7 +4033,7 @@ DEFUN (no_ip_ssmpingd, int idx_ipv4 = 3; int result; struct in_addr source_addr; - const char *source_str = (argc == idx_ipv4) ? argv[idx_ipv4]->arg : "0.0.0.0"; + const char *source_str = (argc == 4) ? argv[idx_ipv4]->arg : "0.0.0.0"; result = inet_pton(AF_INET, source_str, &source_addr); if (result <= 0) { @@ -5956,7 +5956,7 @@ DEFUN (no_ip_msdp_mesh_group_source, "mesh group source\n" "mesh group local address\n") { - if (argc == 6) + if (argc == 7) return ip_no_msdp_mesh_group_cmd_worker(vty, argv[6]->arg); else return ip_no_msdp_mesh_group_source_cmd_worker(vty, argv[4]->arg); @@ -6459,9 +6459,9 @@ DEFUN (show_ip_msdp_sa_sg, if (uj) argc--; - if (argc == 5) + if (argc == 6) ip_msdp_show_sa_sg(vty, argv[4]->arg, argv[5]->arg, uj); - else if (argc == 4) + else if (argc == 5) ip_msdp_show_sa_addr(vty, argv[4]->arg, uj); else ip_msdp_show_sa(vty, uj); diff --git a/zebra/debug.c b/zebra/debug.c index f21778276..a42d5aa3e 100644 --- a/zebra/debug.c +++ b/zebra/debug.c @@ -173,11 +173,12 @@ DEFUN (debug_zebra_kernel_msgdump, "Dump raw netlink messages received\n" "Dump raw netlink messages sent\n") { - int idx_recv_send = 4; - if (argv[idx_recv_send]->arg && strncmp(argv[idx_recv_send]->arg, "recv", strlen(argv[idx_recv_send]->arg)) == 0) + int idx = 0; + if (argc == 4 || argv_find (argv, argc, "recv", &idx)) SET_FLAG(zebra_debug_kernel, ZEBRA_DEBUG_KERNEL_MSGDUMP_RECV); - if (!argv[idx_recv_send]->arg || strncmp(argv[idx_recv_send]->arg, "send", strlen(argv[idx_recv_send]->arg)) == 0) + if (argc == 4 || argv_find (argv, argc, "send", &idx)) SET_FLAG(zebra_debug_kernel, ZEBRA_DEBUG_KERNEL_MSGDUMP_SEND); + return CMD_SUCCESS; } diff --git a/zebra/interface.c b/zebra/interface.c index b22740958..78ac0258c 100644 --- a/zebra/interface.c +++ b/zebra/interface.c @@ -1706,6 +1706,8 @@ link_param_cmd_set_float (struct interface *ifp, float *field, static void link_param_cmd_unset (struct interface *ifp, uint32_t type) { + if (ifp->link_params == NULL) + return; /* Unset field */ UNSET_PARAM(ifp->link_params, type); diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index 35aa69cc9..1708138d8 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -3338,7 +3338,7 @@ DEFUN (show_ipv6_mroute, int first = 1; vrf_id_t vrf_id = VRF_DEFAULT; - if (strmatch(argv[3]->text, "vrf")) + if (argc == 5) VRF_GET_ID (vrf_id, argv[4]->arg); table = zebra_vrf_table (AFI_IP6, SAFI_MULTICAST, vrf_id); |