From 17c84f898bdea754017bd02b035ce810ea94261c Mon Sep 17 00:00:00 2001 From: sthen Date: Sun, 11 Oct 2015 19:53:57 +0000 Subject: [PATCH] Handle the blackhole well-known community in bgpctl as well (print it symbolically, and don't deny its use in 'bgpctl sh rib comm 65535:6666'). ok phessler@ --- usr.sbin/bgpctl/bgpctl.c | 5 ++++- usr.sbin/bgpctl/parser.c | 7 ++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/usr.sbin/bgpctl/bgpctl.c b/usr.sbin/bgpctl/bgpctl.c index 233e9d94e9e..ea3c5c29f22 100644 --- a/usr.sbin/bgpctl/bgpctl.c +++ b/usr.sbin/bgpctl/bgpctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bgpctl.c,v 1.182 2015/09/16 20:25:41 stsp Exp $ */ +/* $OpenBSD: bgpctl.c,v 1.183 2015/10/11 19:53:57 sthen Exp $ */ /* * Copyright (c) 2003 Henning Brauer @@ -1466,6 +1466,9 @@ show_community(u_char *data, u_int16_t len) case COMMUNITY_NO_PEER: printf("NO_PEER"); break; + case COMMUNITY_BLACKHOLE: + printf("BLACKHOLE"); + break; default: printf("WELLKNOWN:%hu", v); break; diff --git a/usr.sbin/bgpctl/parser.c b/usr.sbin/bgpctl/parser.c index 7c51df92f32..72ddca08b36 100644 --- a/usr.sbin/bgpctl/parser.c +++ b/usr.sbin/bgpctl/parser.c @@ -1,4 +1,4 @@ -/* $OpenBSD: parser.c,v 1.72 2015/10/11 19:21:44 phessler Exp $ */ +/* $OpenBSD: parser.c,v 1.73 2015/10/11 19:53:57 sthen Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer @@ -914,6 +914,10 @@ parse_community(const char *word, struct parse_result *r) as = COMMUNITY_WELLKNOWN; type = COMMUNITY_NO_PEER; goto done; + } else if (strcasecmp(word, "BLACKHOLE") == 0) { + as = COMMUNITY_WELLKNOWN; + type = COMMUNITY_BLACKHOLE; + goto done; } if ((p = strchr(word, ':')) == NULL) { @@ -935,6 +939,7 @@ done: case COMMUNITY_NO_EXPORT: case COMMUNITY_NO_ADVERTISE: case COMMUNITY_NO_EXPSUBCONFED: + case COMMUNITY_BLACKHOLE: /* valid */ break; default: -- 2.20.1