Index | Thread | Search

From:
Job Snijders <job@bsd.nl>
Subject:
bgpd: shorthand for DOWNGRADE community
To:
tech@openbsd.org
Date:
Thu, 24 Sep 2026 11:17:57 +0000

Download raw body.

Thread
For https://datatracker.ietf.org/doc/html/draft-ietf-grow-downgrade-bgp-community
IANA assigned a new well-known BGP community. For now just provide
shorthand like (just like is done for other WKC).

OK?

Index: bgpctl/bgpctl.c
===================================================================
RCS file: /cvs/src/usr.sbin/bgpctl/bgpctl.c,v
diff -u -p -r1.324 bgpctl.c
--- bgpctl/bgpctl.c	24 Jul 2026 05:01:57 -0000	1.324
+++ bgpctl/bgpctl.c	24 Sep 2026 11:16:49 -0000
@@ -1034,6 +1034,8 @@ fmt_community(uint16_t a, uint16_t v)
 			return "NO_PEER";
 		case COMMUNITY_BLACKHOLE:
 			return "BLACKHOLE";
+		case COMMUNITY_DOWNGRADE:
+			return "DOWNGRADE";
 		default:
 			break;
 		}
Index: bgpctl/parser.c
===================================================================
RCS file: /cvs/src/usr.sbin/bgpctl/parser.c,v
diff -u -p -r1.140 parser.c
--- bgpctl/parser.c	7 May 2026 12:35:03 -0000	1.140
+++ bgpctl/parser.c	24 Sep 2026 11:16:50 -0000
@@ -1216,6 +1216,10 @@ parsecommunity(struct community *c, char
 		setcommunity(c, COMMUNITY_WELLKNOWN,
 		    COMMUNITY_BLACKHOLE, 0, 0);
 		return;
+	} else if (strcasecmp(s, "DOWNGRADE") == 0) {
+		setcommunity(c, COMMUNITY_WELLKNOWN,
+		    COMMUNITY_DOWNGRADE, 0, 0);
+		return;
 	}
 
 	if ((p = strchr(s, ':')) == NULL)
Index: bgpd/bgpd.conf.5
===================================================================
RCS file: /cvs/src/usr.sbin/bgpd/bgpd.conf.5,v
diff -u -p -r1.258 bgpd.conf.5
--- bgpd/bgpd.conf.5	18 Sep 2026 15:46:14 -0000	1.258
+++ bgpd/bgpd.conf.5	24 Sep 2026 11:16:50 -0000
@@ -1808,6 +1808,7 @@ to do wildcard matching.
 Alternatively, well-known communities may be given by name instead and
 include
 .Ic BLACKHOLE ,
+.Ic DOWNGRADE ,
 .Ic GRACEFUL_SHUTDOWN ,
 .Ic NO_EXPORT ,
 .Ic NO_ADVERTISE ,
Index: bgpd/bgpd.h
===================================================================
RCS file: /cvs/src/usr.sbin/bgpd/bgpd.h,v
diff -u -p -r1.548 bgpd.h
--- bgpd/bgpd.h	21 Sep 2026 19:06:16 -0000	1.548
+++ bgpd/bgpd.h	24 Sep 2026 11:16:51 -0000
@@ -1203,9 +1203,10 @@ struct filter_peers {
 #define	COMMUNITY_NEIGHBOR_AS		2
 #define	COMMUNITY_LOCAL_AS		3
 
-/* wellknown community definitions */
+/* well-known community definitions */
 #define	COMMUNITY_WELLKNOWN		0xffff
 #define	COMMUNITY_GRACEFUL_SHUTDOWN	0x0000  /* RFC 8326 */
+#define	COMMUNITY_DOWNGRADE		0x000A	/* draft-grow-downgrade */
 #define	COMMUNITY_BLACKHOLE		0x029A	/* RFC 7999 */
 #define	COMMUNITY_NO_EXPORT		0xff01
 #define	COMMUNITY_NO_ADVERTISE		0xff02
Index: bgpd/parse.y
===================================================================
RCS file: /cvs/src/usr.sbin/bgpd/parse.y,v
diff -u -p -r1.505 parse.y
--- bgpd/parse.y	21 Sep 2026 18:45:09 -0000	1.505
+++ bgpd/parse.y	24 Sep 2026 11:16:53 -0000
@@ -4460,6 +4460,10 @@ parsecommunity(struct community *c, int 
 		setcommunity(c, COMMUNITY_WELLKNOWN,
 		    COMMUNITY_BLACKHOLE, 0, 0);
 		return (0);
+	} else if (strcasecmp(s, "DOWNGRADE") == 0) {
+		setcommunity(c, COMMUNITY_WELLKNOWN,
+		    COMMUNITY_DOWNGRADE, 0, 0);
+		return (0);
 	}
 
 	if ((p = strchr(s, ':')) == NULL) {