From 325664f108941af9737ec5fc9df0589f0643a466 Mon Sep 17 00:00:00 2001 From: claudio Date: Wed, 12 Apr 2023 17:19:16 +0000 Subject: [PATCH] bgpctl network bulk requires now the specification of 'add' or 'delete'. In the add case the extra attributes can be specified afterwards. This makes the parser behave cleaner since 'add' and 'delete' are removed from the attribute set table. OK tb@ --- usr.sbin/bgpctl/bgpctl.8 | 14 +++----------- usr.sbin/bgpctl/parser.c | 13 +++++++++---- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/usr.sbin/bgpctl/bgpctl.8 b/usr.sbin/bgpctl/bgpctl.8 index ed570515f07..cbe3792113d 100644 --- a/usr.sbin/bgpctl/bgpctl.8 +++ b/usr.sbin/bgpctl/bgpctl.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: bgpctl.8,v 1.106 2023/03/13 16:59:22 claudio Exp $ +.\" $OpenBSD: bgpctl.8,v 1.107 2023/04/12 17:19:16 claudio Exp $ .\" .\" Copyright (c) 2003 Henning Brauer .\" @@ -14,7 +14,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: March 13 2023 $ +.Dd $Mdocdate: April 12 2023 $ .Dt BGPCTL 8 .Os .Sh NAME @@ -133,20 +133,12 @@ It is possible to set various path attributes with additional arguments. Adding a prefix will replace an existing equal prefix, including prefixes loaded from the configuration. .It Xo -.Cm network bulk +.Cm network bulk add .Op Ar argument ... -.Op Cm add .Xc Bulk add specified prefixes to the list of announced networks. Prefixes should be sent via stdin. It is possible to set various path attributes with additional arguments. -If neither -.Cm add -or -.Cm delete -is given, -.Cm add -is the default. .It Cm network bulk delete Bulk remove the specified prefixes from the list of announced networks. Prefixes should be sent via stdin. diff --git a/usr.sbin/bgpctl/parser.c b/usr.sbin/bgpctl/parser.c index 65aac80f00e..efc3ac40a4e 100644 --- a/usr.sbin/bgpctl/parser.c +++ b/usr.sbin/bgpctl/parser.c @@ -1,4 +1,4 @@ -/* $OpenBSD: parser.c,v 1.122 2023/03/13 16:59:22 claudio Exp $ */ +/* $OpenBSD: parser.c,v 1.123 2023/04/12 17:19:16 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer @@ -98,6 +98,7 @@ static const struct token t_show_extcommunity[]; static const struct token t_show_ext_subtype[]; static const struct token t_show_largecommunity[]; static const struct token t_network[]; +static const struct token t_bulk[]; static const struct token t_network_show[]; static const struct token t_prefix[]; static const struct token t_set[]; @@ -371,10 +372,16 @@ static const struct token t_network[] = { { KEYWORD, "flush", NETWORK_FLUSH, NULL}, { KEYWORD, "show", NETWORK_SHOW, t_network_show}, { KEYWORD, "mrt", NETWORK_MRT, t_show_mrt}, - { KEYWORD, "bulk", NETWORK_BULK_ADD, t_set}, + { KEYWORD, "bulk", NONE, t_bulk}, { ENDTOKEN, "", NONE, NULL} }; +static const struct token t_bulk[] = { + { KEYWORD, "add", NETWORK_BULK_ADD, t_set}, + { KEYWORD, "delete", NETWORK_BULK_REMOVE, NULL}, + { ENDTOKEN, "", NONE, NULL} +}; + static const struct token t_prefix[] = { { PREFIX, "", NONE, t_set}, { ENDTOKEN, "", NONE, NULL} @@ -405,8 +412,6 @@ static const struct token t_set[] = { { KEYWORD, "prepend-self", NONE, t_prepself}, { KEYWORD, "rd", NONE, t_rd}, { KEYWORD, "weight", NONE, t_weight}, - { KEYWORD, "add", NETWORK_BULK_ADD, NULL}, - { KEYWORD, "delete", NETWORK_BULK_REMOVE, NULL}, { ENDTOKEN, "", NONE, NULL} }; -- 2.20.1