#include "prefix.h"
#include "filter.h"
+#include "vty.h"
#include "routemap.h"
#include "command.h"
#include "linklist.h"
#ifdef HAVE_LIBPCREPOSIX
# include <pcreposix.h>
#else
-# ifdef HAVE_GNU_REGEX
-# include <regex.h>
-# else
-# include "regex-gnu.h"
-# endif /* HAVE_GNU_REGEX */
+# include <regex.h>
#endif /* HAVE_LIBPCREPOSIX */
#include "buffer.h"
#include "sockunion.h"
#include "bgpd/bgp_filter.h"
#include "bgpd/bgp_mplsvpn.h"
#include "bgpd/bgp_ecommunity.h"
+#include "bgpd/bgp_lcommunity.h"
#include "bgpd/bgp_vty.h"
#include "bgpd/bgp_debug.h"
+#if ENABLE_BGP_VNC
+# include "bgpd/rfapi/bgp_rfapi_cfg.h"
+#endif
/* Memo of route-map commands.
as-path tag : Not yet
automatic-tag : (This will not be implemented by bgpd)
community : Done
+ large-community : Done
+ large-comm-list : Done
comm-list : Not yet
dampning : Not yet
default : (This will not be implemented by bgpd)
o Local extensions
set ipv6 next-hop global: Done
+ set ipv6 next-hop prefer-global: Done
set ipv6 next-hop local : Done
set as-path exclude : Done
-*/
+*/
+
+ /* generic value manipulation to be shared in multiple rules */
+
+#define RMAP_VALUE_SET 0
+#define RMAP_VALUE_ADD 1
+#define RMAP_VALUE_SUB 2
+
+struct rmap_value
+{
+ u_int8_t action;
+ u_int8_t variable;
+ u_int32_t value;
+};
+
+static int
+route_value_match (struct rmap_value *rv, u_int32_t value)
+{
+ if (rv->variable == 0 && value == rv->value)
+ return RMAP_MATCH;
+
+ return RMAP_NOMATCH;
+}
+
+static u_int32_t
+route_value_adjust (struct rmap_value *rv, u_int32_t current, struct peer *peer)
+{
+ u_int32_t value;
+
+ switch (rv->variable)
+ {
+ case 1:
+ value = peer->rtt;
+ break;
+ default:
+ value = rv->value;
+ break;
+ }
+
+ switch (rv->action)
+ {
+ case RMAP_VALUE_ADD:
+ if (current > UINT32_MAX-value)
+ return UINT32_MAX;
+ return current + value;
+ case RMAP_VALUE_SUB:
+ if (current <= value)
+ return 0;
+ return current - value;
+ default:
+ return value;
+ }
+}
+
+static void *
+route_value_compile (const char *arg)
+{
+ u_int8_t action = RMAP_VALUE_SET, var = 0;
+ unsigned long larg = 0;
+ char *endptr = NULL;
+ struct rmap_value *rv;
+
+ if (arg[0] == '+')
+ {
+ action = RMAP_VALUE_ADD;
+ arg++;
+ }
+ else if (arg[0] == '-')
+ {
+ action = RMAP_VALUE_SUB;
+ arg++;
+ }
+
+ if (all_digit(arg))
+ {
+ errno = 0;
+ larg = strtoul (arg, &endptr, 10);
+ if (*arg == 0 || *endptr != 0 || errno || larg > UINT32_MAX)
+ return NULL;
+ }
+ else
+ {
+ if (strcmp(arg, "rtt") == 0)
+ var = 1;
+ else
+ return NULL;
+ }
+
+ rv = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof(struct rmap_value));
+ if (!rv)
+ return NULL;
+
+ rv->action = action;
+ rv->variable = var;
+ rv->value = larg;
+ return rv;
+}
+
+static void
+route_value_free (void *rule)
+{
+ XFREE (MTYPE_ROUTE_MAP_COMPILED, rule);
+}
/* generic as path object to be shared in multiple rules */
void *object)
{
union sockunion *su;
- union sockunion su_def = { .sin.sin_family = AF_INET,
- .sin.sin_addr.s_addr = INADDR_ANY };
+ union sockunion su_def = { .sin = { .sin_family = AF_INET,
+ .sin_addr.s_addr = INADDR_ANY } };
struct peer_group *group;
struct peer *peer;
struct listnode *node, *nnode;
/* Match function should return 1 if match is success else return
zero. */
static route_map_result_t
-route_match_ip_address (void *rule, struct prefix *prefix,
+route_match_ip_address (void *rule, struct prefix *prefix,
route_map_object_t type, void *object)
{
struct access_list *alist;
alist = access_list_lookup (AFI_IP, (char *) rule);
if (alist == NULL)
return RMAP_NOMATCH;
-
+
return (access_list_apply (alist, prefix) == FILTER_DENY ?
RMAP_NOMATCH : RMAP_MATCH);
}
/* Match function return 1 if match is success else return zero. */
static route_map_result_t
-route_match_ip_next_hop (void *rule, struct prefix *prefix,
+route_match_ip_next_hop (void *rule, struct prefix *prefix,
route_map_object_t type, void *object)
{
struct access_list *alist;
/* Match function return 1 if match is success else return zero. */
static route_map_result_t
-route_match_ip_route_source (void *rule, struct prefix *prefix,
+route_match_ip_route_source (void *rule, struct prefix *prefix,
route_map_object_t type, void *object)
{
struct access_list *alist;
/* `match ip address prefix-list PREFIX_LIST' */
static route_map_result_t
-route_match_ip_address_prefix_list (void *rule, struct prefix *prefix,
+route_match_ip_address_prefix_list (void *rule, struct prefix *prefix,
route_map_object_t type, void *object)
{
struct prefix_list *plist;
plist = prefix_list_lookup (AFI_IP, (char *) rule);
if (plist == NULL)
return RMAP_NOMATCH;
-
+
return (prefix_list_apply (plist, prefix) == PREFIX_DENY ?
RMAP_NOMATCH : RMAP_MATCH);
}
/* Match function return 1 if match is success else return zero. */
static route_map_result_t
-route_match_metric (void *rule, struct prefix *prefix,
+route_match_metric (void *rule, struct prefix *prefix,
route_map_object_t type, void *object)
{
- u_int32_t *med;
+ struct rmap_value *rv;
struct bgp_info *bgp_info;
if (type == RMAP_BGP)
{
- med = rule;
+ rv = rule;
bgp_info = object;
-
- if (bgp_info->attr->med == *med)
- return RMAP_MATCH;
- else
- return RMAP_NOMATCH;
+ return route_value_match(rv, bgp_info->attr->med);
}
return RMAP_NOMATCH;
}
-/* Route map `match metric' match statement. `arg' is MED value */
-static void *
-route_match_metric_compile (const char *arg)
-{
- u_int32_t *med;
- char *endptr = NULL;
- unsigned long tmpval;
-
- /* Metric value shoud be integer. */
- if (! all_digit (arg))
- return NULL;
-
- errno = 0;
- tmpval = strtoul (arg, &endptr, 10);
- if (*endptr != '\0' || errno || tmpval > UINT32_MAX)
- return NULL;
-
- med = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (u_int32_t));
-
- if (!med)
- return med;
-
- *med = tmpval;
- return med;
-}
-
-/* Free route map's compiled `match metric' value. */
-static void
-route_match_metric_free (void *rule)
-{
- XFREE (MTYPE_ROUTE_MAP_COMPILED, rule);
-}
-
/* Route map commands for metric matching. */
struct route_map_rule_cmd route_match_metric_cmd =
{
"metric",
route_match_metric,
- route_match_metric_compile,
- route_match_metric_free
+ route_value_compile,
+ route_value_free,
};
/* `match as-path ASPATH' */
/* Match function for as-path match. I assume given object is */
static route_map_result_t
-route_match_aspath (void *rule, struct prefix *prefix,
+route_match_aspath (void *rule, struct prefix *prefix,
route_map_object_t type, void *object)
{
-
+
struct as_list *as_list;
struct bgp_info *bgp_info;
}
/* Route map commands for aspath matching. */
-struct route_map_rule_cmd route_match_aspath_cmd =
+struct route_map_rule_cmd route_match_aspath_cmd =
{
"as-path",
route_match_aspath,
/* Match function for community match. */
static route_map_result_t
-route_match_community (void *rule, struct prefix *prefix,
+route_match_community (void *rule, struct prefix *prefix,
route_map_object_t type, void *object)
{
struct community_list *list;
struct bgp_info *bgp_info;
struct rmap_community *rcom;
- if (type == RMAP_BGP)
+ if (type == RMAP_BGP)
{
bgp_info = object;
rcom = rule;
{
struct rmap_community *rcom = rule;
- XFREE (MTYPE_ROUTE_MAP_COMPILED, rcom->name);
+ XFREE (MTYPE_ROUTE_MAP_COMPILED, rcom->name);
XFREE (MTYPE_ROUTE_MAP_COMPILED, rcom);
}
/* Route map commands for community matching. */
-struct route_map_rule_cmd route_match_community_cmd =
+struct route_map_rule_cmd route_match_community_cmd =
{
"community",
route_match_community,
route_match_community_free
};
+/* Match function for lcommunity match. */
+static route_map_result_t
+route_match_lcommunity (void *rule, struct prefix *prefix,
+ route_map_object_t type, void *object)
+{
+ struct community_list *list;
+ struct bgp_info *bgp_info;
+ struct rmap_community *rcom;
+
+ if (type == RMAP_BGP)
+ {
+ bgp_info = object;
+ rcom = rule;
+
+ list = community_list_lookup (bgp_clist, rcom->name,
+ LARGE_COMMUNITY_LIST_MASTER);
+ if (! list)
+ return RMAP_NOMATCH;
+
+ if (bgp_info->attr->extra &&
+ lcommunity_list_match (bgp_info->attr->extra->lcommunity, list))
+ return RMAP_MATCH;
+
+ }
+ return RMAP_NOMATCH;
+}
+
+/* Compile function for community match. */
+static void *
+route_match_lcommunity_compile (const char *arg)
+{
+ struct rmap_community *rcom;
+ int len;
+ char *p;
+
+ rcom = XCALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (struct rmap_community));
+
+ p = strchr (arg, ' ');
+ if (p)
+ {
+ len = p - arg;
+ rcom->name = XCALLOC (MTYPE_ROUTE_MAP_COMPILED, len + 1);
+ memcpy (rcom->name, arg, len);
+ }
+ else
+ {
+ rcom->name = XSTRDUP (MTYPE_ROUTE_MAP_COMPILED, arg);
+ rcom->exact = 0;
+ }
+ return rcom;
+}
+
+/* Compile function for community match. */
+static void
+route_match_lcommunity_free (void *rule)
+{
+ struct rmap_community *rcom = rule;
+
+ XFREE (MTYPE_ROUTE_MAP_COMPILED, rcom->name);
+ XFREE (MTYPE_ROUTE_MAP_COMPILED, rcom);
+}
+
+/* Route map commands for community matching. */
+struct route_map_rule_cmd route_match_lcommunity_cmd =
+{
+ "large-community",
+ route_match_lcommunity,
+ route_match_lcommunity_compile,
+ route_match_lcommunity_free
+};
+
+
/* Match function for extcommunity match. */
static route_map_result_t
-route_match_ecommunity (void *rule, struct prefix *prefix,
+route_match_ecommunity (void *rule, struct prefix *prefix,
route_map_object_t type, void *object)
{
struct community_list *list;
struct bgp_info *bgp_info;
- if (type == RMAP_BGP)
+ if (type == RMAP_BGP)
{
bgp_info = object;
-
+
if (!bgp_info->attr->extra)
return RMAP_NOMATCH;
-
+
list = community_list_lookup (bgp_clist, (char *) rule,
EXTCOMMUNITY_LIST_MASTER);
if (! list)
}
/* Route map commands for community matching. */
-struct route_map_rule_cmd route_match_ecommunity_cmd =
+struct route_map_rule_cmd route_match_ecommunity_cmd =
{
"extcommunity",
route_match_ecommunity,
/* `match origin' */
static route_map_result_t
-route_match_origin (void *rule, struct prefix *prefix,
+route_match_origin (void *rule, struct prefix *prefix,
route_map_object_t type, void *object)
{
u_char *origin;
{
origin = rule;
bgp_info = object;
-
+
if (bgp_info->attr->origin == *origin)
return RMAP_MATCH;
}
route_match_probability (void *rule, struct prefix *prefix,
route_map_object_t type, void *object)
{
- unsigned long r;
-#if _SVID_SOURCE || _BSD_SOURCE || _XOPEN_SOURCE >= 500
- r = random();
-#else
- r = (unsigned long) rand();
-#endif
+ long r = random();
- switch (*(unsigned *) rule)
+ switch (*(long *) rule)
{
case 0: break;
case RAND_MAX: return RMAP_MATCH;
default:
- if (r < *(unsigned *) rule)
+ if (r < *(long *) rule)
{
return RMAP_MATCH;
}
static void *
route_match_probability_compile (const char *arg)
{
- unsigned *lobule;
+ long *lobule;
unsigned perc;
-#if _SVID_SOURCE || _BSD_SOURCE || _XOPEN_SOURCE >= 500
- srandom (time (NULL));
-#else
- srand (time (NULL));
-#endif
-
perc = atoi (arg);
- lobule = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (unsigned));
+ lobule = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (long));
switch (perc)
{
route_match_tag (void *rule, struct prefix *prefix,
route_map_object_t type, void *object)
{
- u_short *tag;
+ route_tag_t *tag;
struct bgp_info *bgp_info;
if (type == RMAP_BGP)
}
-/* Route map `match tag' match statement. `arg' is TAG value */
-static void *
-route_match_tag_compile (const char *arg)
-{
- u_short *tag;
- u_short tmp;
-
- /* tag value shoud be integer. */
- if (! all_digit (arg))
- return NULL;
-
- tmp = atoi(arg);
- if (tmp < 1)
- return NULL;
-
- tag = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (u_short));
-
- if (!tag)
- return tag;
-
- *tag = tmp;
-
- return tag;
-}
-
-
-/* Free route map's compiled 'match tag' value. */
-static void
-route_match_tag_free (void *rule)
-{
- XFREE (MTYPE_ROUTE_MAP_COMPILED, rule);
-}
-
/* Route map commands for tag matching. */
-struct route_map_rule_cmd route_match_tag_cmd =
+static struct route_map_rule_cmd route_match_tag_cmd =
{
"tag",
route_match_tag,
- route_match_tag_compile,
- route_match_tag_free,
+ route_map_rule_tag_compile,
+ route_map_rule_tag_free,
};
{
if ((CHECK_FLAG (peer->rmap_type, PEER_RMAP_TYPE_IN) ||
CHECK_FLAG (peer->rmap_type, PEER_RMAP_TYPE_IMPORT))
- && peer->su_remote
+ && peer->su_remote
&& sockunion_family (peer->su_remote) == AF_INET)
{
bgp_info->attr->nexthop.s_addr = sockunion2ip (peer->su_remote);
if (rins->address)
XFREE (MTYPE_ROUTE_MAP_COMPILED, rins->address);
-
+
XFREE (MTYPE_ROUTE_MAP_COMPILED, rins);
}
route_set_local_pref (void *rule, struct prefix *prefix,
route_map_object_t type, void *object)
{
- u_int32_t *local_pref;
+ struct rmap_value *rv;
struct bgp_info *bgp_info;
+ u_int32_t locpref = 0;
if (type == RMAP_BGP)
{
/* Fetch routemap's rule information. */
- local_pref = rule;
+ rv = rule;
bgp_info = object;
-
- /* Set local preference value. */
+
+ /* Set local preference value. */
+ if (bgp_info->attr->flag & ATTR_FLAG_BIT (BGP_ATTR_LOCAL_PREF))
+ locpref = bgp_info->attr->local_pref;
+
bgp_info->attr->flag |= ATTR_FLAG_BIT (BGP_ATTR_LOCAL_PREF);
- bgp_info->attr->local_pref = *local_pref;
+ bgp_info->attr->local_pref = route_value_adjust(rv, locpref, bgp_info->peer);
}
return RMAP_OKAY;
}
-/* set local preference compilation. */
-static void *
-route_set_local_pref_compile (const char *arg)
-{
- unsigned long tmp;
- u_int32_t *local_pref;
- char *endptr = NULL;
-
- /* Local preference value shoud be integer. */
- if (! all_digit (arg))
- return NULL;
-
- errno = 0;
- tmp = strtoul (arg, &endptr, 10);
- if (*endptr != '\0' || errno || tmp > UINT32_MAX)
- return NULL;
-
- local_pref = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (u_int32_t));
-
- if (!local_pref)
- return local_pref;
-
- *local_pref = tmp;
-
- return local_pref;
-}
-
-/* Free route map's local preference value. */
-static void
-route_set_local_pref_free (void *rule)
-{
- XFREE (MTYPE_ROUTE_MAP_COMPILED, rule);
-}
-
/* Set local preference rule structure. */
-struct route_map_rule_cmd route_set_local_pref_cmd =
+struct route_map_rule_cmd route_set_local_pref_cmd =
{
"local-preference",
route_set_local_pref,
- route_set_local_pref_compile,
- route_set_local_pref_free,
+ route_value_compile,
+ route_value_free,
};
/* `set weight WEIGHT' */
route_set_weight (void *rule, struct prefix *prefix, route_map_object_t type,
void *object)
{
- u_int32_t *weight;
+ struct rmap_value *rv;
struct bgp_info *bgp_info;
+ u_int32_t weight;
if (type == RMAP_BGP)
{
/* Fetch routemap's rule information. */
- weight = rule;
+ rv = rule;
bgp_info = object;
-
- /* Set weight value. */
- if (*weight)
- (bgp_attr_extra_get (bgp_info->attr))->weight = *weight;
+
+ /* Set weight value. */
+ weight = route_value_adjust(rv, 0, bgp_info->peer);
+ if (weight)
+ (bgp_attr_extra_get (bgp_info->attr))->weight = weight;
else if (bgp_info->attr->extra)
bgp_info->attr->extra->weight = 0;
}
return RMAP_OKAY;
}
-/* set local preference compilation. */
-static void *
-route_set_weight_compile (const char *arg)
-{
- unsigned long tmp;
- u_int32_t *weight;
- char *endptr = NULL;
-
- /* Local preference value shoud be integer. */
- if (! all_digit (arg))
- return NULL;
-
- errno = 0;
- tmp = strtoul (arg, &endptr, 10);
- if (*endptr != '\0' || errno || tmp > UINT32_MAX)
- return NULL;
-
- weight = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (u_int32_t));
-
- if (weight == NULL)
- return weight;
-
- *weight = tmp;
-
- return weight;
-}
-
-/* Free route map's local preference value. */
-static void
-route_set_weight_free (void *rule)
-{
- XFREE (MTYPE_ROUTE_MAP_COMPILED, rule);
-}
-
/* Set local preference rule structure. */
-struct route_map_rule_cmd route_set_weight_cmd =
+struct route_map_rule_cmd route_set_weight_cmd =
{
"weight",
route_set_weight,
- route_set_weight_compile,
- route_set_weight_free,
+ route_value_compile,
+ route_value_free,
};
/* `set metric METRIC' */
/* Set metric to attribute. */
static route_map_result_t
-route_set_metric (void *rule, struct prefix *prefix,
+route_set_metric (void *rule, struct prefix *prefix,
route_map_object_t type, void *object)
{
- char *metric;
- u_int32_t metric_val;
+ struct rmap_value *rv;
struct bgp_info *bgp_info;
+ u_int32_t med = 0;
if (type == RMAP_BGP)
{
/* Fetch routemap's rule information. */
- metric = rule;
+ rv = rule;
bgp_info = object;
- if (! (bgp_info->attr->flag & ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC)))
- bgp_info->attr->med = 0;
- bgp_info->attr->flag |= ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC);
-
- if (all_digit (metric))
- {
- metric_val = strtoul (metric, (char **)NULL, 10);
- bgp_info->attr->med = metric_val;
- }
- else
- {
- metric_val = strtoul (metric+1, (char **)NULL, 10);
+ if (bgp_info->attr->flag & ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC))
+ med = bgp_info->attr->med;
- if (strncmp (metric, "+", 1) == 0)
- {
- if (bgp_info->attr->med/2 + metric_val/2 > BGP_MED_MAX/2)
- bgp_info->attr->med = BGP_MED_MAX - 1;
- else
- bgp_info->attr->med += metric_val;
- }
- else if (strncmp (metric, "-", 1) == 0)
- {
- if (bgp_info->attr->med <= metric_val)
- bgp_info->attr->med = 0;
- else
- bgp_info->attr->med -= metric_val;
- }
- }
+ bgp_info->attr->med = route_value_adjust(rv, med, bgp_info->peer);
+ bgp_info->attr->flag |= ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC);
}
return RMAP_OKAY;
}
-/* set metric compilation. */
-static void *
-route_set_metric_compile (const char *arg)
-{
- unsigned long larg;
- char *endptr = NULL;
-
- if (all_digit (arg))
- {
- /* set metric value check*/
- errno = 0;
- larg = strtoul (arg, &endptr, 10);
- if (*endptr != '\0' || errno || larg > UINT32_MAX)
- return NULL;
- }
- else
- {
- /* set metric <+/-metric> check */
- if ((strncmp (arg, "+", 1) != 0
- && strncmp (arg, "-", 1) != 0)
- || (! all_digit (arg+1)))
- return NULL;
-
- errno = 0;
- larg = strtoul (arg+1, &endptr, 10);
- if (*endptr != '\0' || errno || larg > UINT32_MAX)
- return NULL;
- }
-
- return XSTRDUP (MTYPE_ROUTE_MAP_COMPILED, arg);
-}
-
-/* Free route map's compiled `set metric' value. */
-static void
-route_set_metric_free (void *rule)
-{
- XFREE (MTYPE_ROUTE_MAP_COMPILED, rule);
-}
-
/* Set metric rule structure. */
-struct route_map_rule_cmd route_set_metric_cmd =
+struct route_map_rule_cmd route_set_metric_cmd =
{
"metric",
route_set_metric,
- route_set_metric_compile,
- route_set_metric_free,
+ route_value_compile,
+ route_value_free,
};
/* `set as-path prepend ASPATH' */
if (type == RMAP_BGP)
{
binfo = object;
-
+
if (binfo->attr->aspath->refcnt)
new = aspath_dup (binfo->attr->aspath);
else
/* Set as-path prepend rule structure. */
-struct route_map_rule_cmd route_set_aspath_prepend_cmd =
+struct route_map_rule_cmd route_set_aspath_prepend_cmd =
{
"as-path prepend",
route_set_aspath_prepend,
}
/* Set ASn exlude rule structure. */
-struct route_map_rule_cmd route_set_aspath_exclude_cmd =
+struct route_map_rule_cmd route_set_aspath_exclude_cmd =
{
"as-path exclude",
route_set_aspath_exclude,
struct community *new = NULL;
struct community *old;
struct community *merge;
-
+
if (type == RMAP_BGP)
{
rcs = rule;
if (rcs->additive && old)
{
merge = community_merge (community_dup (old), rcs->com);
-
- /* HACK: if the old community is not intern'd,
+
+ /* HACK: if the old community is not intern'd,
* we should free it here, or all reference to it may be lost.
* Really need to cleanup attribute caching sometime.
*/
}
else
new = community_dup (rcs->com);
-
+
/* will be interned by caller if required */
attr->community = new;
char *sp;
int additive = 0;
int none = 0;
-
+
if (strcmp (arg, "none") == 0)
none = 1;
else
if (! com)
return NULL;
}
-
+
rcs = XCALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (struct rmap_com_set));
rcs->com = com;
rcs->additive = additive;
rcs->none = none;
-
+
return rcs;
}
}
/* Set community rule structure. */
-struct route_map_rule_cmd route_set_community_cmd =
+struct route_map_rule_cmd route_set_community_cmd =
{
"community",
route_set_community,
route_set_community_free,
};
-/* `set comm-list (<1-99>|<100-500>|WORD) delete' */
+/* `set community COMMUNITY' */
+struct rmap_lcom_set
+{
+ struct lcommunity *lcom;
+ int additive;
+ int none;
+};
-/* For community set mechanism. */
+
+/* For lcommunity set mechanism. */
static route_map_result_t
-route_set_community_delete (void *rule, struct prefix *prefix,
- route_map_object_t type, void *object)
+route_set_lcommunity (void *rule, struct prefix *prefix,
+ route_map_object_t type, void *object)
+{
+ struct rmap_lcom_set *rcs;
+ struct bgp_info *binfo;
+ struct attr *attr;
+ struct lcommunity *new = NULL;
+ struct lcommunity *old;
+ struct lcommunity *merge;
+
+ if (type == RMAP_BGP)
+ {
+ rcs = rule;
+ binfo = object;
+ attr = binfo->attr;
+ old = (attr->extra) ? attr->extra->lcommunity : NULL;
+
+ /* "none" case. */
+ if (rcs->none)
+ {
+ attr->flag &= ~(ATTR_FLAG_BIT (BGP_ATTR_LARGE_COMMUNITIES));
+ if (attr->extra)
+ attr->extra->lcommunity = NULL;
+
+ /* See the longer comment down below. */
+ if (old && old->refcnt == 0)
+ lcommunity_free(&old);
+ return RMAP_OKAY;
+ }
+
+ if (rcs->additive && old)
+ {
+ merge = lcommunity_merge (lcommunity_dup (old), rcs->lcom);
+
+ /* HACK: if the old large-community is not intern'd,
+ * we should free it here, or all reference to it may be lost.
+ * Really need to cleanup attribute caching sometime.
+ */
+ if (old->refcnt == 0)
+ lcommunity_free (&old);
+ new = lcommunity_uniq_sort (merge);
+ lcommunity_free (&merge);
+ }
+ else
+ new = lcommunity_dup (rcs->lcom);
+
+ /* will be interned by caller if required */
+ if (attr->extra)
+ attr->extra->lcommunity = new;
+
+ attr->flag |= ATTR_FLAG_BIT (BGP_ATTR_LARGE_COMMUNITIES);
+ }
+
+ return RMAP_OKAY;
+}
+
+/* Compile function for set community. */
+static void *
+route_set_lcommunity_compile (const char *arg)
+{
+ struct rmap_lcom_set *rcs;
+ struct lcommunity *lcom = NULL;
+ char *sp;
+ int additive = 0;
+ int none = 0;
+
+ if (strcmp (arg, "none") == 0)
+ none = 1;
+ else
+ {
+ sp = strstr (arg, "additive");
+
+ if (sp && sp > arg)
+ {
+ /* "additive" keyworkd is included. */
+ additive = 1;
+ *(sp - 1) = '\0';
+ }
+
+ lcom = lcommunity_str2com (arg);
+
+ if (additive)
+ *(sp - 1) = ' ';
+
+ if (! lcom)
+ return NULL;
+ }
+
+ rcs = XCALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (struct rmap_com_set));
+ rcs->lcom = lcom;
+ rcs->additive = additive;
+ rcs->none = none;
+
+ return rcs;
+}
+
+/* Free function for set lcommunity. */
+static void
+route_set_lcommunity_free (void *rule)
+{
+ struct rmap_lcom_set *rcs = rule;
+
+ if (rcs->lcom) {
+ lcommunity_free (&rcs->lcom);
+ }
+ XFREE (MTYPE_ROUTE_MAP_COMPILED, rcs);
+}
+
+/* Set community rule structure. */
+struct route_map_rule_cmd route_set_lcommunity_cmd =
+{
+ "large-community",
+ route_set_lcommunity,
+ route_set_lcommunity_compile,
+ route_set_lcommunity_free,
+};
+
+/* `set large-comm-list (<1-99>|<100-500>|WORD) delete' */
+
+/* For large community set mechanism. */
+static route_map_result_t
+route_set_lcommunity_delete (void *rule, struct prefix *prefix,
+ route_map_object_t type, void *object)
+{
+ struct community_list *list;
+ struct lcommunity *merge;
+ struct lcommunity *new;
+ struct lcommunity *old;
+ struct bgp_info *binfo;
+
+ if (type == RMAP_BGP)
+ {
+ if (! rule)
+ return RMAP_OKAY;
+
+ binfo = object;
+ list = community_list_lookup (bgp_clist, rule,
+ LARGE_COMMUNITY_LIST_MASTER);
+ old = ((binfo->attr->extra) ? binfo->attr->extra->lcommunity : NULL);
+
+ if (list && old)
+ {
+ merge = lcommunity_list_match_delete (lcommunity_dup (old), list);
+ new = lcommunity_uniq_sort (merge);
+ lcommunity_free (&merge);
+
+ /* HACK: if the old community is not intern'd,
+ * we should free it here, or all reference to it may be lost.
+ * Really need to cleanup attribute caching sometime.
+ */
+ if (old->refcnt == 0)
+ lcommunity_free (&old);
+
+ if (new->size == 0)
+ {
+ binfo->attr->extra->lcommunity = NULL;
+ binfo->attr->flag &= ~ATTR_FLAG_BIT (BGP_ATTR_LARGE_COMMUNITIES);
+ lcommunity_free (&new);
+ }
+ else
+ {
+ binfo->attr->extra->lcommunity = new;
+ binfo->attr->flag |= ATTR_FLAG_BIT (BGP_ATTR_LARGE_COMMUNITIES);
+ }
+ }
+ }
+
+ return RMAP_OKAY;
+}
+
+/* Compile function for set lcommunity. */
+static void *
+route_set_lcommunity_delete_compile (const char *arg)
+{
+ char *p;
+ char *str;
+ int len;
+
+ p = strchr (arg, ' ');
+ if (p)
+ {
+ len = p - arg;
+ str = XCALLOC (MTYPE_ROUTE_MAP_COMPILED, len + 1);
+ memcpy (str, arg, len);
+ }
+ else
+ str = NULL;
+
+ return str;
+}
+
+/* Free function for set lcommunity. */
+static void
+route_set_lcommunity_delete_free (void *rule)
+{
+ XFREE (MTYPE_ROUTE_MAP_COMPILED, rule);
+}
+
+/* Set lcommunity rule structure. */
+struct route_map_rule_cmd route_set_lcommunity_delete_cmd =
+{
+ "large-comm-list",
+ route_set_lcommunity_delete,
+ route_set_lcommunity_delete_compile,
+ route_set_lcommunity_delete_free,
+};
+
+
+/* `set comm-list (<1-99>|<100-500>|WORD) delete' */
+
+/* For community set mechanism. */
+static route_map_result_t
+route_set_community_delete (void *rule, struct prefix *prefix,
+ route_map_object_t type, void *object)
{
struct community_list *list;
struct community *merge;
{
ecom = rule;
bgp_info = object;
-
+
if (! ecom)
return RMAP_OKAY;
-
+
/* We assume additive for Extended Community. */
old_ecom = (bgp_attr_extra_get (bgp_info->attr))->ecommunity;
}
/* Set community rule structure. */
-struct route_map_rule_cmd route_set_ecommunity_rt_cmd =
+struct route_map_rule_cmd route_set_ecommunity_rt_cmd =
{
"extcommunity rt",
route_set_ecommunity,
ecom = ecommunity_str2com (arg, ECOMMUNITY_SITE_ORIGIN, 0);
if (! ecom)
return NULL;
-
+
return ecommunity_intern (ecom);
}
/* Set community rule structure. */
-struct route_map_rule_cmd route_set_ecommunity_soo_cmd =
+struct route_map_rule_cmd route_set_ecommunity_soo_cmd =
{
"extcommunity soo",
route_set_ecommunity,
{
origin = rule;
bgp_info = object;
-
+
bgp_info->attr->origin = *origin;
}
}
/* Set origin rule structure. */
-struct route_map_rule_cmd route_set_origin_cmd =
+struct route_map_rule_cmd route_set_origin_cmd =
{
"origin",
route_set_origin,
}
/* Set atomic aggregate rule structure. */
-struct route_map_rule_cmd route_set_atomic_aggregate_cmd =
+struct route_map_rule_cmd route_set_atomic_aggregate_cmd =
{
"atomic-aggregate",
route_set_atomic_aggregate,
};
static route_map_result_t
-route_set_aggregator_as (void *rule, struct prefix *prefix,
+route_set_aggregator_as (void *rule, struct prefix *prefix,
route_map_object_t type, void *object)
{
struct bgp_info *bgp_info;
bgp_info = object;
aggregator = rule;
ae = bgp_attr_extra_get (bgp_info->attr);
-
+
ae->aggregator_as = aggregator->as;
ae->aggregator_addr = aggregator->address;
bgp_info->attr->flag |= ATTR_FLAG_BIT (BGP_ATTR_AGGREGATOR);
XFREE (MTYPE_ROUTE_MAP_COMPILED, rule);
}
-struct route_map_rule_cmd route_set_aggregator_as_cmd =
+struct route_map_rule_cmd route_set_aggregator_as_cmd =
{
"aggregator as",
route_set_aggregator_as,
route_set_tag (void *rule, struct prefix *prefix,
route_map_object_t type, void *object)
{
- u_short *tag;
+ route_tag_t *tag;
struct bgp_info *bgp_info;
struct attr_extra *ae;
return RMAP_OKAY;
}
-/* Route map `tag' compile function. Given string is converted to u_short. */
-static void *
-route_set_tag_compile (const char *arg)
-{
- u_short *tag;
- u_short tmp;
-
- /* tag value shoud be integer. */
- if (! all_digit (arg))
- return NULL;
-
- tmp = atoi(arg);
-
- if (tmp < 1)
- return NULL;
-
- tag = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (u_short));
-
- if (!tag)
- return tag;
-
- *tag = tmp;
-
- return tag;
-}
-
-/* Free route map's tag value. */
-static void
-route_set_tag_free (void *rule)
-{
- XFREE (MTYPE_ROUTE_MAP_COMPILED, rule);
-}
-
-
/* Route map commands for tag set. */
-struct route_map_rule_cmd route_set_tag_cmd =
+static struct route_map_rule_cmd route_set_tag_cmd =
{
"tag",
route_set_tag,
- route_set_tag_compile,
- route_set_tag_free,
+ route_map_rule_tag_compile,
+ route_map_rule_tag_free,
};
-#ifdef HAVE_IPV6
/* `match ipv6 address IP_ACCESS_LIST' */
static route_map_result_t
-route_match_ipv6_address (void *rule, struct prefix *prefix,
+route_match_ipv6_address (void *rule, struct prefix *prefix,
route_map_object_t type, void *object)
{
struct access_list *alist;
alist = access_list_lookup (AFI_IP6, (char *) rule);
if (alist == NULL)
return RMAP_NOMATCH;
-
+
return (access_list_apply (alist, prefix) == FILTER_DENY ?
RMAP_NOMATCH : RMAP_MATCH);
}
/* `match ipv6 next-hop IP_ADDRESS' */
static route_map_result_t
-route_match_ipv6_next_hop (void *rule, struct prefix *prefix,
+route_match_ipv6_next_hop (void *rule, struct prefix *prefix,
route_map_object_t type, void *object)
{
+ struct in6_addr *addr = rule;
struct bgp_info *bgp_info;
if (type == RMAP_BGP)
{
bgp_info = object;
-
+
if (!bgp_info->attr->extra)
return RMAP_NOMATCH;
-
- if (IPV6_ADDR_SAME (&bgp_info->attr->extra->mp_nexthop_global, rule))
+
+ if (IPV6_ADDR_SAME (&bgp_info->attr->extra->mp_nexthop_global, addr))
return RMAP_MATCH;
if (bgp_info->attr->extra->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL &&
/* `match ipv6 address prefix-list PREFIX_LIST' */
static route_map_result_t
-route_match_ipv6_address_prefix_list (void *rule, struct prefix *prefix,
+route_match_ipv6_address_prefix_list (void *rule, struct prefix *prefix,
route_map_object_t type, void *object)
{
struct prefix_list *plist;
plist = prefix_list_lookup (AFI_IP6, (char *) rule);
if (plist == NULL)
return RMAP_NOMATCH;
-
+
return (prefix_list_apply (plist, prefix) == PREFIX_DENY ?
RMAP_NOMATCH : RMAP_MATCH);
}
/* Set nexthop to object. ojbect must be pointer to struct attr. */
static route_map_result_t
-route_set_ipv6_nexthop_global (void *rule, struct prefix *prefix,
+route_set_ipv6_nexthop_global (void *rule, struct prefix *prefix,
route_map_object_t type, void *object)
{
struct in6_addr *address;
/* Fetch routemap's rule information. */
address = rule;
bgp_info = object;
-
- /* Set next hop value. */
+
+ /* Set next hop value. */
(bgp_attr_extra_get (bgp_info->attr))->mp_nexthop_global = *address;
/* Set nexthop length. */
route_set_ipv6_nexthop_global_free
};
+/* Set next-hop preference value. */
+static route_map_result_t
+route_set_ipv6_nexthop_prefer_global (void *rule, struct prefix *prefix,
+ route_map_object_t type, void *object)
+{
+ struct bgp_info *bgp_info;
+ struct peer *peer;
+
+ if (type == RMAP_BGP)
+ {
+ /* Fetch routemap's rule information. */
+ bgp_info = object;
+ peer = bgp_info->peer;
+
+ if ((CHECK_FLAG (peer->rmap_type, PEER_RMAP_TYPE_IN) ||
+ CHECK_FLAG (peer->rmap_type, PEER_RMAP_TYPE_IMPORT))
+ && peer->su_remote
+ && sockunion_family (peer->su_remote) == AF_INET6)
+ {
+ /* Set next hop preference to global */
+ bgp_info->attr->extra->mp_nexthop_prefer_global = TRUE;
+ SET_FLAG(bgp_info->attr->rmap_change_flags,
+ BATTR_RMAP_IPV6_PREFER_GLOBAL_CHANGED);
+ }
+ else
+ {
+ bgp_info->attr->extra->mp_nexthop_prefer_global = FALSE;
+ SET_FLAG(bgp_info->attr->rmap_change_flags,
+ BATTR_RMAP_IPV6_PREFER_GLOBAL_CHANGED);
+ }
+ }
+ return RMAP_OKAY;
+}
+
+static void *
+route_set_ipv6_nexthop_prefer_global_compile (const char *arg)
+{
+ int *rins = NULL;
+
+ rins = XCALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (int));
+ *rins = 1;
+
+ return rins;
+}
+
+/* Free route map's compiled `ip next-hop' value. */
+static void
+route_set_ipv6_nexthop_prefer_global_free (void *rule)
+{
+ XFREE (MTYPE_ROUTE_MAP_COMPILED, rule);
+}
+
+/* Route map commands for ip nexthop set preferred. */
+struct route_map_rule_cmd route_set_ipv6_nexthop_prefer_global_cmd =
+{
+ "ipv6 next-hop prefer-global",
+ route_set_ipv6_nexthop_prefer_global,
+ route_set_ipv6_nexthop_prefer_global_compile,
+ route_set_ipv6_nexthop_prefer_global_free
+};
+
/* `set ipv6 nexthop local IP_ADDRESS' */
/* Set nexthop to object. ojbect must be pointer to struct attr. */
static route_map_result_t
-route_set_ipv6_nexthop_local (void *rule, struct prefix *prefix,
+route_set_ipv6_nexthop_local (void *rule, struct prefix *prefix,
route_map_object_t type, void *object)
{
struct in6_addr *address;
/* Fetch routemap's rule information. */
address = rule;
bgp_info = object;
-
- /* Set next hop value. */
+
+ /* Set next hop value. */
(bgp_attr_extra_get (bgp_info->attr))->mp_nexthop_local = *address;
-
+
/* Set nexthop length. */
if (bgp_info->attr->extra->mp_nexthop_len != BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL)
bgp_info->attr->extra->mp_nexthop_len = BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL;
struct in6_addr peer_address;
struct bgp_info *bgp_info;
struct peer *peer;
- char peer_addr_buf[INET6_ADDRSTRLEN];
if (type == RMAP_BGP)
{
&& peer->su_remote
&& sockunion_family (peer->su_remote) == AF_INET6)
{
- inet_pton (AF_INET6, sockunion2str (peer->su_remote,
- peer_addr_buf,
- INET6_ADDRSTRLEN),
- &peer_address);
+ peer_address = peer->su_remote->sin6.sin6_addr;
/* Set next hop value and length in attribute. */
if (IN6_IS_ADDR_LINKLOCAL(&peer_address))
{
route_set_ipv6_nexthop_peer_free
};
-#endif /* HAVE_IPV6 */
-
/* `set vpnv4 nexthop A.B.C.D' */
static route_map_result_t
-route_set_vpnv4_nexthop (void *rule, struct prefix *prefix,
+route_set_vpnv4_nexthop (void *rule, struct prefix *prefix,
route_map_object_t type, void *object)
{
struct in_addr *address;
/* Fetch routemap's rule information. */
address = rule;
bgp_info = object;
-
- /* Set next hop value. */
+
+ /* Set next hop value. */
(bgp_attr_extra_get (bgp_info->attr))->mp_nexthop_global_in = *address;
+ (bgp_attr_extra_get (bgp_info->attr))->mp_nexthop_len = 4;
}
return RMAP_OKAY;
struct in_addr *address;
struct bgp_info *bgp_info;
- if (type == RMAP_BGP)
+ if (type == RMAP_BGP)
{
address = rule;
bgp_info = object;
-
+
bgp_info->attr->flag |= ATTR_FLAG_BIT (BGP_ATTR_ORIGINATOR_ID);
(bgp_attr_extra_get (bgp_info->attr))->originator_id = *address;
}
}
/* Set originator-id rule structure. */
-struct route_map_rule_cmd route_set_originator_id_cmd =
+struct route_map_rule_cmd route_set_originator_id_cmd =
{
"originator-id",
route_set_originator_id,
/* Add bgp route map rule. */
static int
-bgp_route_match_add (struct vty *vty, struct route_map_index *index,
+bgp_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);
/* Delete bgp route map rule. */
static int
-bgp_route_match_delete (struct vty *vty, struct route_map_index *index,
+bgp_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;
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.
for (ALL_LIST_ELEMENTS (bm->bgp, node, nnode, bgp))
bgp_route_map_process_update(bgp, rmap_name, 1);
+#if ENABLE_BGP_VNC
+ zlog_debug("%s: calling vnc_routemap_update", __func__);
+ vnc_routemap_update(bgp, __func__);
+#endif
return 0;
}
{
for (ALL_LIST_ELEMENTS (bm->bgp, node, nnode, bgp))
bgp_route_map_process_update(bgp, rmap_name, 0);
+ #if ENABLE_BGP_VNC
+ zlog_debug("%s: calling vnc_routemap_update", __func__);
+ vnc_routemap_update(bgp, __func__);
+#endif
}
}
}
DEFUN (match_peer,
match_peer_cmd,
- "match peer (A.B.C.D|X:X::X:X)",
+ "match peer <A.B.C.D|X:X::X:X>",
MATCH_STR
"Match peer address\n"
- "IPv6 address of peer\n"
- "IP address of peer\n")
+ "IP address of peer\n"
+ "IPv6 address of peer\n")
{
- return bgp_route_match_add (vty, vty->index, "peer", argv[0],
+ int idx_ip = 2;
+ return bgp_route_match_add (vty, "peer", argv[idx_ip]->arg,
RMAP_EVENT_MATCH_ADDED);
}
DEFUN (match_peer_local,
- match_peer_local_cmd,
+ match_peer_local_cmd,
"match peer local",
MATCH_STR
"Match peer address\n"
"Static or Redistributed routes\n")
{
- return bgp_route_match_add (vty, vty->index, "peer", "local",
+ return bgp_route_match_add (vty, "peer", "local",
RMAP_EVENT_MATCH_DELETED);
}
DEFUN (no_match_peer,
no_match_peer_cmd,
- "no match peer",
- NO_STR
- MATCH_STR
- "Match peer address\n")
-{
- if (argc == 0)
- return bgp_route_match_delete (vty, vty->index, "peer", NULL,
- RMAP_EVENT_MATCH_DELETED);
-
- return bgp_route_match_delete (vty, vty->index, "peer", argv[0],
- RMAP_EVENT_MATCH_DELETED);
-}
-
-ALIAS (no_match_peer,
- no_match_peer_val_cmd,
- "no match peer (A.B.C.D|X:X::X:X)",
- NO_STR
- MATCH_STR
- "Match peer address\n"
- "IPv6 address of peer\n"
- "IP address of peer\n")
-
-ALIAS (no_match_peer,
- no_match_peer_local_cmd,
- "no match peer local",
+ "no match peer [<local|A.B.C.D|X:X::X:X>]",
NO_STR
MATCH_STR
"Match peer address\n"
- "Static or Redistributed routes\n")
-
-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")
+ "Static or Redistributed routes\n"
+ "IP address of peer\n"
+ "IPv6 address of peer\n")
{
- return bgp_route_match_add (vty, vty->index, "ip address", argv[0],
- RMAP_EVENT_FILTER_ADDED);
-}
-
-DEFUN (no_match_ip_address,
- no_match_ip_address_cmd,
- "no match ip address",
- NO_STR
- MATCH_STR
- IP_STR
- "Match address of route\n")
-{
- if (argc == 0)
- 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[0],
- RMAP_EVENT_FILTER_DELETED);
-}
-
-ALIAS (no_match_ip_address,
- no_match_ip_address_val_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_peer = 3;
-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")
-{
- return bgp_route_match_add (vty, vty->index, "ip next-hop", argv[0],
- RMAP_EVENT_FILTER_ADDED);
+ if (argc <= idx_peer)
+ return bgp_route_match_delete (vty, "peer", NULL,
+ RMAP_EVENT_MATCH_DELETED);
+ return bgp_route_match_delete (vty, "peer", argv[idx_peer]->arg,
+ RMAP_EVENT_MATCH_DELETED);
}
-DEFUN (no_match_ip_next_hop,
- no_match_ip_next_hop_cmd,
- "no match ip next-hop",
- NO_STR
- MATCH_STR
- IP_STR
- "Match next-hop address of route\n")
-{
- if (argc == 0)
- 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[0],
- RMAP_EVENT_FILTER_DELETED);
-}
-
-ALIAS (no_match_ip_next_hop,
- no_match_ip_next_hop_val_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")
-
-/* match probability { */
+/* match probability */
DEFUN (match_probability,
match_probability_cmd,
- "match probability <0-100>",
+ "match probability (0-100)",
MATCH_STR
"Match portion of routes defined by percentage value\n"
"Percentage of routes\n")
{
- return bgp_route_match_add (vty, vty->index, "probability", argv[0],
+ int idx_number = 2;
+ return bgp_route_match_add (vty, "probability", argv[idx_number]->arg,
RMAP_EVENT_MATCH_ADDED);
}
+
DEFUN (no_match_probability,
no_match_probability_cmd,
- "no match probability",
+ "no match probability [(1-99)]",
NO_STR
MATCH_STR
- "Match portion of routes defined by percentage value\n")
+ "Match portion of routes defined by percentage value\n"
+ "Percentage of routes\n")
{
- return bgp_route_match_delete (vty, vty->index, "probability", argc ? argv[0] : NULL,
+ int idx_number = 3;
+ if (argc <= idx_number)
+ return bgp_route_match_delete (vty, "probability", NULL,
+ RMAP_EVENT_MATCH_DELETED);
+ return bgp_route_match_delete (vty, "probability", argv[idx_number]->arg,
RMAP_EVENT_MATCH_DELETED);
}
-ALIAS (no_match_probability,
- no_match_probability_val_cmd,
- "no match probability <1-99>",
- NO_STR
- MATCH_STR
- "Match portion of routes defined by percentage value\n"
- "Percentage of routes\n")
-
-/* } */
-DEFUN (match_ip_route_source,
+DEFUN (match_ip_route_source,
match_ip_route_source_cmd,
- "match ip route-source (<1-199>|<1300-2699>|WORD)",
+ "match ip route-source <(1-199)|(1300-2699)|WORD>",
MATCH_STR
IP_STR
"Match advertising source address of route\n"
"IP access-list number (expanded range)\n"
"IP standard access-list name\n")
{
- return bgp_route_match_add (vty, vty->index, "ip route-source", argv[0],
+ int idx_acl = 3;
+ return bgp_route_match_add (vty, "ip route-source", argv[idx_acl]->arg,
RMAP_EVENT_FILTER_ADDED);
}
+
DEFUN (no_match_ip_route_source,
no_match_ip_route_source_cmd,
- "no match ip route-source",
- NO_STR
- MATCH_STR
- IP_STR
- "Match advertising source address of route\n")
-{
- if (argc == 0)
- return bgp_route_match_delete (vty, vty->index, "ip route-source", NULL,
- RMAP_EVENT_FILTER_DELETED);
-
- return bgp_route_match_delete (vty, vty->index, "ip route-source",
- argv[0], RMAP_EVENT_FILTER_DELETED);
-}
-
-ALIAS (no_match_ip_route_source,
- no_match_ip_route_source_val_cmd,
- "no match ip route-source (<1-199>|<1300-2699>|WORD)",
+ "no match ip route-source [<(1-199)|(1300-2699)|WORD>]",
NO_STR
MATCH_STR
IP_STR
"IP access-list number\n"
"IP access-list number (expanded range)\n"
"IP standard access-list name\n")
-
-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")
-{
- return bgp_route_match_add (vty, vty->index, "ip address prefix-list",
- argv[0], RMAP_EVENT_PLIST_ADDED);
-}
-
-DEFUN (no_match_ip_address_prefix_list,
- no_match_ip_address_prefix_list_cmd,
- "no match ip address prefix-list",
- NO_STR
- MATCH_STR
- IP_STR
- "Match address of route\n"
- "Match entries of prefix-lists\n")
{
- return bgp_route_match_delete (vty, vty->index, "ip address prefix-list",
- argc == 0 ? NULL : argv[0],
- RMAP_EVENT_PLIST_DELETED);
+ int idx_number = 4;
+ if (argc <= idx_number)
+ return bgp_route_match_delete (vty, "ip route-source",
+ NULL, RMAP_EVENT_FILTER_DELETED);
+ return bgp_route_match_delete (vty, "ip route-source",
+ argv[idx_number]->arg, RMAP_EVENT_FILTER_DELETED);
}
-ALIAS (no_match_ip_address_prefix_list,
- no_match_ip_address_prefix_list_val_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")
-
-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")
-{
- return bgp_route_match_add (vty, vty->index, "ip next-hop prefix-list",
- argv[0], 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",
- NO_STR
- MATCH_STR
- IP_STR
- "Match next-hop address of route\n"
- "Match entries of prefix-lists\n")
-{
- return bgp_route_match_delete (vty, vty->index, "ip next-hop prefix-list",
- argc == 0 ? NULL : argv[0],
- RMAP_EVENT_PLIST_DELETED);
-}
-
-ALIAS (no_match_ip_next_hop_prefix_list,
- no_match_ip_next_hop_prefix_list_val_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")
-
-DEFUN (match_ip_route_source_prefix_list,
+DEFUN (match_ip_route_source_prefix_list,
match_ip_route_source_prefix_list_cmd,
"match ip route-source prefix-list WORD",
MATCH_STR
"Match entries of prefix-lists\n"
"IP prefix-list name\n")
{
- return bgp_route_match_add (vty, vty->index, "ip route-source prefix-list",
- argv[0], RMAP_EVENT_PLIST_ADDED);
+ int idx_word = 4;
+ return bgp_route_match_add (vty, "ip route-source prefix-list",
+ argv[idx_word]->arg, RMAP_EVENT_PLIST_ADDED);
}
+
DEFUN (no_match_ip_route_source_prefix_list,
no_match_ip_route_source_prefix_list_cmd,
- "no match ip route-source prefix-list",
- NO_STR
- MATCH_STR
- IP_STR
- "Match advertising source address of route\n"
- "Match entries of prefix-lists\n")
-{
- return bgp_route_match_delete (vty, vty->index, "ip route-source prefix-list",
- argc == 0 ? NULL : argv[0],
- RMAP_EVENT_PLIST_DELETED);
-}
-
-ALIAS (no_match_ip_route_source_prefix_list,
- no_match_ip_route_source_prefix_list_val_cmd,
- "no match ip route-source prefix-list WORD",
+ "no match ip route-source prefix-list [WORD]",
NO_STR
MATCH_STR
IP_STR
"Match advertising source address of route\n"
"Match entries of prefix-lists\n"
"IP prefix-list name\n")
-
-DEFUN (match_metric,
- match_metric_cmd,
- "match metric <0-4294967295>",
- MATCH_STR
- "Match metric of route\n"
- "Metric value\n")
{
- return bgp_route_match_add (vty, vty->index, "metric", argv[0],
- RMAP_EVENT_MATCH_ADDED);
+ int idx_word = 5;
+ if (argc <= idx_word)
+ return bgp_route_match_delete (vty, "ip route-source prefix-list",
+ NULL, RMAP_EVENT_PLIST_DELETED);
+ return bgp_route_match_delete (vty, "ip route-source prefix-list",
+ argv[idx_word]->arg, RMAP_EVENT_PLIST_DELETED);
}
-DEFUN (no_match_metric,
- no_match_metric_cmd,
- "no match metric",
- NO_STR
- MATCH_STR
- "Match metric of route\n")
-{
- return bgp_route_match_delete (vty, vty->index, "metric",
- argc == 0 ? NULL : argv[0],
- RMAP_EVENT_MATCH_DELETED);
-}
-
-ALIAS (no_match_metric,
- no_match_metric_val_cmd,
- "no match metric <0-4294967295>",
- NO_STR
- MATCH_STR
- "Match metric of route\n"
- "Metric value\n")
DEFUN (match_local_pref,
match_local_pref_cmd,
- "match local-preference <0-4294967295>",
+ "match local-preference (0-4294967295)",
MATCH_STR
"Match local-preference of route\n"
"Metric value\n")
{
- return bgp_route_match_add (vty, vty->index, "local-preference", argv[0],
+ int idx_number = 2;
+ return bgp_route_match_add (vty, "local-preference", argv[idx_number]->arg,
RMAP_EVENT_MATCH_ADDED);
}
+
DEFUN (no_match_local_pref,
no_match_local_pref_cmd,
- "no match local-preference",
+ "no match local-preference [(0-4294967295)]",
NO_STR
MATCH_STR
- "Match local preference of route\n")
+ "Match local preference of route\n"
+ "Local preference value\n")
{
- return bgp_route_match_delete (vty, vty->index, "local-preference",
- argc == 0 ? NULL : argv[0],
- RMAP_EVENT_MATCH_DELETED);
-
- return bgp_route_match_delete (vty, vty->index, "local-preference", argv[0],
+ int idx_localpref = 3;
+ if (argc <= idx_localpref)
+ return bgp_route_match_delete (vty, "local-preference",
+ NULL, RMAP_EVENT_MATCH_DELETED);
+ return bgp_route_match_delete (vty, "local-preference",
+ argv[idx_localpref]->arg,
RMAP_EVENT_MATCH_DELETED);
}
-ALIAS (no_match_local_pref,
- no_match_local_pref_val_cmd,
- "no match local-preference <0-4294967295>",
- NO_STR
- MATCH_STR
- "Match local preference of route\n"
- "Local preference value\n")
-DEFUN (match_community,
+DEFUN (match_community,
match_community_cmd,
- "match community (<1-99>|<100-500>|WORD)",
+ "match community <(1-99)|(100-500)|WORD>",
MATCH_STR
"Match BGP community list\n"
"Community-list number (standard)\n"
"Community-list number (expanded)\n"
"Community-list name\n")
{
- return bgp_route_match_add (vty, vty->index, "community", argv[0],
+ int idx_comm_list = 2;
+ return bgp_route_match_add (vty, "community", argv[idx_comm_list]->arg,
RMAP_EVENT_CLIST_ADDED);
}
-DEFUN (match_community_exact,
+DEFUN (match_community_exact,
match_community_exact_cmd,
- "match community (<1-99>|<100-500>|WORD) exact-match",
+ "match community <(1-99)|(100-500)|WORD> exact-match",
MATCH_STR
"Match BGP community list\n"
"Community-list number (standard)\n"
"Community-list name\n"
"Do exact matching of communities\n")
{
+ int idx_comm_list = 2;
int ret;
char *argstr;
argstr = XMALLOC (MTYPE_ROUTE_MAP_COMPILED,
- strlen (argv[0]) + strlen ("exact-match") + 2);
+ strlen (argv[idx_comm_list]->arg) + strlen ("exact-match") + 2);
- sprintf (argstr, "%s exact-match", argv[0]);
+ sprintf (argstr, "%s exact-match", argv[idx_comm_list]->arg);
- ret = bgp_route_match_add (vty, vty->index, "community", argstr,
+ ret = bgp_route_match_add (vty, "community", argstr,
RMAP_EVENT_CLIST_ADDED);
XFREE (MTYPE_ROUTE_MAP_COMPILED, argstr);
DEFUN (no_match_community,
no_match_community_cmd,
- "no match community",
+ "no match community [<(1-99)|(100-500)|WORD> [exact-match]]",
NO_STR
MATCH_STR
- "Match BGP community list\n")
+ "Match BGP community list\n"
+ "Community-list number (standard)\n"
+ "Community-list number (expanded)\n"
+ "Community-list name\n"
+ "Do exact matching of communities\n")
{
- return bgp_route_match_delete (vty, vty->index, "community", NULL,
+ return bgp_route_match_delete (vty, "community", NULL,
RMAP_EVENT_CLIST_DELETED);
}
-ALIAS (no_match_community,
- no_match_community_val_cmd,
- "no match community (<1-99>|<100-500>|WORD)",
- NO_STR
+DEFUN (match_lcommunity,
+ match_lcommunity_cmd,
+ "match large-community [<(1-99)|(100-500)|WORD>]",
MATCH_STR
- "Match BGP community list\n"
- "Community-list number (standard)\n"
- "Community-list number (expanded)\n"
- "Community-list name\n")
+ "Match BGP large community list\n"
+ "Large Community-list number (standard)\n"
+ "Large Community-list number (expanded)\n"
+ "Large Community-list name\n")
+{
+ return bgp_route_match_add (vty, "large-community", argv[2]->arg,
+ RMAP_EVENT_LLIST_ADDED);
+}
-ALIAS (no_match_community,
- no_match_community_exact_cmd,
- "no match community (<1-99>|<100-500>|WORD) exact-match",
+DEFUN (no_match_lcommunity,
+ no_match_lcommunity_cmd,
+ "no match large-community [<(1-99)|(100-500)|WORD>]",
NO_STR
MATCH_STR
- "Match BGP community list\n"
- "Community-list number (standard)\n"
- "Community-list number (expanded)\n"
- "Community-list name\n"
- "Do exact matching of communities\n")
+ "Match BGP large community list\n"
+ "Large Community-list number (standard)\n"
+ "Large Community-list number (expanded)\n"
+ "Large Community-list name\n")
+{
+ return bgp_route_match_delete (vty, "large-community", NULL,
+ RMAP_EVENT_LLIST_DELETED);
+}
-DEFUN (match_ecommunity,
+DEFUN (match_ecommunity,
match_ecommunity_cmd,
- "match extcommunity (<1-99>|<100-500>|WORD)",
+ "match extcommunity <(1-99)|(100-500)|WORD>",
MATCH_STR
"Match BGP/VPN extended community list\n"
"Extended community-list number (standard)\n"
"Extended community-list number (expanded)\n"
"Extended community-list name\n")
{
- return bgp_route_match_add (vty, vty->index, "extcommunity", argv[0],
+ int idx_comm_list = 2;
+ return bgp_route_match_add (vty, "extcommunity", argv[idx_comm_list]->arg,
RMAP_EVENT_ECLIST_ADDED);
}
+
DEFUN (no_match_ecommunity,
no_match_ecommunity_cmd,
- "no match extcommunity",
- NO_STR
- MATCH_STR
- "Match BGP/VPN extended community list\n")
-{
- return bgp_route_match_delete (vty, vty->index, "extcommunity", NULL,
- RMAP_EVENT_ECLIST_DELETED);
-}
-
-ALIAS (no_match_ecommunity,
- no_match_ecommunity_val_cmd,
- "no match extcommunity (<1-99>|<100-500>|WORD)",
+ "no match extcommunity [<(1-99)|(100-500)|WORD>]",
NO_STR
MATCH_STR
"Match BGP/VPN extended community list\n"
"Extended community-list number (standard)\n"
"Extended community-list number (expanded)\n"
"Extended community-list name\n")
+{
+ return bgp_route_match_delete (vty, "extcommunity", NULL,
+ RMAP_EVENT_ECLIST_DELETED);
+}
+
DEFUN (match_aspath,
match_aspath_cmd,
"Match BGP AS path list\n"
"AS path access-list name\n")
{
- return bgp_route_match_add (vty, vty->index, "as-path", argv[0],
+ int idx_word = 2;
+ return bgp_route_match_add (vty, "as-path", argv[idx_word]->arg,
RMAP_EVENT_ASLIST_ADDED);
}
+
DEFUN (no_match_aspath,
no_match_aspath_cmd,
- "no match as-path",
+ "no match as-path [WORD]",
NO_STR
MATCH_STR
- "Match BGP AS path list\n")
+ "Match BGP AS path list\n"
+ "AS path access-list name\n")
{
- return bgp_route_match_delete (vty, vty->index, "as-path", NULL,
+ return bgp_route_match_delete (vty, "as-path", NULL,
RMAP_EVENT_ASLIST_DELETED);
}
-ALIAS (no_match_aspath,
- no_match_aspath_val_cmd,
- "no match as-path WORD",
- NO_STR
- MATCH_STR
- "Match BGP AS path list\n"
- "AS path access-list name\n")
DEFUN (match_origin,
match_origin_cmd,
- "match origin (egp|igp|incomplete)",
+ "match origin <egp|igp|incomplete>",
MATCH_STR
"BGP origin code\n"
"remote EGP\n"
"local IGP\n"
"unknown heritage\n")
{
- if (strncmp (argv[0], "igp", 2) == 0)
- return bgp_route_match_add (vty, vty->index, "origin", "igp",
+ int idx_origin = 2;
+ if (strncmp (argv[idx_origin]->arg, "igp", 2) == 0)
+ return bgp_route_match_add (vty, "origin", "igp",
RMAP_EVENT_MATCH_ADDED);
- if (strncmp (argv[0], "egp", 1) == 0)
- return bgp_route_match_add (vty, vty->index, "origin", "egp",
+ if (strncmp (argv[idx_origin]->arg, "egp", 1) == 0)
+ return bgp_route_match_add (vty, "origin", "egp",
RMAP_EVENT_MATCH_ADDED);
- if (strncmp (argv[0], "incomplete", 2) == 0)
- return bgp_route_match_add (vty, vty->index, "origin", "incomplete",
+ if (strncmp (argv[idx_origin]->arg, "incomplete", 2) == 0)
+ return bgp_route_match_add (vty, "origin", "incomplete",
RMAP_EVENT_MATCH_ADDED);
return CMD_WARNING;
}
+
DEFUN (no_match_origin,
no_match_origin_cmd,
- "no match origin",
- NO_STR
- MATCH_STR
- "BGP origin code\n")
-{
- return bgp_route_match_delete (vty, vty->index, "origin", NULL,
- RMAP_EVENT_MATCH_DELETED);
-}
-
-ALIAS (no_match_origin,
- no_match_origin_val_cmd,
- "no match origin (egp|igp|incomplete)",
+ "no match origin [<egp|igp|incomplete>]",
NO_STR
MATCH_STR
"BGP origin code\n"
"remote EGP\n"
"local IGP\n"
"unknown heritage\n")
-
-DEFUN (match_interface,
- match_interface_cmd,
- "match interface WORD",
- MATCH_STR
- "Match first hop interface of route\n"
- "Interface name\n")
{
- return bgp_route_match_add (vty, vty->index, "interface", argv[0],
- RMAP_EVENT_MATCH_ADDED);
-}
-
-DEFUN (no_match_interface,
- no_match_interface_cmd,
- "no match interface",
- NO_STR
- MATCH_STR
- "Match first hop interface of route\n")
-{
- if (argc == 0)
- return bgp_route_match_delete (vty, vty->index, "interface", NULL,
- RMAP_EVENT_MATCH_DELETED);
-
- return bgp_route_match_delete (vty, vty->index, "interface", argv[0],
+ return bgp_route_match_delete (vty, "origin", NULL,
RMAP_EVENT_MATCH_DELETED);
}
-ALIAS (no_match_interface,
- no_match_interface_val_cmd,
- "no match interface WORD",
- NO_STR
- MATCH_STR
- "Match first hop interface of route\n"
- "Interface name\n")
-
-DEFUN (match_tag,
- match_tag_cmd,
- "match tag <1-65535>",
- MATCH_STR
- "Match tag of route\n"
- "Tag value\n")
-{
- return bgp_route_match_add (vty, vty->index, "tag", argv[0],
- RMAP_EVENT_MATCH_ADDED);
-}
-
-DEFUN (no_match_tag,
- no_match_tag_cmd,
- "no match tag",
- NO_STR
- MATCH_STR
- "Match tag of route\n")
-{
- if (argc == 0)
- return bgp_route_match_delete (vty, vty->index, "tag", NULL,
- RMAP_EVENT_MATCH_DELETED);
-
- return bgp_route_match_delete (vty, vty->index, "tag", argv[0],
- RMAP_EVENT_MATCH_DELETED);
-}
-
-ALIAS (no_match_tag,
- no_match_tag_val_cmd,
- "no match tag <1-65535>",
- NO_STR
- MATCH_STR
- "Match tag of route\n"
- "Tag value\n")
-
-
-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")
-{
- union sockunion su;
- int ret;
-
- ret = str2sockunion (argv[0], &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[0]);
-}
-
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_GET_CONTEXT(route_map_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");
+ return generic_set_add (vty, VTY_GET_CONTEXT(route_map_index),
+ "ip next-hop", "unchanged");
}
-DEFUN (no_set_ip_nexthop,
- no_set_ip_nexthop_cmd,
- "no set ip next-hop",
- NO_STR
- SET_STR
- "Next hop address\n")
-{
- if (argc == 0)
- return bgp_route_set_delete (vty, vty->index, "ip next-hop", NULL);
-
- return bgp_route_set_delete (vty, vty->index, "ip next-hop", argv[0]);
-}
-
-ALIAS (no_set_ip_nexthop,
- no_set_ip_nexthop_val_cmd,
- "no set ip next-hop A.B.C.D",
- NO_STR
- SET_STR
- IP_STR
- "Next hop address\n"
- "IP address of next hop\n")
-
-ALIAS (no_set_ip_nexthop,
- no_set_ip_nexthop_peer_cmd,
- "no set ip next-hop peer-address",
- NO_STR
- SET_STR
- IP_STR
- "Next hop address\n"
- "Use peer address (for BGP only)\n")
-
-DEFUN (set_metric,
- set_metric_cmd,
- "set metric <0-4294967295>",
- SET_STR
- "Metric value for destination routing protocol\n"
- "Metric value\n")
-{
- return bgp_route_set_add (vty, vty->index, "metric", argv[0]);
-}
-
-ALIAS (set_metric,
- set_metric_addsub_cmd,
- "set metric <+/-metric>",
- SET_STR
- "Metric value for destination routing protocol\n"
- "Add or subtract metric\n")
-
-DEFUN (no_set_metric,
- no_set_metric_cmd,
- "no set metric",
- NO_STR
- SET_STR
- "Metric value for destination routing protocol\n")
-{
- if (argc == 0)
- return bgp_route_set_delete (vty, vty->index, "metric", NULL);
-
- return bgp_route_set_delete (vty, vty->index, "metric", argv[0]);
-}
-
-ALIAS (no_set_metric,
- no_set_metric_val_cmd,
- "no set metric <0-4294967295>",
- NO_STR
- SET_STR
- "Metric value for destination routing protocol\n"
- "Metric value\n")
DEFUN (set_local_pref,
set_local_pref_cmd,
- "set local-preference <0-4294967295>",
+ "set local-preference (0-4294967295)",
SET_STR
"BGP local preference path attribute\n"
"Preference value\n")
{
- return bgp_route_set_add (vty, vty->index, "local-preference", argv[0]);
+ int idx_number = 2;
+ return generic_set_add (vty, VTY_GET_CONTEXT(route_map_index),
+ "local-preference", argv[idx_number]->arg);
}
+
DEFUN (no_set_local_pref,
no_set_local_pref_cmd,
- "no set local-preference",
+ "no set local-preference [(0-4294967295)]",
NO_STR
SET_STR
- "BGP local preference path attribute\n")
+ "BGP local preference path attribute\n"
+ "Preference value\n")
{
- if (argc == 0)
- return bgp_route_set_delete (vty, vty->index, "local-preference", NULL);
-
- return bgp_route_set_delete (vty, vty->index, "local-preference", argv[0]);
+ int idx_localpref = 3;
+ if (argc <= idx_localpref)
+ return generic_set_delete (vty, VTY_GET_CONTEXT(route_map_index),
+ "local-preference", NULL);
+ return generic_set_delete (vty, VTY_GET_CONTEXT(route_map_index),
+ "local-preference", argv[idx_localpref]->arg);
}
-ALIAS (no_set_local_pref,
- no_set_local_pref_val_cmd,
- "no set local-preference <0-4294967295>",
- NO_STR
- SET_STR
- "BGP local preference path attribute\n"
- "Preference value\n")
DEFUN (set_weight,
set_weight_cmd,
- "set weight <0-4294967295>",
+ "set weight (0-4294967295)",
SET_STR
"BGP weight for routing table\n"
"Weight value\n")
{
- return bgp_route_set_add (vty, vty->index, "weight", argv[0]);
+ int idx_number = 2;
+ return generic_set_add (vty, VTY_GET_CONTEXT(route_map_index), "weight",
+ argv[idx_number]->arg);
}
+
DEFUN (no_set_weight,
no_set_weight_cmd,
- "no set weight",
+ "no set weight [(0-4294967295)]",
NO_STR
SET_STR
- "BGP weight for routing table\n")
+ "BGP weight for routing table\n"
+ "Weight value\n")
{
- if (argc == 0)
- return bgp_route_set_delete (vty, vty->index, "weight", NULL);
-
- return bgp_route_set_delete (vty, vty->index, "weight", argv[0]);
+ int idx_weight = 3;
+ if (argc <= idx_weight)
+ return generic_set_delete (vty, VTY_GET_CONTEXT(route_map_index),
+ "weight", NULL);
+ return generic_set_delete (vty, VTY_GET_CONTEXT(route_map_index), "weight",
+ argv[idx_weight]->arg);
}
-ALIAS (no_set_weight,
- no_set_weight_val_cmd,
- "no set weight <0-4294967295>",
- NO_STR
- SET_STR
- "BGP weight for routing table\n"
- "Weight value\n")
-DEFUN (set_aspath_prepend,
- set_aspath_prepend_cmd,
- "set as-path prepend ." CMD_AS_RANGE,
+DEFUN (set_aspath_prepend_asn,
+ set_aspath_prepend_asn_cmd,
+ "set as-path prepend (1-4294967295)...",
SET_STR
"Transform BGP AS_PATH attribute\n"
"Prepend to the as-path\n"
"AS number\n")
{
+ int idx_asn = 3;
int ret;
char *str;
- str = argv_concat (argv, argc, 0);
- ret = bgp_route_set_add (vty, vty->index, "as-path prepend", str);
+ str = argv_concat (argv, argc, idx_asn);
+ ret = generic_set_add (vty, VTY_GET_CONTEXT(route_map_index),
+ "as-path prepend", str);
XFREE (MTYPE_TMP, str);
return ret;
}
-ALIAS (set_aspath_prepend,
+DEFUN (set_aspath_prepend_lastas,
set_aspath_prepend_lastas_cmd,
- "set as-path prepend (last-as) <1-10>",
+ "set as-path prepend last-as (1-10)",
SET_STR
"Transform BGP AS_PATH attribute\n"
"Prepend to the as-path\n"
"Use the peer's AS-number\n"
"Number of times to insert")
+{
+ return set_aspath_prepend_asn (self, vty, argc, argv);
+}
DEFUN (no_set_aspath_prepend,
no_set_aspath_prepend_cmd,
- "no set as-path prepend",
+ "no set as-path prepend [(1-4294967295)]",
NO_STR
SET_STR
"Transform BGP AS_PATH attribute\n"
- "Prepend to the as-path\n")
+ "Prepend to the as-path\n"
+ "AS number\n")
{
+ int idx_asn = 4;
int ret;
char *str;
- if (argc == 0)
- return bgp_route_set_delete (vty, vty->index, "as-path prepend", NULL);
-
- str = argv_concat (argv, argc, 0);
- ret = bgp_route_set_delete (vty, vty->index, "as-path prepend", str);
+ str = argv_concat (argv, argc, idx_asn);
+ ret = generic_set_delete (vty, VTY_GET_CONTEXT(route_map_index),
+ "as-path prepend", str);
XFREE (MTYPE_TMP, str);
return ret;
}
-ALIAS (no_set_aspath_prepend,
- no_set_aspath_prepend_val_cmd,
- "no set as-path prepend ." CMD_AS_RANGE,
- NO_STR
- SET_STR
- "Transform BGP AS_PATH attribute\n"
- "Prepend to the as-path\n"
- "AS number\n")
DEFUN (set_aspath_exclude,
set_aspath_exclude_cmd,
- "set as-path exclude ." CMD_AS_RANGE,
+ "set as-path exclude (1-4294967295)...",
SET_STR
"Transform BGP AS-path attribute\n"
"Exclude from the as-path\n"
"AS number\n")
{
+ int idx_asn = 3;
int ret;
char *str;
- str = argv_concat (argv, argc, 0);
- ret = bgp_route_set_add (vty, vty->index, "as-path exclude", str);
+ str = argv_concat (argv, argc, idx_asn);
+ ret = generic_set_add (vty, VTY_GET_CONTEXT(route_map_index),
+ "as-path exclude", str);
XFREE (MTYPE_TMP, str);
return ret;
}
DEFUN (no_set_aspath_exclude,
no_set_aspath_exclude_cmd,
- "no set as-path exclude",
+ "no set as-path exclude (1-4294967295)...",
NO_STR
SET_STR
"Transform BGP AS_PATH attribute\n"
- "Exclude from the as-path\n")
+ "Exclude from the as-path\n"
+ "AS number\n")
{
+ int idx_asn = 4;
int ret;
char *str;
- if (argc == 0)
- return bgp_route_set_delete (vty, vty->index, "as-path exclude", NULL);
-
- str = argv_concat (argv, argc, 0);
- ret = bgp_route_set_delete (vty, vty->index, "as-path exclude", str);
+ str = argv_concat (argv, argc, idx_asn);
+ ret = generic_set_delete (vty, VTY_GET_CONTEXT(route_map_index),
+ "as-path exclude", str);
XFREE (MTYPE_TMP, str);
return ret;
}
-ALIAS (no_set_aspath_exclude,
- no_set_aspath_exclude_val_cmd,
- "no set as-path exclude ." CMD_AS_RANGE,
- NO_STR
- SET_STR
- "Transform BGP AS_PATH attribute\n"
- "Exclude from the as-path\n"
- "AS number\n")
DEFUN (set_community,
set_community_cmd,
- "set community .AA:NN",
+ "set community AA:NN...",
SET_STR
"BGP community attribute\n"
COMMUNITY_VAL_STR)
{
+ int idx_aa_nn = 2;
int i;
int first = 0;
int additive = 0;
b = buffer_new (1024);
- for (i = 0; i < argc; i++)
+ for (i = idx_aa_nn; i < argc; i++)
{
- if (strncmp (argv[i], "additive", strlen (argv[i])) == 0)
+ if (strncmp (argv[i]->arg, "additive", strlen (argv[i]->arg)) == 0)
{
additive = 1;
continue;
else
first = 1;
- if (strncmp (argv[i], "internet", strlen (argv[i])) == 0)
+ if (strncmp (argv[i]->arg, "internet", strlen (argv[i]->arg)) == 0)
{
buffer_putstr (b, "internet");
continue;
}
- if (strncmp (argv[i], "local-AS", strlen (argv[i])) == 0)
+ if (strncmp (argv[i]->arg, "local-AS", strlen (argv[i]->arg)) == 0)
{
buffer_putstr (b, "local-AS");
continue;
}
- if (strncmp (argv[i], "no-a", strlen ("no-a")) == 0
- && strncmp (argv[i], "no-advertise", strlen (argv[i])) == 0)
+ if (strncmp (argv[i]->arg, "no-a", strlen ("no-a")) == 0
+ && strncmp (argv[i]->arg, "no-advertise", strlen (argv[i]->arg)) == 0)
{
buffer_putstr (b, "no-advertise");
continue;
}
- if (strncmp (argv[i], "no-e", strlen ("no-e"))== 0
- && strncmp (argv[i], "no-export", strlen (argv[i])) == 0)
+ if (strncmp (argv[i]->arg, "no-e", strlen ("no-e"))== 0
+ && strncmp (argv[i]->arg, "no-export", strlen (argv[i]->arg)) == 0)
{
buffer_putstr (b, "no-export");
continue;
}
- buffer_putstr (b, argv[i]);
+ buffer_putstr (b, argv[i]->arg);
}
buffer_putc (b, '\0');
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_GET_CONTEXT(route_map_index),
+ "community", argstr);
XFREE (MTYPE_TMP, argstr);
}
else
- ret = bgp_route_set_add (vty, vty->index, "community", str);
+ ret = generic_set_add (vty, VTY_GET_CONTEXT(route_map_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_GET_CONTEXT(route_map_index), "community",
+ "none");
}
DEFUN (no_set_community,
no_set_community_cmd,
- "no set community",
+ "no set community AA:NN...",
NO_STR
SET_STR
- "BGP community attribute\n")
+ "BGP community attribute\n"
+ COMMUNITY_VAL_STR)
{
- return bgp_route_set_delete (vty, vty->index, "community", NULL);
+ return generic_set_delete (vty, VTY_GET_CONTEXT(route_map_index),
+ "community", NULL);
}
-ALIAS (no_set_community,
- no_set_community_val_cmd,
- "no set community .AA:NN",
- NO_STR
- SET_STR
- "BGP community attribute\n"
- COMMUNITY_VAL_STR)
-ALIAS (no_set_community,
- no_set_community_none_cmd,
- "no set community none",
- NO_STR
- SET_STR
- "BGP community attribute\n"
- "No community attribute\n")
DEFUN (set_community_delete,
set_community_delete_cmd,
- "set comm-list (<1-99>|<100-500>|WORD) delete",
+ "set comm-list <(1-99)|(100-500)|WORD> delete",
SET_STR
"set BGP community list (for deletion)\n"
"Community-list number (standard)\n"
"Community-list name\n"
"Delete matching communities\n")
{
+ int idx_comm_list = 2;
char *str;
- str = XCALLOC (MTYPE_TMP, strlen (argv[0]) + strlen (" delete") + 1);
- strcpy (str, argv[0]);
- strcpy (str + strlen (argv[0]), " delete");
+ str = XCALLOC (MTYPE_TMP, strlen (argv[idx_comm_list]->arg) + strlen (" delete") + 1);
+ 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_GET_CONTEXT(route_map_index), "comm-list", str);
XFREE (MTYPE_TMP, str);
return CMD_SUCCESS;
DEFUN (no_set_community_delete,
no_set_community_delete_cmd,
- "no set comm-list",
- NO_STR
- SET_STR
- "set BGP community list (for deletion)\n")
-{
- return bgp_route_set_delete (vty, vty->index, "comm-list", NULL);
-}
-
-ALIAS (no_set_community_delete,
- no_set_community_delete_val_cmd,
- "no set comm-list (<1-99>|<100-500>|WORD) delete",
+ "no set comm-list [<(1-99)|(100-500)|WORD> delete]",
NO_STR
SET_STR
"set BGP community list (for deletion)\n"
"Community-list number (expanded)\n"
"Community-list name\n"
"Delete matching communities\n")
+{
+ return generic_set_delete (vty, VTY_GET_CONTEXT(route_map_index),
+ "comm-list", NULL);
+}
+
+DEFUN (set_lcommunity,
+ set_lcommunity_cmd,
+ "set large-community AA:BB:CC...",
+ SET_STR
+ "BGP large community attribute\n"
+ "Large Community number in aa:bb:cc format or additive\n")
+{
+ int ret;
+ char *str;
+
+ str = argv_concat (argv, argc, 2);
+ ret = generic_set_add (vty, VTY_GET_CONTEXT(route_map_index), "large-community", str);
+ XFREE (MTYPE_TMP, str);
+
+ return ret;
+}
+
+DEFUN (set_lcommunity_none,
+ set_lcommunity_none_cmd,
+ "set large-community none",
+ SET_STR
+ "BGP large community attribute\n"
+ "No large community attribute\n")
+{
+ return generic_set_add (vty, VTY_GET_CONTEXT(route_map_index),
+ "large-community", "none");
+}
+
+DEFUN (no_set_lcommunity,
+ no_set_lcommunity_cmd,
+ "no set large-community none",
+ NO_STR
+ SET_STR
+ "BGP large community attribute\n"
+ "No community attribute\n")
+{
+ return generic_set_delete (vty, VTY_GET_CONTEXT(route_map_index),
+ "large-community", NULL);
+}
+
+DEFUN (no_set_lcommunity1,
+ no_set_lcommunity1_cmd,
+ "no set large-community AA:BB:CC...",
+ NO_STR
+ SET_STR
+ "BGP large community attribute\n"
+ "Large community in AA:BB:CC... format or additive\n")
+{
+ return generic_set_delete (vty, VTY_GET_CONTEXT(route_map_index),
+ "large-community", NULL);
+}
+
+DEFUN (set_lcommunity_delete,
+ set_lcommunity_delete_cmd,
+ "set large-comm-list <(1-99)|(100-500)|WORD> delete",
+ SET_STR
+ "set BGP large community list (for deletion)\n"
+ "Large Community-list number (standard)\n"
+ "Large Communitly-list number (expanded)\n"
+ "Large Community-list name\n"
+ "Delete matching large communities\n")
+{
+ char *str;
+
+ str = XCALLOC (MTYPE_TMP, strlen (argv[2]->arg) + strlen (" delete") + 1);
+ strcpy (str, argv[2]->arg);
+ strcpy (str + strlen (argv[2]->arg), " delete");
+
+ generic_set_add (vty, VTY_GET_CONTEXT(route_map_index),
+ "large-comm-list", str);
+
+ XFREE (MTYPE_TMP, str);
+ return CMD_SUCCESS;
+}
+
+DEFUN (no_set_lcommunity_delete,
+ no_set_lcommunity_delete_cmd,
+ "no set large-comm-list <(1-99|(100-500)|WORD)> [delete]",
+ NO_STR
+ SET_STR
+ "set BGP large community list (for deletion)\n"
+ "Large Community-list number (standard)\n"
+ "Large Communitly-list number (expanded)\n"
+ "Large Community-list name\n"
+ "Delete matching large communities\n")
+{
+ return generic_set_delete (vty, VTY_GET_CONTEXT(route_map_index),
+ "large-comm-list", NULL);
+}
DEFUN (set_ecommunity_rt,
set_ecommunity_rt_cmd,
- "set extcommunity rt .ASN:nn_or_IP-address:nn",
+ "set extcommunity rt ASN:nn_or_IP-address:nn...",
SET_STR
"BGP extended community attribute\n"
"Route Target extended community\n"
"VPN extended community\n")
{
+ int idx_asn_nn = 3;
int ret;
char *str;
- str = argv_concat (argv, argc, 0);
- ret = bgp_route_set_add (vty, vty->index, "extcommunity rt", str);
+ str = argv_concat (argv, argc, idx_asn_nn);
+ ret = generic_set_add (vty, VTY_GET_CONTEXT(route_map_index),
+ "extcommunity rt", str);
XFREE (MTYPE_TMP, str);
return ret;
DEFUN (no_set_ecommunity_rt,
no_set_ecommunity_rt_cmd,
- "no set extcommunity rt",
+ "no set extcommunity rt ASN:nn_or_IP-address:nn...",
NO_STR
SET_STR
"BGP extended community attribute\n"
- "Route Target extended community\n")
+ "Route Target extended community\n"
+ "VPN extended community\n")
{
- return bgp_route_set_delete (vty, vty->index, "extcommunity rt", NULL);
+ return generic_set_delete (vty, VTY_GET_CONTEXT(route_map_index),
+ "extcommunity rt", NULL);
}
-ALIAS (no_set_ecommunity_rt,
- no_set_ecommunity_rt_val_cmd,
- "no set extcommunity rt .ASN:nn_or_IP-address:nn",
- NO_STR
- SET_STR
- "BGP extended community attribute\n"
- "Route Target extended community\n"
- "VPN extended community\n")
DEFUN (set_ecommunity_soo,
set_ecommunity_soo_cmd,
- "set extcommunity soo .ASN:nn_or_IP-address:nn",
+ "set extcommunity soo ASN:nn_or_IP-address:nn...",
SET_STR
"BGP extended community attribute\n"
"Site-of-Origin extended community\n"
"VPN extended community\n")
{
+ int idx_asn_nn = 3;
int ret;
char *str;
- str = argv_concat (argv, argc, 0);
- ret = bgp_route_set_add (vty, vty->index, "extcommunity soo", str);
+ str = argv_concat (argv, argc, idx_asn_nn);
+ ret = generic_set_add (vty, VTY_GET_CONTEXT(route_map_index),
+ "extcommunity soo", str);
XFREE (MTYPE_TMP, str);
return ret;
}
+
DEFUN (no_set_ecommunity_soo,
no_set_ecommunity_soo_cmd,
- "no set extcommunity soo",
+ "no set extcommunity soo ASN:nn_or_IP-address:nn...",
NO_STR
SET_STR
"BGP extended community attribute\n"
- "Site-of-Origin extended community\n")
+ "Site-of-Origin extended community\n"
+ "VPN extended community\n")
{
- return bgp_route_set_delete (vty, vty->index, "extcommunity soo", NULL);
+ return generic_set_delete (vty, VTY_GET_CONTEXT(route_map_index),
+ "extcommunity soo", NULL);
}
-ALIAS (no_set_ecommunity_soo,
- no_set_ecommunity_soo_val_cmd,
- "no set extcommunity soo .ASN:nn_or_IP-address:nn",
- NO_STR
- SET_STR
- "BGP extended community attribute\n"
- "Site-of-Origin extended community\n"
- "VPN extended community\n")
DEFUN (set_origin,
set_origin_cmd,
- "set origin (egp|igp|incomplete)",
+ "set origin <egp|igp|incomplete>",
SET_STR
"BGP origin code\n"
"remote EGP\n"
"local IGP\n"
"unknown heritage\n")
{
- if (strncmp (argv[0], "igp", 2) == 0)
- return bgp_route_set_add (vty, vty->index, "origin", "igp");
- if (strncmp (argv[0], "egp", 1) == 0)
- return bgp_route_set_add (vty, vty->index, "origin", "egp");
- if (strncmp (argv[0], "incomplete", 2) == 0)
- return bgp_route_set_add (vty, vty->index, "origin", "incomplete");
+ int idx_origin = 2;
+ if (strncmp (argv[idx_origin]->arg, "igp", 2) == 0)
+ return generic_set_add (vty, VTY_GET_CONTEXT(route_map_index), "origin",
+ "igp");
+ if (strncmp (argv[idx_origin]->arg, "egp", 1) == 0)
+ return generic_set_add (vty, VTY_GET_CONTEXT(route_map_index), "origin",
+ "egp");
+ if (strncmp (argv[idx_origin]->arg, "incomplete", 2) == 0)
+ return generic_set_add (vty, VTY_GET_CONTEXT(route_map_index), "origin",
+ "incomplete");
return CMD_WARNING;
}
+
DEFUN (no_set_origin,
no_set_origin_cmd,
- "no set origin",
- NO_STR
- SET_STR
- "BGP origin code\n")
-{
- return bgp_route_set_delete (vty, vty->index, "origin", NULL);
-}
-
-ALIAS (no_set_origin,
- no_set_origin_val_cmd,
- "no set origin (egp|igp|incomplete)",
+ "no set origin [<egp|igp|incomplete>]",
NO_STR
SET_STR
"BGP origin code\n"
"remote EGP\n"
"local IGP\n"
"unknown heritage\n")
+{
+ return generic_set_delete (vty, VTY_GET_CONTEXT(route_map_index), "origin",
+ NULL);
+}
+
DEFUN (set_atomic_aggregate,
set_atomic_aggregate_cmd,
SET_STR
"BGP atomic aggregate attribute\n" )
{
- return bgp_route_set_add (vty, vty->index, "atomic-aggregate", NULL);
+ return generic_set_add (vty, VTY_GET_CONTEXT(route_map_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_GET_CONTEXT(route_map_index),
+ "atomic-aggregate", NULL);
}
DEFUN (set_aggregator_as,
set_aggregator_as_cmd,
- "set aggregator as " CMD_AS_RANGE " A.B.C.D",
+ "set aggregator as (1-4294967295) A.B.C.D",
SET_STR
"BGP aggregator attribute\n"
"AS number of aggregator\n"
"AS number\n"
"IP address of aggregator\n")
{
+ int idx_number = 3;
+ int idx_ipv4 = 4;
int ret;
struct in_addr address;
char *argstr;
-
- ret = inet_aton (argv[1], &address);
+
+ ret = inet_aton (argv[idx_ipv4]->arg, &address);
if (ret == 0)
{
vty_out (vty, "Aggregator IP address is invalid%s", VTY_NEWLINE);
}
argstr = XMALLOC (MTYPE_ROUTE_MAP_COMPILED,
- strlen (argv[0]) + strlen (argv[1]) + 2);
+ strlen (argv[idx_number]->arg) + strlen (argv[idx_ipv4]->arg) + 2);
- sprintf (argstr, "%s %s", argv[0], argv[1]);
+ 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_GET_CONTEXT(route_map_index),
+ "aggregator as", argstr);
XFREE (MTYPE_ROUTE_MAP_COMPILED, argstr);
return ret;
}
+
DEFUN (no_set_aggregator_as,
no_set_aggregator_as_cmd,
- "no set aggregator as",
+ "no set aggregator as [(1-4294967295) A.B.C.D]",
NO_STR
SET_STR
"BGP aggregator attribute\n"
- "AS number of aggregator\n")
+ "AS number of aggregator\n"
+ "AS number\n"
+ "IP address of aggregator\n")
{
+ int idx_asn = 4;
+ int idx_ip = 5;
int ret;
struct in_addr address;
char *argstr;
- if (argv == 0)
- return bgp_route_set_delete (vty, vty->index, "aggregator as", NULL);
-
- ret = inet_aton (argv[1], &address);
+ if (argc <= idx_asn)
+ return generic_set_delete (vty, VTY_GET_CONTEXT(route_map_index),
+ "aggregator as", NULL);
+
+ ret = inet_aton (argv[idx_ip]->arg, &address);
if (ret == 0)
{
vty_out (vty, "Aggregator IP address is invalid%s", VTY_NEWLINE);
}
argstr = XMALLOC (MTYPE_ROUTE_MAP_COMPILED,
- strlen (argv[0]) + strlen (argv[1]) + 2);
+ strlen (argv[idx_asn]->arg) + strlen (argv[idx_ip]->arg) + 2);
- sprintf (argstr, "%s %s", argv[0], argv[1]);
+ 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_GET_CONTEXT(route_map_index),
+ "aggregator as", argstr);
XFREE (MTYPE_ROUTE_MAP_COMPILED, argstr);
return ret;
}
-ALIAS (no_set_aggregator_as,
- no_set_aggregator_as_val_cmd,
- "no set aggregator as " CMD_AS_RANGE " A.B.C.D",
- NO_STR
- SET_STR
- "BGP aggregator attribute\n"
- "AS number of aggregator\n"
- "AS number\n"
- "IP address of aggregator\n")
-
-DEFUN (set_tag,
- set_tag_cmd,
- "set tag <1-65535>",
- SET_STR
- "Tag value for routing protocol\n"
- "Tag value\n")
-{
- return bgp_route_set_add (vty, vty->index, "tag", argv[0]);
-}
-
-DEFUN (no_set_tag,
- no_set_tag_cmd,
- "no set tag",
- NO_STR
- SET_STR
- "Tag value for routing protocol\n")
-{
- if (argc == 0)
- bgp_route_set_delete(vty, vty->index, "tag", NULL);
-
- return bgp_route_set_delete (vty, vty->index, "tag", argv[0]);
-}
-
-ALIAS (no_set_tag,
- no_set_tag_val_cmd,
- "no set tag <1-65535>",
- NO_STR
- SET_STR
- "Tag value for routing protocol\n"
- "Tag value\n")
-
-
-#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")
-{
- return bgp_route_match_add (vty, vty->index, "ipv6 address", argv[0],
- 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")
-{
- return bgp_route_match_delete (vty, vty->index, "ipv6 address", argv[0],
- RMAP_EVENT_FILTER_DELETED);
-}
-
-DEFUN (match_ipv6_next_hop,
+DEFUN (match_ipv6_next_hop,
match_ipv6_next_hop_cmd,
"match ipv6 next-hop X:X::X:X",
MATCH_STR
"Match IPv6 next-hop address of route\n"
"IPv6 address of next hop\n")
{
- return bgp_route_match_add (vty, vty->index, "ipv6 next-hop", argv[0],
+ int idx_ipv6 = 3;
+ return bgp_route_match_add (vty, "ipv6 next-hop", argv[idx_ipv6]->arg,
RMAP_EVENT_MATCH_ADDED);
}
"Match IPv6 next-hop address of route\n"
"IPv6 address of next hop\n")
{
- return bgp_route_match_delete (vty, vty->index, "ipv6 next-hop", argv[0],
+ int idx_ipv6 = 4;
+ return bgp_route_match_delete (vty, "ipv6 next-hop", argv[idx_ipv6]->arg,
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")
-{
- return bgp_route_match_add (vty, vty->index, "ipv6 address prefix-list",
- argv[0], 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")
-{
- return bgp_route_match_delete (vty, vty->index, "ipv6 address prefix-list",
- argv[0], 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_GET_CONTEXT(route_map_index),
+ "ipv6 next-hop peer-address", NULL);
}
DEFUN (no_set_ipv6_nexthop_peer,
SET_STR
IPV6_STR
"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_GET_CONTEXT(route_map_index),
+ "ipv6 next-hop peer-address", NULL);
}
-DEFUN (set_ipv6_nexthop_global,
- set_ipv6_nexthop_global_cmd,
- "set ipv6 next-hop global X:X::X:X",
+DEFUN (set_ipv6_nexthop_prefer_global,
+ set_ipv6_nexthop_prefer_global_cmd,
+ "set ipv6 next-hop prefer-global",
SET_STR
IPV6_STR
"IPv6 next-hop address\n"
- "IPv6 global address\n"
- "IPv6 address of next hop\n")
+ "Prefer global over link-local if both exist\n")
{
- struct in6_addr addr;
- int ret;
-
- ret = inet_pton (AF_INET6, argv[0], &addr);
- if (!ret)
- {
- vty_out (vty, "%% Malformed nexthop address%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
- if (IN6_IS_ADDR_UNSPECIFIED(&addr) ||
- IN6_IS_ADDR_LOOPBACK(&addr) ||
- IN6_IS_ADDR_MULTICAST(&addr) ||
- IN6_IS_ADDR_LINKLOCAL(&addr))
- {
- vty_out (vty, "%% Invalid global nexthop address%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
-
- return bgp_route_set_add (vty, vty->index, "ipv6 next-hop global", argv[0]);
+ return generic_set_add (vty, VTY_GET_CONTEXT(route_map_index),
+ "ipv6 next-hop prefer-global", NULL);;
}
-DEFUN (no_set_ipv6_nexthop_global,
- no_set_ipv6_nexthop_global_cmd,
- "no set ipv6 next-hop global",
+DEFUN (no_set_ipv6_nexthop_prefer_global,
+ no_set_ipv6_nexthop_prefer_global_cmd,
+ "no set ipv6 next-hop prefer-global",
NO_STR
SET_STR
IPV6_STR
"IPv6 next-hop address\n"
- "IPv6 global address\n")
+ "Prefer global over link-local if both exist\n")
{
- if (argc == 0)
- 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[0]);
+ return generic_set_delete (vty, VTY_GET_CONTEXT(route_map_index),
+ "ipv6 next-hop prefer-global", NULL);
}
-ALIAS (no_set_ipv6_nexthop_global,
- no_set_ipv6_nexthop_global_val_cmd,
- "no set ipv6 next-hop global X:X::X:X",
- NO_STR
+DEFUN (set_ipv6_nexthop_global,
+ set_ipv6_nexthop_global_cmd,
+ "set ipv6 next-hop global X:X::X:X",
SET_STR
IPV6_STR
"IPv6 next-hop address\n"
"IPv6 global address\n"
"IPv6 address of next hop\n")
-
-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[0], &addr);
+ 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))
+ if (IN6_IS_ADDR_UNSPECIFIED(&addr) ||
+ IN6_IS_ADDR_LOOPBACK(&addr) ||
+ IN6_IS_ADDR_MULTICAST(&addr) ||
+ IN6_IS_ADDR_LINKLOCAL(&addr))
{
- vty_out (vty, "%% Invalid link-local nexthop address%s", VTY_NEWLINE);
+ vty_out (vty, "%% Invalid global nexthop address%s", VTY_NEWLINE);
return CMD_WARNING;
}
- return bgp_route_set_add (vty, vty->index, "ipv6 next-hop local", argv[0]);
+ return generic_set_add (vty, VTY_GET_CONTEXT(route_map_index),
+ "ipv6 next-hop global", argv[idx_ipv6]->arg);
}
-DEFUN (no_set_ipv6_nexthop_local,
- no_set_ipv6_nexthop_local_cmd,
- "no set ipv6 next-hop local",
- NO_STR
- SET_STR
- IPV6_STR
- "IPv6 next-hop address\n"
- "IPv6 local address\n")
-{
- if (argc == 0)
- 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[0]);
-}
-ALIAS (no_set_ipv6_nexthop_local,
- no_set_ipv6_nexthop_local_val_cmd,
- "no set ipv6 next-hop local X:X::X:X",
+DEFUN (no_set_ipv6_nexthop_global,
+ no_set_ipv6_nexthop_global_cmd,
+ "no set ipv6 next-hop global X:X::X:X",
NO_STR
SET_STR
IPV6_STR
"IPv6 next-hop address\n"
- "IPv6 local address\n"
+ "IPv6 global address\n"
"IPv6 address of next hop\n")
-#endif /* HAVE_IPV6 */
+{
+ int idx_ipv6 = 5;
+ if (argc <= idx_ipv6)
+ return generic_set_delete (vty, VTY_GET_CONTEXT(route_map_index),
+ "ipv6 next-hop global", NULL);
+ return generic_set_delete (vty, VTY_GET_CONTEXT(route_map_index),
+ "ipv6 next-hop global", argv[idx_ipv6]->arg);
+}
DEFUN (set_vpnv4_nexthop,
set_vpnv4_nexthop_cmd,
"VPNv4 next-hop address\n"
"IP address of next hop\n")
{
- return bgp_route_set_add (vty, vty->index, "vpnv4 next-hop", argv[0]);
+ int idx_ipv4 = 3;
+ return generic_set_add (vty, VTY_GET_CONTEXT(route_map_index),
+ "vpnv4 next-hop", argv[idx_ipv4]->arg);
}
+
DEFUN (no_set_vpnv4_nexthop,
no_set_vpnv4_nexthop_cmd,
- "no set vpnv4 next-hop",
+ "no set vpnv4 next-hop [A.B.C.D]",
NO_STR
SET_STR
"VPNv4 information\n"
- "VPNv4 next-hop address\n")
+ "VPNv4 next-hop address\n"
+ "IP address of next hop\n")
{
- if (argc == 0)
- return bgp_route_set_delete (vty, vty->index, "vpnv4 next-hop", NULL);
-
- return bgp_route_set_delete (vty, vty->index, "vpnv4 next-hop", argv[0]);
+ int idx_ipv4 = 4;
+ if (argc <= idx_ipv4)
+ return generic_set_delete (vty, VTY_GET_CONTEXT(route_map_index),
+ "vpnv4 next-hop", NULL);
+ return generic_set_delete (vty, VTY_GET_CONTEXT(route_map_index),
+ "vpnv4 next-hop", argv[idx_ipv4]->arg);
}
-ALIAS (no_set_vpnv4_nexthop,
- no_set_vpnv4_nexthop_val_cmd,
- "no set vpnv4 next-hop A.B.C.D",
- NO_STR
- SET_STR
- "VPNv4 information\n"
- "VPNv4 next-hop address\n"
- "IP address of next hop\n")
DEFUN (set_originator_id,
set_originator_id_cmd,
"BGP originator ID attribute\n"
"IP address of originator\n")
{
- return bgp_route_set_add (vty, vty->index, "originator-id", argv[0]);
+ int idx_ipv4 = 2;
+ return generic_set_add (vty, VTY_GET_CONTEXT(route_map_index),
+ "originator-id", argv[idx_ipv4]->arg);
}
+
DEFUN (no_set_originator_id,
no_set_originator_id_cmd,
- "no set originator-id",
+ "no set originator-id [A.B.C.D]",
NO_STR
SET_STR
- "BGP originator ID attribute\n")
+ "BGP originator ID attribute\n"
+ "IP address of originator\n")
{
- if (argc == 0)
- return bgp_route_set_delete (vty, vty->index, "originator-id", NULL);
-
- return bgp_route_set_delete (vty, vty->index, "originator-id", argv[0]);
+ int idx_id = 3;
+ if (argc < idx_id)
+ return generic_set_delete (vty, VTY_GET_CONTEXT(route_map_index),
+ "originator-id", NULL);
+ return generic_set_delete (vty, VTY_GET_CONTEXT(route_map_index),
+ "originator-id", argv[idx_id]->arg);
}
-ALIAS (no_set_originator_id,
- no_set_originator_id_val_cmd,
- "no set originator-id A.B.C.D",
- NO_STR
- SET_STR
- "BGP originator ID attribute\n"
- "IP address of originator\n")
/* Initialization of route map. */
void
bgp_route_map_init (void)
{
route_map_init ();
- route_map_init_vty ();
+
route_map_add_hook (bgp_route_map_add);
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);
route_map_install_match (&route_match_ip_route_source_prefix_list_cmd);
route_map_install_match (&route_match_aspath_cmd);
route_map_install_match (&route_match_community_cmd);
+ route_map_install_match (&route_match_lcommunity_cmd);
route_map_install_match (&route_match_ecommunity_cmd);
route_map_install_match (&route_match_local_pref_cmd);
route_map_install_match (&route_match_metric_cmd);
route_map_install_set (&route_set_aggregator_as_cmd);
route_map_install_set (&route_set_community_cmd);
route_map_install_set (&route_set_community_delete_cmd);
+ route_map_install_set (&route_set_lcommunity_cmd);
+ route_map_install_set (&route_set_lcommunity_delete_cmd);
route_map_install_set (&route_set_vpnv4_nexthop_cmd);
route_map_install_set (&route_set_originator_id_cmd);
route_map_install_set (&route_set_ecommunity_rt_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, &no_match_peer_val_cmd);
- install_element (RMAP_NODE, &no_match_peer_local_cmd);
- install_element (RMAP_NODE, &match_ip_address_cmd);
- install_element (RMAP_NODE, &no_match_ip_address_cmd);
- install_element (RMAP_NODE, &no_match_ip_address_val_cmd);
- install_element (RMAP_NODE, &match_ip_next_hop_cmd);
- install_element (RMAP_NODE, &no_match_ip_next_hop_cmd);
- install_element (RMAP_NODE, &no_match_ip_next_hop_val_cmd);
install_element (RMAP_NODE, &match_ip_route_source_cmd);
install_element (RMAP_NODE, &no_match_ip_route_source_cmd);
- install_element (RMAP_NODE, &no_match_ip_route_source_val_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, &no_match_ip_address_prefix_list_val_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, &no_match_ip_next_hop_prefix_list_val_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, &no_match_ip_route_source_prefix_list_val_cmd);
install_element (RMAP_NODE, &match_aspath_cmd);
install_element (RMAP_NODE, &no_match_aspath_cmd);
- install_element (RMAP_NODE, &no_match_aspath_val_cmd);
- install_element (RMAP_NODE, &match_metric_cmd);
- install_element (RMAP_NODE, &no_match_metric_cmd);
- install_element (RMAP_NODE, &no_match_metric_val_cmd);
install_element (RMAP_NODE, &match_local_pref_cmd);
install_element (RMAP_NODE, &no_match_local_pref_cmd);
- install_element (RMAP_NODE, &no_match_local_pref_val_cmd);
install_element (RMAP_NODE, &match_community_cmd);
install_element (RMAP_NODE, &match_community_exact_cmd);
install_element (RMAP_NODE, &no_match_community_cmd);
- install_element (RMAP_NODE, &no_match_community_val_cmd);
- install_element (RMAP_NODE, &no_match_community_exact_cmd);
+ install_element (RMAP_NODE, &match_lcommunity_cmd);
+ install_element (RMAP_NODE, &no_match_lcommunity_cmd);
install_element (RMAP_NODE, &match_ecommunity_cmd);
install_element (RMAP_NODE, &no_match_ecommunity_cmd);
- install_element (RMAP_NODE, &no_match_ecommunity_val_cmd);
install_element (RMAP_NODE, &match_origin_cmd);
install_element (RMAP_NODE, &no_match_origin_cmd);
- install_element (RMAP_NODE, &no_match_origin_val_cmd);
install_element (RMAP_NODE, &match_probability_cmd);
install_element (RMAP_NODE, &no_match_probability_cmd);
- install_element (RMAP_NODE, &no_match_probability_val_cmd);
- install_element (RMAP_NODE, &match_interface_cmd);
- install_element (RMAP_NODE, &no_match_interface_cmd);
- install_element (RMAP_NODE, &no_match_interface_val_cmd);
- install_element (RMAP_NODE, &match_tag_cmd);
- install_element (RMAP_NODE, &no_match_tag_cmd);
- install_element (RMAP_NODE, &no_match_tag_val_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, &no_set_ip_nexthop_val_cmd);
- install_element (RMAP_NODE, &no_set_ip_nexthop_peer_cmd);
install_element (RMAP_NODE, &set_local_pref_cmd);
install_element (RMAP_NODE, &no_set_local_pref_cmd);
- install_element (RMAP_NODE, &no_set_local_pref_val_cmd);
install_element (RMAP_NODE, &set_weight_cmd);
install_element (RMAP_NODE, &no_set_weight_cmd);
- install_element (RMAP_NODE, &no_set_weight_val_cmd);
- install_element (RMAP_NODE, &set_metric_cmd);
- install_element (RMAP_NODE, &set_metric_addsub_cmd);
- install_element (RMAP_NODE, &no_set_metric_cmd);
- install_element (RMAP_NODE, &no_set_metric_val_cmd);
- install_element (RMAP_NODE, &set_aspath_prepend_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_aspath_prepend_cmd);
- install_element (RMAP_NODE, &no_set_aspath_prepend_val_cmd);
install_element (RMAP_NODE, &no_set_aspath_exclude_cmd);
- install_element (RMAP_NODE, &no_set_aspath_exclude_val_cmd);
install_element (RMAP_NODE, &set_origin_cmd);
install_element (RMAP_NODE, &no_set_origin_cmd);
- install_element (RMAP_NODE, &no_set_origin_val_cmd);
install_element (RMAP_NODE, &set_atomic_aggregate_cmd);
install_element (RMAP_NODE, &no_set_atomic_aggregate_cmd);
install_element (RMAP_NODE, &set_aggregator_as_cmd);
install_element (RMAP_NODE, &no_set_aggregator_as_cmd);
- install_element (RMAP_NODE, &no_set_aggregator_as_val_cmd);
install_element (RMAP_NODE, &set_community_cmd);
install_element (RMAP_NODE, &set_community_none_cmd);
install_element (RMAP_NODE, &no_set_community_cmd);
- install_element (RMAP_NODE, &no_set_community_val_cmd);
- install_element (RMAP_NODE, &no_set_community_none_cmd);
install_element (RMAP_NODE, &set_community_delete_cmd);
install_element (RMAP_NODE, &no_set_community_delete_cmd);
- install_element (RMAP_NODE, &no_set_community_delete_val_cmd);
+ install_element (RMAP_NODE, &set_lcommunity_cmd);
+ install_element (RMAP_NODE, &set_lcommunity_none_cmd);
+ install_element (RMAP_NODE, &no_set_lcommunity_cmd);
+ install_element (RMAP_NODE, &no_set_lcommunity1_cmd);
+ install_element (RMAP_NODE, &set_lcommunity_delete_cmd);
+ install_element (RMAP_NODE, &no_set_lcommunity_delete_cmd);
install_element (RMAP_NODE, &set_ecommunity_rt_cmd);
install_element (RMAP_NODE, &no_set_ecommunity_rt_cmd);
- install_element (RMAP_NODE, &no_set_ecommunity_rt_val_cmd);
install_element (RMAP_NODE, &set_ecommunity_soo_cmd);
install_element (RMAP_NODE, &no_set_ecommunity_soo_cmd);
- install_element (RMAP_NODE, &no_set_ecommunity_soo_val_cmd);
install_element (RMAP_NODE, &set_vpnv4_nexthop_cmd);
install_element (RMAP_NODE, &no_set_vpnv4_nexthop_cmd);
- install_element (RMAP_NODE, &no_set_vpnv4_nexthop_val_cmd);
install_element (RMAP_NODE, &set_originator_id_cmd);
install_element (RMAP_NODE, &no_set_originator_id_cmd);
- install_element (RMAP_NODE, &no_set_originator_id_val_cmd);
- install_element (RMAP_NODE, &set_tag_cmd);
- install_element (RMAP_NODE, &no_set_tag_cmd);
- install_element (RMAP_NODE, &no_set_tag_val_cmd);
-#ifdef HAVE_IPV6
route_map_install_match (&route_match_ipv6_address_cmd);
route_map_install_match (&route_match_ipv6_next_hop_cmd);
route_map_install_match (&route_match_ipv6_address_prefix_list_cmd);
route_map_install_set (&route_set_ipv6_nexthop_global_cmd);
+ route_map_install_set (&route_set_ipv6_nexthop_prefer_global_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, &no_set_ipv6_nexthop_global_val_cmd);
- install_element (RMAP_NODE, &set_ipv6_nexthop_local_cmd);
- install_element (RMAP_NODE, &no_set_ipv6_nexthop_local_cmd);
- install_element (RMAP_NODE, &no_set_ipv6_nexthop_local_val_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_peer_cmd);
install_element (RMAP_NODE, &no_set_ipv6_nexthop_peer_cmd);
-#endif /* HAVE_IPV6 */
}
void