From 474301a1d22042cc5a8ca6d7bf7e61325d48c8dc Mon Sep 17 00:00:00 2001 From: claudio Date: Mon, 7 Feb 2022 09:31:21 +0000 Subject: [PATCH] Switch to stdint.h types like rest of bgpd --- .../bgpd/unittests/rde_community_test.c | 12 +++++----- .../usr.sbin/bgpd/unittests/rde_decide_test.c | 12 +++++----- .../usr.sbin/bgpd/unittests/rde_sets_test.c | 12 +++++----- .../usr.sbin/bgpd/unittests/rde_trie_test.c | 22 +++++++++---------- 4 files changed, 29 insertions(+), 29 deletions(-) diff --git a/regress/usr.sbin/bgpd/unittests/rde_community_test.c b/regress/usr.sbin/bgpd/unittests/rde_community_test.c index f81974342ca..4c85c80c15c 100644 --- a/regress/usr.sbin/bgpd/unittests/rde_community_test.c +++ b/regress/usr.sbin/bgpd/unittests/rde_community_test.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde_community_test.c,v 1.2 2019/07/04 10:20:59 claudio Exp $ */ +/* $OpenBSD: rde_community_test.c,v 1.3 2022/02/07 09:31:21 claudio Exp $ */ /* * Copyright (c) 2019 Claudio Jeker @@ -196,11 +196,11 @@ log_warnx(const char *emsg, ...) } int -attr_write(void *p, u_int16_t p_len, u_int8_t flags, u_int8_t type, - void *data, u_int16_t data_len) +attr_write(void *p, uint16_t p_len, uint8_t flags, uint8_t type, + void *data, uint16_t data_len) { u_char *b = p; - u_int16_t tmp, tot_len = 2; /* attribute header (without len) */ + uint16_t tmp, tot_len = 2; /* attribute header (without len) */ flags &= ~ATTR_DEFMASK; if (data_len > 255) { @@ -232,8 +232,8 @@ attr_write(void *p, u_int16_t p_len, u_int8_t flags, u_int8_t type, } int -attr_writebuf(struct ibuf *buf, u_int8_t flags, u_int8_t type, void *data, - u_int16_t data_len) +attr_writebuf(struct ibuf *buf, uint8_t flags, uint8_t type, void *data, + uint16_t data_len) { return (-1); } diff --git a/regress/usr.sbin/bgpd/unittests/rde_decide_test.c b/regress/usr.sbin/bgpd/unittests/rde_decide_test.c index 5e1b13e1c8a..e437eb4fffa 100644 --- a/regress/usr.sbin/bgpd/unittests/rde_decide_test.c +++ b/regress/usr.sbin/bgpd/unittests/rde_decide_test.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde_decide_test.c,v 1.6 2021/08/31 10:54:40 claudio Exp $ */ +/* $OpenBSD: rde_decide_test.c,v 1.7 2022/02/07 09:31:21 claudio Exp $ */ /* * Copyright (c) 2020 Claudio Jeker @@ -71,11 +71,11 @@ union a { struct aspath a; struct { LIST_ENTRY(aspath) entry; - u_int32_t source_as; + uint32_t source_as; int refcnt; uint16_t len; uint16_t ascnt; - uint8_t d[6]; + uint8_t d[6]; } x; } asdata[] = { { .x = { .len = 6, .ascnt = 2, .d = { 2, 1, 0, 0, 0, 1 } } }, @@ -338,7 +338,7 @@ rde_decisionflags(void) /* * Helper functions need to link and run the tests. */ -u_int32_t +uint32_t rde_local_as(void) { return 65000; @@ -351,13 +351,13 @@ rde_evaluate_all(void) } int -as_set_match(const struct as_set *aset, u_int32_t asnum) +as_set_match(const struct as_set *aset, uint32_t asnum) { errx(1, __func__); } struct rib * -rib_byid(u_int16_t id) +rib_byid(uint16_t id) { return &dummy_rib; } diff --git a/regress/usr.sbin/bgpd/unittests/rde_sets_test.c b/regress/usr.sbin/bgpd/unittests/rde_sets_test.c index 0216273a3e9..48712fc3991 100644 --- a/regress/usr.sbin/bgpd/unittests/rde_sets_test.c +++ b/regress/usr.sbin/bgpd/unittests/rde_sets_test.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde_sets_test.c,v 1.7 2019/12/17 11:57:16 claudio Exp $ */ +/* $OpenBSD: rde_sets_test.c,v 1.8 2022/02/07 09:31:21 claudio Exp $ */ /* * Copyright (c) 2018 Claudio Jeker @@ -26,15 +26,15 @@ struct rde_memstats rdemem; -u_int32_t va[] = { 19, 14, 32, 76, 125 }; -u_int32_t vaa[] = { 125, 14, 76, 32, 19 }; -u_int32_t vb[] = { 256, 1024, 512, 4096, 2048, 512 }; -u_int32_t vc[] = { 42 }; +uint32_t va[] = { 19, 14, 32, 76, 125 }; +uint32_t vaa[] = { 125, 14, 76, 32, 19 }; +uint32_t vb[] = { 256, 1024, 512, 4096, 2048, 512 }; +uint32_t vc[] = { 42 }; struct as_set_head as_sets; static struct as_set * -build_set(const char *name, u_int32_t *mem, size_t nmemb, size_t initial) +build_set(const char *name, uint32_t *mem, size_t nmemb, size_t initial) { struct as_set *a; diff --git a/regress/usr.sbin/bgpd/unittests/rde_trie_test.c b/regress/usr.sbin/bgpd/unittests/rde_trie_test.c index de47bbdcef8..7ace072167c 100644 --- a/regress/usr.sbin/bgpd/unittests/rde_trie_test.c +++ b/regress/usr.sbin/bgpd/unittests/rde_trie_test.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde_trie_test.c,v 1.12 2020/12/29 15:35:57 claudio Exp $ */ +/* $OpenBSD: rde_trie_test.c,v 1.13 2022/02/07 09:31:21 claudio Exp $ */ /* * Copyright (c) 2018 Claudio Jeker @@ -37,7 +37,7 @@ int roa; int orlonger; int -host_ip(const char *s, struct bgpd_addr *h, u_int8_t *len) +host_ip(const char *s, struct bgpd_addr *h, uint8_t *len) { struct addrinfo hints, *res; int bits; @@ -61,7 +61,7 @@ host_ip(const char *s, struct bgpd_addr *h, u_int8_t *len) } int -host(const char *s, struct bgpd_addr *h, u_int8_t *len) +host(const char *s, struct bgpd_addr *h, uint8_t *len) { int mask = 128; char *p, *ps; @@ -117,11 +117,11 @@ parse_file(FILE *in, struct trie_head *th) const char *errstr; char *line, *s; struct bgpd_addr prefix; - u_int8_t plen; + uint8_t plen; while ((line = fparseln(in, NULL, NULL, NULL, FPARSELN_UNESCALL))) { int state = 0; - u_int8_t min = 255, max = 255, maskmax = 0; + uint8_t min = 255, max = 255, maskmax = 0; while ((s = strsep(&line, " \t\n"))) { if (*s == '\0') @@ -174,12 +174,12 @@ parse_roa_file(FILE *in, struct trie_head *th) struct set_table *set = NULL; struct roa roa; struct bgpd_addr prefix; - u_int8_t plen; + uint8_t plen; while ((line = fparseln(in, NULL, NULL, NULL, FPARSELN_UNESCALL))) { int state = 0; - u_int32_t as; - u_int8_t max = 0; + uint32_t as; + uint8_t max = 0; while ((s = strsep(&line, " \t\n"))) { if (*s == '\0') @@ -236,7 +236,7 @@ test_file(FILE *in, struct trie_head *th) { char *line; struct bgpd_addr prefix; - u_int8_t plen; + uint8_t plen; while ((line = fparseln(in, NULL, NULL, NULL, FPARSELN_UNESCALL))) { if (!host(line, &prefix, &plen)) @@ -257,8 +257,8 @@ test_roa_file(FILE *in, struct trie_head *th) const char *errstr; char *line, *s; struct bgpd_addr prefix; - u_int8_t plen; - u_int32_t as; + uint8_t plen; + uint32_t as; int r; while ((line = fparseln(in, NULL, NULL, NULL, FPARSELN_UNESCALL))) { -- 2.20.1