diff options
Diffstat (limited to 'bgpd/bgp_encap.c')
| -rw-r--r-- | bgpd/bgp_encap.c | 82 |
1 files changed, 52 insertions, 30 deletions
diff --git a/bgpd/bgp_encap.c b/bgpd/bgp_encap.c index c60b592133..499401bd4f 100644 --- a/bgpd/bgp_encap.c +++ b/bgpd/bgp_encap.c @@ -224,7 +224,10 @@ DEFUN (encap_network, "BGP tag\n" "tag value\n") { - return bgp_static_set_safi (SAFI_ENCAP, vty, argv[0], argv[1], argv[2], NULL); + int idx_ipv4 = 1; + int idx_rd = 3; + int idx_word = 5; + return bgp_static_set_safi (SAFI_ENCAP, vty, argv[idx_ipv4]->arg, argv[idx_rd]->arg, argv[idx_word]->arg, NULL); } /* For testing purpose, static route of ENCAP. */ @@ -239,7 +242,10 @@ DEFUN (no_encap_network, "BGP tag\n" "tag value\n") { - return bgp_static_unset_safi (SAFI_ENCAP, vty, argv[0], argv[1], argv[2]); + int idx_ipv4 = 2; + int idx_rd = 4; + int idx_word = 6; + return bgp_static_unset_safi (SAFI_ENCAP, vty, argv[idx_ipv4]->arg, argv[idx_rd]->arg, argv[idx_word]->arg); } static int @@ -501,10 +507,11 @@ DEFUN (show_bgp_ipv4_encap_rd, "Display information for a route distinguisher\n" "ENCAP Route Distinguisher\n") { + int idx_rd = 5; int ret; struct prefix_rd prd; - ret = str2prefix_rd (argv[0], &prd); + ret = str2prefix_rd (argv[idx_rd]->arg, &prd); if (! ret) { vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); @@ -524,10 +531,11 @@ DEFUN (show_bgp_ipv6_encap_rd, "ENCAP Route Distinguisher\n" "Display BGP tags for prefixes\n") { + int idx_rd = 5; int ret; struct prefix_rd prd; - ret = str2prefix_rd (argv[0], &prd); + ret = str2prefix_rd (argv[idx_rd]->arg, &prd); if (! ret) { vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); @@ -573,10 +581,11 @@ DEFUN (show_bgp_ipv4_encap_rd_tags, "ENCAP Route Distinguisher\n" "Display BGP tags for prefixes\n") { + int idx_rd = 5; int ret; struct prefix_rd prd; - ret = str2prefix_rd (argv[0], &prd); + ret = str2prefix_rd (argv[idx_rd]->arg, &prd); if (! ret) { vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); @@ -596,10 +605,11 @@ DEFUN (show_bgp_ipv6_encap_rd_tags, "ENCAP Route Distinguisher\n" "Display BGP tags for prefixes\n") { + int idx_rd = 5; int ret; struct prefix_rd prd; - ret = str2prefix_rd (argv[0], &prd); + ret = str2prefix_rd (argv[idx_rd]->arg, &prd); if (! ret) { vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); @@ -620,12 +630,13 @@ DEFUN (show_bgp_ipv4_encap_neighbor_routes, "Neighbor to display information about\n" "Display routes learned from neighbor\n") { + int idx_peer = 5; union sockunion su; struct peer *peer; - if (str2sockunion(argv[0], &su)) + if (sockunion_str2su (argv[idx_peer]->arg)) { - vty_out (vty, "Malformed address: %s%s", argv[0], VTY_NEWLINE); + vty_out (vty, "Malformed address: %s%s", argv[idx_peer]->arg, VTY_NEWLINE); return CMD_WARNING; } @@ -650,12 +661,13 @@ DEFUN (show_bgp_ipv6_encap_neighbor_routes, "Neighbor to display information about\n" "Display routes learned from neighbor\n") { + int idx_peer = 5; union sockunion su; struct peer *peer; - if (str2sockunion(argv[0], &su)) + if (str2sockunion(argv[idx_peer]->arg, &su)) { - vty_out (vty, "Malformed address: %s%s", argv[0], VTY_NEWLINE); + vty_out (vty, "Malformed address: %s%s", argv[idx_peer]->arg, VTY_NEWLINE); return CMD_WARNING; } @@ -672,7 +684,7 @@ DEFUN (show_bgp_ipv6_encap_neighbor_routes, DEFUN (show_bgp_ipv4_encap_rd_neighbor_routes, show_bgp_ipv4_encap_rd_neighbor_routes_cmd, - "show bgp ipv4 encap rd ASN:nn_or_IP-address:nn neighbors (A.B.C.D|X:X::X:X) routes", + "show bgp ipv4 encap rd ASN:nn_or_IP-address:nn neighbors <A.B.C.D|X:X::X:X> routes", SHOW_STR BGP_STR "Address Family\n" @@ -684,21 +696,23 @@ DEFUN (show_bgp_ipv4_encap_rd_neighbor_routes, "Neighbor to display information about\n" "Display routes learned from neighbor\n") { + int idx_rd = 5; + int idx_peer = 7; int ret; union sockunion su; struct peer *peer; struct prefix_rd prd; - ret = str2prefix_rd (argv[0], &prd); + ret = str2prefix_rd (argv[idx_rd]->arg, &prd); if (! ret) { vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); return CMD_WARNING; } - if (str2sockunion(argv[1], &su)) + if (str2sockunion(argv[idx_peer]->arg, &su)) { - vty_out (vty, "Malformed address: %s%s", argv[1], VTY_NEWLINE); + vty_out (vty, "Malformed address: %s%s", argv[idx_peer]->arg, VTY_NEWLINE); return CMD_WARNING; } @@ -714,7 +728,7 @@ DEFUN (show_bgp_ipv4_encap_rd_neighbor_routes, #ifdef HAVE_IPV6 DEFUN (show_bgp_ipv6_encap_rd_neighbor_routes, show_bgp_ipv6_encap_rd_neighbor_routes_cmd, - "show bgp ipv6 encap rd ASN:nn_or_IP-address:nn neighbors (A.B.C.D|X:X::X:X) routes", + "show bgp ipv6 encap rd ASN:nn_or_IP-address:nn neighbors <A.B.C.D|X:X::X:X> routes", SHOW_STR BGP_STR "Address Family\n" @@ -726,21 +740,23 @@ DEFUN (show_bgp_ipv6_encap_rd_neighbor_routes, "Neighbor to display information about\n" "Display routes learned from neighbor\n") { + int idx_rd = 5; + int idx_peer = 7; int ret; union sockunion su; struct peer *peer; struct prefix_rd prd; - ret = str2prefix_rd (argv[0], &prd); + ret = str2prefix_rd (argv[idx_rd]->arg, &prd); if (! ret) { vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); return CMD_WARNING; } - if (str2sockunion(argv[1], &su)) + if (str2sockunion(argv[idx_peer]->arg, &su)) { - vty_out (vty, "Malformed address: %s%s", argv[1], VTY_NEWLINE); + vty_out (vty, "Malformed address: %s%s", argv[idx_peer]->arg, VTY_NEWLINE); return CMD_WARNING; } @@ -766,14 +782,15 @@ DEFUN (show_bgp_ipv4_encap_neighbor_advertised_routes, "Neighbor to display information about\n" "Display the routes advertised to a BGP neighbor\n") { + int idx_peer = 5; int ret; struct peer *peer; union sockunion su; - ret = str2sockunion (argv[0], &su); + ret = str2sockunion (argv[idx_peer]->arg, &su); if (ret < 0) { - vty_out (vty, "%% Malformed address: %s%s", argv[0], VTY_NEWLINE); + vty_out (vty, "%% Malformed address: %s%s", argv[idx_peer]->arg, VTY_NEWLINE); return CMD_WARNING; } peer = peer_lookup (NULL, &su); @@ -797,14 +814,15 @@ DEFUN (show_bgp_ipv6_encap_neighbor_advertised_routes, "Neighbor to display information about\n" "Display the routes advertised to a BGP neighbor\n") { + int idx_peer = 5; int ret; struct peer *peer; union sockunion su; - ret = str2sockunion (argv[0], &su); + ret = str2sockunion (argv[idx_peer]->arg, &su); if (ret < 0) { - vty_out (vty, "%% Malformed address: %s%s", argv[0], VTY_NEWLINE); + vty_out (vty, "%% Malformed address: %s%s", argv[idx_peer]->arg, VTY_NEWLINE); return CMD_WARNING; } peer = peer_lookup (NULL, &su); @@ -820,7 +838,7 @@ DEFUN (show_bgp_ipv6_encap_neighbor_advertised_routes, DEFUN (show_bgp_ipv4_encap_rd_neighbor_advertised_routes, show_bgp_ipv4_encap_rd_neighbor_advertised_routes_cmd, - "show bgp ipv4 encap rd ASN:nn_or_IP-address:nn neighbors (A.B.C.D|X:X::X:X) advertised-routes", + "show bgp ipv4 encap rd ASN:nn_or_IP-address:nn neighbors <A.B.C.D|X:X::X:X> advertised-routes", SHOW_STR BGP_STR "Address Family\n" @@ -832,15 +850,17 @@ DEFUN (show_bgp_ipv4_encap_rd_neighbor_advertised_routes, "Neighbor to display information about\n" "Display the routes advertised to a BGP neighbor\n") { + int idx_rd = 5; + int idx_peer = 7; int ret; struct peer *peer; struct prefix_rd prd; union sockunion su; - ret = str2sockunion (argv[1], &su); + ret = str2sockunion (argv[idx_peer]->arg, &su); if (ret < 0) { - vty_out (vty, "%% Malformed address: %s%s", argv[1], VTY_NEWLINE); + vty_out (vty, "%% Malformed address: %s%s", argv[idx_peer]->arg, VTY_NEWLINE); return CMD_WARNING; } peer = peer_lookup (NULL, &su); @@ -850,7 +870,7 @@ DEFUN (show_bgp_ipv4_encap_rd_neighbor_advertised_routes, return CMD_WARNING; } - ret = str2prefix_rd (argv[0], &prd); + ret = str2prefix_rd (argv[idx_rd]->arg, &prd); if (! ret) { vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); @@ -862,7 +882,7 @@ DEFUN (show_bgp_ipv4_encap_rd_neighbor_advertised_routes, #ifdef HAVE_IPV6 DEFUN (show_bgp_ipv6_encap_rd_neighbor_advertised_routes, show_bgp_ipv6_encap_rd_neighbor_advertised_routes_cmd, - "show bgp ipv6 encap rd ASN:nn_or_IP-address:nn neighbors (A.B.C.D|X:X::X:X) advertised-routes", + "show bgp ipv6 encap rd ASN:nn_or_IP-address:nn neighbors <A.B.C.D|X:X::X:X> advertised-routes", SHOW_STR BGP_STR "Address Family\n" @@ -874,15 +894,17 @@ DEFUN (show_bgp_ipv6_encap_rd_neighbor_advertised_routes, "Neighbor to display information about\n" "Display the routes advertised to a BGP neighbor\n") { + int idx_rd = 5; + int idx_peer = 7; int ret; struct peer *peer; struct prefix_rd prd; union sockunion su; - ret = str2sockunion (argv[1], &su); + ret = str2sockunion (argv[idx_peer]->arg, &su); if (ret < 0) { - vty_out (vty, "%% Malformed address: %s%s", argv[1], VTY_NEWLINE); + vty_out (vty, "%% Malformed address: %s%s", argv[idx_peer]->arg, VTY_NEWLINE); return CMD_WARNING; } peer = peer_lookup (NULL, &su); @@ -892,7 +914,7 @@ DEFUN (show_bgp_ipv6_encap_rd_neighbor_advertised_routes, return CMD_WARNING; } - ret = str2prefix_rd (argv[0], &prd); + ret = str2prefix_rd (argv[idx_rd]->arg, &prd); if (! ret) { vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); |
