From 61794f1ce47302947e3a4e236f664136c5389d24 Mon Sep 17 00:00:00 2001 From: claudio Date: Tue, 22 Feb 2022 17:24:12 +0000 Subject: [PATCH] Convert parse.y to use stdint.h types uintX_t instead of u_intX_t OK tb@ --- usr.sbin/bgpd/parse.y | 64 +++++++++++++++++++++---------------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/usr.sbin/bgpd/parse.y b/usr.sbin/bgpd/parse.y index d41ae03bfe2..1cb823cbc93 100644 --- a/usr.sbin/bgpd/parse.y +++ b/usr.sbin/bgpd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.420 2021/10/15 15:01:27 naddy Exp $ */ +/* $OpenBSD: parse.y,v 1.421 2022/02/22 17:24:12 claudio Exp $ */ /* * Copyright (c) 2002, 2003, 2004 Henning Brauer @@ -161,10 +161,10 @@ int parsecommunity(struct community *, int, char *); int parseextcommunity(struct community *, char *, char *); static int new_as_set(char *); -static void add_as_set(u_int32_t); +static void add_as_set(uint32_t); static void done_as_set(void); static struct prefixset *new_prefix_set(char *, int); -static void add_roa_set(struct prefixset_item *, u_int32_t, u_int8_t, +static void add_roa_set(struct prefixset_item *, uint32_t, uint8_t, time_t); static struct rtr_config *get_rtr(struct bgpd_addr *); static int insert_rtr(struct rtr_config *); @@ -174,7 +174,7 @@ typedef struct { long long number; char *string; struct bgpd_addr addr; - u_int8_t u8; + uint8_t u8; struct filter_rib_l *filter_rib; struct filter_peers_l *filter_peers; struct filter_match_l filter_match; @@ -185,14 +185,14 @@ typedef struct { struct filter_set_head *filter_set_head; struct { struct bgpd_addr prefix; - u_int8_t len; + uint8_t len; } prefix; struct filter_prefixlen prefixlen; struct prefixset_item *prefixset_item; struct { - u_int8_t enc_alg; + uint8_t enc_alg; + uint8_t enc_key_len; char enc_key[IPSEC_ENC_KEY_LEN]; - u_int8_t enc_key_len; } encspec; } v; int lineno; @@ -283,7 +283,7 @@ asnumber : NUMBER { as4number : STRING { const char *errstr; char *dot; - u_int32_t uvalh = 0, uval; + uint32_t uvalh = 0, uval; if ((dot = strchr($1,'.')) != NULL) { *dot++ = '\0'; @@ -315,7 +315,7 @@ as4number : STRING { | asnumber { if ($1 == AS_TRANS || $1 == 0) { yyerror("AS %u is reserved and may not be used", - (u_int32_t)$1); + (uint32_t)$1); YYERROR; } $$ = $1; @@ -325,7 +325,7 @@ as4number : STRING { as4number_any : STRING { const char *errstr; char *dot; - u_int32_t uvalh = 0, uval; + uint32_t uvalh = 0, uval; if ((dot = strchr($1,'.')) != NULL) { *dot++ = '\0'; @@ -1063,7 +1063,7 @@ restricted : RESTRICTED { $$ = 1; } ; address : STRING { - u_int8_t len; + uint8_t len; if (!host($1, &$$, &len)) { yyerror("could not parse address spec \"%s\"", @@ -1439,8 +1439,8 @@ peeropts : REMOTEAS as4number { curpeer->conf.min_holdtime = $3; } | ANNOUNCE family safi { - u_int8_t aid, safi; - u_int16_t afi; + uint8_t aid, safi; + uint16_t afi; if ($3 == SAFI_NONE) { for (aid = 0; aid < AID_MAX; aid++) { @@ -1474,7 +1474,7 @@ peeropts : REMOTEAS as4number { } | ANNOUNCE ADDPATH RECV yesno { int8_t *ap = curpeer->conf.capabilities.add_path; - u_int8_t i; + uint8_t i; for (i = 0; i < AID_MAX; i++) if ($4) @@ -1576,8 +1576,8 @@ peeropts : REMOTEAS as4number { curpeer->conf.auth.method = AUTH_IPSEC_IKE_AH; } | IPSEC espah inout SPI NUMBER STRING STRING encspec { - u_int32_t auth_alg; - u_int8_t keylen; + uint32_t auth_alg; + uint8_t keylen; if (curpeer->conf.auth.method && (((curpeer->conf.auth.spi_in && $3 == 1) || @@ -2743,7 +2743,7 @@ filter_set_opt : LOCALPREF NUMBER { free($2); } | community delete STRING { - u_int8_t f1, f2, f3; + uint8_t f1, f2, f3; if (($$ = calloc(1, sizeof(struct filter_set))) == NULL) fatal(NULL); @@ -3615,7 +3615,7 @@ cmpcommunity(struct community *a, struct community *b) } static int -getcommunity(char *s, int large, u_int32_t *val, u_int32_t *flag) +getcommunity(char *s, int large, uint32_t *val, uint32_t *flag) { long long max = USHRT_MAX; const char *errstr; @@ -3643,8 +3643,8 @@ getcommunity(char *s, int large, u_int32_t *val, u_int32_t *flag) } static void -setcommunity(struct community *c, u_int32_t as, u_int32_t data, - u_int32_t asflag, u_int32_t dataflag) +setcommunity(struct community *c, uint32_t as, uint32_t data, + uint32_t asflag, uint32_t dataflag) { c->flags = COMMUNITY_TYPE_BASIC; c->flags |= asflag << 8; @@ -3658,7 +3658,7 @@ static int parselargecommunity(struct community *c, char *s) { char *p, *q; - u_int32_t dflag1, dflag2, dflag3; + uint32_t dflag1, dflag2, dflag3; if ((p = strchr(s, ':')) == NULL) { yyerror("Bad community syntax"); @@ -3687,7 +3687,7 @@ int parsecommunity(struct community *c, int type, char *s) { char *p; - u_int32_t as, data, asflag, dataflag; + uint32_t as, data, asflag, dataflag; if (type == COMMUNITY_TYPE_LARGE) return parselargecommunity(c, s); @@ -3753,12 +3753,12 @@ parsesubtype(char *name, int *type, int *subtype) } static int -parseextvalue(int type, char *s, u_int32_t *v, u_int32_t *flag) +parseextvalue(int type, char *s, uint32_t *v, uint32_t *flag) { const char *errstr; char *p; struct in_addr ip; - u_int32_t uvalh, uval; + uint32_t uvalh, uval; if (type != -1) { /* nothing */ @@ -3836,8 +3836,8 @@ parseextcommunity(struct community *c, char *t, char *s) { const struct ext_comm_pairs *cp; char *p, *ep; - u_int64_t ullval; - u_int32_t uval, uval2, dflag1 = 0, dflag2 = 0; + uint64_t ullval; + uint32_t uval, uval2, dflag1 = 0, dflag2 = 0; int type = 0, subtype = 0; if (strcmp(t, "*") == 0 && strcmp(s, "*") == 0) { @@ -3950,7 +3950,7 @@ struct peer * alloc_peer(void) { struct peer *p; - u_int8_t i; + uint8_t i; if ((p = calloc(1, sizeof(struct peer))) == NULL) fatal("new_peer"); @@ -4144,7 +4144,7 @@ find_prefixset(char *name, struct prefixset_head *p) int get_id(struct peer *newpeer) { - static u_int32_t id = PEER_ID_STATIC_MIN; + static uint32_t id = PEER_ID_STATIC_MIN; struct peer *p = NULL; /* check if the peer already existed before */ @@ -4187,7 +4187,7 @@ get_id(struct peer *newpeer) int merge_prefixspec(struct filter_prefix *p, struct filter_prefixlen *pl) { - u_int8_t max_len = 0; + uint8_t max_len = 0; switch (p->addr.aid) { case AID_INET: @@ -4632,7 +4632,7 @@ new_as_set(char *name) return -1; } - aset = as_sets_new(&conf->as_sets, name, 0, sizeof(u_int32_t)); + aset = as_sets_new(&conf->as_sets, name, 0, sizeof(uint32_t)); if (aset == NULL) fatal(NULL); @@ -4641,7 +4641,7 @@ new_as_set(char *name) } static void -add_as_set(u_int32_t as) +add_as_set(uint32_t as) { if (curset == NULL) fatalx("%s: bad mojo jojo", __func__); @@ -4687,7 +4687,7 @@ new_prefix_set(char *name, int is_roa) } static void -add_roa_set(struct prefixset_item *npsi, u_int32_t as, u_int8_t max, +add_roa_set(struct prefixset_item *npsi, uint32_t as, uint8_t max, time_t expires) { struct roa *roa, *r; -- 2.20.1