diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2019-01-20 23:30:16 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2019-01-20 23:30:16 +0000 |
commit | c3b184c88a7ace5328f8e02108a5eb66e5b77501 (patch) | |
tree | b55e212c2c2bf564038cd6a43c557ce49063b8af /usr.sbin/bgpctl/parser.c | |
parent | ccb85b4c8b85eccd56fc477802112d1153469938 (diff) |
Allow 'neighbor descripton' to be used like neighbor group description
which will match all neighbors in that group. Works for
bgpctl neighbor group <name> [clear|destroy|down|refresh|up]
bgpctl show neighbor group <name> [messages|terse|timers]
bgpctl show rib neighbor group <name> ...
Manpage bits from sthen@
OK benno@ sthen@
Diffstat (limited to 'usr.sbin/bgpctl/parser.c')
-rw-r--r-- | usr.sbin/bgpctl/parser.c | 39 |
1 files changed, 31 insertions, 8 deletions
diff --git a/usr.sbin/bgpctl/parser.c b/usr.sbin/bgpctl/parser.c index 211ac8772ba..44d73d41fb5 100644 --- a/usr.sbin/bgpctl/parser.c +++ b/usr.sbin/bgpctl/parser.c @@ -1,4 +1,4 @@ -/* $OpenBSD: parser.c,v 1.88 2018/12/19 15:27:29 claudio Exp $ */ +/* $OpenBSD: parser.c,v 1.89 2019/01/20 23:30:15 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -44,6 +44,7 @@ enum token_type { ASTYPE, PREFIX, PEERDESC, + GROUPDESC, RIBNAME, SHUTDOWN_COMMUNICATION, COMMUNITY, @@ -220,7 +221,13 @@ static const struct token t_show_mrt_file[] = { { ENDTOKEN, "", NONE, NULL} }; +static const struct token t_show_rib_neigh_group[] = { + { GROUPDESC, "", NONE, t_show_rib}, + { ENDTOKEN, "", NONE, NULL} +}; + static const struct token t_show_rib_neigh[] = { + { KEYWORD, "group", NONE, t_show_rib_neigh_group}, { PEERADDRESS, "", NONE, t_show_rib}, { PEERDESC, "", NONE, t_show_rib}, { ENDTOKEN, "", NONE, NULL} @@ -236,13 +243,6 @@ static const struct token t_show_rib_rib[] = { { ENDTOKEN, "", NONE, NULL} }; -static const struct token t_show_neighbor[] = { - { NOTOKEN, "", NONE, NULL}, - { PEERADDRESS, "", NONE, t_show_neighbor_modifiers}, - { PEERDESC, "", NONE, t_show_neighbor_modifiers}, - { ENDTOKEN, "", NONE, NULL} -}; - static const struct token t_show_neighbor_modifiers[] = { { NOTOKEN, "", NONE, NULL}, { KEYWORD, "timers", SHOW_NEIGHBOR_TIMERS, NULL}, @@ -251,6 +251,19 @@ static const struct token t_show_neighbor_modifiers[] = { { ENDTOKEN, "", NONE, NULL} }; +static const struct token t_show_neighbor_group[] = { + { GROUPDESC, "", NONE, t_show_neighbor_modifiers}, + { ENDTOKEN, "", NONE, NULL} +}; + +static const struct token t_show_neighbor[] = { + { NOTOKEN, "", NONE, NULL}, + { KEYWORD, "group", NONE, t_show_neighbor_group}, + { PEERADDRESS, "", NONE, t_show_neighbor_modifiers}, + { PEERDESC, "", NONE, t_show_neighbor_modifiers}, + { ENDTOKEN, "", NONE, NULL} +}; + static const struct token t_fib[] = { { KEYWORD, "couple", FIB_COUPLE, NULL}, { KEYWORD, "decouple", FIB_DECOUPLE, NULL}, @@ -258,7 +271,13 @@ static const struct token t_fib[] = { { ENDTOKEN, "", NONE, NULL} }; +static const struct token t_neighbor_group[] = { + { GROUPDESC, "", NONE, t_neighbor_modifiers}, + { ENDTOKEN, "", NONE, NULL} +}; + static const struct token t_neighbor[] = { + { KEYWORD, "group", NONE, t_neighbor_group}, { PEERADDRESS, "", NONE, t_neighbor_modifiers}, { PEERDESC, "", NONE, t_neighbor_modifiers}, { ENDTOKEN, "", NONE, NULL} @@ -622,6 +641,9 @@ match_token(int *argc, char **argv[], const struct token table[]) t = &table[i]; } break; + case GROUPDESC: + res.is_group = 1; + /* FALLTHROUGH */ case PEERDESC: if (!match && word != NULL && wordlen > 0) { if (strlcpy(res.peerdesc, word, @@ -788,6 +810,7 @@ show_valid_args(const struct token table[]) case ASNUM: fprintf(stderr, " <asnum>\n"); break; + case GROUPDESC: case PEERDESC: fprintf(stderr, " <neighbor description>\n"); break; |