diff options
author | Donald Sharp <sharpd@nvidia.com> | 2021-03-10 02:00:45 +0100 |
---|---|---|
committer | Donald Sharp <sharpd@nvidia.com> | 2021-03-10 02:00:45 +0100 |
commit | c067e23e547425d779fa362674befe82db558a48 (patch) | |
tree | acb9d33ca32048f0218566516295a6272f18d51a /ospfd/ospf_packet.c | |
parent | bgpd: Convert remaining string output to our internal types (diff) | |
download | frr-c067e23e547425d779fa362674befe82db558a48.tar.xz frr-c067e23e547425d779fa362674befe82db558a48.zip |
ospfd: Convert to using proper string formatting
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to 'ospfd/ospf_packet.c')
-rw-r--r-- | ospfd/ospf_packet.c | 59 |
1 files changed, 15 insertions, 44 deletions
diff --git a/ospfd/ospf_packet.c b/ospfd/ospf_packet.c index 343e406f2..0fd4803c7 100644 --- a/ospfd/ospf_packet.c +++ b/ospfd/ospf_packet.c @@ -1881,20 +1881,10 @@ static void ospf_ls_upd(struct ospf *ospf, struct ip *iph, struct ospf_lsa *ls_ret, *current; int ret = 1; - if (IS_DEBUG_OSPF_NSSA) { - char buf1[INET_ADDRSTRLEN]; - char buf2[INET_ADDRSTRLEN]; - char buf3[INET_ADDRSTRLEN]; - - zlog_debug("LSA Type-%d from %s, ID: %s, ADV: %s", - lsa->data->type, - inet_ntop(AF_INET, &ospfh->router_id, buf1, - INET_ADDRSTRLEN), - inet_ntop(AF_INET, &lsa->data->id, buf2, - INET_ADDRSTRLEN), - inet_ntop(AF_INET, &lsa->data->adv_router, - buf3, INET_ADDRSTRLEN)); - } + if (IS_DEBUG_OSPF_NSSA) + zlog_debug("LSA Type-%d from %pI4, ID: %pI4, ADV: %pI4", + lsa->data->type, &ospfh->router_id, + &lsa->data->id, &lsa->data->adv_router); listnode_delete(lsas, lsa); /* We don't need it in list anymore */ @@ -1940,19 +1930,11 @@ static void ospf_ls_upd(struct ospf *ospf, struct ip *iph, if (lsa->data->type == OSPF_ROUTER_LSA) if (!IPV4_ADDR_SAME(&lsa->data->id, &lsa->data->adv_router)) { - char buf1[INET_ADDRSTRLEN]; - char buf2[INET_ADDRSTRLEN]; - char buf3[INET_ADDRSTRLEN]; - - flog_err(EC_OSPF_ROUTER_LSA_MISMATCH, - "Incoming Router-LSA from %s with Adv-ID[%s] != LS-ID[%s]", - inet_ntop(AF_INET, &ospfh->router_id, - buf1, INET_ADDRSTRLEN), - inet_ntop(AF_INET, &lsa->data->id, - buf2, INET_ADDRSTRLEN), - inet_ntop(AF_INET, - &lsa->data->adv_router, buf3, - INET_ADDRSTRLEN)); + flog_err( + EC_OSPF_ROUTER_LSA_MISMATCH, + "Incoming Router-LSA from %pI4 with Adv-ID[%pI4] != LS-ID[%pI4]", + &ospfh->router_id, &lsa->data->id, + &lsa->data->adv_router); flog_err( EC_OSPF_DOMAIN_CORRUPT, "OSPF domain compromised by attack or corruption. Verify correct operation of -ALL- OSPF routers."); @@ -3045,17 +3027,11 @@ static enum ospf_read_return_enum ospf_read_helper(struct ospf *ospf) /* If incoming interface is passive one, ignore it. */ if (oi && OSPF_IF_PASSIVE_STATUS(oi) == OSPF_IF_PASSIVE) { - char buf[3][INET_ADDRSTRLEN]; - if (IS_DEBUG_OSPF_EVENT) zlog_debug( - "ignoring packet from router %s sent to %s, received on a passive interface, %s", - inet_ntop(AF_INET, &ospfh->router_id, buf[0], - sizeof(buf[0])), - inet_ntop(AF_INET, &iph->ip_dst, buf[1], - sizeof(buf[1])), - inet_ntop(AF_INET, &oi->address->u.prefix4, - buf[2], sizeof(buf[2]))); + "ignoring packet from router %pI4 sent to %pI4, received on a passive interface, %pI4", + &ospfh->router_id, &iph->ip_dst, + &oi->address->u.prefix4); if (iph->ip_dst.s_addr == htonl(OSPF_ALLSPFROUTERS)) { /* Try to fix multicast membership. @@ -3097,16 +3073,11 @@ static enum ospf_read_return_enum ospf_read_helper(struct ospf *ospf) &iph->ip_src, ifp->name); return OSPF_READ_CONTINUE; } else if (oi->state == ISM_Down) { - char buf[2][INET_ADDRSTRLEN]; - flog_warn( EC_OSPF_PACKET, - "Ignoring packet from %s to %s received on interface that is down [%s]; interface flags are %s", - inet_ntop(AF_INET, &iph->ip_src, buf[0], - sizeof(buf[0])), - inet_ntop(AF_INET, &iph->ip_dst, buf[1], - sizeof(buf[1])), - ifp->name, if_flag_dump(ifp->flags)); + "Ignoring packet from %pI4 to %pI4 received on interface that is down [%s]; interface flags are %s", + &iph->ip_src, &iph->ip_dst, ifp->name, + if_flag_dump(ifp->flags)); /* Fix multicast memberships? */ if (iph->ip_dst.s_addr == htonl(OSPF_ALLSPFROUTERS)) OI_MEMBER_JOINED(oi, MEMBER_ALLROUTERS); |