mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-15 03:27:25 +00:00
Merge pull request #12832 from opensourcerouting/fix/deprecate_bgp_internet_community
bgpd: Deprecate BGP `internet` community
This commit is contained in:
commit
d86be4994f
@ -449,8 +449,12 @@ static char *community_str_get(struct community *com, int i)
|
|||||||
comval = ntohl(comval);
|
comval = ntohl(comval);
|
||||||
|
|
||||||
switch (comval) {
|
switch (comval) {
|
||||||
|
#if CONFDATE > 20230801
|
||||||
|
CPP_NOTICE("Deprecate COMMUNITY_INTERNET BGP community")
|
||||||
|
#endif
|
||||||
case COMMUNITY_INTERNET:
|
case COMMUNITY_INTERNET:
|
||||||
str = XSTRDUP(MTYPE_COMMUNITY_STR, "internet");
|
str = XSTRDUP(MTYPE_COMMUNITY_STR, "internet");
|
||||||
|
zlog_warn("`internet` community is deprecated");
|
||||||
break;
|
break;
|
||||||
case COMMUNITY_GSHUT:
|
case COMMUNITY_GSHUT:
|
||||||
str = XSTRDUP(MTYPE_COMMUNITY_STR, "graceful-shutdown");
|
str = XSTRDUP(MTYPE_COMMUNITY_STR, "graceful-shutdown");
|
||||||
|
@ -168,7 +168,6 @@ struct community *community_uniq_sort(struct community *com)
|
|||||||
|
|
||||||
For Well-known communities value, below keyword is used.
|
For Well-known communities value, below keyword is used.
|
||||||
|
|
||||||
0x0 "internet"
|
|
||||||
0xFFFF0000 "graceful-shutdown"
|
0xFFFF0000 "graceful-shutdown"
|
||||||
0xFFFF0001 "accept-own"
|
0xFFFF0001 "accept-own"
|
||||||
0xFFFF0002 "route-filter-translated-v4"
|
0xFFFF0002 "route-filter-translated-v4"
|
||||||
@ -229,8 +228,12 @@ static void set_community_string(struct community *com, bool make_json,
|
|||||||
comval = ntohl(comval);
|
comval = ntohl(comval);
|
||||||
|
|
||||||
switch (comval) {
|
switch (comval) {
|
||||||
|
#if CONFDATE > 20230801
|
||||||
|
CPP_NOTICE("Deprecate COMMUNITY_INTERNET BGP community")
|
||||||
|
#endif
|
||||||
case COMMUNITY_INTERNET:
|
case COMMUNITY_INTERNET:
|
||||||
len += strlen(" internet");
|
len += strlen(" internet");
|
||||||
|
zlog_warn("`internet` community is deprecated");
|
||||||
break;
|
break;
|
||||||
case COMMUNITY_GSHUT:
|
case COMMUNITY_GSHUT:
|
||||||
len += strlen(" graceful-shutdown");
|
len += strlen(" graceful-shutdown");
|
||||||
@ -295,6 +298,9 @@ static void set_community_string(struct community *com, bool make_json,
|
|||||||
strlcat(str, " ", len);
|
strlcat(str, " ", len);
|
||||||
|
|
||||||
switch (comval) {
|
switch (comval) {
|
||||||
|
#if CONFDATE > 20230801
|
||||||
|
CPP_NOTICE("Deprecate COMMUNITY_INTERNET BGP community")
|
||||||
|
#endif
|
||||||
case COMMUNITY_INTERNET:
|
case COMMUNITY_INTERNET:
|
||||||
strlcat(str, "internet", len);
|
strlcat(str, "internet", len);
|
||||||
if (make_json) {
|
if (make_json) {
|
||||||
@ -303,6 +309,7 @@ static void set_community_string(struct community *com, bool make_json,
|
|||||||
json_object_array_add(json_community_list,
|
json_object_array_add(json_community_list,
|
||||||
json_string);
|
json_string);
|
||||||
}
|
}
|
||||||
|
zlog_warn("`internet` community is deprecated");
|
||||||
break;
|
break;
|
||||||
case COMMUNITY_GSHUT:
|
case COMMUNITY_GSHUT:
|
||||||
strlcat(str, "graceful-shutdown", len);
|
strlcat(str, "graceful-shutdown", len);
|
||||||
@ -673,10 +680,14 @@ community_gettoken(const char *buf, enum community_token *token, uint32_t *val)
|
|||||||
|
|
||||||
/* Well known community string check. */
|
/* Well known community string check. */
|
||||||
if (isalpha((unsigned char)*p)) {
|
if (isalpha((unsigned char)*p)) {
|
||||||
|
#if CONFDATE > 20230801
|
||||||
|
CPP_NOTICE("Deprecate COMMUNITY_INTERNET BGP community")
|
||||||
|
#endif
|
||||||
if (strncmp(p, "internet", strlen("internet")) == 0) {
|
if (strncmp(p, "internet", strlen("internet")) == 0) {
|
||||||
*val = COMMUNITY_INTERNET;
|
*val = COMMUNITY_INTERNET;
|
||||||
*token = community_token_no_export;
|
*token = community_token_no_export;
|
||||||
p += strlen("internet");
|
p += strlen("internet");
|
||||||
|
zlog_warn("`internet` community is deprecated");
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
if (strncmp(p, "graceful-shutdown", strlen("graceful-shutdown"))
|
if (strncmp(p, "graceful-shutdown", strlen("graceful-shutdown"))
|
||||||
|
@ -30,6 +30,9 @@ struct community {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* Well-known communities value. */
|
/* Well-known communities value. */
|
||||||
|
#if CONFDATE > 20230801
|
||||||
|
CPP_NOTICE("Deprecate COMMUNITY_INTERNET BGP community")
|
||||||
|
#endif
|
||||||
#define COMMUNITY_INTERNET 0x0
|
#define COMMUNITY_INTERNET 0x0
|
||||||
#define COMMUNITY_GSHUT 0xFFFF0000
|
#define COMMUNITY_GSHUT 0xFFFF0000
|
||||||
#define COMMUNITY_ACCEPT_OWN 0xFFFF0001
|
#define COMMUNITY_ACCEPT_OWN 0xFFFF0001
|
||||||
|
@ -5902,9 +5902,14 @@ DEFUN_YANG (set_community,
|
|||||||
else
|
else
|
||||||
first = 1;
|
first = 1;
|
||||||
|
|
||||||
|
#if CONFDATE > 20230801
|
||||||
|
CPP_NOTICE("Deprecate COMMUNITY_INTERNET BGP community")
|
||||||
|
#endif
|
||||||
if (strncmp(argv[i]->arg, "internet", strlen(argv[i]->arg))
|
if (strncmp(argv[i]->arg, "internet", strlen(argv[i]->arg))
|
||||||
== 0) {
|
== 0) {
|
||||||
buffer_putstr(b, "internet");
|
buffer_putstr(b, "internet");
|
||||||
|
vty_out(vty, "%% `internet` community is deprecated\n");
|
||||||
|
zlog_warn("`internet` community is deprecated");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (strncmp(argv[i]->arg, "local-AS", strlen(argv[i]->arg))
|
if (strncmp(argv[i]->arg, "local-AS", strlen(argv[i]->arg))
|
||||||
|
@ -2114,9 +2114,6 @@ is 4 octet long. The following format is used to define the community value.
|
|||||||
``7675:80`` can be used when AS 7675 wants to pass local policy value 80 to
|
``7675:80`` can be used when AS 7675 wants to pass local policy value 80 to
|
||||||
neighboring peer.
|
neighboring peer.
|
||||||
|
|
||||||
``internet``
|
|
||||||
``internet`` represents well-known communities value 0.
|
|
||||||
|
|
||||||
``graceful-shutdown``
|
``graceful-shutdown``
|
||||||
``graceful-shutdown`` represents well-known communities value
|
``graceful-shutdown`` represents well-known communities value
|
||||||
``GRACEFUL_SHUTDOWN`` ``0xFFFF0000`` ``65535:0``. :rfc:`8326` implements
|
``GRACEFUL_SHUTDOWN`` ``0xFFFF0000`` ``65535:0``. :rfc:`8326` implements
|
||||||
@ -2487,17 +2484,6 @@ community-list.
|
|||||||
match community FILTER
|
match community FILTER
|
||||||
|
|
||||||
|
|
||||||
The communities value keyword ``internet`` has special meanings in standard
|
|
||||||
community lists. In the below example ``internet`` matches all BGP routes even
|
|
||||||
if the route does not have communities attribute at all. So community list
|
|
||||||
``INTERNET`` is the same as ``FILTER`` in the previous example.
|
|
||||||
|
|
||||||
.. code-block:: frr
|
|
||||||
|
|
||||||
bgp community-list standard INTERNET deny 1:1
|
|
||||||
bgp community-list standard INTERNET permit internet
|
|
||||||
|
|
||||||
|
|
||||||
The following configuration is an example of communities value deletion. With
|
The following configuration is an example of communities value deletion. With
|
||||||
this configuration the community values ``100:1`` and ``100:2`` are removed
|
this configuration the community values ``100:1`` and ``100:2`` are removed
|
||||||
from BGP updates. For communities value deletion, only ``permit``
|
from BGP updates. For communities value deletion, only ``permit``
|
||||||
@ -2567,9 +2553,6 @@ Extended Community Lists
|
|||||||
there is no matched entry, deny will be returned. When `extcommunity` is
|
there is no matched entry, deny will be returned. When `extcommunity` is
|
||||||
empty it matches to any routes.
|
empty it matches to any routes.
|
||||||
|
|
||||||
A special handling for ``internet`` community is applied. It matches
|
|
||||||
any community.
|
|
||||||
|
|
||||||
.. clicmd:: bgp extcommunity-list expanded NAME permit|deny LINE
|
.. clicmd:: bgp extcommunity-list expanded NAME permit|deny LINE
|
||||||
|
|
||||||
This command defines a new expanded extcommunity-list. `line` is a string
|
This command defines a new expanded extcommunity-list. `line` is a string
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
Following tests are covered to test bgp community functionality:
|
Following tests are covered to test bgp community functionality:
|
||||||
1. Verify that BGP well known communities work fine for
|
1. Verify that BGP well known communities work fine for
|
||||||
eBGP and iBGP peers.
|
eBGP and iBGP peers.
|
||||||
Well known communities tested: no-export, local-AS, internet
|
Well known communities tested: no-export, local-AS
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@ -140,11 +140,11 @@ def teardown_module(mod):
|
|||||||
#####################################################
|
#####################################################
|
||||||
|
|
||||||
|
|
||||||
def test_bgp_no_export_local_as_and_internet_communities_p0(request):
|
def test_bgp_no_export_local_as_communities_p0(request):
|
||||||
"""
|
"""
|
||||||
Verify that BGP well known communities work fine for
|
Verify that BGP well known communities work fine for
|
||||||
eBGP and iBGP peers.
|
eBGP and iBGP peers.
|
||||||
Well known communities tested: no-export, local-AS, internet
|
Well known communities tested: no-export, local-AS
|
||||||
"""
|
"""
|
||||||
|
|
||||||
tc_name = request.node.name
|
tc_name = request.node.name
|
||||||
@ -170,7 +170,7 @@ def test_bgp_no_export_local_as_and_internet_communities_p0(request):
|
|||||||
tc_name, result
|
tc_name, result
|
||||||
)
|
)
|
||||||
|
|
||||||
for comm_type in ["no-export", "local-AS", "internet"]:
|
for comm_type in ["no-export", "local-AS"]:
|
||||||
|
|
||||||
step("Create a route-map on R1 to set community as {}".format(comm_type))
|
step("Create a route-map on R1 to set community as {}".format(comm_type))
|
||||||
|
|
||||||
@ -258,38 +258,16 @@ def test_bgp_no_export_local_as_and_internet_communities_p0(request):
|
|||||||
tc_name, result
|
tc_name, result
|
||||||
)
|
)
|
||||||
|
|
||||||
if comm_type == "internet":
|
|
||||||
step(
|
|
||||||
"Verify that these prefixes, originated on R1, are"
|
|
||||||
"received on both R2 and R3"
|
|
||||||
)
|
|
||||||
|
|
||||||
result = verify_rib(
|
|
||||||
tgen,
|
|
||||||
addr_type,
|
|
||||||
"r3",
|
|
||||||
input_dict_4,
|
|
||||||
next_hop=topo["routers"]["r1"]["links"]["r3"][addr_type].split("/")[
|
|
||||||
0
|
|
||||||
],
|
|
||||||
)
|
|
||||||
assert result is True, "Testcase {} : Failed \n Error: {}".format(
|
|
||||||
tc_name, result
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
step(
|
step(
|
||||||
"Verify that these prefixes, originated on R1, are not"
|
"Verify that these prefixes, originated on R1, are not"
|
||||||
"received on R3 but received on R2"
|
"received on R3 but received on R2"
|
||||||
)
|
)
|
||||||
|
|
||||||
result = verify_rib(
|
result = verify_rib(
|
||||||
tgen,
|
tgen,
|
||||||
addr_type,
|
addr_type,
|
||||||
"r3",
|
"r3",
|
||||||
input_dict_4,
|
input_dict_4,
|
||||||
next_hop=topo["routers"]["r1"]["links"]["r3"][addr_type].split("/")[
|
next_hop=topo["routers"]["r1"]["links"]["r3"][addr_type].split("/")[0],
|
||||||
0
|
|
||||||
],
|
|
||||||
expected=False,
|
expected=False,
|
||||||
)
|
)
|
||||||
assert result is not True, (
|
assert result is not True, (
|
||||||
|
Loading…
Reference in New Issue
Block a user