diff options
author | Mark Stapp <mjs@voltanet.io> | 2020-10-21 19:57:06 +0200 |
---|---|---|
committer | Mark Stapp <mjs@voltanet.io> | 2020-10-22 19:37:25 +0200 |
commit | 9bcef951be1db4f94eb985c007e4b563657af20e (patch) | |
tree | d818389f6d611c47770f002fbada358260cb43e6 /zebra/irdp_packet.c | |
parent | ospfd: replace inet_ntoa (diff) | |
download | frr-9bcef951be1db4f94eb985c007e4b563657af20e.tar.xz frr-9bcef951be1db4f94eb985c007e4b563657af20e.zip |
zebra: replace inet_ntoa
Stop using inet_ntoa - use %pI4 or inet_ntop instead
Signed-off-by: Mark Stapp <mjs@voltanet.io>
Diffstat (limited to 'zebra/irdp_packet.c')
-rw-r--r-- | zebra/irdp_packet.c | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/zebra/irdp_packet.c b/zebra/irdp_packet.c index 502a2f277..56fd35a73 100644 --- a/zebra/irdp_packet.c +++ b/zebra/irdp_packet.c @@ -79,6 +79,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 +105,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\n", + &src); return; } @@ -115,8 +116,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\n", + &src); return; } @@ -128,8 +129,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 +142,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 +153,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\n", + &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 +171,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 +180,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); } } |