ospfclient: replace inet_ntoa

Replace all use of inet_ntoa; use pI4 (and printfrr).

Signed-off-by: Mark Stapp <mjs@voltanet.io>
This commit is contained in:
Mark Stapp 2020-10-22 13:41:51 -04:00
parent 9bcef951be
commit d0b0a2c545

View file

@ -30,6 +30,7 @@
#include "prefix.h" /* needed by ospf_asbr.h */ #include "prefix.h" /* needed by ospf_asbr.h */
#include "privs.h" #include "privs.h"
#include "log.h" #include "log.h"
#include "lib/printfrr.h"
/* work around gcc bug 69981, disable MTYPEs in libospf */ /* work around gcc bug 69981, disable MTYPEs in libospf */
#define _QUAGGA_OSPF_MEMORY_H #define _QUAGGA_OSPF_MEMORY_H
@ -186,8 +187,8 @@ static void lsa_update_callback(struct in_addr ifaddr, struct in_addr area_id,
struct lsa_header *lsa) struct lsa_header *lsa)
{ {
printf("lsa_update_callback: "); printf("lsa_update_callback: ");
printf("ifaddr: %s ", inet_ntoa(ifaddr)); printfrr("ifaddr: %pI4 ", &ifaddr);
printf("area: %s\n", inet_ntoa(area_id)); printfrr("area: %pI4\n", &area_id);
printf("is_self_origin: %u\n", is_self_originated); printf("is_self_origin: %u\n", is_self_originated);
/* It is important to note that lsa_header does indeed include the /* It is important to note that lsa_header does indeed include the
@ -211,8 +212,8 @@ static void lsa_delete_callback(struct in_addr ifaddr, struct in_addr area_id,
struct lsa_header *lsa) struct lsa_header *lsa)
{ {
printf("lsa_delete_callback: "); printf("lsa_delete_callback: ");
printf("ifaddr: %s ", inet_ntoa(ifaddr)); printf("ifaddr: %pI4 ", &ifaddr);
printf("area: %s\n", inet_ntoa(area_id)); printf("area: %pI4\n", &area_id);
printf("is_self_origin: %u\n", is_self_originated); printf("is_self_origin: %u\n", is_self_originated);
ospf_lsa_header_dump(lsa); ospf_lsa_header_dump(lsa);
@ -221,8 +222,8 @@ static void lsa_delete_callback(struct in_addr ifaddr, struct in_addr area_id,
static void ready_callback(uint8_t lsa_type, uint8_t opaque_type, static void ready_callback(uint8_t lsa_type, uint8_t opaque_type,
struct in_addr addr) struct in_addr addr)
{ {
printf("ready_callback: lsa_type: %d opaque_type: %d addr=%s\n", printfrr("ready_callback: lsa_type: %d opaque_type: %d addr=%pI4\n",
lsa_type, opaque_type, inet_ntoa(addr)); lsa_type, opaque_type, &addr);
/* Schedule opaque LSA originate in 5 secs */ /* Schedule opaque LSA originate in 5 secs */
thread_add_timer(master, lsa_inject, oclient, 5, NULL); thread_add_timer(master, lsa_inject, oclient, 5, NULL);
@ -236,20 +237,20 @@ static void ready_callback(uint8_t lsa_type, uint8_t opaque_type,
static void new_if_callback(struct in_addr ifaddr, struct in_addr area_id) static void new_if_callback(struct in_addr ifaddr, struct in_addr area_id)
{ {
printf("new_if_callback: ifaddr: %s ", inet_ntoa(ifaddr)); printfrr("new_if_callback: ifaddr: %pI4 ", &ifaddr);
printf("area_id: %s\n", inet_ntoa(area_id)); printfrr("area_id: %pI4\n", &area_id);
} }
static void del_if_callback(struct in_addr ifaddr) static void del_if_callback(struct in_addr ifaddr)
{ {
printf("new_if_callback: ifaddr: %s\n ", inet_ntoa(ifaddr)); printfrr("new_if_callback: ifaddr: %pI4\n ", &ifaddr);
} }
static void ism_change_callback(struct in_addr ifaddr, struct in_addr area_id, static void ism_change_callback(struct in_addr ifaddr, struct in_addr area_id,
uint8_t state) uint8_t state)
{ {
printf("ism_change: ifaddr: %s ", inet_ntoa(ifaddr)); printfrr("ism_change: ifaddr: %pI4 ", &ifaddr);
printf("area_id: %s\n", inet_ntoa(area_id)); printfrr("area_id: %pI4\n", &area_id);
printf("state: %d [%s]\n", state, printf("state: %d [%s]\n", state,
lookup_msg(ospf_ism_state_msg, state, NULL)); lookup_msg(ospf_ism_state_msg, state, NULL));
} }
@ -257,9 +258,9 @@ static void ism_change_callback(struct in_addr ifaddr, struct in_addr area_id,
static void nsm_change_callback(struct in_addr ifaddr, struct in_addr nbraddr, static void nsm_change_callback(struct in_addr ifaddr, struct in_addr nbraddr,
struct in_addr router_id, uint8_t state) struct in_addr router_id, uint8_t state)
{ {
printf("nsm_change: ifaddr: %s ", inet_ntoa(ifaddr)); printfrr("nsm_change: ifaddr: %pI4 ", &ifaddr);
printf("nbraddr: %s\n", inet_ntoa(nbraddr)); printfrr("nbraddr: %pI4\n", &nbraddr);
printf("router_id: %s\n", inet_ntoa(router_id)); printfrr("router_id: %pI4\n", &router_id);
printf("state: %d [%s]\n", state, printf("state: %d [%s]\n", state,
lookup_msg(ospf_nsm_state_msg, state, NULL)); lookup_msg(ospf_nsm_state_msg, state, NULL));
} }