summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorphessler <phessler@openbsd.org>2017-06-26 10:05:57 +0000
committerphessler <phessler@openbsd.org>2017-06-26 10:05:57 +0000
commit1540651089022fc021f3c66076e0a458f3d94ccd (patch)
tree25505bbd70fb1976ca9b96ecd9781d5c6aab5ad6
parentallow setting localpref to 0 (diff)
downloadwireguard-openbsd-1540651089022fc021f3c66076e0a458f3d94ccd.tar.xz
wireguard-openbsd-1540651089022fc021f3c66076e0a458f3d94ccd.zip
add support for the "graceful shutdown" well-known community as described
in draft-ietf-grow-bgp-gshut from Job Snijders ok phessler@ benno@
-rw-r--r--usr.sbin/bgpctl/bgpctl.c5
-rw-r--r--usr.sbin/bgpctl/parser.c9
-rw-r--r--usr.sbin/bgpd/bgpd.conf.56
-rw-r--r--usr.sbin/bgpd/bgpd.h3
-rw-r--r--usr.sbin/bgpd/parse.y8
5 files changed, 23 insertions, 8 deletions
diff --git a/usr.sbin/bgpctl/bgpctl.c b/usr.sbin/bgpctl/bgpctl.c
index 4d9701da35b..55a5312e8f9 100644
--- a/usr.sbin/bgpctl/bgpctl.c
+++ b/usr.sbin/bgpctl/bgpctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bgpctl.c,v 1.195 2017/05/31 10:48:06 claudio Exp $ */
+/* $OpenBSD: bgpctl.c,v 1.196 2017/06/26 10:05:57 phessler Exp $ */
/*
* Copyright (c) 2003 Henning Brauer <henning@openbsd.org>
@@ -1532,6 +1532,9 @@ show_community(u_char *data, u_int16_t len)
v = ntohs(v);
if (a == COMMUNITY_WELLKNOWN)
switch (v) {
+ case COMMUNITY_GRACEFUL_SHUTDOWN:
+ printf("GRACEFUL_SHUTDOWN");
+ break;
case COMMUNITY_NO_EXPORT:
printf("NO_EXPORT");
break;
diff --git a/usr.sbin/bgpctl/parser.c b/usr.sbin/bgpctl/parser.c
index 85300d1cd32..1020afeb6ff 100644
--- a/usr.sbin/bgpctl/parser.c
+++ b/usr.sbin/bgpctl/parser.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: parser.c,v 1.77 2017/02/14 13:13:23 benno Exp $ */
+/* $OpenBSD: parser.c,v 1.78 2017/06/26 10:05:57 phessler Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -950,7 +950,11 @@ parse_community(const char *word, struct parse_result *r)
int as, type;
/* Well-known communities */
- if (strcasecmp(word, "NO_EXPORT") == 0) {
+ if (strcasecmp(word, "GRACEFUL_SHUTDOWN") == 0) {
+ as = COMMUNITY_WELLKNOWN;
+ type = COMMUNITY_GRACEFUL_SHUTDOWN;
+ goto done;
+ } else if (strcasecmp(word, "NO_EXPORT") == 0) {
as = COMMUNITY_WELLKNOWN;
type = COMMUNITY_NO_EXPORT;
goto done;
@@ -988,6 +992,7 @@ done:
}
if (as == COMMUNITY_WELLKNOWN)
switch (type) {
+ case COMMUNITY_GRACEFUL_SHUTDOWN:
case COMMUNITY_NO_EXPORT:
case COMMUNITY_NO_ADVERTISE:
case COMMUNITY_NO_EXPSUBCONFED:
diff --git a/usr.sbin/bgpd/bgpd.conf.5 b/usr.sbin/bgpd/bgpd.conf.5
index 6cecd7a5a80..d7945b810c3 100644
--- a/usr.sbin/bgpd/bgpd.conf.5
+++ b/usr.sbin/bgpd/bgpd.conf.5
@@ -1,4 +1,4 @@
-.\" $OpenBSD: bgpd.conf.5,v 1.160 2017/05/31 10:49:10 claudio Exp $
+.\" $OpenBSD: bgpd.conf.5,v 1.161 2017/06/26 10:05:57 phessler Exp $
.\"
.\" Copyright (c) 2004 Claudio Jeker <claudio@openbsd.org>
.\" Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -16,7 +16,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: May 31 2017 $
+.Dd $Mdocdate: June 26 2017 $
.Dt BGPD.CONF 5
.Os
.Sh NAME
@@ -1173,6 +1173,7 @@ to do wildcard matching.
Alternatively, well-known communities may be given by name instead and
include
.Ic BLACKHOLE ,
+.Ic GRACEFUL_SHUTDOWN ,
.Ic NO_EXPORT ,
.Ic NO_ADVERTISE ,
.Ic NO_EXPORT_SUBCONFED ,
@@ -1444,6 +1445,7 @@ is an AS number and
is a locally-significant number between zero and
.Li 65535 .
Alternately, well-known communities may be specified by name:
+.Ic GRACEFUL_SHUTDOWN ,
.Ic NO_EXPORT ,
.Ic NO_ADVERTISE ,
.Ic NO_EXPORT_SUBCONFED ,
diff --git a/usr.sbin/bgpd/bgpd.h b/usr.sbin/bgpd/bgpd.h
index db52f858241..ed248775699 100644
--- a/usr.sbin/bgpd/bgpd.h
+++ b/usr.sbin/bgpd/bgpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: bgpd.h,v 1.308 2017/05/31 10:44:00 claudio Exp $ */
+/* $OpenBSD: bgpd.h,v 1.309 2017/06/26 10:05:57 phessler Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -750,6 +750,7 @@ struct filter_peers {
#define COMMUNITY_LOCAL_AS -4
#define COMMUNITY_UNSET -5
#define COMMUNITY_WELLKNOWN 0xffff
+#define COMMUNITY_GRACEFUL_SHUTDOWN 0x0000 /* draft-ietf-grow-bgp-gshut */
#define COMMUNITY_BLACKHOLE 0x029A /* RFC 7999 */
#define COMMUNITY_NO_EXPORT 0xff01
#define COMMUNITY_NO_ADVERTISE 0xff02
diff --git a/usr.sbin/bgpd/parse.y b/usr.sbin/bgpd/parse.y
index ce06f4d7d0d..606f84603d5 100644
--- a/usr.sbin/bgpd/parse.y
+++ b/usr.sbin/bgpd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.310 2017/06/26 10:04:21 phessler Exp $ */
+/* $OpenBSD: parse.y,v 1.311 2017/06/26 10:05:57 phessler Exp $ */
/*
* Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -2989,7 +2989,11 @@ parsecommunity(struct filter_community *c, char *s)
int i, as;
/* Well-known communities */
- if (strcasecmp(s, "NO_EXPORT") == 0) {
+ if (strcasecmp(s, "GRACEFUL_SHUTDOWN") == 0) {
+ c->as = COMMUNITY_WELLKNOWN;
+ c->type = COMMUNITY_GRACEFUL_SHUTDOWN;
+ return (0);
+ } else if (strcasecmp(s, "NO_EXPORT") == 0) {
c->as = COMMUNITY_WELLKNOWN;
c->type = COMMUNITY_NO_EXPORT;
return (0);