From f5c43549e5d12ec2105a43c27986416124143e6e Mon Sep 17 00:00:00 2001 From: Abhik Roy Date: Tue, 7 Nov 2023 20:42:38 +1100 Subject: [PATCH] lwip_debug: Fixed string format error in ip6 and napt --- src/core/ipv4/ip4_napt.c | 12 ++++++------ src/core/ipv6/ip6.c | 10 +++++----- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/core/ipv4/ip4_napt.c b/src/core/ipv4/ip4_napt.c index 0cf228cef..c02b599ed 100644 --- a/src/core/ipv4/ip4_napt.c +++ b/src/core/ipv4/ip4_napt.c @@ -124,7 +124,7 @@ napt_debug_print(void) u32_t now = sys_now(); #if LWIP_STATS u32_t nr_total = STATS_GET(ip_napt.nr_active_tcp) + STATS_GET(ip_napt.nr_active_udp) + STATS_GET(ip_napt.nr_active_icmp); - DPRINTF(("NAPT table (%"U16_F"+%"U16_F"+%"U16_F"=%"U32_F" / %"U16_F"):\n", + DPRINTF(("NAPT table (%"STAT_COUNTER_F"+%"STAT_COUNTER_F"+%"STAT_COUNTER_F"=%"U32_F" / %"U16_F"):\n", STATS_GET(ip_napt.nr_active_tcp), STATS_GET(ip_napt.nr_active_udp), STATS_GET(ip_napt.nr_active_icmp), nr_total, ip_napt_max)); if (nr_total == 0) return; #endif @@ -363,7 +363,7 @@ ip_napt_send_rst(u32_t src_be, u16_t sport_be, u32_t dst_be, u16_t dport_be, u32 if (netif != NULL) { err_t res = ip4_output_if(p, ip_2_ip4(&src), ip_2_ip4(&dst), ICMP_TTL, 0, IP_PROTO_TCP, netif); LWIP_UNUSED_ARG(res); /* might be unused if debugging off */ - LWIP_DEBUGF(NAPT_DEBUG, ("SEND RST to %#x:%u from %#x:%u seq %u ack %u res %d\n", + LWIP_DEBUGF(NAPT_DEBUG, ("SEND RST to %#"X32_F":%"U16_F" from %#"X32_F":%"U16_F" seq %"U32_F" ack %"U32_F" res %d\n", lwip_ntohl(src_be), lwip_ntohs(sport_be), lwip_ntohl(dst_be), lwip_ntohs(dport_be), seqno_le, ackno_le, res)); } @@ -398,7 +398,7 @@ ip_napt_insert(struct ip_napt_entry *t) if (t->proto == IP_PROTO_ICMP) STATS_INC(ip_napt.nr_active_icmp); #endif - LWIP_DEBUGF(NAPT_DEBUG, ("ip_napt_insert(): TCP=%d, UDP=%d, ICMP=%d\n", + LWIP_DEBUGF(NAPT_DEBUG, ("ip_napt_insert(): TCP=%"STAT_COUNTER_F", UDP=%"STAT_COUNTER_F", ICMP=%"STAT_COUNTER_F"\n", STATS_GET(ip_napt.nr_active_tcp), STATS_GET(ip_napt.nr_active_udp), STATS_GET(ip_napt.nr_active_icmp))); #endif /* LWIP_STATS */ } @@ -528,7 +528,7 @@ ip_napt_find(u8_t proto, u32_t addr, u16_t port, u16_t mport, u8_t dest) struct ip_napt_entry *t; LWIP_DEBUGF(NAPT_DEBUG, ("ip_napt_find\n")); - LWIP_DEBUGF(NAPT_DEBUG, ("looking up in table %s: %"U16_F".%"U16_F".%"U16_F".%"U16_F", port: %u, mport: %u\n", + LWIP_DEBUGF(NAPT_DEBUG, ("looking up in table %s: %"U16_F".%"U16_F".%"U16_F".%"U16_F", port: %"U16_F", mport: %"U16_F"\n", (dest ? "dest" : "src"), ((const u8_t*) (&addr))[0], ((const u8_t*) (&addr))[1], ((const u8_t*) (&addr))[2], ((const u8_t*) (&addr))[3], @@ -785,7 +785,7 @@ ip_napt_recv(struct pbuf *p, struct ip_hdr *iphdr) ip4_addr1_16(&iphdr->dest), ip4_addr2_16(&iphdr->dest), ip4_addr3_16(&iphdr->dest), ip4_addr4_16(&iphdr->dest))); - LWIP_DEBUGF(NAPT_DEBUG, ("sport %u, dport: %u\n", + LWIP_DEBUGF(NAPT_DEBUG, ("sport %"U16_F", dport: %"U16_F"\n", lwip_htons(tcphdr->src), lwip_htons(tcphdr->dest))); @@ -1034,7 +1034,7 @@ ip_napt_gc(uint32_t now, bool force) forced++; STATS_INC(ip_napt.nr_forced_evictions); } - LWIP_DEBUGF(NAPT_DEBUG, ("ip_napt_gc(%d): chk %d evict %d (forced %d), oldest %u\n", + LWIP_DEBUGF(NAPT_DEBUG, ("ip_napt_gc(%d): chk %d evict %d (forced %d), oldest %"U32_F"\n", force, checked, evicted, forced, oldest_age)); } diff --git a/src/core/ipv6/ip6.c b/src/core/ipv6/ip6.c index 030ea1ddd..15f229aa0 100644 --- a/src/core/ipv6/ip6.c +++ b/src/core/ipv6/ip6.c @@ -1470,7 +1470,7 @@ ip6_debug_print(struct pbuf *p) LWIP_DEBUGF(IP6_DEBUG, ("IPv6 header:\n")); LWIP_DEBUGF(IP6_DEBUG, ("+-------------------------------+\n")); - LWIP_DEBUGF(IP6_DEBUG, ("| %2"U16_F" | %3"U16_F" | %7"U32_F" | (ver, class, flow)\n", + LWIP_DEBUGF(IP6_DEBUG, ("| %2"U32_F" | %3"U32_F" | %7"U32_F" | (ver, class, flow)\n", IP6H_V(ip6hdr), IP6H_TC(ip6hdr), IP6H_FL(ip6hdr))); @@ -1480,23 +1480,23 @@ ip6_debug_print(struct pbuf *p) IP6H_NEXTH(ip6hdr), IP6H_HOPLIM(ip6hdr))); LWIP_DEBUGF(IP6_DEBUG, ("+-------------------------------+\n")); - LWIP_DEBUGF(IP6_DEBUG, ("| %4"X32_F" | %4"X32_F" | %4"X32_F" | %4"X32_F" | (src)\n", + LWIP_DEBUGF(IP6_DEBUG, ("| %4"X16_F" | %4"X16_F" | %4"X16_F" | %4"X16_F" | (src)\n", IP6_ADDR_BLOCK1(&(ip6hdr->src)), IP6_ADDR_BLOCK2(&(ip6hdr->src)), IP6_ADDR_BLOCK3(&(ip6hdr->src)), IP6_ADDR_BLOCK4(&(ip6hdr->src)))); - LWIP_DEBUGF(IP6_DEBUG, ("| %4"X32_F" | %4"X32_F" | %4"X32_F" | %4"X32_F" |\n", + LWIP_DEBUGF(IP6_DEBUG, ("| %4"X16_F" | %4"X16_F" | %4"X16_F" | %4"X16_F" |\n", IP6_ADDR_BLOCK5(&(ip6hdr->src)), IP6_ADDR_BLOCK6(&(ip6hdr->src)), IP6_ADDR_BLOCK7(&(ip6hdr->src)), IP6_ADDR_BLOCK8(&(ip6hdr->src)))); LWIP_DEBUGF(IP6_DEBUG, ("+-------------------------------+\n")); - LWIP_DEBUGF(IP6_DEBUG, ("| %4"X32_F" | %4"X32_F" | %4"X32_F" | %4"X32_F" | (dest)\n", + LWIP_DEBUGF(IP6_DEBUG, ("| %4"X16_F" | %4"X16_F" | %4"X16_F" | %4"X16_F" | (dest)\n", IP6_ADDR_BLOCK1(&(ip6hdr->dest)), IP6_ADDR_BLOCK2(&(ip6hdr->dest)), IP6_ADDR_BLOCK3(&(ip6hdr->dest)), IP6_ADDR_BLOCK4(&(ip6hdr->dest)))); - LWIP_DEBUGF(IP6_DEBUG, ("| %4"X32_F" | %4"X32_F" | %4"X32_F" | %4"X32_F" |\n", + LWIP_DEBUGF(IP6_DEBUG, ("| %4"X16_F" | %4"X16_F" | %4"X16_F" | %4"X16_F" |\n", IP6_ADDR_BLOCK5(&(ip6hdr->dest)), IP6_ADDR_BLOCK6(&(ip6hdr->dest)), IP6_ADDR_BLOCK7(&(ip6hdr->dest)),