Re: bgpd convert parse.y to uintXY_t

2022-02-22 Thread Theo Buehler
On Tue, Feb 22, 2022 at 06:00:34PM +0100, Claudio Jeker wrote:
> In the big conversion I forgot to include parse.y in the files.
> This diff fixes that.

Seems your sed missed a 'g' after the pattern :)

I believe all the variables you missed are visible below (mentioned
inline), with those fixed

ok tb

> 
> -- 
> :wq Claudio
> 
> Index: parse.y
> ===
> RCS file: /cvs/src/usr.sbin/bgpd/parse.y,v
> retrieving revision 1.420
> diff -u -p -r1.420 parse.y
> --- parse.y   15 Oct 2021 15:01:27 -  1.420
> +++ parse.y   22 Feb 2022 16:57:03 -
> @@ -161,10 +161,10 @@ int  parsecommunity(struct community *,
>  int   parseextcommunity(struct community *, char *,
>   char *);
>  static intnew_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 intinsert_rtr(struct rtr_config *);
> @@ -174,7 +174,7 @@ typedef struct {
>   long longnumber;
>   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_lfilter_match;
> @@ -185,14 +185,14 @@ typedef struct {
>   struct filter_set_head  *filter_set_head;
>   struct {
>   struct bgpd_addrprefix;
> - u_int8_tlen;
> + uint8_t len;
>   }   prefix;
>   struct filter_prefixlen prefixlen;
>   struct prefixset_item   *prefixset_item;
>   struct {
> - u_int8_tenc_alg;
> + uint8_t enc_alg;
> + uint8_t enc_key_len;
>   charenc_key[IPSEC_ENC_KEY_LEN];
> - u_int8_tenc_key_len;
>   }   encspec;
>   } v;
>   int lineno;
> @@ -283,7 +283,7 @@ asnumber  : NUMBER{
>  as4number: STRING{
>   const char  *errstr;
>   char*dot;
> - u_int32_tuvalh = 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_tuvalh = 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_tlen;
> + uint8_t len;
>  
>   if (!host($1, &$$, )) {
>   yyerror("could not parse address spec \"%s\"",
> @@ -1439,8 +1439,8 @@ peeropts: REMOTEAS as4number{
>   curpeer->conf.min_holdtime = $3;
>   }
>   | ANNOUNCE family safi {
> - u_int8_taid, safi;
> - u_int16_t   afi;
> + uint8_t aid, safi;
> + uint16_tafi;
>  
>   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 

bgpd convert parse.y to uintXY_t

2022-02-22 Thread Claudio Jeker
In the big conversion I forgot to include parse.y in the files.
This diff fixes that.

-- 
:wq Claudio

Index: parse.y
===
RCS file: /cvs/src/usr.sbin/bgpd/parse.y,v
retrieving revision 1.420
diff -u -p -r1.420 parse.y
--- parse.y 15 Oct 2021 15:01:27 -  1.420
+++ parse.y 22 Feb 2022 16:57:03 -
@@ -161,10 +161,10 @@ intparsecommunity(struct community *,
 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 longnumber;
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_lfilter_match;
@@ -185,14 +185,14 @@ typedef struct {
struct filter_set_head  *filter_set_head;
struct {
struct bgpd_addrprefix;
-   u_int8_tlen;
+   uint8_t len;
}   prefix;
struct filter_prefixlen prefixlen;
struct prefixset_item   *prefixset_item;
struct {
-   u_int8_tenc_alg;
+   uint8_t enc_alg;
+   uint8_t enc_key_len;
charenc_key[IPSEC_ENC_KEY_LEN];
-   u_int8_tenc_key_len;
}   encspec;
} v;
int lineno;
@@ -283,7 +283,7 @@ asnumber: NUMBER{
 as4number  : STRING{
const char  *errstr;
char*dot;
-   u_int32_tuvalh = 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_tuvalh = 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_tlen;
+   uint8_t len;
 
if (!host($1, &$$, )) {
yyerror("could not parse address spec \"%s\"",
@@ -1439,8 +1439,8 @@ peeropts  : REMOTEAS as4number{
curpeer->conf.min_holdtime = $3;
}
| ANNOUNCE family safi {
-   u_int8_taid, safi;
-   u_int16_t   afi;
+   uint8_t aid, safi;
+   uint16_tafi;
 
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;