diff options
author | Mark Stapp <mjs@voltanet.io> | 2020-10-21 19:56:26 +0200 |
---|---|---|
committer | Mark Stapp <mjs@voltanet.io> | 2020-10-22 19:37:25 +0200 |
commit | 96b663a381c2e90fa663d69fce4e40f0be698e58 (patch) | |
tree | 061e8297387581dcb5e730f405bf9a5596a58dc1 /ospfd/ospf_packet.c | |
parent | Merge pull request #7343 from ton31337/fix/prefix2str_to_pFX (diff) | |
download | frr-96b663a381c2e90fa663d69fce4e40f0be698e58.tar.xz frr-96b663a381c2e90fa663d69fce4e40f0be698e58.zip |
ospfd: replace inet_ntoa
Stop using inet_ntoa, use %pI4 etc or inet_ntop instead
Signed-off-by: Mark Stapp <mjs@voltanet.io>
Diffstat (limited to 'ospfd/ospf_packet.c')
-rw-r--r-- | ospfd/ospf_packet.c | 282 |
1 files changed, 141 insertions, 141 deletions
diff --git a/ospfd/ospf_packet.c b/ospfd/ospf_packet.c index 160982a23..8cb0062ea 100644 --- a/ospfd/ospf_packet.c +++ b/ospfd/ospf_packet.c @@ -606,15 +606,15 @@ static void ospf_write_frags(int fd, struct ospf_packet *op, struct ip *iph, if (ret < 0) flog_err( EC_LIB_SOCKET, - "*** ospf_write_frags: sendmsg failed to %s, id %d, off %d, len %d, mtu %u failed with %s", - inet_ntoa(iph->ip_dst), iph->ip_id, iph->ip_off, + "*** ospf_write_frags: sendmsg failed to %pI4, id %d, off %d, len %d, mtu %u failed with %s", + &iph->ip_dst, iph->ip_id, iph->ip_off, iph->ip_len, mtu, safe_strerror(errno)); if (IS_DEBUG_OSPF_PACKET(type - 1, SEND)) { zlog_debug( - "ospf_write_frags: sent id %d, off %d, len %d to %s", + "ospf_write_frags: sent id %d, off %d, len %d to %pI4", iph->ip_id, iph->ip_off, iph->ip_len, - inet_ntoa(iph->ip_dst)); + &iph->ip_dst); } iph->ip_off += offset; @@ -659,8 +659,8 @@ static int ospf_write(struct thread *thread) if (ospf->fd < 0 || ospf->oi_running == 0) { if (IS_DEBUG_OSPF_EVENT) zlog_debug( - "ospf_write failed to send, fd %d, instance %u" - ,ospf->fd, ospf->oi_running); + "ospf_write failed to send, fd %d, instance %u", + ospf->fd, ospf->oi_running); return -1; } @@ -799,15 +799,15 @@ static int ospf_write(struct thread *thread) sockopt_iphdrincl_swab_systoh(&iph); if (IS_DEBUG_OSPF_EVENT) zlog_debug( - "ospf_write to %s, id %d, off %d, len %d, interface %s, mtu %u:", - inet_ntoa(iph.ip_dst), iph.ip_id, iph.ip_off, + "ospf_write to %pI4, id %d, off %d, len %d, interface %s, mtu %u:", + &iph.ip_dst, iph.ip_id, iph.ip_off, iph.ip_len, oi->ifp->name, oi->ifp->mtu); if (ret < 0) flog_err( EC_LIB_SOCKET, - "*** sendmsg in ospf_write failed to %s, id %d, off %d, len %d, interface %s, mtu %u: %s", - inet_ntoa(iph.ip_dst), iph.ip_id, iph.ip_off, + "*** sendmsg in ospf_write failed to %pI4, id %d, off %d, len %d, interface %s, mtu %u: %s", + &iph.ip_dst, iph.ip_id, iph.ip_off, iph.ip_len, oi->ifp->name, oi->ifp->mtu, safe_strerror(errno)); @@ -820,9 +820,9 @@ static int ospf_write(struct thread *thread) ospf_packet_dump(op->s); } - zlog_debug("%s sent to [%s] via [%s].", + zlog_debug("%s sent to [%pI4] via [%s].", lookup_msg(ospf_packet_type_str, type, NULL), - inet_ntoa(op->dst), IF_NAME(oi)); + &op->dst, IF_NAME(oi)); if (IS_DEBUG_OSPF_PACKET(type - 1, DETAIL)) zlog_debug( @@ -896,10 +896,10 @@ static void ospf_hello(struct ip *iph, struct ospf_header *ospfh, if (IPV4_ADDR_SAME(&ospfh->router_id, &oi->ospf->router_id)) { if (IS_DEBUG_OSPF_PACKET(ospfh->type - 1, RECV)) { zlog_debug( - "ospf_header[%s/%s]: selforiginated, dropping.", + "ospf_header[%s/%pI4]: selforiginated, dropping.", lookup_msg(ospf_packet_type_str, ospfh->type, NULL), - inet_ntoa(iph->ip_src)); + &iph->ip_src); } return; } @@ -916,8 +916,8 @@ static void ospf_hello(struct ip *iph, struct ospf_header *ospfh, if (oi->address->prefixlen != p.prefixlen) { flog_warn( EC_OSPF_PACKET, - "Packet %s [Hello:RECV]: NetworkMask mismatch on %s (configured prefix length is %d, but hello packet indicates %d).", - inet_ntoa(ospfh->router_id), IF_NAME(oi), + "Packet %pI4 [Hello:RECV]: NetworkMask mismatch on %s (configured prefix length is %d, but hello packet indicates %d).", + &ospfh->router_id, IF_NAME(oi), (int)oi->address->prefixlen, (int)p.prefixlen); return; } @@ -925,8 +925,8 @@ static void ospf_hello(struct ip *iph, struct ospf_header *ospfh, /* Compare Router Dead Interval. */ if (OSPF_IF_PARAM(oi, v_wait) != ntohl(hello->dead_interval)) { flog_warn(EC_OSPF_PACKET, - "Packet %s [Hello:RECV]: RouterDeadInterval mismatch (expected %u, but received %u).", - inet_ntoa(ospfh->router_id), + "Packet %pI4 [Hello:RECV]: RouterDeadInterval mismatch (expected %u, but received %u).", + &ospfh->router_id, OSPF_IF_PARAM(oi, v_wait), ntohl(hello->dead_interval)); return; @@ -938,8 +938,8 @@ static void ospf_hello(struct ip *iph, struct ospf_header *ospfh, != ntohs(hello->hello_interval)) { flog_warn( EC_OSPF_PACKET, - "Packet %s [Hello:RECV]: HelloInterval mismatch (expected %u, but received %u).", - inet_ntoa(ospfh->router_id), + "Packet %pI4 [Hello:RECV]: HelloInterval mismatch (expected %u, but received %u).", + &ospfh->router_id, OSPF_IF_PARAM(oi, v_hello), ntohs(hello->hello_interval)); return; @@ -947,8 +947,8 @@ static void ospf_hello(struct ip *iph, struct ospf_header *ospfh, } if (IS_DEBUG_OSPF_EVENT) - zlog_debug("Packet %s [Hello:RECV]: Options %s vrf %s", - inet_ntoa(ospfh->router_id), + zlog_debug("Packet %pI4 [Hello:RECV]: Options %s vrf %s", + &ospfh->router_id, ospf_options_dump(hello->options), ospf_vrf_id_to_name(oi->ospf->vrf_id)); @@ -962,8 +962,8 @@ static void ospf_hello(struct ip *iph, struct ospf_header *ospfh, * relationship. */ flog_warn(EC_OSPF_PACKET, - "Packet %s [Hello:RECV]: T-bit on, drop it.", - inet_ntoa(ospfh->router_id)); + "Packet %pI4 [Hello:RECV]: T-bit on, drop it.", + &ospfh->router_id); return; } #endif /* REJECT_IF_TBIT_ON */ @@ -975,8 +975,8 @@ static void ospf_hello(struct ip *iph, struct ospf_header *ospfh, * the bit should be set in DD packet only. */ flog_warn(EC_OSPF_PACKET, - "Packet %s [Hello:RECV]: O-bit abuse?", - inet_ntoa(ospfh->router_id)); + "Packet %pI4 [Hello:RECV]: O-bit abuse?", + &ospfh->router_id); #ifdef STRICT_OBIT_USAGE_CHECK return; /* Reject this packet. */ #else /* STRICT_OBIT_USAGE_CHECK */ @@ -993,14 +993,14 @@ static void ospf_hello(struct ip *iph, struct ospf_header *ospfh, && !CHECK_FLAG(hello->options, OSPF_OPTION_E))) { flog_warn( EC_OSPF_PACKET, - "NSSA-Packet-%s[Hello:RECV]: my options: %x, his options %x", - inet_ntoa(ospfh->router_id), OPTIONS(oi), + "NSSA-Packet-%pI4[Hello:RECV]: my options: %x, his options %x", + &ospfh->router_id, OPTIONS(oi), hello->options); return; } if (IS_DEBUG_OSPF_NSSA) - zlog_debug("NSSA-Hello:RECV:Packet from %s:", - inet_ntoa(ospfh->router_id)); + zlog_debug("NSSA-Hello:RECV:Packet from %pI4:", + &ospfh->router_id); } else /* The setting of the E-bit found in the Hello Packet's Options field must match this area's ExternalRoutingCapability A @@ -1011,8 +1011,8 @@ static void ospf_hello(struct ip *iph, struct ospf_header *ospfh, != CHECK_FLAG(hello->options, OSPF_OPTION_E)) { flog_warn( EC_OSPF_PACKET, - "Packet %s [Hello:RECV]: my options: %x, his options %x", - inet_ntoa(ospfh->router_id), OPTIONS(oi), + "Packet %pI4 [Hello:RECV]: my options: %x, his options %x", + &ospfh->router_id, OPTIONS(oi), hello->options); return; } @@ -1147,8 +1147,8 @@ static void ospf_db_desc_proc(struct stream *s, struct ospf_interface *oi, if (IS_OPAQUE_LSA(lsah->type) && !CHECK_FLAG(nbr->options, OSPF_OPTION_O)) { flog_warn(EC_OSPF_PACKET, - "LSA[Type%d:%s]: Opaque capability mismatch?", - lsah->type, inet_ntoa(lsah->id)); + "LSA[Type%d:%pI4]: Opaque capability mismatch?", + lsah->type, &lsah->id); OSPF_NSM_EVENT_SCHEDULE(nbr, NSM_SeqNumberMismatch); return; } @@ -1162,8 +1162,8 @@ static void ospf_db_desc_proc(struct stream *s, struct ospf_interface *oi, if (oi->area->external_routing == OSPF_AREA_STUB) { flog_warn( EC_OSPF_PACKET, - "Packet [DD:RECV]: LSA[Type%d:%s] from %s area.", - lsah->type, inet_ntoa(lsah->id), + "Packet [DD:RECV]: LSA[Type%d:%pI4] from %s area.", + lsah->type, &lsah->id, (oi->area->external_routing == OSPF_AREA_STUB) ? "STUB" @@ -1218,8 +1218,8 @@ static void ospf_db_desc_proc(struct stream *s, struct ospf_interface *oi, */ if (IS_DEBUG_OSPF_EVENT) zlog_debug( - "Packet [DD:RECV]: LSA received Type %d, ID %s is not recent.", - lsah->type, inet_ntoa(lsah->id)); + "Packet [DD:RECV]: LSA received Type %d, ID %pI4 is not recent.", + lsah->type, &lsah->id); ospf_lsa_discard(new); } } @@ -1287,8 +1287,8 @@ static void ospf_db_desc(struct ip *iph, struct ospf_header *ospfh, nbr = ospf_nbr_lookup(oi, iph, ospfh); if (nbr == NULL) { - flog_warn(EC_OSPF_PACKET, "Packet[DD]: Unknown Neighbor %s", - inet_ntoa(ospfh->router_id)); + flog_warn(EC_OSPF_PACKET, "Packet[DD]: Unknown Neighbor %pI4", + &ospfh->router_id); return; } @@ -1297,8 +1297,8 @@ static void ospf_db_desc(struct ip *iph, struct ospf_header *ospfh, && (ntohs(dd->mtu) > oi->ifp->mtu)) { flog_warn( EC_OSPF_PACKET, - "Packet[DD]: Neighbor %s MTU %u is larger than [%s]'s MTU %u", - inet_ntoa(nbr->router_id), ntohs(dd->mtu), IF_NAME(oi), + "Packet[DD]: Neighbor %pI4 MTU %u is larger than [%s]'s MTU %u", + &nbr->router_id, ntohs(dd->mtu), IF_NAME(oi), oi->ifp->mtu); return; } @@ -1324,8 +1324,8 @@ static void ospf_db_desc(struct ip *iph, struct ospf_header *ospfh, && (!CHECK_FLAG(dd->options, OSPF_OPTION_NP))) { if (IS_DEBUG_OSPF_EVENT) zlog_debug( - "Packet[DD]: Neighbour %s: Has NSSA capability, sends with N bit clear in DD options", - inet_ntoa(nbr->router_id)); + "Packet[DD]: Neighbour %pI4: Has NSSA capability, sends with N bit clear in DD options", + &nbr->router_id); SET_FLAG(dd->options, OSPF_OPTION_NP); } @@ -1335,8 +1335,8 @@ static void ospf_db_desc(struct ip *iph, struct ospf_header *ospfh, * In Hello protocol, optional capability must have checked * to prevent this T-bit enabled router be my neighbor. */ - flog_warn(EC_OSPF_PACKET, "Packet[DD]: Neighbor %s: T-bit on?", - inet_ntoa(nbr->router_id)); + flog_warn(EC_OSPF_PACKET, "Packet[DD]: Neighbor %pI4: T-bit on?", + &nbr->router_id); return; } #endif /* REJECT_IF_TBIT_ON */ @@ -1356,9 +1356,9 @@ static void ospf_db_desc(struct ip *iph, struct ospf_header *ospfh, if (CHECK_FLAG(oi->ospf->config, OSPF_LOG_ADJACENCY_DETAIL)) zlog_info( - "%s:Packet[DD]: Neighbor %s state is %s, seq_num:0x%x, local:0x%x", + "%s:Packet[DD]: Neighbor %pI4 state is %s, seq_num:0x%x, local:0x%x", (oi->ospf->name) ? oi->ospf->name : VRF_DEFAULT_NAME, - inet_ntoa(nbr->router_id), + &nbr->router_id, lookup_msg(ospf_nsm_state_msg, nbr->state, NULL), ntohl(dd->dd_seqnum), nbr->dd_seqnum); @@ -1369,8 +1369,8 @@ static void ospf_db_desc(struct ip *iph, struct ospf_header *ospfh, case NSM_TwoWay: if (CHECK_FLAG(oi->ospf->config, OSPF_LOG_ADJACENCY_DETAIL)) zlog_info( - "Packet[DD]: Neighbor %s state is %s, packet discarded.", - inet_ntoa(nbr->router_id), + "Packet[DD]: Neighbor %pI4 state is %s, packet discarded.", + &nbr->router_id, lookup_msg(ospf_nsm_state_msg, nbr->state, NULL)); break; @@ -1392,8 +1392,8 @@ static void ospf_db_desc(struct ip *iph, struct ospf_header *ospfh, if (CHECK_FLAG(oi->ospf->config, OSPF_LOG_ADJACENCY_DETAIL)) zlog_info( - "Packet[DD]: Neighbor %s Negotiation done (Slave).", - inet_ntoa(nbr->router_id)); + "Packet[DD]: Neighbor %pI4 Negotiation done (Slave).", + &nbr->router_id); nbr->dd_seqnum = ntohl(dd->dd_seqnum); @@ -1406,8 +1406,8 @@ static void ospf_db_desc(struct ip *iph, struct ospf_header *ospfh, if (CHECK_FLAG(oi->ospf->config, OSPF_LOG_ADJACENCY_DETAIL)) zlog_info( - "Packet[DD]: Neighbor %s: Initial DBD from Slave, ignoring.", - inet_ntoa(nbr->router_id)); + "Packet[DD]: Neighbor %pI4: Initial DBD from Slave, ignoring.", + &nbr->router_id); break; } } @@ -1417,14 +1417,14 @@ static void ospf_db_desc(struct ip *iph, struct ospf_header *ospfh, && IPV4_ADDR_CMP(&nbr->router_id, &oi->ospf->router_id) < 0) { zlog_info( - "Packet[DD]: Neighbor %s Negotiation done (Master).", - inet_ntoa(nbr->router_id)); + "Packet[DD]: Neighbor %pI4 Negotiation done (Master).", + &nbr->router_id); /* Reset I, leaving MS */ UNSET_FLAG(nbr->dd_flags, OSPF_DD_FLAG_I); } else { flog_warn(EC_OSPF_PACKET, - "Packet[DD]: Neighbor %s Negotiation fails.", - inet_ntoa(nbr->router_id)); + "Packet[DD]: Neighbor %pI4 Negotiation fails.", + &nbr->router_id); break; } @@ -1434,8 +1434,8 @@ static void ospf_db_desc(struct ip *iph, struct ospf_header *ospfh, if (CHECK_FLAG(oi->ospf->config, OSPF_OPAQUE_CAPABLE)) { if (IS_DEBUG_OSPF_EVENT) zlog_debug( - "Neighbor[%s] is %sOpaque-capable.", - inet_ntoa(nbr->router_id), + "Neighbor[%pI4] is %sOpaque-capable.", + &nbr->router_id, CHECK_FLAG(nbr->options, OSPF_OPTION_O) ? "" : "NOT "); @@ -1445,8 +1445,8 @@ static void ospf_db_desc(struct ip *iph, struct ospf_header *ospfh, &nbr->address.u.prefix4)) { flog_warn( EC_OSPF_PACKET, - "DR-neighbor[%s] is NOT opaque-capable; Opaque-LSAs cannot be reliably advertised in this network.", - inet_ntoa(nbr->router_id)); + "DR-neighbor[%pI4] is NOT opaque-capable; Opaque-LSAs cannot be reliably advertised in this network.", + &nbr->router_id); /* This situation is undesirable, but not a real * error. */ } @@ -1462,15 +1462,15 @@ static void ospf_db_desc(struct ip *iph, struct ospf_header *ospfh, if (IS_SET_DD_MS(nbr->dd_flags)) /* Master: discard duplicated DD packet. */ zlog_info( - "Packet[DD] (Master): Neighbor %s packet duplicated.", - inet_ntoa(nbr->router_id)); + "Packet[DD] (Master): Neighbor %pI4 packet duplicated.", + &nbr->router_id); else /* Slave: cause to retransmit the last Database Description. */ { zlog_info( - "Packet[DD] [Slave]: Neighbor %s packet duplicated.", - inet_ntoa(nbr->router_id)); + "Packet[DD] [Slave]: Neighbor %pI4 packet duplicated.", + &nbr->router_id); ospf_db_desc_resend(nbr); } break; @@ -1481,8 +1481,8 @@ static void ospf_db_desc(struct ip *iph, struct ospf_header *ospfh, if (IS_SET_DD_MS(dd->flags) != IS_SET_DD_MS(nbr->last_recv.flags)) { flog_warn(EC_OSPF_PACKET, - "Packet[DD]: Neighbor %s MS-bit mismatch.", - inet_ntoa(nbr->router_id)); + "Packet[DD]: Neighbor %pI4 MS-bit mismatch.", + &nbr->router_id); OSPF_NSM_EVENT_SCHEDULE(nbr, NSM_SeqNumberMismatch); if (IS_DEBUG_OSPF_EVENT) zlog_debug( @@ -1493,8 +1493,8 @@ static void ospf_db_desc(struct ip *iph, struct ospf_header *ospfh, /* Check initialize bit is set. */ if (IS_SET_DD_I(dd->flags)) { - zlog_info("Packet[DD]: Neighbor %s I-bit set.", - inet_ntoa(nbr->router_id)); + zlog_info("Packet[DD]: Neighbor %pI4 I-bit set.", + &nbr->router_id); OSPF_NSM_EVENT_SCHEDULE(nbr, NSM_SeqNumberMismatch); break; } @@ -1502,8 +1502,8 @@ static void ospf_db_desc(struct ip *iph, struct ospf_header *ospfh, /* Check DD Options. */ if (dd->options != nbr->options) { flog_warn(EC_OSPF_PACKET, - "Packet[DD]: Neighbor %s options mismatch.", - inet_ntoa(nbr->router_id)); + "Packet[DD]: Neighbor %pI4 options mismatch.", + &nbr->router_id); OSPF_NSM_EVENT_SCHEDULE(nbr, NSM_SeqNumberMismatch); break; } @@ -1515,8 +1515,8 @@ static void ospf_db_desc(struct ip *iph, struct ospf_header *ospfh, && ntohl(dd->dd_seqnum) != nbr->dd_seqnum + 1)) { flog_warn( EC_OSPF_PACKET, - "Packet[DD]: Neighbor %s sequence number mismatch.", - inet_ntoa(nbr->router_id)); + "Packet[DD]: Neighbor %pI4 sequence number mismatch.", + &nbr->router_id); OSPF_NSM_EVENT_SCHEDULE(nbr, NSM_SeqNumberMismatch); break; } @@ -1530,8 +1530,8 @@ static void ospf_db_desc(struct ip *iph, struct ospf_header *ospfh, if (IS_SET_DD_MS(nbr->dd_flags)) { /* Master should discard duplicate DD packet. */ zlog_info( - "Packet[DD]: Neighbor %s duplicated, packet discarded.", - inet_ntoa(nbr->router_id)); + "Packet[DD]: Neighbor %pI4 duplicated, packet discarded.", + &nbr->router_id); break; } else { if (monotime_since(&nbr->last_send_ts, NULL) @@ -1564,8 +1564,8 @@ static void ospf_db_desc(struct ip *iph, struct ospf_header *ospfh, break; default: flog_warn(EC_OSPF_PACKET, - "Packet[DD]: Neighbor %s NSM illegal status %u.", - inet_ntoa(nbr->router_id), nbr->state); + "Packet[DD]: Neighbor %pI4 NSM illegal status %u.", + &nbr->router_id, nbr->state); break; } } @@ -1591,8 +1591,8 @@ static void ospf_ls_req(struct ip *iph, struct ospf_header *ospfh, nbr = ospf_nbr_lookup(oi, iph, ospfh); if (nbr == NULL) { flog_warn(EC_OSPF_PACKET, - "Link State Request: Unknown Neighbor %s.", - inet_ntoa(ospfh->router_id)); + "Link State Request: Unknown Neighbor %pI4", + &ospfh->router_id); return; } @@ -1604,8 +1604,8 @@ static void ospf_ls_req(struct ip *iph, struct ospf_header *ospfh, && nbr->state != NSM_Full) { flog_warn( EC_OSPF_PACKET, - "Link State Request received from %s: Neighbor state is %s, packet discarded.", - inet_ntoa(ospfh->router_id), + "Link State Request received from %pI4: Neighbor state is %s, packet discarded.", + &ospfh->router_id, lookup_msg(ospf_nsm_state_msg, nbr->state, NULL)); return; } @@ -1712,10 +1712,10 @@ static struct list *ospf_ls_upd_list_lsa(struct ospf_neighbor *nbr, * other */ flog_warn( EC_OSPF_PACKET, - "Link State Update: LSA checksum error %x/%x, ID=%s from: nbr %s, router ID %s, adv router %s", - sum, lsah->checksum, inet_ntoa(lsah->id), - inet_ntoa(nbr->src), inet_ntoa(nbr->router_id), - inet_ntoa(lsah->adv_router)); + "Link State Update: LSA checksum error %x/%x, ID=%pI4 from: nbr %pI4, router ID %pI4, adv router %pI4", + sum, lsah->checksum, &lsah->id, + &nbr->src, &nbr->router_id, + &lsah->adv_router); continue; } @@ -1747,8 +1747,8 @@ static struct list *ospf_ls_upd_list_lsa(struct ospf_neighbor *nbr, * only. */ flog_warn(EC_OSPF_PACKET, - "LSA[Type%d:%s]: O-bit abuse?", - lsah->type, inet_ntoa(lsah->id)); + "LSA[Type%d:%pI4]: O-bit abuse?", + lsah->type, &lsah->id); continue; } #endif /* STRICT_OBIT_USAGE_CHECK */ @@ -1760,15 +1760,15 @@ static struct list *ospf_ls_upd_list_lsa(struct ospf_neighbor *nbr, != OSPF_AREA_DEFAULT) { if (IS_DEBUG_OSPF_EVENT) zlog_debug( - "LSA[Type%d:%s]: We are a stub, don't take this LSA.", + "LSA[Type%d:%pI4]: We are a stub, don't take this LSA.", lsah->type, - inet_ntoa(lsah->id)); + &lsah->id); continue; } } else if (IS_OPAQUE_LSA(lsah->type)) { flog_warn(EC_OSPF_PACKET, - "LSA[Type%d:%s]: Opaque capability mismatch?", - lsah->type, inet_ntoa(lsah->id)); + "LSA[Type%d:%pI4]: Opaque capability mismatch?", + lsah->type, &lsah->id); continue; } @@ -1796,8 +1796,8 @@ static struct list *ospf_ls_upd_list_lsa(struct ospf_neighbor *nbr, if (IS_DEBUG_OSPF_EVENT) zlog_debug( - "LSA[Type%d:%s]: %p new LSA created with Link State Update", - lsa->data->type, inet_ntoa(lsa->data->id), + "LSA[Type%d:%pI4]: %p new LSA created with Link State Update", + lsa->data->type, &lsa->data->id, (void *)lsa); listnode_add(lsas, lsa); } @@ -1838,8 +1838,8 @@ static void ospf_ls_upd(struct ospf *ospf, struct ip *iph, nbr = ospf_nbr_lookup(oi, iph, ospfh); if (nbr == NULL) { flog_warn(EC_OSPF_PACKET, - "Link State Update: Unknown Neighbor %s on int: %s", - inet_ntoa(ospfh->router_id), IF_NAME(oi)); + "Link State Update: Unknown Neighbor %pI4 on int: %s", + &ospfh->router_id, IF_NAME(oi)); return; } @@ -1850,8 +1850,8 @@ static void ospf_ls_upd(struct ospf *ospf, struct ip *iph, if (nbr->state < NSM_Exchange) { if (IS_DEBUG_OSPF(nsm, NSM_EVENTS)) zlog_debug( - "Link State Update: Neighbor[%s] state %s is less than Exchange", - inet_ntoa(ospfh->router_id), + "Link State Update: Neighbor[%pI4] state %s is less than Exchange", + &ospfh->router_id, lookup_msg(ospf_nsm_state_msg, nbr->state, NULL)); return; @@ -2241,8 +2241,8 @@ static void ospf_ls_ack(struct ip *iph, struct ospf_header *ospfh, nbr = ospf_nbr_lookup(oi, iph, ospfh); if (nbr == NULL) { flog_warn(EC_OSPF_PACKET, - "Link State Acknowledgment: Unknown Neighbor %s.", - inet_ntoa(ospfh->router_id)); + "Link State Acknowledgment: Unknown Neighbor %pI4", + &ospfh->router_id); return; } @@ -2252,8 +2252,8 @@ static void ospf_ls_ack(struct ip *iph, struct ospf_header *ospfh, if (nbr->state < NSM_Exchange) { if (IS_DEBUG_OSPF(nsm, NSM_EVENTS)) zlog_debug( - "Link State Acknowledgment: Neighbor[%s] state %s is less than Exchange", - inet_ntoa(ospfh->router_id), + "Link State Acknowledgment: Neighbor[%pI4] state %s is less than Exchange", + &ospfh->router_id, lookup_msg(ospf_nsm_state_msg, nbr->state, NULL)); return; @@ -2485,9 +2485,9 @@ static int ospf_check_auth(struct ospf_interface *oi, struct ospf_header *ospfh) if (IS_DEBUG_OSPF_PACKET(ospfh->type - 1, RECV)) flog_warn( EC_OSPF_PACKET, - "interface %s: Null auth OK, but checksum error, Router-ID %s", + "interface %s: Null auth OK, but checksum error, Router-ID %pI4", IF_NAME(oi), - inet_ntoa(ospfh->router_id)); + &ospfh->router_id); return 0; } return 1; @@ -2515,9 +2515,9 @@ static int ospf_check_auth(struct ospf_interface *oi, struct ospf_header *ospfh) if (IS_DEBUG_OSPF_PACKET(ospfh->type - 1, RECV)) flog_warn( EC_OSPF_PACKET, - "interface %s: Simple auth OK, checksum error, Router-ID %s", + "interface %s: Simple auth OK, checksum error, Router-ID %pI4", IF_NAME(oi), - inet_ntoa(ospfh->router_id)); + &ospfh->router_id); return 0; } return 1; @@ -2916,8 +2916,8 @@ static int ospf_verify_header(struct stream *ibuf, struct ospf_interface *oi, /* Check Area ID. */ if (!ospf_check_area_id(oi, ospfh)) { flog_warn(EC_OSPF_PACKET, - "interface %s: ospf_read invalid Area ID %s.", - IF_NAME(oi), inet_ntoa(ospfh->area_id)); + "interface %s: ospf_read invalid Area ID %pI4", + IF_NAME(oi), &ospfh->area_id); return -1; } @@ -2925,8 +2925,8 @@ static int ospf_verify_header(struct stream *ibuf, struct ospf_interface *oi, if (!ospf_check_network_mask(oi, iph->ip_src)) { flog_warn( EC_OSPF_PACKET, - "interface %s: ospf_read network address is not same [%s]", - IF_NAME(oi), inet_ntoa(iph->ip_src)); + "interface %s: ospf_read network address is not same [%pI4]", + IF_NAME(oi), &iph->ip_src); return -1; } @@ -2984,8 +2984,8 @@ static enum ospf_read_return_enum ospf_read_helper(struct ospf *ospf) if (ifp == NULL) { if (IS_DEBUG_OSPF_PACKET(0, RECV)) zlog_debug( - "%s: Unable to determine incoming interface from: %s(%s)", - __func__, inet_ntoa(iph->ip_src), + "%s: Unable to determine incoming interface from: %pI4(%s)", + __func__, &iph->ip_src, ospf_get_name(ospf)); return OSPF_READ_CONTINUE; } @@ -2995,8 +2995,8 @@ static enum ospf_read_return_enum ospf_read_helper(struct ospf *ospf) if (ospf_if_lookup_by_local_addr(ospf, NULL, iph->ip_src)) { if (IS_DEBUG_OSPF_PACKET(0, RECV)) { zlog_debug( - "ospf_read[%s]: Dropping self-originated packet", - inet_ntoa(iph->ip_src)); + "ospf_read[%pI4]: Dropping self-originated packet", + &iph->ip_src); } return OSPF_READ_CONTINUE; } @@ -3074,8 +3074,8 @@ static enum ospf_read_return_enum ospf_read_helper(struct ospf *ospf) == NULL) { if (!ospf->instance && IS_DEBUG_OSPF_EVENT) zlog_debug( - "Packet from [%s] received on link %s but no ospf_interface", - inet_ntoa(iph->ip_src), ifp->name); + "Packet from [%pI4] received on link %s but no ospf_interface", + &iph->ip_src, ifp->name); return OSPF_READ_CONTINUE; } } @@ -3087,8 +3087,8 @@ static enum ospf_read_return_enum ospf_read_helper(struct ospf *ospf) else if (oi->ifp != ifp) { if (IS_DEBUG_OSPF_EVENT) flog_warn(EC_OSPF_PACKET, - "Packet from [%s] received on wrong link %s", - inet_ntoa(iph->ip_src), ifp->name); + "Packet from [%pI4] received on wrong link %s", + &iph->ip_src, ifp->name); return OSPF_READ_CONTINUE; } else if (oi->state == ISM_Down) { char buf[2][INET_ADDRSTRLEN]; @@ -3122,8 +3122,8 @@ static enum ospf_read_return_enum ospf_read_helper(struct ospf *ospf) && (oi->state != ISM_DR && oi->state != ISM_Backup)) { flog_warn( EC_OSPF_PACKET, - "Dropping packet for AllDRouters from [%s] via [%s] (ISM: %s)", - inet_ntoa(iph->ip_src), IF_NAME(oi), + "Dropping packet for AllDRouters from [%pI4] via [%s] (ISM: %s)", + &iph->ip_src, IF_NAME(oi), lookup_msg(ospf_ism_state_msg, oi->state, NULL)); /* Try to fix multicast membership. */ SET_FLAG(oi->multicast_memberships, MEMBER_DROUTERS); @@ -3136,8 +3136,8 @@ static enum ospf_read_return_enum ospf_read_helper(struct ospf *ospf) if (ret < 0) { if (IS_DEBUG_OSPF_PACKET(0, RECV)) zlog_debug( - "ospf_read[%s]: Header check failed, dropping.", - inet_ntoa(iph->ip_src)); + "ospf_read[%pI4]: Header check failed, dropping.", + &iph->ip_src); return OSPF_READ_CONTINUE; } @@ -3149,11 +3149,11 @@ static enum ospf_read_return_enum ospf_read_helper(struct ospf *ospf) ospf_packet_dump(ibuf); } - zlog_debug("%s received from [%s] via [%s]", + zlog_debug("%s received from [%pI4] via [%s]", lookup_msg(ospf_packet_type_str, ospfh->type, NULL), - inet_ntoa(ospfh->router_id), IF_NAME(oi)); - zlog_debug(" src [%s],", inet_ntoa(iph->ip_src)); - zlog_debug(" dst [%s]", inet_ntoa(iph->ip_dst)); + &ospfh->router_id, IF_NAME(oi)); + zlog_debug(" src [%pI4],", &iph->ip_src); + zlog_debug(" dst [%pI4]", &iph->ip_dst); if (IS_DEBUG_OSPF_PACKET(ospfh->type - 1, DETAIL)) zlog_debug( @@ -3736,8 +3736,8 @@ int ospf_poll_timer(struct thread *thread) nbr_nbma->t_poll = NULL; if (IS_DEBUG_OSPF(nsm, NSM_TIMERS)) - zlog_debug("NSM[%s:%s]: Timer (Poll timer expire)", - IF_NAME(nbr_nbma->oi), inet_ntoa(nbr_nbma->addr)); + zlog_debug("NSM[%s:%pI4]: Timer (Poll timer expire)", + IF_NAME(nbr_nbma->oi), &nbr_nbma->addr); ospf_poll_send(nbr_nbma); @@ -3757,8 +3757,8 @@ int ospf_hello_reply_timer(struct thread *thread) nbr->t_hello_reply = NULL; if (IS_DEBUG_OSPF(nsm, NSM_TIMERS)) - zlog_debug("NSM[%s:%s]: Timer (hello-reply timer expire)", - IF_NAME(nbr->oi), inet_ntoa(nbr->router_id)); + zlog_debug("NSM[%s:%pI4]: Timer (hello-reply timer expire)", + IF_NAME(nbr->oi), &nbr->router_id); ospf_hello_send_sub(nbr->oi, nbr->address.u.prefix4.s_addr); @@ -3875,9 +3875,9 @@ void ospf_db_desc_send(struct ospf_neighbor *nbr) monotime(&nbr->last_send_ts); if (CHECK_FLAG(oi->ospf->config, OSPF_LOG_ADJACENCY_DETAIL)) zlog_info( - "%s:Packet[DD]: %s DB Desc send with seqnum:%x , flags:%x", + "%s:Packet[DD]: %pI4 DB Desc send with seqnum:%x , flags:%x", (oi->ospf->name) ? oi->ospf->name : VRF_DEFAULT_NAME, - inet_ntoa(nbr->router_id), nbr->dd_seqnum, + &nbr->router_id, nbr->dd_seqnum, nbr->dd_flags); } @@ -3895,9 +3895,9 @@ void ospf_db_desc_resend(struct ospf_neighbor *nbr) OSPF_ISM_WRITE_ON(oi->ospf); if (CHECK_FLAG(oi->ospf->config, OSPF_LOG_ADJACENCY_DETAIL)) zlog_info( - "%s:Packet[DD]: %s DB Desc resend with seqnum:%x , flags:%x", + "%s:Packet[DD]: %pI4 DB Desc resend with seqnum:%x , flags:%x", (oi->ospf->name) ? oi->ospf->name : VRF_DEFAULT_NAME, - inet_ntoa(nbr->router_id), nbr->dd_seqnum, + &nbr->router_id, nbr->dd_seqnum, nbr->dd_flags); } @@ -3992,10 +3992,10 @@ static struct ospf_packet *ospf_ls_upd_packet_new(struct list *update, if (IS_DEBUG_OSPF_PACKET(0, SEND)) zlog_debug( - "ospf_ls_upd_packet_new: oversized LSA id:%s, %d bytes originated by %s, will be fragmented!", - inet_ntoa(lsa->data->id), + "ospf_ls_upd_packet_new: oversized LSA id:%pI4, %d bytes originated by %pI4, will be fragmented!", + &lsa->data->id, ntohs(lsa->data->length), - inet_ntoa(lsa->data->adv_router)); + &lsa->data->adv_router); /* * Allocate just enough to fit this LSA only, to avoid including @@ -4010,8 +4010,8 @@ static struct ospf_packet *ospf_ls_upd_packet_new(struct list *update, if (size > OSPF_MAX_PACKET_SIZE) { flog_warn(EC_OSPF_LARGE_LSA, - "ospf_ls_upd_packet_new: oversized LSA id:%s too big, %d bytes, packet size %ld, dropping it completely. OSPF routing is broken!", - inet_ntoa(lsa->data->id), ntohs(lsa->data->length), + "ospf_ls_upd_packet_new: oversized LSA id:%pI4 too big, %d bytes, packet size %ld, dropping it completely. OSPF routing is broken!", + &lsa->data->id, ntohs(lsa->data->length), (long int)size); list_delete_node(update, ln); return NULL; @@ -4043,8 +4043,8 @@ static void ospf_ls_upd_queue_send(struct ospf_interface *oi, uint16_t length = OSPF_HEADER_SIZE; if (IS_DEBUG_OSPF_EVENT) - zlog_debug("listcount = %d, [%s]dst %s", listcount(update), - IF_NAME(oi), inet_ntoa(addr)); + zlog_debug("listcount = %d, [%s]dst %pI4", listcount(update), + IF_NAME(oi), &addr); /* Check that we have really something to process */ if (listcount(update) == 0) |