summaryrefslogtreecommitdiffstats
path: root/usr.sbin/bgpctl/parser.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/bgpctl/parser.c')
-rw-r--r--usr.sbin/bgpctl/parser.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/usr.sbin/bgpctl/parser.c b/usr.sbin/bgpctl/parser.c
index 4b65785a0a6..f93881d2cee 100644
--- a/usr.sbin/bgpctl/parser.c
+++ b/usr.sbin/bgpctl/parser.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: parser.c,v 1.74 2016/10/14 16:05:35 phessler Exp $ */
+/* $OpenBSD: parser.c,v 1.75 2017/01/13 18:59:12 phessler Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -45,6 +45,7 @@ enum token_type {
PREFIX,
PEERDESC,
RIBNAME,
+ SHUTDOWN_COMMUNICATION,
COMMUNITY,
LARGE_COMMUNITY,
LOCALPREF,
@@ -245,9 +246,15 @@ static const struct token t_neighbor[] = {
{ ENDTOKEN, "", NONE, NULL}
};
+static const struct token t_nei_mod_shutc[] = {
+ { NOTOKEN, "", NONE, NULL},
+ { SHUTDOWN_COMMUNICATION, "", NONE, NULL},
+ { ENDTOKEN, "", NONE, NULL}
+};
+
static const struct token t_neighbor_modifiers[] = {
{ KEYWORD, "up", NEIGHBOR_UP, NULL},
- { KEYWORD, "down", NEIGHBOR_DOWN, NULL},
+ { KEYWORD, "down", NEIGHBOR_DOWN, t_nei_mod_shutc},
{ KEYWORD, "clear", NEIGHBOR_CLEAR, NULL},
{ KEYWORD, "refresh", NEIGHBOR_RREFRESH, NULL},
{ KEYWORD, "destroy", NEIGHBOR_DESTROY, NULL},
@@ -571,6 +578,16 @@ match_token(int *argc, char **argv[], const struct token table[])
t = &table[i];
}
break;
+ case SHUTDOWN_COMMUNICATION:
+ if (!match && word != NULL && wordlen > 0) {
+ if (strlcpy(res.shutcomm, word,
+ sizeof(res.shutcomm)) >=
+ sizeof(res.shutcomm))
+ errx(1, "shutdown reason too long");
+ match++;
+ t = &table[i];
+ }
+ break;
case COMMUNITY:
if (word != NULL && wordlen > 0 &&
parse_community(word, &res)) {
@@ -694,6 +711,9 @@ show_valid_args(const struct token table[])
case RIBNAME:
fprintf(stderr, " <rib name>\n");
break;
+ case SHUTDOWN_COMMUNICATION:
+ fprintf(stderr, " <shutdown reason>\n");
+ break;
case COMMUNITY:
fprintf(stderr, " <community>\n");
break;