summaryrefslogtreecommitdiffstats
path: root/vrrpd
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@diac24.net>2020-03-27 12:51:47 +0100
committerDavid Lamparter <equinox@diac24.net>2020-07-14 10:43:40 +0200
commit6cde4b45528e52819c803de92d10d4be3abddf29 (patch)
tree745ba8e073b939160c79a55b36d538100811d660 /vrrpd
parent*: un-split strings across lines (diff)
downloadfrr-6cde4b45528e52819c803de92d10d4be3abddf29.tar.xz
frr-6cde4b45528e52819c803de92d10d4be3abddf29.zip
*: remove PRI[udx](8|16|32)
These are completely pointless and break coccinelle string replacements. Scripted commit, idempotent to running: ``` python3 tools/stringmangle.py --pri8-16-32 `git ls-files | egrep '\.[ch]$'` ``` Signed-off-by: David Lamparter <equinox@diac24.net>
Diffstat (limited to 'vrrpd')
-rw-r--r--vrrpd/vrrp.c24
-rw-r--r--vrrpd/vrrp_northbound.c2
-rw-r--r--vrrpd/vrrp_packet.c15
-rw-r--r--vrrpd/vrrp_vty.c28
4 files changed, 31 insertions, 38 deletions
diff --git a/vrrpd/vrrp.c b/vrrpd/vrrp.c
index 3ef9fd90a..3e79cff39 100644
--- a/vrrpd/vrrp.c
+++ b/vrrpd/vrrp.c
@@ -867,8 +867,7 @@ static int vrrp_recv_advertisement(struct vrrp_router *r, struct ipaddr *src,
if (pkt->hdr.vrid != r->vr->vrid) {
DEBUGD(&vrrp_dbg_proto,
VRRP_LOGPFX VRRP_LOGPFX_VRID VRRP_LOGPFX_FAM
- "Datagram invalid: Advertisement contains VRID %" PRIu8
- " which does not match our instance",
+ "Datagram invalid: Advertisement contains VRID %hhu which does not match our instance",
r->vr->vrid, family2str(r->family), pkt->hdr.vrid);
return -1;
}
@@ -888,8 +887,7 @@ static int vrrp_recv_advertisement(struct vrrp_router *r, struct ipaddr *src,
if (r->vr->version == 2 && !adveq) {
DEBUGD(&vrrp_dbg_proto,
VRRP_LOGPFX VRRP_LOGPFX_VRID VRRP_LOGPFX_FAM
- "Datagram invalid: Received advertisement with advertisement interval %" PRIu8
- " unequal to our configured value %u",
+ "Datagram invalid: Received advertisement with advertisement interval %hhu unequal to our configured value %u",
r->vr->vrid, family2str(r->family),
pkt->hdr.v2.adver_int,
MAX(r->vr->advertisement_interval / 100, 1));
@@ -901,8 +899,7 @@ static int vrrp_recv_advertisement(struct vrrp_router *r, struct ipaddr *src,
if (pkt->hdr.naddr != r->addrs->count)
DEBUGD(&vrrp_dbg_proto,
VRRP_LOGPFX VRRP_LOGPFX_VRID VRRP_LOGPFX_FAM
- "Datagram has %" PRIu8
- " addresses, but this VRRP instance has %u",
+ "Datagram has %hhu addresses, but this VRRP instance has %u",
r->vr->vrid, family2str(r->family), pkt->hdr.naddr,
r->addrs->count);
@@ -926,8 +923,7 @@ static int vrrp_recv_advertisement(struct vrrp_router *r, struct ipaddr *src,
&& addrcmp > 0)) {
zlog_info(
VRRP_LOGPFX VRRP_LOGPFX_VRID VRRP_LOGPFX_FAM
- "Received advertisement from %s w/ priority %" PRIu8
- "; switching to Backup",
+ "Received advertisement from %s w/ priority %hhu; switching to Backup",
r->vr->vrid, family2str(r->family), sipstr,
pkt->hdr.priority);
THREAD_OFF(r->t_adver_timer);
@@ -946,8 +942,7 @@ static int vrrp_recv_advertisement(struct vrrp_router *r, struct ipaddr *src,
/* Discard advertisement */
DEBUGD(&vrrp_dbg_proto,
VRRP_LOGPFX VRRP_LOGPFX_VRID VRRP_LOGPFX_FAM
- "Discarding advertisement from %s (%" PRIu8
- " <= %" PRIu8 " & %s <= %s)",
+ "Discarding advertisement from %s (%hhu <= %hhu & %s <= %s)",
r->vr->vrid, family2str(r->family), sipstr,
pkt->hdr.priority, r->priority, sipstr, dipstr);
}
@@ -975,8 +970,7 @@ static int vrrp_recv_advertisement(struct vrrp_router *r, struct ipaddr *src,
/* Discard advertisement */
DEBUGD(&vrrp_dbg_proto,
VRRP_LOGPFX VRRP_LOGPFX_VRID VRRP_LOGPFX_FAM
- "Discarding advertisement from %s (%" PRIu8
- " < %" PRIu8 " & preempt = true)",
+ "Discarding advertisement from %s (%hhu < %hhu & preempt = true)",
r->vr->vrid, family2str(r->family), sipstr,
pkt->hdr.priority, r->priority);
}
@@ -2353,11 +2347,11 @@ int vrrp_config_write_global(struct vty *vty)
/* FIXME: needs to be udpated for full YANG conversion. */
if (vd.priority != VRRP_DEFAULT_PRIORITY && ++writes)
- vty_out(vty, "vrrp default priority %" PRIu8 "\n", vd.priority);
+ vty_out(vty, "vrrp default priority %hhu\n", vd.priority);
if (vd.advertisement_interval != VRRP_DEFAULT_ADVINT && ++writes)
vty_out(vty,
- "vrrp default advertisement-interval %" PRIu16 "\n",
+ "vrrp default advertisement-interval %hu\n",
vd.advertisement_interval * CS2MS);
if (vd.preempt_mode != VRRP_DEFAULT_PREEMPT && ++writes)
@@ -2380,7 +2374,7 @@ static unsigned int vrrp_hash_key(const void *arg)
const struct vrrp_vrouter *vr = arg;
char key[IFNAMSIZ + 64];
- snprintf(key, sizeof(key), "%s@%" PRIu8, vr->ifp->name, vr->vrid);
+ snprintf(key, sizeof(key), "%s@%hhu", vr->ifp->name, vr->vrid);
return string_hash_make(key);
}
diff --git a/vrrpd/vrrp_northbound.c b/vrrpd/vrrp_northbound.c
index c11e0352d..e9cd714a9 100644
--- a/vrrpd/vrrp_northbound.c
+++ b/vrrpd/vrrp_northbound.c
@@ -103,7 +103,7 @@ lib_interface_vrrp_vrrp_group_get_keys(struct nb_cb_get_keys_args *args)
const struct vrrp_vrouter *vr = args->list_entry;
args->keys->num = 1;
- snprintf(args->keys->key[0], sizeof(args->keys->key[0]), "%" PRIu32,
+ snprintf(args->keys->key[0], sizeof(args->keys->key[0]), "%u",
vr->vrid);
return NB_OK;
diff --git a/vrrpd/vrrp_packet.c b/vrrpd/vrrp_packet.c
index e4fee2d79..61fcc4e85 100644
--- a/vrrpd/vrrp_packet.c
+++ b/vrrpd/vrrp_packet.c
@@ -222,13 +222,12 @@ ssize_t vrrp_pkt_parse_datagram(int family, int version, struct msghdr *m,
/* IP total length check */
VRRP_PKT_VCHECK(
ntohs(ip->ip_len) == read,
- "IPv4 packet length field does not match # received bytes; %" PRIu16
- "!= %zu",
+ "IPv4 packet length field does not match # received bytes; %hu!= %zu",
ntohs(ip->ip_len), read);
/* TTL check */
VRRP_PKT_VCHECK(ip->ip_ttl == 255,
- "IPv4 TTL is %" PRIu8 "; should be 255",
+ "IPv4 TTL is %hhu; should be 255",
ip->ip_ttl);
*pkt = (struct vrrp_pkt *)(buf + (ip->ip_hl << 2));
@@ -256,7 +255,7 @@ ssize_t vrrp_pkt_parse_datagram(int family, int version, struct msghdr *m,
uint8_t *hoplimit = CMSG_DATA(c);
VRRP_PKT_VCHECK(*hoplimit == 255,
- "IPv6 Hop Limit is %" PRIu8 "; should be 255",
+ "IPv6 Hop Limit is %hhu; should be 255",
*hoplimit);
*pkt = (struct vrrp_pkt *)buf;
@@ -293,11 +292,11 @@ ssize_t vrrp_pkt_parse_datagram(int family, int version, struct msghdr *m,
uint16_t chksum = vrrp_pkt_checksum(*pkt, pktsize, src);
VRRP_PKT_VCHECK((*pkt)->hdr.chksum == chksum,
- "Bad VRRP checksum %" PRIx16 "; should be %" PRIx16 "",
+ "Bad VRRP checksum %hx; should be %hx",
(*pkt)->hdr.chksum, chksum);
/* Type check */
- VRRP_PKT_VCHECK(((*pkt)->hdr.vertype & 0x0F) == 1, "Bad type %" PRIu8,
+ VRRP_PKT_VCHECK(((*pkt)->hdr.vertype & 0x0F) == 1, "Bad type %hhu",
(*pkt)->hdr.vertype & 0x0f);
/* Exact size check */
@@ -309,7 +308,7 @@ ssize_t vrrp_pkt_parse_datagram(int family, int version, struct msghdr *m,
/* auth type check */
if (version == 2)
VRRP_PKT_VCHECK((*pkt)->hdr.v2.auth_type == 0,
- "Bad authentication type %" PRIu8,
+ "Bad authentication type %hhu",
(*pkt)->hdr.v2.auth_type);
/* Addresses check */
@@ -318,7 +317,7 @@ ssize_t vrrp_pkt_parse_datagram(int family, int version, struct msghdr *m,
for (uint8_t i = 0; i < (*pkt)->hdr.naddr; i++) {
VRRP_PKT_VCHECK(inet_ntop(family, p, vbuf, sizeof(vbuf)),
- "Bad IP address, #%" PRIu8, i);
+ "Bad IP address, #%hhu", i);
p += addrsz;
}
diff --git a/vrrpd/vrrp_vty.c b/vrrpd/vrrp_vty.c
index b6388cc5b..1a1233708 100644
--- a/vrrpd/vrrp_vty.c
+++ b/vrrpd/vrrp_vty.c
@@ -470,8 +470,8 @@ static void vrrp_show(struct vty *vty, struct vrrp_vrouter *vr)
struct ttable *tt = ttable_new(&ttable_styles[TTSTYLE_BLANK]);
- ttable_add_row(tt, "%s|%" PRIu32, "Virtual Router ID", vr->vrid);
- ttable_add_row(tt, "%s|%" PRIu8, "Protocol Version", vr->version);
+ ttable_add_row(tt, "%s|%u", "Virtual Router ID", vr->vrid);
+ ttable_add_row(tt, "%s|%hhu", "Protocol Version", vr->version);
ttable_add_row(tt, "%s|%s", "Autoconfigured",
vr->autoconf ? "Yes" : "No");
ttable_add_row(tt, "%s|%s", "Shutdown", vr->shutdown ? "Yes" : "No");
@@ -492,10 +492,10 @@ static void vrrp_show(struct vty *vty, struct vrrp_vrouter *vr)
ttable_add_row(tt, "%s|%s", "Virtual MAC (v6)", ethstr6);
ttable_add_row(tt, "%s|%s", "Status (v4)", stastr4);
ttable_add_row(tt, "%s|%s", "Status (v6)", stastr6);
- ttable_add_row(tt, "%s|%" PRIu8, "Priority", vr->priority);
- ttable_add_row(tt, "%s|%" PRIu8, "Effective Priority (v4)",
+ ttable_add_row(tt, "%s|%hhu", "Priority", vr->priority);
+ ttable_add_row(tt, "%s|%hhu", "Effective Priority (v4)",
vr->v4->priority);
- ttable_add_row(tt, "%s|%" PRIu8, "Effective Priority (v6)",
+ ttable_add_row(tt, "%s|%hhu", "Effective Priority (v6)",
vr->v6->priority);
ttable_add_row(tt, "%s|%s", "Preempt Mode",
vr->preempt_mode ? "Yes" : "No");
@@ -509,21 +509,21 @@ static void vrrp_show(struct vty *vty, struct vrrp_vrouter *vr)
ttable_add_row(tt, "%s|%d ms",
"Master Advertisement Interval (v6)",
vr->v6->master_adver_interval * CS2MS);
- ttable_add_row(tt, "%s|%" PRIu32, "Advertisements Tx (v4)",
+ ttable_add_row(tt, "%s|%u", "Advertisements Tx (v4)",
vr->v4->stats.adver_tx_cnt);
- ttable_add_row(tt, "%s|%" PRIu32, "Advertisements Tx (v6)",
+ ttable_add_row(tt, "%s|%u", "Advertisements Tx (v6)",
vr->v6->stats.adver_tx_cnt);
- ttable_add_row(tt, "%s|%" PRIu32, "Advertisements Rx (v4)",
+ ttable_add_row(tt, "%s|%u", "Advertisements Rx (v4)",
vr->v4->stats.adver_rx_cnt);
- ttable_add_row(tt, "%s|%" PRIu32, "Advertisements Rx (v6)",
+ ttable_add_row(tt, "%s|%u", "Advertisements Rx (v6)",
vr->v6->stats.adver_rx_cnt);
- ttable_add_row(tt, "%s|%" PRIu32, "Gratuitous ARP Tx (v4)",
+ ttable_add_row(tt, "%s|%u", "Gratuitous ARP Tx (v4)",
vr->v4->stats.garp_tx_cnt);
- ttable_add_row(tt, "%s|%" PRIu32, "Neigh. Adverts Tx (v6)",
+ ttable_add_row(tt, "%s|%u", "Neigh. Adverts Tx (v6)",
vr->v6->stats.una_tx_cnt);
- ttable_add_row(tt, "%s|%" PRIu32, "State transitions (v4)",
+ ttable_add_row(tt, "%s|%u", "State transitions (v4)",
vr->v4->stats.trans_cnt);
- ttable_add_row(tt, "%s|%" PRIu32, "State transitions (v6)",
+ ttable_add_row(tt, "%s|%u", "State transitions (v6)",
vr->v6->stats.trans_cnt);
ttable_add_row(tt, "%s|%d ms", "Skew Time (v4)",
vr->v4->skew_time * CS2MS);
@@ -653,7 +653,7 @@ DEFPY(vrrp_vrid_show_summary,
continue;
ttable_add_row(
- tt, "%s|%" PRIu8 "|%" PRIu8 "|%d|%d|%s|%s",
+ tt, "%s|%hhu|%hhu|%d|%d|%s|%s",
vr->ifp->name, vr->vrid, vr->priority,
vr->v4->addrs->count, vr->v6->addrs->count,
vr->v4->fsm.state == VRRP_STATE_MASTER ? "Master"