mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-04-29 12:18:12 +00:00
pimd: replace inet_ntoa
Replace all use of inet_ntoa, using %pI4 or inet_ntoa instead Signed-off-by: Mark Stapp <mjs@voltanet.io>
This commit is contained in:
parent
84de5a245a
commit
ee2bbf7ce2
@ -26,7 +26,6 @@
|
||||
#include "checksum.h"
|
||||
#include "prefix.h"
|
||||
#include "mtracebis_routeget.h"
|
||||
|
||||
#include <sys/select.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
@ -64,13 +63,14 @@ static void version(void)
|
||||
static void print_host(struct in_addr addr)
|
||||
{
|
||||
struct hostent *h;
|
||||
char buf[PREFIX_STRLEN];
|
||||
|
||||
h = gethostbyaddr(&addr, sizeof(addr), AF_INET);
|
||||
if (h == NULL)
|
||||
printf("?");
|
||||
else
|
||||
printf("%s", h->h_name);
|
||||
printf(" (%s) ", inet_ntoa(addr));
|
||||
printf(" (%s) ", inet_ntop(AF_INET, &addr, buf, sizeof(buf)));
|
||||
}
|
||||
|
||||
static void print_line_no(int i)
|
||||
|
@ -376,9 +376,9 @@ static void pim_g2rp_timer_start(struct bsm_rpinfo *bsrp, int hold_time)
|
||||
THREAD_OFF(bsrp->g2rp_timer);
|
||||
if (PIM_DEBUG_BSM)
|
||||
zlog_debug(
|
||||
"%s : starting g2rp timer for grp: %pFX - rp: %s with timeout %d secs(Actual Hold time : %d secs)",
|
||||
"%s : starting g2rp timer for grp: %pFX - rp: %pI4 with timeout %d secs(Actual Hold time : %d secs)",
|
||||
__func__, &bsrp->bsgrp_node->group,
|
||||
inet_ntoa(bsrp->rp_address), hold_time,
|
||||
&bsrp->rp_address, hold_time,
|
||||
bsrp->rp_holdtime);
|
||||
|
||||
thread_add_timer(router->master, pim_on_g2rp_timer, bsrp, hold_time,
|
||||
@ -397,9 +397,9 @@ static void pim_g2rp_timer_stop(struct bsm_rpinfo *bsrp)
|
||||
return;
|
||||
|
||||
if (PIM_DEBUG_BSM)
|
||||
zlog_debug("%s : stopping g2rp timer for grp: %pFX - rp: %s",
|
||||
zlog_debug("%s : stopping g2rp timer for grp: %pFX - rp: %pI4",
|
||||
__func__, &bsrp->bsgrp_node->group,
|
||||
inet_ntoa(bsrp->rp_address));
|
||||
&bsrp->rp_address);
|
||||
|
||||
THREAD_OFF(bsrp->g2rp_timer);
|
||||
}
|
||||
|
@ -199,6 +199,7 @@ static void pim_show_assert_helper(struct vty *vty,
|
||||
struct in_addr ifaddr;
|
||||
char uptime[10];
|
||||
char timer[10];
|
||||
char buf[PREFIX_STRLEN];
|
||||
|
||||
ifaddr = pim_ifp->primary_address;
|
||||
|
||||
@ -211,9 +212,10 @@ static void pim_show_assert_helper(struct vty *vty,
|
||||
pim_time_timer_to_mmss(timer, sizeof(timer), ch->t_ifassert_timer);
|
||||
|
||||
vty_out(vty, "%-16s %-15s %-15s %-15s %-6s %-15s %-8s %-5s\n",
|
||||
ch->interface->name, inet_ntoa(ifaddr), ch_src_str, ch_grp_str,
|
||||
pim_ifchannel_ifassert_name(ch->ifassert_state), winner_str,
|
||||
uptime, timer);
|
||||
ch->interface->name,
|
||||
inet_ntop(AF_INET, &ifaddr, buf, sizeof(buf)), ch_src_str,
|
||||
ch_grp_str, pim_ifchannel_ifassert_name(ch->ifassert_state),
|
||||
winner_str, uptime, timer);
|
||||
}
|
||||
|
||||
static void pim_show_assert(struct pim_instance *pim, struct vty *vty)
|
||||
@ -246,13 +248,16 @@ static void pim_show_assert_internal_helper(struct vty *vty,
|
||||
char ch_src_str[INET_ADDRSTRLEN];
|
||||
char ch_grp_str[INET_ADDRSTRLEN];
|
||||
struct in_addr ifaddr;
|
||||
char buf[PREFIX_STRLEN];
|
||||
|
||||
ifaddr = pim_ifp->primary_address;
|
||||
|
||||
pim_inet4_dump("<ch_src?>", ch->sg.src, ch_src_str, sizeof(ch_src_str));
|
||||
pim_inet4_dump("<ch_grp?>", ch->sg.grp, ch_grp_str, sizeof(ch_grp_str));
|
||||
vty_out(vty, "%-16s %-15s %-15s %-15s %-3s %-3s %-3s %-4s\n",
|
||||
ch->interface->name, inet_ntoa(ifaddr), ch_src_str, ch_grp_str,
|
||||
ch->interface->name,
|
||||
inet_ntop(AF_INET, &ifaddr, buf, sizeof(buf)),
|
||||
ch_src_str, ch_grp_str,
|
||||
PIM_IF_FLAG_TEST_COULD_ASSERT(ch->flags) ? "yes" : "no",
|
||||
pim_macro_ch_could_assert_eval(ch) ? "yes" : "no",
|
||||
PIM_IF_FLAG_TEST_ASSERT_TRACKING_DESIRED(ch->flags) ? "yes"
|
||||
@ -294,6 +299,7 @@ static void pim_show_assert_metric_helper(struct vty *vty,
|
||||
char addr_str[INET_ADDRSTRLEN];
|
||||
struct pim_assert_metric am;
|
||||
struct in_addr ifaddr;
|
||||
char buf[PREFIX_STRLEN];
|
||||
|
||||
ifaddr = pim_ifp->primary_address;
|
||||
|
||||
@ -305,9 +311,10 @@ static void pim_show_assert_metric_helper(struct vty *vty,
|
||||
pim_inet4_dump("<addr?>", am.ip_address, addr_str, sizeof(addr_str));
|
||||
|
||||
vty_out(vty, "%-16s %-15s %-15s %-15s %-3s %4u %6u %-15s\n",
|
||||
ch->interface->name, inet_ntoa(ifaddr), ch_src_str, ch_grp_str,
|
||||
am.rpt_bit_flag ? "yes" : "no", am.metric_preference,
|
||||
am.route_metric, addr_str);
|
||||
ch->interface->name,
|
||||
inet_ntop(AF_INET, &ifaddr, buf, sizeof(buf)),
|
||||
ch_src_str, ch_grp_str, am.rpt_bit_flag ? "yes" : "no",
|
||||
am.metric_preference, am.route_metric, addr_str);
|
||||
}
|
||||
|
||||
static void pim_show_assert_metric(struct pim_instance *pim, struct vty *vty)
|
||||
@ -341,6 +348,7 @@ static void pim_show_assert_winner_metric_helper(struct vty *vty,
|
||||
struct in_addr ifaddr;
|
||||
char pref_str[16];
|
||||
char metr_str[16];
|
||||
char buf[PREFIX_STRLEN];
|
||||
|
||||
ifaddr = pim_ifp->primary_address;
|
||||
|
||||
@ -362,8 +370,10 @@ static void pim_show_assert_winner_metric_helper(struct vty *vty,
|
||||
snprintf(metr_str, sizeof(metr_str), "%6u", am->route_metric);
|
||||
|
||||
vty_out(vty, "%-16s %-15s %-15s %-15s %-3s %-4s %-6s %-15s\n",
|
||||
ch->interface->name, inet_ntoa(ifaddr), ch_src_str, ch_grp_str,
|
||||
am->rpt_bit_flag ? "yes" : "no", pref_str, metr_str, addr_str);
|
||||
ch->interface->name,
|
||||
inet_ntop(AF_INET, &ifaddr, buf, sizeof(buf)), ch_src_str,
|
||||
ch_grp_str, am->rpt_bit_flag ? "yes" : "no", pref_str, metr_str,
|
||||
addr_str);
|
||||
}
|
||||
|
||||
static void pim_show_assert_winner_metric(struct pim_instance *pim,
|
||||
@ -391,12 +401,14 @@ static void json_object_pim_ifp_add(struct json_object *json,
|
||||
struct interface *ifp)
|
||||
{
|
||||
struct pim_interface *pim_ifp;
|
||||
char buf[PREFIX_STRLEN];
|
||||
|
||||
pim_ifp = ifp->info;
|
||||
json_object_string_add(json, "name", ifp->name);
|
||||
json_object_string_add(json, "state", if_is_up(ifp) ? "up" : "down");
|
||||
json_object_string_add(json, "address",
|
||||
inet_ntoa(pim_ifp->primary_address));
|
||||
inet_ntop(AF_INET, &pim_ifp->primary_address,
|
||||
buf, sizeof(buf)));
|
||||
json_object_int_add(json, "index", ifp->ifindex);
|
||||
|
||||
if (if_is_multicast(ifp))
|
||||
@ -569,6 +581,7 @@ static void igmp_show_interfaces(struct pim_instance *pim, struct vty *vty,
|
||||
{
|
||||
struct interface *ifp;
|
||||
time_t now;
|
||||
char buf[PREFIX_STRLEN];
|
||||
json_object *json = NULL;
|
||||
json_object *json_row = NULL;
|
||||
|
||||
@ -632,7 +645,8 @@ static void igmp_show_interfaces(struct pim_instance *pim, struct vty *vty,
|
||||
? (igmp->mtrace_only ? "mtrc"
|
||||
: "up")
|
||||
: "down",
|
||||
inet_ntoa(igmp->ifaddr),
|
||||
inet_ntop(AF_INET, &igmp->ifaddr,
|
||||
buf, sizeof(buf)),
|
||||
pim_ifp->igmp_version,
|
||||
igmp->t_igmp_query_timer ? "local"
|
||||
: "other",
|
||||
@ -797,8 +811,8 @@ static void igmp_show_interfaces_single(struct pim_instance *pim,
|
||||
? (igmp->mtrace_only ? "mtrace"
|
||||
: "up")
|
||||
: "down");
|
||||
vty_out(vty, "Address : %s\n",
|
||||
inet_ntoa(pim_ifp->primary_address));
|
||||
vty_out(vty, "Address : %pI4\n",
|
||||
&pim_ifp->primary_address);
|
||||
vty_out(vty, "Uptime : %s\n", uptime);
|
||||
vty_out(vty, "Version : %d\n",
|
||||
pim_ifp->igmp_version);
|
||||
@ -940,6 +954,7 @@ static void pim_show_interfaces_single(struct pim_instance *pim,
|
||||
int mloop = 0;
|
||||
int found_ifname = 0;
|
||||
int print_header;
|
||||
char buf[PREFIX_STRLEN];
|
||||
json_object *json = NULL;
|
||||
json_object *json_row = NULL;
|
||||
json_object *json_pim_neighbor = NULL;
|
||||
@ -992,7 +1007,9 @@ static void pim_show_interfaces_single(struct pim_instance *pim,
|
||||
if (pim_ifp->update_source.s_addr != INADDR_ANY) {
|
||||
json_object_string_add(
|
||||
json_row, "useSource",
|
||||
inet_ntoa(pim_ifp->update_source));
|
||||
inet_ntop(AF_INET,
|
||||
&pim_ifp->update_source,
|
||||
buf, sizeof(buf)));
|
||||
}
|
||||
if (pim_ifp->sec_addr_list) {
|
||||
json_object *sec_list = NULL;
|
||||
@ -1160,20 +1177,20 @@ static void pim_show_interfaces_single(struct pim_instance *pim,
|
||||
vty_out(vty, "State : %s\n",
|
||||
if_is_up(ifp) ? "up" : "down");
|
||||
if (pim_ifp->update_source.s_addr != INADDR_ANY) {
|
||||
vty_out(vty, "Use Source : %s\n",
|
||||
inet_ntoa(pim_ifp->update_source));
|
||||
vty_out(vty, "Use Source : %pI4\n",
|
||||
&pim_ifp->update_source);
|
||||
}
|
||||
if (pim_ifp->sec_addr_list) {
|
||||
vty_out(vty, "Address : %s (primary)\n",
|
||||
inet_ntoa(ifaddr));
|
||||
vty_out(vty, "Address : %pI4 (primary)\n",
|
||||
&ifaddr);
|
||||
for (ALL_LIST_ELEMENTS_RO(
|
||||
pim_ifp->sec_addr_list, sec_node,
|
||||
sec_addr))
|
||||
vty_out(vty, " %pFX\n",
|
||||
&sec_addr->addr);
|
||||
} else {
|
||||
vty_out(vty, "Address : %s\n",
|
||||
inet_ntoa(ifaddr));
|
||||
vty_out(vty, "Address : %pI4\n",
|
||||
&ifaddr);
|
||||
}
|
||||
vty_out(vty, "\n");
|
||||
|
||||
@ -1397,6 +1414,7 @@ static void pim_show_interfaces(struct pim_instance *pim, struct vty *vty,
|
||||
int fhr = 0;
|
||||
int pim_nbrs = 0;
|
||||
int pim_ifchannels = 0;
|
||||
char buf[PREFIX_STRLEN];
|
||||
json_object *json = NULL;
|
||||
json_object *json_row = NULL;
|
||||
json_object *json_tmp;
|
||||
@ -1427,7 +1445,9 @@ static void pim_show_interfaces(struct pim_instance *pim, struct vty *vty,
|
||||
json_object_int_add(json_row, "pimIfChannels", pim_ifchannels);
|
||||
json_object_int_add(json_row, "firstHopRouterCount", fhr);
|
||||
json_object_string_add(json_row, "pimDesignatedRouter",
|
||||
inet_ntoa(pim_ifp->pim_dr_addr));
|
||||
inet_ntop(AF_INET,
|
||||
&pim_ifp->pim_dr_addr, buf,
|
||||
sizeof(buf)));
|
||||
|
||||
if (pim_ifp->pim_dr_addr.s_addr
|
||||
== pim_ifp->primary_address.s_addr)
|
||||
@ -1682,6 +1702,7 @@ static void pim_show_join_helper(struct vty *vty, struct pim_interface *pim_ifp,
|
||||
char uptime[10];
|
||||
char expire[10];
|
||||
char prune[10];
|
||||
char buf[PREFIX_STRLEN];
|
||||
|
||||
ifaddr = pim_ifp->primary_address;
|
||||
|
||||
@ -1730,8 +1751,9 @@ static void pim_show_join_helper(struct vty *vty, struct pim_interface *pim_ifp,
|
||||
json_object_object_add(json_grp, ch_src_str, json_row);
|
||||
} else {
|
||||
vty_out(vty, "%-16s %-15s %-15s %-15s %-10s %8s %-6s %5s\n",
|
||||
ch->interface->name, inet_ntoa(ifaddr), ch_src_str,
|
||||
ch_grp_str,
|
||||
ch->interface->name,
|
||||
inet_ntop(AF_INET, &ifaddr, buf, sizeof(buf)),
|
||||
ch_src_str, ch_grp_str,
|
||||
pim_ifchannel_ifjoin_name(ch->ifjoin_state, ch->flags),
|
||||
uptime, expire, prune);
|
||||
}
|
||||
@ -2304,6 +2326,7 @@ static void pim_show_neighbors_secondary(struct pim_instance *pim,
|
||||
struct in_addr ifaddr;
|
||||
struct listnode *neighnode;
|
||||
struct pim_neighbor *neigh;
|
||||
char buf[PREFIX_STRLEN];
|
||||
|
||||
pim_ifp = ifp->info;
|
||||
|
||||
@ -2330,7 +2353,9 @@ static void pim_show_neighbors_secondary(struct pim_instance *pim,
|
||||
for (ALL_LIST_ELEMENTS_RO(neigh->prefix_list,
|
||||
prefix_node, p))
|
||||
vty_out(vty, "%-16s %-15s %-15s %-15pFX\n",
|
||||
ifp->name, inet_ntoa(ifaddr),
|
||||
ifp->name,
|
||||
inet_ntop(AF_INET, &ifaddr,
|
||||
buf, sizeof(buf)),
|
||||
neigh_src_str, p);
|
||||
}
|
||||
}
|
||||
@ -2975,14 +3000,17 @@ static int pim_print_pnc_cache_walkcb(struct hash_bucket *bucket, void *arg)
|
||||
struct nexthop *nh_node = NULL;
|
||||
ifindex_t first_ifindex;
|
||||
struct interface *ifp = NULL;
|
||||
char buf[PREFIX_STRLEN];
|
||||
|
||||
for (nh_node = pnc->nexthop; nh_node; nh_node = nh_node->next) {
|
||||
first_ifindex = nh_node->ifindex;
|
||||
ifp = if_lookup_by_index(first_ifindex, pim->vrf_id);
|
||||
|
||||
vty_out(vty, "%-15s ", inet_ntoa(pnc->rpf.rpf_addr.u.prefix4));
|
||||
vty_out(vty, "%-15s ", inet_ntop(AF_INET,
|
||||
&pnc->rpf.rpf_addr.u.prefix4,
|
||||
buf, sizeof(buf)));
|
||||
vty_out(vty, "%-16s ", ifp ? ifp->name : "NULL");
|
||||
vty_out(vty, "%s ", inet_ntoa(nh_node->gate.ipv4));
|
||||
vty_out(vty, "%pI4 ", &nh_node->gate.ipv4);
|
||||
vty_out(vty, "\n");
|
||||
}
|
||||
return CMD_SUCCESS;
|
||||
@ -5656,6 +5684,7 @@ static void show_multicast_interfaces(struct pim_instance *pim, struct vty *vty,
|
||||
bool uj)
|
||||
{
|
||||
struct interface *ifp;
|
||||
char buf[PREFIX_STRLEN];
|
||||
json_object *json = NULL;
|
||||
json_object *json_row = NULL;
|
||||
|
||||
@ -5696,7 +5725,8 @@ static void show_multicast_interfaces(struct pim_instance *pim, struct vty *vty,
|
||||
if_is_up(ifp) ? "up" : "down");
|
||||
json_object_string_add(
|
||||
json_row, "address",
|
||||
inet_ntoa(pim_ifp->primary_address));
|
||||
inet_ntop(AF_INET, &pim_ifp->primary_address,
|
||||
buf, sizeof(buf)));
|
||||
json_object_int_add(json_row, "ifIndex", ifp->ifindex);
|
||||
json_object_int_add(json_row, "vif",
|
||||
pim_ifp->mroute_vif_index);
|
||||
@ -5712,8 +5742,9 @@ static void show_multicast_interfaces(struct pim_instance *pim, struct vty *vty,
|
||||
} else {
|
||||
vty_out(vty,
|
||||
"%-16s %-15s %3d %3d %7lu %7lu %10lu %10lu\n",
|
||||
ifp->name, inet_ntoa(ifaddr), ifp->ifindex,
|
||||
pim_ifp->mroute_vif_index,
|
||||
ifp->name,
|
||||
inet_ntop(AF_INET, &ifaddr, buf, sizeof(buf)),
|
||||
ifp->ifindex, pim_ifp->mroute_vif_index,
|
||||
(unsigned long)vreq.icount,
|
||||
(unsigned long)vreq.ocount,
|
||||
(unsigned long)vreq.ibytes,
|
||||
|
@ -63,8 +63,8 @@ static int igmp_sock_open(struct in_addr ifaddr, struct interface *ifp,
|
||||
++join;
|
||||
} else {
|
||||
zlog_warn(
|
||||
"%s %s: IGMP socket fd=%d interface %s: could not solve %s to group address: errno=%d: %s",
|
||||
__FILE__, __func__, fd, inet_ntoa(ifaddr),
|
||||
"%s %s: IGMP socket fd=%d interface %pI4: could not solve %s to group address: errno=%d: %s",
|
||||
__FILE__, __func__, fd, &ifaddr,
|
||||
PIM_ALL_ROUTERS, errno, safe_strerror(errno));
|
||||
}
|
||||
}
|
||||
@ -79,8 +79,8 @@ static int igmp_sock_open(struct in_addr ifaddr, struct interface *ifp,
|
||||
++join;
|
||||
} else {
|
||||
zlog_warn(
|
||||
"%s %s: IGMP socket fd=%d interface %s: could not solve %s to group address: errno=%d: %s",
|
||||
__FILE__, __func__, fd, inet_ntoa(ifaddr),
|
||||
"%s %s: IGMP socket fd=%d interface %pI4: could not solve %s to group address: errno=%d: %s",
|
||||
__FILE__, __func__, fd, &ifaddr,
|
||||
PIM_ALL_SYSTEMS, errno, safe_strerror(errno));
|
||||
}
|
||||
|
||||
@ -90,16 +90,16 @@ static int igmp_sock_open(struct in_addr ifaddr, struct interface *ifp,
|
||||
}
|
||||
} else {
|
||||
zlog_warn(
|
||||
"%s %s: IGMP socket fd=%d interface %s: could not solve %s to group address: errno=%d: %s",
|
||||
__FILE__, __func__, fd, inet_ntoa(ifaddr),
|
||||
"%s %s: IGMP socket fd=%d interface %pI4: could not solve %s to group address: errno=%d: %s",
|
||||
__FILE__, __func__, fd, &ifaddr,
|
||||
PIM_ALL_IGMP_ROUTERS, errno, safe_strerror(errno));
|
||||
}
|
||||
|
||||
if (!join) {
|
||||
flog_err_sys(
|
||||
EC_LIB_SOCKET,
|
||||
"IGMP socket fd=%d could not join any group on interface address %s",
|
||||
fd, inet_ntoa(ifaddr));
|
||||
"IGMP socket fd=%d could not join any group on interface address %pI4",
|
||||
fd, &ifaddr);
|
||||
close(fd);
|
||||
fd = -1;
|
||||
}
|
||||
@ -117,8 +117,8 @@ static void igmp_sock_dump(array_t *igmp_sock_array)
|
||||
|
||||
struct igmp_sock *igmp = array_get(igmp_sock_array, i);
|
||||
|
||||
zlog_debug("%s %s: [%d/%d] igmp_addr=%s fd=%d", __FILE__,
|
||||
__func__, i, size, inet_ntoa(igmp->ifaddr),
|
||||
zlog_debug("%s %s: [%d/%d] igmp_addr=%pI4 fd=%d", __FILE__,
|
||||
__func__, i, size, &igmp->ifaddr,
|
||||
igmp->fd);
|
||||
}
|
||||
}
|
||||
@ -701,8 +701,8 @@ static void sock_close(struct igmp_sock *igmp)
|
||||
if (PIM_DEBUG_IGMP_TRACE_DETAIL) {
|
||||
if (igmp->t_igmp_read) {
|
||||
zlog_debug(
|
||||
"Cancelling READ event on IGMP socket %s fd=%d on interface %s",
|
||||
inet_ntoa(igmp->ifaddr), igmp->fd,
|
||||
"Cancelling READ event on IGMP socket %pI4 fd=%d on interface %s",
|
||||
&igmp->ifaddr, igmp->fd,
|
||||
igmp->interface->name);
|
||||
}
|
||||
}
|
||||
@ -711,14 +711,14 @@ static void sock_close(struct igmp_sock *igmp)
|
||||
if (close(igmp->fd)) {
|
||||
flog_err(
|
||||
EC_LIB_SOCKET,
|
||||
"Failure closing IGMP socket %s fd=%d on interface %s: errno=%d: %s",
|
||||
inet_ntoa(igmp->ifaddr), igmp->fd,
|
||||
"Failure closing IGMP socket %pI4 fd=%d on interface %s: errno=%d: %s",
|
||||
&igmp->ifaddr, igmp->fd,
|
||||
igmp->interface->name, errno, safe_strerror(errno));
|
||||
}
|
||||
|
||||
if (PIM_DEBUG_IGMP_TRACE_DETAIL) {
|
||||
zlog_debug("Deleted IGMP socket %s fd=%d on interface %s",
|
||||
inet_ntoa(igmp->ifaddr), igmp->fd,
|
||||
zlog_debug("Deleted IGMP socket %pI4 fd=%d on interface %s",
|
||||
&igmp->ifaddr, igmp->fd,
|
||||
igmp->interface->name);
|
||||
}
|
||||
}
|
||||
@ -900,8 +900,8 @@ static struct igmp_sock *igmp_sock_new(int fd, struct in_addr ifaddr,
|
||||
|
||||
if (PIM_DEBUG_IGMP_TRACE) {
|
||||
zlog_debug(
|
||||
"Creating IGMP socket fd=%d for address %s on interface %s",
|
||||
fd, inet_ntoa(ifaddr), ifp->name);
|
||||
"Creating IGMP socket fd=%d for address %pI4 on interface %s",
|
||||
fd, &ifaddr, ifp->name);
|
||||
}
|
||||
|
||||
igmp = XCALLOC(MTYPE_PIM_IGMP_SOCKET, sizeof(*igmp));
|
||||
@ -1000,8 +1000,8 @@ struct igmp_sock *pim_igmp_sock_add(struct list *igmp_sock_list,
|
||||
|
||||
fd = igmp_sock_open(ifaddr, ifp, pim_ifp->options);
|
||||
if (fd < 0) {
|
||||
zlog_warn("Could not open IGMP socket for %s on %s",
|
||||
inet_ntoa(ifaddr), ifp->name);
|
||||
zlog_warn("Could not open IGMP socket for %pI4 on %s",
|
||||
&ifaddr, ifp->name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -1009,8 +1009,8 @@ struct igmp_sock *pim_igmp_sock_add(struct list *igmp_sock_list,
|
||||
sin.sin_addr = ifaddr;
|
||||
sin.sin_port = 0;
|
||||
if (bind(fd, (struct sockaddr *) &sin, sizeof(sin)) != 0) {
|
||||
zlog_warn("Could not bind IGMP socket for %s on %s",
|
||||
inet_ntoa(ifaddr), ifp->name);
|
||||
zlog_warn("Could not bind IGMP socket for %pI4 on %s",
|
||||
&ifaddr, ifp->name);
|
||||
close(fd);
|
||||
|
||||
return NULL;
|
||||
@ -1153,8 +1153,8 @@ struct igmp_group *igmp_add_group_by_addr(struct igmp_sock *igmp,
|
||||
if (pim_is_group_224_0_0_0_24(group_addr)) {
|
||||
if (PIM_DEBUG_IGMP_TRACE)
|
||||
zlog_debug(
|
||||
"%s: Group specified %s is part of 224.0.0.0/24",
|
||||
__func__, inet_ntoa(group_addr));
|
||||
"%s: Group specified %pI4 is part of 224.0.0.0/24",
|
||||
__func__, &group_addr);
|
||||
return NULL;
|
||||
}
|
||||
/*
|
||||
|
@ -447,8 +447,8 @@ static int mtrace_un_forward_packet(struct pim_instance *pim, struct ip *ip_hdr,
|
||||
}
|
||||
|
||||
if (PIM_DEBUG_MTRACE) {
|
||||
zlog_debug("Fwd mtrace packet len=%u to %s ttl=%u",
|
||||
ntohs(ip_hdr->ip_len), inet_ntoa(ip_hdr->ip_dst),
|
||||
zlog_debug("Fwd mtrace packet len=%u to %pI4 ttl=%u",
|
||||
ntohs(ip_hdr->ip_len), &ip_hdr->ip_dst,
|
||||
ip_hdr->ip_ttl);
|
||||
}
|
||||
|
||||
@ -472,9 +472,9 @@ static int mtrace_mc_forward_packet(struct pim_instance *pim, struct ip *ip_hdr)
|
||||
if (c_oil == NULL) {
|
||||
if (PIM_DEBUG_MTRACE) {
|
||||
zlog_debug(
|
||||
"Dropping mtrace multicast packet len=%u to %s ttl=%u",
|
||||
"Dropping mtrace multicast packet len=%u to %pI4 ttl=%u",
|
||||
ntohs(ip_hdr->ip_len),
|
||||
inet_ntoa(ip_hdr->ip_dst), ip_hdr->ip_ttl);
|
||||
&ip_hdr->ip_dst, ip_hdr->ip_ttl);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
@ -523,9 +523,9 @@ static int mtrace_send_mc_response(struct pim_instance *pim,
|
||||
if (c_oil == NULL) {
|
||||
if (PIM_DEBUG_MTRACE) {
|
||||
zlog_debug(
|
||||
"Dropping mtrace multicast response packet len=%u to %s",
|
||||
"Dropping mtrace multicast response packet len=%u to %pI4",
|
||||
(unsigned int)mtrace_len,
|
||||
inet_ntoa(mtracep->rsp_addr));
|
||||
&mtracep->rsp_addr);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
@ -716,8 +716,8 @@ int igmp_mtrace_recv_qry_req(struct igmp_sock *igmp, struct ip *ip_hdr,
|
||||
&& !IPV4_MC_LINKLOCAL(ntohl(ip_hdr->ip_dst.s_addr))) {
|
||||
if (PIM_DEBUG_MTRACE)
|
||||
zlog_warn(
|
||||
"Recv mtrace packet from %s on %s: not link-local multicast %s",
|
||||
from_str, ifp->name, inet_ntoa(ip_hdr->ip_dst));
|
||||
"Recv mtrace packet from %s on %s: not link-local multicast %pI4",
|
||||
from_str, ifp->name, &ip_hdr->ip_dst);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1921,10 +1921,10 @@ int igmp_v3_recv_report(struct igmp_sock *igmp, struct in_addr from,
|
||||
|
||||
if (PIM_DEBUG_IGMP_PACKETS) {
|
||||
zlog_debug(
|
||||
" Recv IGMP report v3 from %s on %s: record=%d type=%d auxdatalen=%d sources=%d group=%s",
|
||||
" Recv IGMP report v3 from %s on %s: record=%d type=%d auxdatalen=%d sources=%d group=%pI4",
|
||||
from_str, ifp->name, i, rec_type,
|
||||
rec_auxdatalen, rec_num_sources,
|
||||
inet_ntoa(rec_group));
|
||||
&rec_group);
|
||||
}
|
||||
|
||||
/* Scan sources */
|
||||
@ -1949,9 +1949,9 @@ int igmp_v3_recv_report(struct igmp_sock *igmp, struct in_addr from,
|
||||
"<source?>");
|
||||
|
||||
zlog_debug(
|
||||
" Recv IGMP report v3 from %s on %s: record=%d group=%s source=%s",
|
||||
" Recv IGMP report v3 from %s on %s: record=%d group=%pI4 source=%s",
|
||||
from_str, ifp->name, i,
|
||||
inet_ntoa(rec_group), src_str);
|
||||
&rec_group, src_str);
|
||||
}
|
||||
} /* for (sources) */
|
||||
|
||||
@ -1969,8 +1969,8 @@ int igmp_v3_recv_report(struct igmp_sock *igmp, struct in_addr from,
|
||||
|
||||
if (PIM_DEBUG_IGMP_PACKETS && filtered)
|
||||
zlog_debug(
|
||||
"Filtering IGMPv3 group record %s from %s on %s per prefix-list %s",
|
||||
inet_ntoa(rec_group), from_str, ifp->name,
|
||||
"Filtering IGMPv3 group record %pI4 from %s on %s per prefix-list %s",
|
||||
&rec_group, from_str, ifp->name,
|
||||
pim_ifp->boundary_oil_plist);
|
||||
|
||||
/*
|
||||
|
@ -810,9 +810,9 @@ int pim_parse_nexthop_update(ZAPI_CALLBACK_ARGS)
|
||||
|
||||
if (PIM_DEBUG_PIM_NHT)
|
||||
zlog_debug(
|
||||
"%s: NHT addr %pFX(%s) %d-nhop via %s(%s) type %d distance:%u metric:%u ",
|
||||
"%s: NHT addr %pFX(%s) %d-nhop via %pI4(%s) type %d distance:%u metric:%u ",
|
||||
__func__, &nhr.prefix, pim->vrf->name,
|
||||
i + 1, inet_ntoa(nexthop->gate.ipv4),
|
||||
i + 1, &nexthop->gate.ipv4,
|
||||
ifp->name, nexthop->type, nhr.distance,
|
||||
nhr.metric);
|
||||
|
||||
|
@ -75,8 +75,8 @@ void pim_register_stop_send(struct interface *ifp, struct prefix_sg *sg,
|
||||
struct prefix p;
|
||||
|
||||
if (PIM_DEBUG_PIM_REG) {
|
||||
zlog_debug("Sending Register stop for %s to %s on %s",
|
||||
pim_str_sg_dump(sg), inet_ntoa(originator),
|
||||
zlog_debug("Sending Register stop for %s to %pI4 on %s",
|
||||
pim_str_sg_dump(sg), &originator,
|
||||
ifp->name);
|
||||
}
|
||||
|
||||
@ -170,9 +170,9 @@ void pim_register_send(const uint8_t *buf, int buf_size, struct in_addr src,
|
||||
struct interface *ifp;
|
||||
|
||||
if (PIM_DEBUG_PIM_REG) {
|
||||
zlog_debug("Sending %s %sRegister Packet to %s", up->sg_str,
|
||||
zlog_debug("Sending %s %sRegister Packet to %pI4", up->sg_str,
|
||||
null_register ? "NULL " : "",
|
||||
inet_ntoa(rpg->rpf_addr.u.prefix4));
|
||||
&rpg->rpf_addr.u.prefix4);
|
||||
}
|
||||
|
||||
ifp = rpg->source_nexthop.interface;
|
||||
@ -192,12 +192,9 @@ void pim_register_send(const uint8_t *buf, int buf_size, struct in_addr src,
|
||||
}
|
||||
|
||||
if (PIM_DEBUG_PIM_REG) {
|
||||
char rp_str[INET_ADDRSTRLEN];
|
||||
strlcpy(rp_str, inet_ntoa(rpg->rpf_addr.u.prefix4),
|
||||
sizeof(rp_str));
|
||||
zlog_debug("%s: Sending %s %sRegister Packet to %s on %s",
|
||||
zlog_debug("%s: Sending %s %sRegister Packet to %pI4 on %s",
|
||||
__func__, up->sg_str, null_register ? "NULL " : "",
|
||||
rp_str, ifp->name);
|
||||
&rpg->rpf_addr.u.prefix4, ifp->name);
|
||||
}
|
||||
|
||||
memset(buffer, 0, 10000);
|
||||
|
@ -350,8 +350,8 @@ void pim_upstream_update(struct pim_instance *pim, struct pim_upstream *up)
|
||||
up->sg.grp);
|
||||
|
||||
if (PIM_DEBUG_PIM_TRACE)
|
||||
zlog_debug("%s: pim upstream update for old upstream %s",
|
||||
__func__, inet_ntoa(old_upstream_addr));
|
||||
zlog_debug("%s: pim upstream update for old upstream %pI4",
|
||||
__func__, &old_upstream_addr);
|
||||
|
||||
if (old_upstream_addr.s_addr == new_upstream_addr.s_addr)
|
||||
return;
|
||||
@ -1204,6 +1204,7 @@ void pim_rp_show_information(struct pim_instance *pim, struct vty *vty, bool uj)
|
||||
struct rp_info *prev_rp_info = NULL;
|
||||
struct listnode *node;
|
||||
char source[7];
|
||||
char buf[PREFIX_STRLEN];
|
||||
|
||||
json_object *json = NULL;
|
||||
json_object *json_rp_rows = NULL;
|
||||
@ -1236,9 +1237,11 @@ void pim_rp_show_information(struct pim_instance *pim, struct vty *vty, bool uj)
|
||||
.s_addr) {
|
||||
json_object_object_add(
|
||||
json,
|
||||
inet_ntoa(prev_rp_info->rp
|
||||
inet_ntop(AF_INET,
|
||||
&prev_rp_info->rp
|
||||
.rpf_addr.u
|
||||
.prefix4),
|
||||
.prefix4,
|
||||
buf, sizeof(buf)),
|
||||
json_rp_rows);
|
||||
json_rp_rows = NULL;
|
||||
}
|
||||
@ -1249,8 +1252,10 @@ void pim_rp_show_information(struct pim_instance *pim, struct vty *vty, bool uj)
|
||||
json_row = json_object_new_object();
|
||||
json_object_string_add(
|
||||
json_row, "rpAddress",
|
||||
inet_ntoa(rp_info->rp.rpf_addr.u
|
||||
.prefix4));
|
||||
inet_ntop(AF_INET,
|
||||
&rp_info->rp.rpf_addr.u
|
||||
.prefix4,
|
||||
buf, sizeof(buf)));
|
||||
if (rp_info->rp.source_nexthop.interface)
|
||||
json_object_string_add(
|
||||
json_row, "outboundInterface",
|
||||
@ -1282,8 +1287,10 @@ void pim_rp_show_information(struct pim_instance *pim, struct vty *vty, bool uj)
|
||||
json_object_array_add(json_rp_rows, json_row);
|
||||
} else {
|
||||
vty_out(vty, "%-15s ",
|
||||
inet_ntoa(rp_info->rp.rpf_addr.u
|
||||
.prefix4));
|
||||
inet_ntop(AF_INET,
|
||||
&rp_info->rp.rpf_addr.u
|
||||
.prefix4,
|
||||
buf, sizeof(buf)));
|
||||
|
||||
if (rp_info->plist)
|
||||
vty_out(vty, "%-18s ", rp_info->plist);
|
||||
@ -1313,7 +1320,9 @@ void pim_rp_show_information(struct pim_instance *pim, struct vty *vty, bool uj)
|
||||
if (prev_rp_info && json_rp_rows)
|
||||
json_object_object_add(
|
||||
json,
|
||||
inet_ntoa(prev_rp_info->rp.rpf_addr.u.prefix4),
|
||||
inet_ntop(AF_INET,
|
||||
&prev_rp_info->rp.rpf_addr.u.prefix4,
|
||||
buf, sizeof(buf)),
|
||||
json_rp_rows);
|
||||
|
||||
vty_out(vty, "%s\n", json_object_to_json_string_ext(
|
||||
|
@ -951,8 +951,8 @@ static struct pim_upstream *pim_upstream_new(struct pim_instance *pim,
|
||||
|
||||
if (PIM_DEBUG_PIM_TRACE) {
|
||||
zlog_debug(
|
||||
"%s: Created Upstream %s upstream_addr %s ref count %d increment",
|
||||
__func__, up->sg_str, inet_ntoa(up->upstream_addr),
|
||||
"%s: Created Upstream %s upstream_addr %pI4 ref count %d increment",
|
||||
__func__, up->sg_str, &up->upstream_addr,
|
||||
up->ref_count);
|
||||
}
|
||||
|
||||
|
@ -98,8 +98,8 @@ static void dump_if_address(struct interface *ifp)
|
||||
if (p->family != AF_INET)
|
||||
continue;
|
||||
|
||||
zlog_debug("%s %s: interface %s address %s %s", __FILE__,
|
||||
__func__, ifp->name, inet_ntoa(p->u.prefix4),
|
||||
zlog_debug("%s %s: interface %s address %pI4 %s", __FILE__,
|
||||
__func__, ifp->name, &p->u.prefix4,
|
||||
CHECK_FLAG(ifc->flags, ZEBRA_IFA_SECONDARY)
|
||||
? "secondary"
|
||||
: "primary");
|
||||
@ -837,9 +837,9 @@ void pim_forward_start(struct pim_ifchannel *ch)
|
||||
sizeof(group_str));
|
||||
pim_inet4_dump("<upstream?>", up->upstream_addr, upstream_str,
|
||||
sizeof(upstream_str));
|
||||
zlog_debug("%s: (S,G)=(%s,%s) oif=%s (%s)", __func__,
|
||||
zlog_debug("%s: (S,G)=(%s,%s) oif=%s (%pI4)", __func__,
|
||||
source_str, group_str, ch->interface->name,
|
||||
inet_ntoa(up->upstream_addr));
|
||||
&up->upstream_addr);
|
||||
}
|
||||
|
||||
if (PIM_IF_FLAG_TEST_PROTO_IGMP(ch->flags))
|
||||
|
Loading…
Reference in New Issue
Block a user