diff options
Diffstat (limited to 'zebra/zebra_routemap.c')
| -rw-r--r-- | zebra/zebra_routemap.c | 70 |
1 files changed, 37 insertions, 33 deletions
diff --git a/zebra/zebra_routemap.c b/zebra/zebra_routemap.c index e6c5a3e917..685f5cc4b9 100644 --- a/zebra/zebra_routemap.c +++ b/zebra/zebra_routemap.c @@ -58,10 +58,11 @@ static void zebra_route_map_set_delay_timer(u_int32_t value); /* Add zebra route map rule */ static int -zebra_route_match_add(struct vty *vty, struct route_map_index *index, +zebra_route_match_add(struct vty *vty, const char *command, const char *arg, route_map_event_t type) { + VTY_DECLVAR_CONTEXT (route_map_index, index); int ret; ret = route_map_add_match (index, command, arg); @@ -87,10 +88,11 @@ zebra_route_match_add(struct vty *vty, struct route_map_index *index, /* Delete zebra route map rule. */ static int -zebra_route_match_delete (struct vty *vty, struct route_map_index *index, +zebra_route_match_delete (struct vty *vty, const char *command, const char *arg, route_map_event_t type) { + VTY_DECLVAR_CONTEXT (route_map_index, index); int ret; char *dep_name = NULL; const char *tmpstr; @@ -138,9 +140,10 @@ zebra_route_match_delete (struct vty *vty, struct route_map_index *index, /* Add zebra route map rule. */ static int -zebra_route_set_add (struct vty *vty, struct route_map_index *index, +zebra_route_set_add (struct vty *vty, const char *command, const char *arg) { + VTY_DECLVAR_CONTEXT (route_map_index, index); int ret; ret = route_map_add_set (index, command, arg); @@ -161,9 +164,10 @@ zebra_route_set_add (struct vty *vty, struct route_map_index *index, /* Delete zebra route map rule. */ static int -zebra_route_set_delete (struct vty *vty, struct route_map_index *index, +zebra_route_set_delete (struct vty *vty, const char *command, const char *arg) { + VTY_DECLVAR_CONTEXT (route_map_index, index); int ret; ret = route_map_delete_set (index, command, arg); @@ -301,7 +305,7 @@ DEFUN (match_interface, "match first hop interface of route\n" "Interface name\n") { - return zebra_route_match_add (vty, vty->index, "interface", argv[0], + return zebra_route_match_add (vty, "interface", argv[0], RMAP_EVENT_MATCH_ADDED); } @@ -313,9 +317,9 @@ DEFUN (no_match_interface, "Match first hop interface of route\n") { if (argc == 0) - return zebra_route_match_delete (vty, vty->index, "interface", NULL, RMAP_EVENT_MATCH_DELETED); + return zebra_route_match_delete (vty, "interface", NULL, RMAP_EVENT_MATCH_DELETED); - return zebra_route_match_delete (vty, vty->index, "interface", argv[0], RMAP_EVENT_MATCH_DELETED); + return zebra_route_match_delete (vty, "interface", argv[0], RMAP_EVENT_MATCH_DELETED); } ALIAS (no_match_interface, @@ -333,7 +337,7 @@ DEFUN (match_tag, "Match tag of route\n" "Tag value\n") { - return zebra_route_match_add (vty, vty->index, "tag", argv[0], + return zebra_route_match_add (vty, "tag", argv[0], RMAP_EVENT_MATCH_ADDED); } @@ -345,10 +349,10 @@ DEFUN (no_match_tag, "Match tag of route\n") { if (argc == 0) - return zebra_route_match_delete (vty, vty->index, "tag", NULL, + return zebra_route_match_delete (vty, "tag", NULL, RMAP_EVENT_MATCH_DELETED); - return zebra_route_match_delete (vty, vty->index, "tag", argv[0], + return zebra_route_match_delete (vty, "tag", argv[0], RMAP_EVENT_MATCH_DELETED); } @@ -369,7 +373,7 @@ DEFUN (match_ip_next_hop, "IP access-list number (expanded range)\n" "IP Access-list name\n") { - return zebra_route_match_add (vty, vty->index, "ip next-hop", argv[0], RMAP_EVENT_FILTER_ADDED); + return zebra_route_match_add (vty, "ip next-hop", argv[0], RMAP_EVENT_FILTER_ADDED); } DEFUN (no_match_ip_next_hop, @@ -381,10 +385,10 @@ DEFUN (no_match_ip_next_hop, "Match next-hop address of route\n") { if (argc == 0) - return zebra_route_match_delete (vty, vty->index, "ip next-hop", NULL, + return zebra_route_match_delete (vty, "ip next-hop", NULL, RMAP_EVENT_FILTER_DELETED); - return zebra_route_match_delete (vty, vty->index, "ip next-hop", argv[0], + return zebra_route_match_delete (vty, "ip next-hop", argv[0], RMAP_EVENT_FILTER_DELETED); } @@ -408,7 +412,7 @@ DEFUN (match_ip_next_hop_prefix_list, "Match entries of prefix-lists\n" "IP prefix-list name\n") { - return zebra_route_match_add (vty, vty->index, "ip next-hop prefix-list", + return zebra_route_match_add (vty, "ip next-hop prefix-list", argv[0], RMAP_EVENT_PLIST_ADDED); } @@ -422,11 +426,11 @@ DEFUN (no_match_ip_next_hop_prefix_list, "Match entries of prefix-lists\n") { if (argc == 0) - return zebra_route_match_delete (vty, vty->index, + return zebra_route_match_delete (vty, "ip next-hop prefix-list", NULL, RMAP_EVENT_PLIST_DELETED); - return zebra_route_match_delete (vty, vty->index, + return zebra_route_match_delete (vty, "ip next-hop prefix-list", argv[0], RMAP_EVENT_PLIST_DELETED); } @@ -452,7 +456,7 @@ DEFUN (match_ip_address, "IP Access-list name\n") { - return zebra_route_match_add (vty, vty->index, "ip address", argv[0], + return zebra_route_match_add (vty, "ip address", argv[0], RMAP_EVENT_FILTER_ADDED); } @@ -465,10 +469,10 @@ DEFUN (no_match_ip_address, "Match address of route\n") { if (argc == 0) - return zebra_route_match_delete (vty, vty->index, "ip address", NULL, + return zebra_route_match_delete (vty, "ip address", NULL, RMAP_EVENT_FILTER_DELETED); - return zebra_route_match_delete (vty, vty->index, "ip address", argv[0], + return zebra_route_match_delete (vty, "ip address", argv[0], RMAP_EVENT_FILTER_DELETED); } @@ -492,7 +496,7 @@ DEFUN (match_ip_address_prefix_list, "Match entries of prefix-lists\n" "IP prefix-list name\n") { - return zebra_route_match_add (vty, vty->index, "ip address prefix-list", + return zebra_route_match_add (vty, "ip address prefix-list", argv[0], RMAP_EVENT_PLIST_ADDED); } @@ -506,11 +510,11 @@ DEFUN (no_match_ip_address_prefix_list, "Match entries of prefix-lists\n") { if (argc == 0) - return zebra_route_match_delete (vty, vty->index, + return zebra_route_match_delete (vty, "ip address prefix-list", NULL, RMAP_EVENT_PLIST_DELETED); - return zebra_route_match_delete (vty, vty->index, + return zebra_route_match_delete (vty, "ip address prefix-list", argv[0], RMAP_EVENT_PLIST_DELETED); } @@ -534,7 +538,7 @@ DEFUN (match_ip_address_prefix_len, "Match prefix length of ip address\n" "Prefix length\n") { - return zebra_route_match_add (vty, vty->index, "ip address prefix-len", + return zebra_route_match_add (vty, "ip address prefix-len", argv[0], RMAP_EVENT_MATCH_ADDED); } @@ -548,11 +552,11 @@ DEFUN (no_match_ip_address_prefix_len, "prefix length of ip address\n") { if (argc == 0) - return zebra_route_match_delete (vty, vty->index, + return zebra_route_match_delete (vty, "ip address prefix-len", NULL, RMAP_EVENT_MATCH_DELETED); - return zebra_route_match_delete (vty, vty->index, + return zebra_route_match_delete (vty, "ip address prefix-len", argv[0], RMAP_EVENT_MATCH_DELETED); } @@ -575,7 +579,7 @@ DEFUN (match_ip_nexthop_prefix_len, "Match prefixlen of given nexthop\n" "Prefix length\n") { - return zebra_route_match_add (vty, vty->index, "ip next-hop prefix-len", + return zebra_route_match_add (vty, "ip next-hop prefix-len", argv[0], RMAP_EVENT_MATCH_ADDED); } @@ -589,11 +593,11 @@ DEFUN (no_match_ip_nexthop_prefix_len, "Match prefix length of nexthop\n") { if (argc == 0) - return zebra_route_match_delete (vty, vty->index, + return zebra_route_match_delete (vty, "ip next-hop prefix-len", NULL, RMAP_EVENT_MATCH_DELETED); - return zebra_route_match_delete (vty, vty->index, + return zebra_route_match_delete (vty, "ip next-hop prefix-len", argv[0], RMAP_EVENT_MATCH_DELETED); } @@ -620,7 +624,7 @@ DEFUN (match_source_protocol, VTY_NEWLINE); return CMD_WARNING; } - return zebra_route_match_add (vty, vty->index, "source-protocol", + return zebra_route_match_add (vty, "source-protocol", argv[0], RMAP_EVENT_MATCH_ADDED); } @@ -643,7 +647,7 @@ DEFUN (no_match_source_protocol, return CMD_WARNING; } } - return zebra_route_match_delete (vty, vty->index, + return zebra_route_match_delete (vty, "source-protocol", argv[0] ? argv[0] : NULL, RMAP_EVENT_MATCH_DELETED); } @@ -706,7 +710,7 @@ DEFUN (set_src, vty_out (vty, "%% not a local address%s", VTY_NEWLINE); return CMD_WARNING; } - return zebra_route_set_add (vty, vty->index, "src", argv[0]); + return zebra_route_set_add (vty, "src", argv[0]); } DEFUN (no_set_src, @@ -717,9 +721,9 @@ DEFUN (no_set_src, "Source address for route\n") { if (argc == 0) - return zebra_route_set_delete (vty, vty->index, "src", NULL); + return zebra_route_set_delete (vty, "src", NULL); - return zebra_route_set_delete (vty, vty->index, "src", argv[0]); + return zebra_route_set_delete (vty, "src", argv[0]); } DEFUN (zebra_route_map_timer, |
