{
struct community_list *list;
struct bgp_path_info *path;
- struct rmap_community *rcom;
+ struct rmap_community *rcom = rule;
if (type == RMAP_BGP) {
path = object;
{
struct community_list *list;
struct bgp_path_info *path;
- struct rmap_community *rcom;
+ struct rmap_community *rcom = rule;
if (type == RMAP_BGP) {
path = object;
- rcom = rule;
list = community_list_lookup(bgp_clist, rcom->name,
LARGE_COMMUNITY_LIST_MASTER);
{
struct community_list *list;
struct bgp_path_info *path;
+ struct rmap_community *rcom = rule;
if (type == RMAP_BGP) {
path = object;
- list = community_list_lookup(bgp_clist, (char *)rule,
+ list = community_list_lookup(bgp_clist, rcom->name,
EXTCOMMUNITY_LIST_MASTER);
if (!list)
return RMAP_NOMATCH;
/* Compile function for extcommunity match. */
static void *route_match_ecommunity_compile(const char *arg)
{
- return XSTRDUP(MTYPE_ROUTE_MAP_COMPILED, arg);
+ struct rmap_community *rcom;
+
+ rcom = XCALLOC(MTYPE_ROUTE_MAP_COMPILED, sizeof(struct rmap_community));
+ rcom->name = XSTRDUP(MTYPE_ROUTE_MAP_COMPILED, arg);
+
+ return rcom;
}
/* Compile function for extcommunity match. */
static void route_match_ecommunity_free(void *rule)
{
- XFREE(MTYPE_ROUTE_MAP_COMPILED, 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 lcommunity *new;
struct lcommunity *old;
struct bgp_path_info *path;
+ struct rmap_community *rcom = rule;
if (type == RMAP_BGP) {
- if (!rule)
+ if (!rcom)
return RMAP_OKAY;
path = object;
- list = community_list_lookup(bgp_clist, rule,
+ list = community_list_lookup(bgp_clist, rcom->name,
LARGE_COMMUNITY_LIST_MASTER);
old = path->attr->lcommunity;
/* Compile function for set lcommunity. */
static void *route_set_lcommunity_delete_compile(const char *arg)
{
+ struct rmap_community *rcom;
char *p;
char *str;
int len;
+ rcom = XCALLOC(MTYPE_ROUTE_MAP_COMPILED, sizeof(struct rmap_community));
+
p = strchr(arg, ' ');
if (p) {
len = p - arg;
} else
str = NULL;
- return str;
+ rcom->name = str;
+ return rcom;
}
/* Free function for set lcommunity. */
static void route_set_lcommunity_delete_free(void *rule)
{
- XFREE(MTYPE_ROUTE_MAP_COMPILED, rule);
+ struct rmap_community *rcom = rule;
+
+ XFREE(MTYPE_ROUTE_MAP_COMPILED, rcom->name);
+ XFREE(MTYPE_ROUTE_MAP_COMPILED, rcom);
}
/* Set lcommunity rule structure. */
struct community *new;
struct community *old;
struct bgp_path_info *path;
+ struct rmap_community *rcom = rule;
if (type == RMAP_BGP) {
- if (!rule)
+ if (!rcom)
return RMAP_OKAY;
path = object;
- list = community_list_lookup(bgp_clist, rule,
+ list = community_list_lookup(bgp_clist, rcom->name,
COMMUNITY_LIST_MASTER);
old = path->attr->community;
/* Compile function for set community. */
static void *route_set_community_delete_compile(const char *arg)
{
+ struct rmap_community *rcom;
char *p;
char *str;
int len;
+ rcom = XCALLOC(MTYPE_ROUTE_MAP_COMPILED, sizeof(struct rmap_community));
+
p = strchr(arg, ' ');
if (p) {
len = p - arg;
} else
str = NULL;
- return str;
+ rcom->name = str;
+ return rcom;
}
/* Free function for set community. */
static void route_set_community_delete_free(void *rule)
{
- XFREE(MTYPE_ROUTE_MAP_COMPILED, rule);
+ struct rmap_community *rcom = rule;
+
+ XFREE(MTYPE_ROUTE_MAP_COMPILED, rcom->name);
+ XFREE(MTYPE_ROUTE_MAP_COMPILED, rcom);
}
/* Set community rule structure. */