From bdbe4b397f993f0cc513786f0715f1a4190b2a34 Mon Sep 17 00:00:00 2001 From: Claudio Jeker Date: Tue, 4 Apr 2023 16:01:55 +0000 Subject: Cleanup parse.y a bit. Move global defines a bit down. Move mrtdump and network rules up into the grammar and switch the order of restricted to be more like the rest. OK tb@ --- usr.sbin/bgpd/parse.y | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) (limited to 'usr.sbin') diff --git a/usr.sbin/bgpd/parse.y b/usr.sbin/bgpd/parse.y index b3f17396c32..0836b3e5a19 100644 --- a/usr.sbin/bgpd/parse.y +++ b/usr.sbin/bgpd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.443 2023/04/03 10:48:00 claudio Exp $ */ +/* $OpenBSD: parse.y,v 1.444 2023/04/04 16:01:54 claudio Exp $ */ /* * Copyright (c) 2002, 2003, 2004 Henning Brauer @@ -89,24 +89,6 @@ struct sym { int symset(const char *, const char *, int); char *symget(const char *); -static struct bgpd_config *conf; -static struct network_head *netconf; -static struct peer_head *new_peers, *cur_peers; -static struct rtr_config_head *cur_rtrs; -static struct peer *curpeer; -static struct peer *curgroup; -static struct rde_rib *currib; -static struct l3vpn *curvpn; -static struct prefixset *curpset, *curoset; -static struct roa_tree *curroatree; -static struct rtr_config *currtr; -static struct filter_head *filter_l; -static struct filter_head *peerfilter_l; -static struct filter_head *groupfilter_l; -static struct filter_rule *curpeer_filter[2]; -static struct filter_rule *curgroup_filter[2]; -static int noexpires; - struct filter_rib_l { struct filter_rib_l *next; char name[PEER_DESCR_LEN]; @@ -180,6 +162,24 @@ static struct rtr_config *get_rtr(struct bgpd_addr *); static int insert_rtr(struct rtr_config *); static int merge_aspa_set(uint32_t, struct aspa_tas_l *, time_t); +static struct bgpd_config *conf; +static struct network_head *netconf; +static struct peer_head *new_peers, *cur_peers; +static struct rtr_config_head *cur_rtrs; +static struct peer *curpeer; +static struct peer *curgroup; +static struct rde_rib *currib; +static struct l3vpn *curvpn; +static struct prefixset *curpset, *curoset; +static struct roa_tree *curroatree; +static struct rtr_config *currtr; +static struct filter_head *filter_l; +static struct filter_head *peerfilter_l; +static struct filter_head *groupfilter_l; +static struct filter_rule *curpeer_filter[2]; +static struct filter_rule *curgroup_filter[2]; +static int noexpires; + typedef struct { union { long long number; @@ -278,6 +278,8 @@ grammar : /* empty */ | grammar origin_set '\n' | grammar rtr '\n' | grammar rib '\n' + | grammar network '\n' + | grammar mrtdump '\n' | grammar conf_main '\n' | grammar l3vpn '\n' | grammar neighbor '\n' @@ -807,7 +809,6 @@ conf_main : AS as4number { } free($2); } - | network | DUMP STRING STRING optnumber { int action; @@ -868,7 +869,6 @@ conf_main : AS as4number { free($3); free($5); } - | mrtdump | RDE STRING EVALUATE { if (!strcmp($2, "route-age")) conf->flags |= BGPD_FLAG_DECISION_ROUTEAGE; @@ -1151,8 +1151,8 @@ inout : IN { $$ = 1; } | OUT { $$ = 0; } ; -restricted : RESTRICTED { $$ = 1; } - | /* nothing */ { $$ = 0; } +restricted : /* empty */ { $$ = 0; } + | RESTRICTED { $$ = 1; } ; address : STRING { -- cgit v1.2.3