Flowspec added some new ext communities. They use new type (generic
transitive types). Adjust the ext community code to handle these types as
well. I need to cycle back to this but this gets us of the ground.
--
:wq Claudio
Index: parse.y
===================================================================
RCS file: /cvs/src/usr.sbin/bgpd/parse.y,v
retrieving revision 1.449
diff -u -p -r1.449 parse.y
--- parse.y 19 Apr 2023 15:27:46 -0000 1.449
+++ parse.y 21 Apr 2023 09:13:22 -0000
@@ -4441,7 +4441,7 @@ parseextvalue(int type, char *s, uint32_
type = EXT_COMMUNITY_TRANS_IPV4;
}
- switch (type) {
+ switch (type & EXT_COMMUNITY_VALUE) {
case EXT_COMMUNITY_TRANS_TWO_AS:
uval = strtonum(s, 0, USHRT_MAX, &errstr);
if (errstr) {
@@ -4510,6 +4510,9 @@ parseextcommunity(struct community *c, c
case EXT_COMMUNITY_TRANS_TWO_AS:
case EXT_COMMUNITY_TRANS_FOUR_AS:
case EXT_COMMUNITY_TRANS_IPV4:
+ case EXT_COMMUNITY_GEN_TWO_AS:
+ case EXT_COMMUNITY_GEN_FOUR_AS:
+ case EXT_COMMUNITY_GEN_IPV4:
case -1:
if (strcmp(s, "*") == 0) {
dflag1 = COMMUNITY_ANY;
@@ -4525,11 +4528,14 @@ parseextcommunity(struct community *c, c
switch (type) {
case EXT_COMMUNITY_TRANS_TWO_AS:
+ case EXT_COMMUNITY_GEN_TWO_AS:
if (getcommunity(p, 1, &uval2, &dflag2) == -1)
return (-1);
break;
case EXT_COMMUNITY_TRANS_IPV4:
case EXT_COMMUNITY_TRANS_FOUR_AS:
+ case EXT_COMMUNITY_GEN_IPV4:
+ case EXT_COMMUNITY_GEN_FOUR_AS:
if (getcommunity(p, 0, &uval2, &dflag2) == -1)
return (-1);
break;
Index: printconf.c
===================================================================
RCS file: /cvs/src/usr.sbin/bgpd/printconf.c,v
retrieving revision 1.165
diff -u -p -r1.165 printconf.c
--- printconf.c 18 Apr 2023 14:11:54 -0000 1.165
+++ printconf.c 21 Apr 2023 09:13:22 -0000
@@ -219,6 +219,8 @@ print_community(struct community *c)
switch (type) {
case EXT_COMMUNITY_TRANS_TWO_AS:
case EXT_COMMUNITY_TRANS_FOUR_AS:
+ case EXT_COMMUNITY_GEN_TWO_AS:
+ case EXT_COMMUNITY_GEN_FOUR_AS:
if ((c->flags >> 8 & 0xff) == COMMUNITY_NEIGHBOR_AS)
printf("neighbor-as:");
else if ((c->flags >> 8 & 0xff) == COMMUNITY_LOCAL_AS)
@@ -227,6 +229,7 @@ print_community(struct community *c)
printf("%s:", log_as(c->data1));
break;
case EXT_COMMUNITY_TRANS_IPV4:
+ case EXT_COMMUNITY_GEN_IPV4:
addr.s_addr = htonl(c->data1);
printf("%s:", inet_ntoa(addr));
break;
@@ -236,6 +239,9 @@ print_community(struct community *c)
case EXT_COMMUNITY_TRANS_TWO_AS:
case EXT_COMMUNITY_TRANS_FOUR_AS:
case EXT_COMMUNITY_TRANS_IPV4:
+ case EXT_COMMUNITY_GEN_TWO_AS:
+ case EXT_COMMUNITY_GEN_FOUR_AS:
+ case EXT_COMMUNITY_GEN_IPV4:
if ((c->flags >> 16 & 0xff) == COMMUNITY_ANY)
printf("* ");
else if ((c->flags >> 16 & 0xff) ==