On Tue, Apr 04, 2023 at 05:20:21PM +0200, Claudio Jeker wrote:
> Here is a preparation diff that just does some stylistic cleanup in
> parse.y
> 
> This moves the globals a bit down (I want to add a struct define later and
> those are below the current place).
> Move the mrt and network statements to the grammar.
> Swap order of restricted to follow the common idiom of empty rule first.

Looks good to me

ok tb

> 
> -- 
> :wq Claudio
> 
> Index: parse.y
> ===================================================================
> RCS file: /cvs/src/usr.sbin/bgpd/parse.y,v
> retrieving revision 1.443
> diff -u -p -r1.443 parse.y
> --- parse.y   3 Apr 2023 10:48:00 -0000       1.443
> +++ parse.y   4 Apr 2023 15:16:23 -0000
> @@ -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
>  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                {
> 

Reply via email to