#include "prefix.h"
#include "filter.h"
+#include "vty.h"
#include "routemap.h"
#include "command.h"
#include "linklist.h"
return CMD_SUCCESS;
}
-/* Add bgp route map rule. */
-static int
-bgp_route_set_add (struct vty *vty, struct route_map_index *index,
- const char *command, const char *arg)
-{
- int ret;
-
- ret = route_map_add_set (index, command, arg);
- if (ret)
- {
- switch (ret)
- {
- case RMAP_RULE_MISSING:
- vty_out (vty, "%% BGP Can't find rule.%s", VTY_NEWLINE);
- return CMD_WARNING;
- case RMAP_COMPILE_ERROR:
- vty_out (vty, "%% BGP Argument is malformed.%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
- }
- return CMD_SUCCESS;
-}
-
-/* Delete bgp route map rule. */
-static int
-bgp_route_set_delete (struct vty *vty, struct route_map_index *index,
- const char *command, const char *arg)
-{
- int ret;
-
- ret = route_map_delete_set (index, command, arg);
- if (ret)
- {
- switch (ret)
- {
- case RMAP_RULE_MISSING:
- vty_out (vty, "%% BGP Can't find rule.%s", VTY_NEWLINE);
- return CMD_WARNING;
- case RMAP_COMPILE_ERROR:
- vty_out (vty, "%% BGP Argument is malformed.%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
- }
- return CMD_SUCCESS;
-}
-
/*
* This is the workhorse routine for processing in/out routemap
* modifications.
}
-
-DEFUN (match_ip_address,
- match_ip_address_cmd,
- "match ip address <(1-199)|(1300-2699)|WORD>",
- MATCH_STR
- IP_STR
- "Match address of route\n"
- "IP access-list number\n"
- "IP access-list number (expanded range)\n"
- "IP Access-list name\n")
-{
- int idx_acl = 3;
- return bgp_route_match_add (vty, vty->index, "ip address", argv[idx_acl]->arg,
- RMAP_EVENT_FILTER_ADDED);
-}
-
-
-DEFUN (no_match_ip_address,
- no_match_ip_address_cmd,
- "no match ip address [<(1-199)|(1300-2699)|WORD>]",
- NO_STR
- MATCH_STR
- IP_STR
- "Match address of route\n"
- "IP access-list number\n"
- "IP access-list number (expanded range)\n"
- "IP Access-list name\n")
-{
- int idx_word = 4;
- if (argc <= idx_word)
- return bgp_route_match_delete (vty, vty->index, "ip address", NULL,
- RMAP_EVENT_FILTER_DELETED);
- return bgp_route_match_delete (vty, vty->index, "ip address", argv[idx_word]->arg,
- RMAP_EVENT_FILTER_DELETED);
-}
-
-
-DEFUN (match_ip_next_hop,
- match_ip_next_hop_cmd,
- "match ip next-hop <(1-199)|(1300-2699)|WORD>",
- MATCH_STR
- IP_STR
- "Match next-hop address of route\n"
- "IP access-list number\n"
- "IP access-list number (expanded range)\n"
- "IP Access-list name\n")
-{
- int idx_acl = 3;
- return bgp_route_match_add (vty, vty->index, "ip next-hop", argv[idx_acl]->arg,
- RMAP_EVENT_FILTER_ADDED);
-}
-
-
-DEFUN (no_match_ip_next_hop,
- no_match_ip_next_hop_cmd,
- "no match ip next-hop [<(1-199)|(1300-2699)|WORD>]",
- NO_STR
- MATCH_STR
- IP_STR
- "Match next-hop address of route\n"
- "IP access-list number\n"
- "IP access-list number (expanded range)\n"
- "IP Access-list name\n")
-{
- int idx_word = 4;
- if (argc <= idx_word)
- return bgp_route_match_delete (vty, vty->index, "ip next-hop", NULL,
- RMAP_EVENT_FILTER_DELETED);
- return bgp_route_match_delete (vty, vty->index, "ip next-hop", argv[idx_word]->arg,
- RMAP_EVENT_FILTER_DELETED);
-}
-
-
/* match probability */
DEFUN (match_probability,
match_probability_cmd,
}
-DEFUN (match_ip_address_prefix_list,
- match_ip_address_prefix_list_cmd,
- "match ip address prefix-list WORD",
- MATCH_STR
- IP_STR
- "Match address of route\n"
- "Match entries of prefix-lists\n"
- "IP prefix-list name\n")
-{
- int idx_word = 4;
- return bgp_route_match_add (vty, vty->index, "ip address prefix-list",
- argv[idx_word]->arg, RMAP_EVENT_PLIST_ADDED);
-}
-
-
-DEFUN (no_match_ip_address_prefix_list,
- no_match_ip_address_prefix_list_cmd,
- "no match ip address prefix-list [WORD]",
- NO_STR
- MATCH_STR
- IP_STR
- "Match address of route\n"
- "Match entries of prefix-lists\n"
- "IP prefix-list name\n")
-{
- int idx_word = 5;
- if (argc <= idx_word)
- return bgp_route_match_delete (vty, vty->index, "ip address prefix-list",
- NULL, RMAP_EVENT_PLIST_DELETED);
- return bgp_route_match_delete (vty, vty->index, "ip address prefix-list",
- argv[idx_word]->arg, RMAP_EVENT_PLIST_DELETED);
-}
-
-
-DEFUN (match_ip_next_hop_prefix_list,
- match_ip_next_hop_prefix_list_cmd,
- "match ip next-hop prefix-list WORD",
- MATCH_STR
- IP_STR
- "Match next-hop address of route\n"
- "Match entries of prefix-lists\n"
- "IP prefix-list name\n")
-{
- int idx_word = 4;
- return bgp_route_match_add (vty, vty->index, "ip next-hop prefix-list",
- argv[idx_word]->arg, RMAP_EVENT_PLIST_ADDED);
-}
-
-DEFUN (no_match_ip_next_hop_prefix_list,
- no_match_ip_next_hop_prefix_list_cmd,
- "no match ip next-hop prefix-list [WORD]",
- NO_STR
- MATCH_STR
- IP_STR
- "Match next-hop address of route\n"
- "Match entries of prefix-lists\n"
- "IP prefix-list name\n")
-{
- int idx_word = 5;
- if (argc <= idx_word)
- return bgp_route_match_delete (vty, vty->index, "ip next-hop prefix-list",
- NULL, RMAP_EVENT_PLIST_DELETED);
- return bgp_route_match_delete (vty, vty->index, "ip next-hop prefix-list",
- argv[idx_word]->arg, RMAP_EVENT_PLIST_DELETED);
-}
-
-
DEFUN (match_ip_route_source_prefix_list,
match_ip_route_source_prefix_list_cmd,
"match ip route-source prefix-list WORD",
}
-DEFUN (match_metric,
- match_metric_cmd,
- "match metric (0-4294967295)",
- MATCH_STR
- "Match metric of route\n"
- "Metric value\n")
-{
- int idx_number = 2;
- return bgp_route_match_add (vty, vty->index, "metric", argv[idx_number]->arg,
- RMAP_EVENT_MATCH_ADDED);
-}
-
-
-DEFUN (no_match_metric,
- no_match_metric_cmd,
- "no match metric [(0-4294967295)]",
- NO_STR
- MATCH_STR
- "Match metric of route\n"
- "Metric value\n")
-{
- int idx_number = 3;
- if (argc <= idx_number)
- return bgp_route_match_delete (vty, vty->index, "metric",
- NULL, RMAP_EVENT_MATCH_DELETED);
- return bgp_route_match_delete (vty, vty->index, "metric",
- argv[idx_number]->arg,
- RMAP_EVENT_MATCH_DELETED);
-}
-
-
DEFUN (match_local_pref,
match_local_pref_cmd,
"match local-preference (0-4294967295)",
RMAP_EVENT_MATCH_DELETED);
}
-
-DEFUN (match_interface,
- match_interface_cmd,
- "match interface WORD",
- MATCH_STR
- "Match first hop interface of route\n"
- "Interface name\n")
-{
- int idx_word = 2;
- return bgp_route_match_add (vty, vty->index, "interface", argv[idx_word]->arg,
- RMAP_EVENT_MATCH_ADDED);
-}
-
-
-DEFUN (no_match_interface,
- no_match_interface_cmd,
- "no match interface [WORD]",
- NO_STR
- MATCH_STR
- "Match first hop interface of route\n"
- "Interface name\n")
-{
- return bgp_route_match_delete (vty, vty->index, "interface", argv[3]->arg,
- RMAP_EVENT_MATCH_DELETED);
-}
-
-
-DEFUN (match_tag,
- match_tag_cmd,
- "match tag (1-65535)",
- MATCH_STR
- "Match tag of route\n"
- "Tag value\n")
-{
- int idx_number = 2;
- return bgp_route_match_add (vty, vty->index, "tag", argv[idx_number]->arg,
- RMAP_EVENT_MATCH_ADDED);
-}
-
-
-DEFUN (no_match_tag,
- no_match_tag_cmd,
- "no match tag [(1-65535)]",
- NO_STR
- MATCH_STR
- "Match tag of route\n"
- "Tag value\n")
-{
- return bgp_route_match_delete (vty, vty->index, "tag", argv[3]->arg,
- RMAP_EVENT_MATCH_DELETED);
-}
-
-
-DEFUN (set_ip_nexthop,
- set_ip_nexthop_cmd,
- "set ip next-hop A.B.C.D",
- SET_STR
- IP_STR
- "Next hop address\n"
- "IP address of next hop\n")
-{
- int idx_ipv4 = 3;
- union sockunion su;
- int ret;
-
- ret = str2sockunion (argv[idx_ipv4]->arg, &su);
- if (ret < 0)
- {
- vty_out (vty, "%% Malformed nexthop address%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
- if (su.sin.sin_addr.s_addr == 0 ||
- IPV4_CLASS_DE(su.sin.sin_addr.s_addr))
- {
- vty_out (vty, "%% nexthop address cannot be 0.0.0.0, multicast "
- "or reserved%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
-
- return bgp_route_set_add (vty, vty->index, "ip next-hop", argv[idx_ipv4]->arg);
-}
-
DEFUN (set_ip_nexthop_peer,
set_ip_nexthop_peer_cmd,
"set ip next-hop peer-address",
"Next hop address\n"
"Use peer address (for BGP only)\n")
{
- return bgp_route_set_add (vty, vty->index, "ip next-hop", "peer-address");
+ return generic_set_add (vty, vty->index, "ip next-hop", "peer-address");
}
DEFUN (set_ip_nexthop_unchanged,
"Next hop address\n"
"Don't modify existing Next hop address\n")
{
- return bgp_route_set_add (vty, vty->index, "ip next-hop", "unchanged");
-}
-
-
-DEFUN (no_set_ip_nexthop,
- no_set_ip_nexthop_cmd,
- "no set ip next-hop [<peer-address|A.B.C.D>]",
- NO_STR
- SET_STR
- "Next hop address\n"
- "Use peer address (for BGP only)\n"
- "IP address of next hop\n")
-{
- int idx_peer = 4;
- if (argc <= idx_peer)
- return bgp_route_set_delete (vty, vty->index, "ip next-hop", NULL);
- return bgp_route_set_delete (vty, vty->index, "ip next-hop", argv[idx_peer]->arg);
-}
-
-
-DEFUN (set_metric,
- set_metric_cmd,
- "set metric <(0-4294967295)|rtt|+rtt|-rtt|+metric|-metric>",
- SET_STR
- "Metric value for destination routing protocol\n"
- "Metric value\n"
- "Assign round trip time\n"
- "Add round trip time\n"
- "Subtract round trip time\n"
- "Add metric\n"
- "Subtract metric\n")
-{
- int idx_number = 2;
- return bgp_route_set_add (vty, vty->index, "metric", argv[idx_number]->arg);
-}
-
-
-DEFUN (no_set_metric,
- no_set_metric_cmd,
- "no set metric [(0-4294967295)]",
- NO_STR
- SET_STR
- "Metric value for destination routing protocol\n"
- "Metric value\n")
-{
- int idx_number = 3;
- if (argc <= idx_number)
- return bgp_route_set_delete (vty, vty->index, "metric", NULL);
- return bgp_route_set_delete (vty, vty->index, "metric", argv[idx_number]->arg);
+ return generic_set_add (vty, vty->index, "ip next-hop", "unchanged");
}
"Preference value\n")
{
int idx_number = 2;
- return bgp_route_set_add (vty, vty->index, "local-preference", argv[idx_number]->arg);
+ return generic_set_add (vty, vty->index, "local-preference", argv[idx_number]->arg);
}
{
int idx_localpref = 3;
if (argc <= idx_localpref)
- return bgp_route_set_delete (vty, vty->index, "local-preference", NULL);
- return bgp_route_set_delete (vty, vty->index, "local-preference", argv[idx_localpref]->arg);
+ return generic_set_delete (vty, vty->index, "local-preference", NULL);
+ return generic_set_delete (vty, vty->index, "local-preference", argv[idx_localpref]->arg);
}
"Weight value\n")
{
int idx_number = 2;
- return bgp_route_set_add (vty, vty->index, "weight", argv[idx_number]->arg);
+ return generic_set_add (vty, vty->index, "weight", argv[idx_number]->arg);
}
{
int idx_weight = 3;
if (argc <= idx_weight)
- return bgp_route_set_delete (vty, vty->index, "weight", NULL);
- return bgp_route_set_delete (vty, vty->index, "weight", argv[idx_weight]->arg);
+ return generic_set_delete (vty, vty->index, "weight", NULL);
+ return generic_set_delete (vty, vty->index, "weight", argv[idx_weight]->arg);
}
char *str;
str = argv_concat (argv, argc, idx_asn);
- ret = bgp_route_set_add (vty, vty->index, "as-path prepend", str);
+ ret = generic_set_add (vty, vty->index, "as-path prepend", str);
XFREE (MTYPE_TMP, str);
return ret;
char *str;
str = argv_concat (argv, argc, idx_asn);
- ret = bgp_route_set_delete (vty, vty->index, "as-path prepend", str);
+ ret = generic_set_delete (vty, vty->index, "as-path prepend", str);
XFREE (MTYPE_TMP, str);
return ret;
}
char *str;
str = argv_concat (argv, argc, idx_asn);
- ret = bgp_route_set_add (vty, vty->index, "as-path exclude", str);
+ ret = generic_set_add (vty, vty->index, "as-path exclude", str);
XFREE (MTYPE_TMP, str);
return ret;
}
char *str;
str = argv_concat (argv, argc, idx_asn);
- ret = bgp_route_set_delete (vty, vty->index, "as-path exclude", str);
+ ret = generic_set_delete (vty, vty->index, "as-path exclude", str);
XFREE (MTYPE_TMP, str);
return ret;
}
argstr = XCALLOC (MTYPE_TMP, strlen (str) + strlen (" additive") + 1);
strcpy (argstr, str);
strcpy (argstr + strlen (str), " additive");
- ret = bgp_route_set_add (vty, vty->index, "community", argstr);
+ ret = generic_set_add (vty, vty->index, "community", argstr);
XFREE (MTYPE_TMP, argstr);
}
else
- ret = bgp_route_set_add (vty, vty->index, "community", str);
+ ret = generic_set_add (vty, vty->index, "community", str);
community_free (com);
"BGP community attribute\n"
"No community attribute\n")
{
- return bgp_route_set_add (vty, vty->index, "community", "none");
+ return generic_set_add (vty, vty->index, "community", "none");
}
DEFUN (no_set_community,
SET_STR
"BGP community attribute\n")
{
- return bgp_route_set_delete (vty, vty->index, "community", NULL);
+ return generic_set_delete (vty, vty->index, "community", NULL);
}
strcpy (str, argv[idx_comm_list]->arg);
strcpy (str + strlen (argv[idx_comm_list]->arg), " delete");
- bgp_route_set_add (vty, vty->index, "comm-list", str);
+ generic_set_add (vty, vty->index, "comm-list", str);
XFREE (MTYPE_TMP, str);
return CMD_SUCCESS;
SET_STR
"set BGP community list (for deletion)\n")
{
- return bgp_route_set_delete (vty, vty->index, "comm-list", NULL);
+ return generic_set_delete (vty, vty->index, "comm-list", NULL);
}
char *str;
str = argv_concat (argv, argc, idx_asn_nn);
- ret = bgp_route_set_add (vty, vty->index, "extcommunity rt", str);
+ ret = generic_set_add (vty, vty->index, "extcommunity rt", str);
XFREE (MTYPE_TMP, str);
return ret;
"BGP extended community attribute\n"
"Route Target extended community\n")
{
- return bgp_route_set_delete (vty, vty->index, "extcommunity rt", NULL);
+ return generic_set_delete (vty, vty->index, "extcommunity rt", NULL);
}
char *str;
str = argv_concat (argv, argc, idx_asn_nn);
- ret = bgp_route_set_add (vty, vty->index, "extcommunity soo", str);
+ ret = generic_set_add (vty, vty->index, "extcommunity soo", str);
XFREE (MTYPE_TMP, str);
return ret;
}
"BGP extended community attribute\n"
"Site-of-Origin extended community\n")
{
- return bgp_route_set_delete (vty, vty->index, "extcommunity soo", NULL);
+ return generic_set_delete (vty, vty->index, "extcommunity soo", NULL);
}
{
int idx_origin = 2;
if (strncmp (argv[idx_origin]->arg, "igp", 2) == 0)
- return bgp_route_set_add (vty, vty->index, "origin", "igp");
+ return generic_set_add (vty, vty->index, "origin", "igp");
if (strncmp (argv[idx_origin]->arg, "egp", 1) == 0)
- return bgp_route_set_add (vty, vty->index, "origin", "egp");
+ return generic_set_add (vty, vty->index, "origin", "egp");
if (strncmp (argv[idx_origin]->arg, "incomplete", 2) == 0)
- return bgp_route_set_add (vty, vty->index, "origin", "incomplete");
+ return generic_set_add (vty, vty->index, "origin", "incomplete");
return CMD_WARNING;
}
SET_STR
"BGP origin code\n")
{
- return bgp_route_set_delete (vty, vty->index, "origin", NULL);
+ return generic_set_delete (vty, vty->index, "origin", NULL);
}
SET_STR
"BGP atomic aggregate attribute\n" )
{
- return bgp_route_set_add (vty, vty->index, "atomic-aggregate", NULL);
+ return generic_set_add (vty, vty->index, "atomic-aggregate", NULL);
}
DEFUN (no_set_atomic_aggregate,
SET_STR
"BGP atomic aggregate attribute\n" )
{
- return bgp_route_set_delete (vty, vty->index, "atomic-aggregate", NULL);
+ return generic_set_delete (vty, vty->index, "atomic-aggregate", NULL);
}
DEFUN (set_aggregator_as,
sprintf (argstr, "%s %s", argv[idx_number]->arg, argv[idx_ipv4]->arg);
- ret = bgp_route_set_add (vty, vty->index, "aggregator as", argstr);
+ ret = generic_set_add (vty, vty->index, "aggregator as", argstr);
XFREE (MTYPE_ROUTE_MAP_COMPILED, argstr);
char *argstr;
if (argc <= idx_asn)
- return bgp_route_set_delete (vty, vty->index, "aggregator as", NULL);
+ return generic_set_delete (vty, vty->index, "aggregator as", NULL);
ret = inet_aton (argv[idx_ip]->arg, &address);
if (ret == 0)
sprintf (argstr, "%s %s", argv[idx_asn]->arg, argv[idx_ip]->arg);
- ret = bgp_route_set_delete (vty, vty->index, "aggregator as", argstr);
+ ret = generic_set_delete (vty, vty->index, "aggregator as", argstr);
XFREE (MTYPE_ROUTE_MAP_COMPILED, argstr);
}
-DEFUN (set_tag,
- set_tag_cmd,
- "set tag (1-65535)",
- SET_STR
- "Tag value for routing protocol\n"
- "Tag value\n")
-{
- int idx_number = 2;
- return bgp_route_set_add (vty, vty->index, "tag", argv[idx_number]->arg);
-}
-
-
-DEFUN (no_set_tag,
- no_set_tag_cmd,
- "no set tag [(1-65535)]",
- NO_STR
- SET_STR
- "Tag value for routing protocol\n"
- "Tag value\n")
-{
- int idx_number = 3;
- if (argc <= idx_number)
- return bgp_route_set_delete (vty, vty->index, "tag", NULL);
- return bgp_route_set_delete (vty, vty->index, "tag", argv[idx_number]->arg);
-}
-
-
-
#ifdef HAVE_IPV6
-DEFUN (match_ipv6_address,
- match_ipv6_address_cmd,
- "match ipv6 address WORD",
- MATCH_STR
- IPV6_STR
- "Match IPv6 address of route\n"
- "IPv6 access-list name\n")
-{
- int idx_word = 3;
- return bgp_route_match_add (vty, vty->index, "ipv6 address", argv[idx_word]->arg,
- RMAP_EVENT_FILTER_ADDED);
-}
-
-DEFUN (no_match_ipv6_address,
- no_match_ipv6_address_cmd,
- "no match ipv6 address WORD",
- NO_STR
- MATCH_STR
- IPV6_STR
- "Match IPv6 address of route\n"
- "IPv6 access-list name\n")
-{
- int idx_word = 4;
- return bgp_route_match_delete (vty, vty->index, "ipv6 address", argv[idx_word]->arg,
- RMAP_EVENT_FILTER_DELETED);
-}
-
DEFUN (match_ipv6_next_hop,
match_ipv6_next_hop_cmd,
"match ipv6 next-hop X:X::X:X",
RMAP_EVENT_MATCH_DELETED);
}
-DEFUN (match_ipv6_address_prefix_list,
- match_ipv6_address_prefix_list_cmd,
- "match ipv6 address prefix-list WORD",
- MATCH_STR
- IPV6_STR
- "Match address of route\n"
- "Match entries of prefix-lists\n"
- "IP prefix-list name\n")
-{
- int idx_word = 4;
- return bgp_route_match_add (vty, vty->index, "ipv6 address prefix-list",
- argv[idx_word]->arg, RMAP_EVENT_PLIST_ADDED);
-}
-
-DEFUN (no_match_ipv6_address_prefix_list,
- no_match_ipv6_address_prefix_list_cmd,
- "no match ipv6 address prefix-list WORD",
- NO_STR
- MATCH_STR
- IPV6_STR
- "Match address of route\n"
- "Match entries of prefix-lists\n"
- "IP prefix-list name\n")
-{
- int idx_word = 5;
- return bgp_route_match_delete (vty, vty->index, "ipv6 address prefix-list",
- argv[idx_word]->arg, RMAP_EVENT_PLIST_DELETED);
-}
DEFUN (set_ipv6_nexthop_peer,
set_ipv6_nexthop_peer_cmd,
"Next hop address\n"
"Use peer address (for BGP only)\n")
{
- return bgp_route_set_add (vty, vty->index, "ipv6 next-hop peer-address", NULL);
+ return generic_set_add (vty, vty->index, "ipv6 next-hop peer-address", NULL);
}
DEFUN (no_set_ipv6_nexthop_peer,
"IPv6 next-hop address\n"
"Use peer address (for BGP only)\n")
{
- return bgp_route_set_delete (vty, vty->index, "ipv6 next-hop peer-address", NULL);
+ return generic_set_delete (vty, vty->index, "ipv6 next-hop peer-address", NULL);
}
DEFUN (set_ipv6_nexthop_prefer_global,
"IPv6 next-hop address\n"
"Prefer global over link-local if both exist\n")
{
- return bgp_route_set_add (vty, vty->index, "ipv6 next-hop prefer-global", NULL);;
+ return generic_set_add (vty, vty->index, "ipv6 next-hop prefer-global", NULL);;
}
DEFUN (no_set_ipv6_nexthop_prefer_global,
"IPv6 next-hop address\n"
"Prefer global over link-local if both exist\n")
{
- return bgp_route_set_delete (vty, vty->index, "ipv6 next-hop prefer-global", NULL);
+ return generic_set_delete (vty, vty->index, "ipv6 next-hop prefer-global", NULL);
}
DEFUN (set_ipv6_nexthop_global,
return CMD_WARNING;
}
- return bgp_route_set_add (vty, vty->index, "ipv6 next-hop global", argv[idx_ipv6]->arg);
+ return generic_set_add (vty, vty->index, "ipv6 next-hop global", argv[idx_ipv6]->arg);
}
{
int idx_ipv6 = 5;
if (argc <= idx_ipv6)
- return bgp_route_set_delete (vty, vty->index, "ipv6 next-hop global", NULL);
- return bgp_route_set_delete (vty, vty->index, "ipv6 next-hop global", argv[idx_ipv6]->arg);
-}
-
-
-DEFUN (set_ipv6_nexthop_local,
- set_ipv6_nexthop_local_cmd,
- "set ipv6 next-hop local X:X::X:X",
- SET_STR
- IPV6_STR
- "IPv6 next-hop address\n"
- "IPv6 local address\n"
- "IPv6 address of next hop\n")
-{
- int idx_ipv6 = 4;
- struct in6_addr addr;
- int ret;
-
- ret = inet_pton (AF_INET6, argv[idx_ipv6]->arg, &addr);
- if (!ret)
- {
- vty_out (vty, "%% Malformed nexthop address%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
- if (!IN6_IS_ADDR_LINKLOCAL(&addr))
- {
- vty_out (vty, "%% Invalid link-local nexthop address%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
-
- return bgp_route_set_add (vty, vty->index, "ipv6 next-hop local", argv[idx_ipv6]->arg);
-}
-
-
-DEFUN (no_set_ipv6_nexthop_local,
- no_set_ipv6_nexthop_local_cmd,
- "no set ipv6 next-hop local [X:X::X:X]",
- NO_STR
- SET_STR
- IPV6_STR
- "IPv6 next-hop address\n"
- "IPv6 local address\n"
- "IPv6 address of next hop\n")
-{
- int idx_ipv6 = 5;
- if (argc <= idx_ipv6)
- return bgp_route_set_delete (vty, vty->index, "ipv6 next-hop local", NULL);
- return bgp_route_set_delete (vty, vty->index, "ipv6 next-hop local", argv[5]->arg);
+ return generic_set_delete (vty, vty->index, "ipv6 next-hop global", NULL);
+ return generic_set_delete (vty, vty->index, "ipv6 next-hop global", argv[idx_ipv6]->arg);
}
-
#endif /* HAVE_IPV6 */
DEFUN (set_vpnv4_nexthop,
"IP address of next hop\n")
{
int idx_ipv4 = 3;
- return bgp_route_set_add (vty, vty->index, "vpnv4 next-hop", argv[idx_ipv4]->arg);
+ return generic_set_add (vty, vty->index, "vpnv4 next-hop", argv[idx_ipv4]->arg);
}
{
int idx_ipv4 = 4;
if (argc <= idx_ipv4)
- return bgp_route_set_delete (vty, vty->index, "vpnv4 next-hop", NULL);
- return bgp_route_set_delete (vty, vty->index, "vpnv4 next-hop", argv[idx_ipv4]->arg);
+ return generic_set_delete (vty, vty->index, "vpnv4 next-hop", NULL);
+ return generic_set_delete (vty, vty->index, "vpnv4 next-hop", argv[idx_ipv4]->arg);
}
"IP address of originator\n")
{
int idx_ipv4 = 2;
- return bgp_route_set_add (vty, vty->index, "originator-id", argv[idx_ipv4]->arg);
+ return generic_set_add (vty, vty->index, "originator-id", argv[idx_ipv4]->arg);
}
{
int idx_id = 3;
if (argc < idx_id)
- return bgp_route_set_delete (vty, vty->index, "originator-id", NULL);
- return bgp_route_set_delete (vty, vty->index, "originator-id", argv[idx_id]->arg);
+ return generic_set_delete (vty, vty->index, "originator-id", NULL);
+ return generic_set_delete (vty, vty->index, "originator-id", argv[idx_id]->arg);
}
route_map_delete_hook (bgp_route_map_delete);
route_map_event_hook (bgp_route_map_event);
+ route_map_match_interface_hook (generic_match_add);
+ route_map_no_match_interface_hook (generic_match_delete);
+
+ route_map_match_ip_address_hook (generic_match_add);
+ route_map_no_match_ip_address_hook (generic_match_delete);
+
+ route_map_match_ip_address_prefix_list_hook (generic_match_add);
+ route_map_no_match_ip_address_prefix_list_hook (generic_match_delete);
+
+ route_map_match_ip_next_hop_hook (generic_match_add);
+ route_map_no_match_ip_next_hop_hook (generic_match_delete);
+
+ route_map_match_ip_next_hop_prefix_list_hook (generic_match_add);
+ route_map_no_match_ip_next_hop_prefix_list_hook (generic_match_delete);
+
+ route_map_match_ipv6_address_hook (generic_match_add);
+ route_map_no_match_ipv6_address_hook (generic_match_delete);
+
+ route_map_match_ipv6_address_prefix_list_hook (generic_match_add);
+ route_map_no_match_ipv6_address_prefix_list_hook (generic_match_delete);
+
+ route_map_match_metric_hook (generic_match_add);
+ route_map_no_match_metric_hook (generic_match_delete);
+
+ route_map_match_tag_hook (generic_match_add);
+ route_map_no_match_tag_hook (generic_match_delete);
+
+ route_map_set_ip_nexthop_hook (generic_set_add);
+ route_map_no_set_ip_nexthop_hook (generic_set_delete);
+
+ route_map_set_ipv6_nexthop_local_hook (generic_set_add);
+ route_map_no_set_ipv6_nexthop_local_hook (generic_set_delete);
+
+ route_map_set_metric_hook (generic_set_add);
+ route_map_no_set_metric_hook (generic_set_delete);
+
+ route_map_set_tag_hook (generic_set_add);
+ route_map_no_set_tag_hook (generic_set_delete);
+
route_map_install_match (&route_match_peer_cmd);
route_map_install_match (&route_match_local_pref_cmd);
route_map_install_match (&route_match_ip_address_cmd);
install_element (RMAP_NODE, &match_peer_cmd);
install_element (RMAP_NODE, &match_peer_local_cmd);
install_element (RMAP_NODE, &no_match_peer_cmd);
- install_element (RMAP_NODE, &match_ip_address_cmd);
- install_element (RMAP_NODE, &no_match_ip_address_cmd);
- install_element (RMAP_NODE, &match_ip_next_hop_cmd);
- install_element (RMAP_NODE, &no_match_ip_next_hop_cmd);
install_element (RMAP_NODE, &match_ip_route_source_cmd);
install_element (RMAP_NODE, &no_match_ip_route_source_cmd);
- install_element (RMAP_NODE, &match_ip_address_prefix_list_cmd);
- install_element (RMAP_NODE, &no_match_ip_address_prefix_list_cmd);
- install_element (RMAP_NODE, &match_ip_next_hop_prefix_list_cmd);
- install_element (RMAP_NODE, &no_match_ip_next_hop_prefix_list_cmd);
install_element (RMAP_NODE, &match_ip_route_source_prefix_list_cmd);
install_element (RMAP_NODE, &no_match_ip_route_source_prefix_list_cmd);
install_element (RMAP_NODE, &match_aspath_cmd);
install_element (RMAP_NODE, &no_match_aspath_cmd);
- install_element (RMAP_NODE, &match_metric_cmd);
- install_element (RMAP_NODE, &no_match_metric_cmd);
install_element (RMAP_NODE, &match_local_pref_cmd);
install_element (RMAP_NODE, &no_match_local_pref_cmd);
install_element (RMAP_NODE, &match_community_cmd);
install_element (RMAP_NODE, &no_match_origin_cmd);
install_element (RMAP_NODE, &match_probability_cmd);
install_element (RMAP_NODE, &no_match_probability_cmd);
- install_element (RMAP_NODE, &match_interface_cmd);
- install_element (RMAP_NODE, &no_match_interface_cmd);
- install_element (RMAP_NODE, &match_tag_cmd);
- install_element (RMAP_NODE, &no_match_tag_cmd);
- install_element (RMAP_NODE, &set_ip_nexthop_cmd);
install_element (RMAP_NODE, &set_ip_nexthop_peer_cmd);
install_element (RMAP_NODE, &set_ip_nexthop_unchanged_cmd);
- install_element (RMAP_NODE, &no_set_ip_nexthop_cmd);
install_element (RMAP_NODE, &set_local_pref_cmd);
install_element (RMAP_NODE, &no_set_local_pref_cmd);
install_element (RMAP_NODE, &set_weight_cmd);
install_element (RMAP_NODE, &no_set_weight_cmd);
- install_element (RMAP_NODE, &set_metric_cmd);
- install_element (RMAP_NODE, &no_set_metric_cmd);
install_element (RMAP_NODE, &set_aspath_prepend_asn_cmd);
install_element (RMAP_NODE, &set_aspath_prepend_lastas_cmd);
install_element (RMAP_NODE, &set_aspath_exclude_cmd);
install_element (RMAP_NODE, &no_set_vpnv4_nexthop_cmd);
install_element (RMAP_NODE, &set_originator_id_cmd);
install_element (RMAP_NODE, &no_set_originator_id_cmd);
- install_element (RMAP_NODE, &set_tag_cmd);
- install_element (RMAP_NODE, &no_set_tag_cmd);
#ifdef HAVE_IPV6
route_map_install_match (&route_match_ipv6_address_cmd);
route_map_install_set (&route_set_ipv6_nexthop_local_cmd);
route_map_install_set (&route_set_ipv6_nexthop_peer_cmd);
- install_element (RMAP_NODE, &match_ipv6_address_cmd);
- install_element (RMAP_NODE, &no_match_ipv6_address_cmd);
install_element (RMAP_NODE, &match_ipv6_next_hop_cmd);
install_element (RMAP_NODE, &no_match_ipv6_next_hop_cmd);
- install_element (RMAP_NODE, &match_ipv6_address_prefix_list_cmd);
- install_element (RMAP_NODE, &no_match_ipv6_address_prefix_list_cmd);
install_element (RMAP_NODE, &set_ipv6_nexthop_global_cmd);
install_element (RMAP_NODE, &no_set_ipv6_nexthop_global_cmd);
install_element (RMAP_NODE, &set_ipv6_nexthop_prefer_global_cmd);
install_element (RMAP_NODE, &no_set_ipv6_nexthop_prefer_global_cmd);
- install_element (RMAP_NODE, &set_ipv6_nexthop_local_cmd);
- install_element (RMAP_NODE, &no_set_ipv6_nexthop_local_cmd);
install_element (RMAP_NODE, &set_ipv6_nexthop_peer_cmd);
install_element (RMAP_NODE, &no_set_ipv6_nexthop_peer_cmd);
#endif /* HAVE_IPV6 */