]> git.proxmox.com Git - mirror_frr.git/blobdiff - zebra/irdp_packet.c
Merge pull request #8317 from mjstapp/fix_short_printfrr_buf
[mirror_frr.git] / zebra / irdp_packet.c
index 13dcab92944c1204886550c48073a529608212dd..7d67c42a79e9b06f843b7ca9f4f7bf6af164ebf8 100644 (file)
@@ -54,7 +54,6 @@
 #include "zclient.h"
 #include "lib_errors.h"
 
-#include "zebra_memory.h"
 #include "zebra/interface.h"
 #include "zebra/rtadv.h"
 #include "zebra/rib.h"
@@ -79,6 +78,7 @@ static void parse_irdp_packet(char *p, int len, struct interface *ifp)
        struct zebra_if *zi;
        struct irdp_interface *irdp;
        uint16_t saved_chksum;
+       char buf[PREFIX_STRLEN];
 
        zi = ifp->info;
        if (!zi)
@@ -104,8 +104,8 @@ static void parse_irdp_packet(char *p, int len, struct interface *ifp)
 
        if (iplen < ICMP_MINLEN) {
                flog_err(EC_ZEBRA_IRDP_LEN_MISMATCH,
-                        "IRDP: RX ICMP packet too short from %s\n",
-                        inet_ntoa(src));
+                        "IRDP: RX ICMP packet too short from %pI4",
+                        &src);
                return;
        }
 
@@ -115,8 +115,8 @@ static void parse_irdp_packet(char *p, int len, struct interface *ifp)
         len of IP-header) 14+20 */
        if (iplen > IRDP_RX_BUF - 34) {
                flog_err(EC_ZEBRA_IRDP_LEN_MISMATCH,
-                        "IRDP: RX ICMP packet too long from %s\n",
-                        inet_ntoa(src));
+                        "IRDP: RX ICMP packet too long from %pI4",
+                        &src);
                return;
        }
 
@@ -128,8 +128,8 @@ static void parse_irdp_packet(char *p, int len, struct interface *ifp)
        if (in_cksum(icmp, datalen) != saved_chksum) {
                flog_warn(
                        EC_ZEBRA_IRDP_BAD_CHECKSUM,
-                       "IRDP: RX ICMP packet from %s. Bad checksum, silently ignored",
-                       inet_ntoa(src));
+                       "IRDP: RX ICMP packet from %pI4 Bad checksum, silently ignored",
+                       &src);
                return;
        }
 
@@ -141,8 +141,8 @@ static void parse_irdp_packet(char *p, int len, struct interface *ifp)
        if (icmp->code != 0) {
                flog_warn(
                        EC_ZEBRA_IRDP_BAD_TYPE_CODE,
-                       "IRDP: RX packet type %d from %s. Bad ICMP type code, silently ignored",
-                       icmp->type, inet_ntoa(src));
+                       "IRDP: RX packet type %d from %pI4 Bad ICMP type code, silently ignored",
+                       icmp->type, &src);
                return;
        }
 
@@ -152,11 +152,12 @@ static void parse_irdp_packet(char *p, int len, struct interface *ifp)
                && !(irdp->flags & IF_BROADCAST))) {
                flog_warn(
                        EC_ZEBRA_IRDP_BAD_RX_FLAGS,
-                       "IRDP: RX illegal from %s to %s while %s operates in %s; Please correct settings\n",
-                       inet_ntoa(src),
+                       "IRDP: RX illegal from %pI4 to %s while %s operates in %s; Please correct settings",
+                       &src,
                        ntohl(ip->ip_dst.s_addr) == INADDR_ALLRTRS_GROUP
                                ? "multicast"
-                               : inet_ntoa(ip->ip_dst),
+                               : inet_ntop(AF_INET, &ip->ip_dst,
+                                           buf, sizeof(buf)),
                        ifp->name,
                        irdp->flags & IF_BROADCAST ? "broadcast" : "multicast");
                return;
@@ -169,8 +170,8 @@ static void parse_irdp_packet(char *p, int len, struct interface *ifp)
        case ICMP_ROUTERSOLICIT:
 
                if (irdp->flags & IF_DEBUG_MESSAGES)
-                       zlog_debug("IRDP: RX Solicit on %s from %s",
-                                  ifp->name, inet_ntoa(src));
+                       zlog_debug("IRDP: RX Solicit on %s from %pI4",
+                                  ifp->name, &src);
 
                process_solicit(ifp);
                break;
@@ -178,8 +179,8 @@ static void parse_irdp_packet(char *p, int len, struct interface *ifp)
        default:
                flog_warn(
                        EC_ZEBRA_IRDP_BAD_TYPE_CODE,
-                       "IRDP: RX packet type %d from %s. Bad ICMP type code, silently ignored",
-                       icmp->type, inet_ntoa(src));
+                       "IRDP: RX packet type %d from %pI4 Bad ICMP type code, silently ignored",
+                       icmp->type, &src);
        }
 }
 
@@ -196,7 +197,7 @@ static int irdp_recvmsg(int sock, uint8_t *buf, int size, int *ifindex)
        msg.msg_iov = &iov;
        msg.msg_iovlen = 1;
        msg.msg_control = (void *)adata;
-       msg.msg_controllen = sizeof adata;
+       msg.msg_controllen = sizeof(adata);
 
        iov.iov_base = buf;
        iov.iov_len = size;