summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bgpd/bgp_attr.c51
-rw-r--r--bgpd/bgp_attr.h7
-rw-r--r--bgpd/bgp_clist.c20
-rw-r--r--bgpd/bgp_community.c30
-rw-r--r--bgpd/bgp_community.h4
-rw-r--r--bgpd/bgp_routemap.c10
6 files changed, 35 insertions, 87 deletions
diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c
index e6c44a760a..d31e266c95 100644
--- a/bgpd/bgp_attr.c
+++ b/bgpd/bgp_attr.c
@@ -167,6 +167,9 @@ static struct cluster_list *cluster_intern(struct cluster_list *cluster)
static void cluster_unintern(struct cluster_list **cluster)
{
+ if (!*cluster)
+ return;
+
if ((*cluster)->refcnt)
(*cluster)->refcnt--;
@@ -330,6 +333,10 @@ static void encap_unintern(struct bgp_attr_encap_subtlv **encapp,
encap_subtlv_type type)
{
struct bgp_attr_encap_subtlv *encap = *encapp;
+
+ if (!*encapp)
+ return;
+
if (encap->refcnt)
encap->refcnt--;
@@ -418,6 +425,9 @@ static struct transit *transit_intern(struct transit *transit)
static void transit_unintern(struct transit **transit)
{
+ if (!*transit)
+ return;
+
if ((*transit)->refcnt)
(*transit)->refcnt--;
@@ -558,6 +568,9 @@ static void srv6_l3vpn_unintern(struct bgp_attr_srv6_l3vpn **l3vpnp)
{
struct bgp_attr_srv6_l3vpn *l3vpn = *l3vpnp;
+ if (!*l3vpnp)
+ return;
+
if (l3vpn->refcnt)
l3vpn->refcnt--;
@@ -593,6 +606,9 @@ static void srv6_vpn_unintern(struct bgp_attr_srv6_vpn **vpnp)
{
struct bgp_attr_srv6_vpn *vpn = *vpnp;
+ if (!*vpnp)
+ return;
+
if (vpn->refcnt)
vpn->refcnt--;
@@ -1183,6 +1199,7 @@ void bgp_attr_unintern_sub(struct attr *attr)
struct cluster_list *cluster;
struct lcommunity *lcomm = NULL;
struct community *comm = NULL;
+ struct transit *transit;
/* aspath refcount shoud be decrement. */
aspath_unintern(&attr->aspath);
@@ -1205,37 +1222,25 @@ void bgp_attr_unintern_sub(struct attr *attr)
bgp_attr_set_lcommunity(attr, NULL);
cluster = bgp_attr_get_cluster(attr);
- if (cluster) {
- cluster_unintern(&cluster);
- bgp_attr_set_cluster(attr, cluster);
- }
- UNSET_FLAG(attr->flag, ATTR_FLAG_BIT(BGP_ATTR_CLUSTER_LIST));
-
- struct transit *transit = bgp_attr_get_transit(attr);
+ cluster_unintern(&cluster);
+ bgp_attr_set_cluster(attr, NULL);
- if (transit) {
- transit_unintern(&transit);
- bgp_attr_set_transit(attr, transit);
- }
+ transit = bgp_attr_get_transit(attr);
+ transit_unintern(&transit);
+ bgp_attr_set_transit(attr, NULL);
- if (attr->encap_subtlvs)
- encap_unintern(&attr->encap_subtlvs, ENCAP_SUBTLV_TYPE);
+ encap_unintern(&attr->encap_subtlvs, ENCAP_SUBTLV_TYPE);
#ifdef ENABLE_BGP_VNC
struct bgp_attr_encap_subtlv *vnc_subtlvs =
bgp_attr_get_vnc_subtlvs(attr);
- if (vnc_subtlvs) {
- encap_unintern(&vnc_subtlvs, VNC_SUBTLV_TYPE);
- bgp_attr_set_vnc_subtlvs(attr, vnc_subtlvs);
- }
+ encap_unintern(&vnc_subtlvs, VNC_SUBTLV_TYPE);
+ bgp_attr_set_vnc_subtlvs(attr, NULL);
#endif
- if (attr->srv6_l3vpn)
- srv6_l3vpn_unintern(&attr->srv6_l3vpn);
-
- if (attr->srv6_vpn)
- srv6_vpn_unintern(&attr->srv6_vpn);
+ srv6_l3vpn_unintern(&attr->srv6_l3vpn);
+ srv6_vpn_unintern(&attr->srv6_vpn);
}
/* Free bgp attribute and aspath. */
@@ -2214,8 +2219,6 @@ bgp_attr_cluster_list(struct bgp_attr_parser_args *args)
/* XXX: Fix cluster_parse to use stream API and then remove this */
stream_forward_getp(peer->curr, length);
- attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_CLUSTER_LIST);
-
return BGP_ATTR_PARSE_PROCEED;
cluster_list_ignore:
diff --git a/bgpd/bgp_attr.h b/bgpd/bgp_attr.h
index 415df2ce53..961e5f1224 100644
--- a/bgpd/bgp_attr.h
+++ b/bgpd/bgp_attr.h
@@ -594,7 +594,7 @@ static inline void bgp_attr_set_aigp_metric(struct attr *attr, uint64_t aigp)
attr->aigp_metric = aigp;
if (aigp)
- attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_AIGP);
+ SET_FLAG(attr->flag, ATTR_FLAG_BIT(BGP_ATTR_AIGP));
}
static inline struct cluster_list *bgp_attr_get_cluster(const struct attr *attr)
@@ -606,6 +606,11 @@ static inline void bgp_attr_set_cluster(struct attr *attr,
struct cluster_list *cl)
{
attr->cluster1 = cl;
+
+ if (cl)
+ SET_FLAG(attr->flag, ATTR_FLAG_BIT(BGP_ATTR_CLUSTER_LIST));
+ else
+ UNSET_FLAG(attr->flag, ATTR_FLAG_BIT(BGP_ATTR_CLUSTER_LIST));
}
static inline const struct bgp_route_evpn *
diff --git a/bgpd/bgp_clist.c b/bgpd/bgp_clist.c
index 3b987c2f57..3fd246397f 100644
--- a/bgpd/bgp_clist.c
+++ b/bgpd/bgp_clist.c
@@ -449,13 +449,6 @@ static char *community_str_get(struct community *com, int i)
comval = ntohl(comval);
switch (comval) {
-#if CONFDATE > 20230801
-CPP_NOTICE("Deprecate COMMUNITY_INTERNET BGP community")
-#endif
- case COMMUNITY_INTERNET:
- str = XSTRDUP(MTYPE_COMMUNITY_STR, "internet");
- zlog_warn("`internet` community is deprecated");
- break;
case COMMUNITY_GSHUT:
str = XSTRDUP(MTYPE_COMMUNITY_STR, "graceful-shutdown");
break;
@@ -660,9 +653,6 @@ bool community_list_match(struct community *com, struct community_list *list)
for (entry = list->head; entry; entry = entry->next) {
if (entry->style == COMMUNITY_LIST_STANDARD) {
- if (community_include(entry->u.com, COMMUNITY_INTERNET))
- return entry->direct == COMMUNITY_PERMIT;
-
if (community_match(com, entry->u.com))
return entry->direct == COMMUNITY_PERMIT;
} else if (entry->style == COMMUNITY_LIST_EXPANDED) {
@@ -735,9 +725,6 @@ bool community_list_exact_match(struct community *com,
for (entry = list->head; entry; entry = entry->next) {
if (entry->style == COMMUNITY_LIST_STANDARD) {
- if (community_include(entry->u.com, COMMUNITY_INTERNET))
- return entry->direct == COMMUNITY_PERMIT;
-
if (community_cmp(com, entry->u.com))
return entry->direct == COMMUNITY_PERMIT;
} else if (entry->style == COMMUNITY_LIST_EXPANDED) {
@@ -767,17 +754,14 @@ struct community *community_list_match_delete(struct community *com,
for (entry = list->head; entry; entry = entry->next) {
if ((entry->style == COMMUNITY_LIST_STANDARD) &&
- (community_include(entry->u.com,
- COMMUNITY_INTERNET) ||
- community_include(entry->u.com, val))) {
+ community_include(entry->u.com, val)) {
if (entry->direct == COMMUNITY_PERMIT) {
com_index_to_delete[delete_index] = i;
delete_index++;
}
break;
} else if ((entry->style == COMMUNITY_LIST_EXPANDED) &&
- community_regexp_include(entry->reg, com,
- i)) {
+ community_regexp_include(entry->reg, com, i)) {
if (entry->direct == COMMUNITY_PERMIT) {
com_index_to_delete[delete_index] = i;
delete_index++;
diff --git a/bgpd/bgp_community.c b/bgpd/bgp_community.c
index f56bfc8bdc..8e4c430555 100644
--- a/bgpd/bgp_community.c
+++ b/bgpd/bgp_community.c
@@ -228,13 +228,6 @@ static void set_community_string(struct community *com, bool make_json,
comval = ntohl(comval);
switch (comval) {
-#if CONFDATE > 20230801
-CPP_NOTICE("Deprecate COMMUNITY_INTERNET BGP community")
-#endif
- case COMMUNITY_INTERNET:
- len += strlen(" internet");
- zlog_warn("`internet` community is deprecated");
- break;
case COMMUNITY_GSHUT:
len += strlen(" graceful-shutdown");
break;
@@ -298,19 +291,6 @@ CPP_NOTICE("Deprecate COMMUNITY_INTERNET BGP community")
strlcat(str, " ", len);
switch (comval) {
-#if CONFDATE > 20230801
-CPP_NOTICE("Deprecate COMMUNITY_INTERNET BGP community")
-#endif
- case COMMUNITY_INTERNET:
- strlcat(str, "internet", len);
- if (make_json) {
- json_string =
- json_object_new_string("internet");
- json_object_array_add(json_community_list,
- json_string);
- }
- zlog_warn("`internet` community is deprecated");
- break;
case COMMUNITY_GSHUT:
strlcat(str, "graceful-shutdown", len);
if (make_json) {
@@ -680,16 +660,6 @@ community_gettoken(const char *buf, enum community_token *token, uint32_t *val)
/* Well known community string check. */
if (isalpha((unsigned char)*p)) {
-#if CONFDATE > 20230801
-CPP_NOTICE("Deprecate COMMUNITY_INTERNET BGP community")
-#endif
- if (strncmp(p, "internet", strlen("internet")) == 0) {
- *val = COMMUNITY_INTERNET;
- *token = community_token_no_export;
- p += strlen("internet");
- zlog_warn("`internet` community is deprecated");
- return p;
- }
if (strncmp(p, "graceful-shutdown", strlen("graceful-shutdown"))
== 0) {
*val = COMMUNITY_GSHUT;
diff --git a/bgpd/bgp_community.h b/bgpd/bgp_community.h
index e7af362ea8..7c7e7af4d2 100644
--- a/bgpd/bgp_community.h
+++ b/bgpd/bgp_community.h
@@ -30,10 +30,6 @@ struct community {
};
/* Well-known communities value. */
-#if CONFDATE > 20230801
-CPP_NOTICE("Deprecate COMMUNITY_INTERNET BGP community")
-#endif
-#define COMMUNITY_INTERNET 0x0
#define COMMUNITY_GSHUT 0xFFFF0000
#define COMMUNITY_ACCEPT_OWN 0xFFFF0001
#define COMMUNITY_ROUTE_FILTER_TRANSLATED_v4 0xFFFF0002
diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c
index 0f86cfdd2d..b7ac976e23 100644
--- a/bgpd/bgp_routemap.c
+++ b/bgpd/bgp_routemap.c
@@ -6282,16 +6282,6 @@ DEFUN_YANG (set_community,
else
first = 1;
-#if CONFDATE > 20230801
-CPP_NOTICE("Deprecate COMMUNITY_INTERNET BGP community")
-#endif
- if (strncmp(argv[i]->arg, "internet", strlen(argv[i]->arg))
- == 0) {
- buffer_putstr(b, "internet");
- vty_out(vty, "%% `internet` community is deprecated\n");
- zlog_warn("`internet` community is deprecated");
- continue;
- }
if (strncmp(argv[i]->arg, "local-AS", strlen(argv[i]->arg))
== 0) {
buffer_putstr(b, "local-AS");