KTR: log IPv4 addresses in hex rather than dotted-quad

When I made the changes in r313821, I fell victim to one of the
classic blunders, the most famous of which is: never get involved
in a land war in Asia.  But only slightly less well known is this:
Keep your brain turned on and engaged when making a tedious, sweeping,
mechanical change.  KTR can correctly log the immediate integral values
passed to it, as well as constant strings, but not non-constant strings,
since they might change by the time ktrdump retrieves them.

Reported by:	glebius
MFC after:	3 days
Sponsored by:	Dell EMC
This commit is contained in:
Eric van Gyzen 2017-03-14 18:27:48 +00:00
parent f490b9b3bf
commit 47d803ea71
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=315277
4 changed files with 99 additions and 209 deletions

View File

@ -1461,9 +1461,6 @@ static void
process_data(struct iwch_ep *ep)
{
struct sockaddr_in *local, *remote;
#ifdef KTR
char local_str[INET_ADDRSTRLEN], remote_str[INET_ADDRSTRLEN];
#endif
CTR4(KTR_IW_CXGB, "%s ep %p so %p state %s", __FUNCTION__, ep, ep->com.so, states[ep->com.state]);
@ -1481,9 +1478,8 @@ process_data(struct iwch_ep *ep)
*/
in_getsockaddr(ep->com.so, (struct sockaddr **)&local);
in_getpeeraddr(ep->com.so, (struct sockaddr **)&remote);
CTR3(KTR_IW_CXGB, "%s local %s remote %s", __FUNCTION__,
inet_ntoa_r(local->sin_addr, local_str),
inet_ntoa_r(remote->sin_addr, remote_str));
CTR3(KTR_IW_CXGB, "%s local 0x%08x remote 0x%08x", __FUNCTION__,
local->sin_addr.s_addr, remote->sin_addr.s_addr);
ep->com.local_addr = *local;
ep->com.remote_addr = *remote;
free(local, M_SONAME);
@ -1522,9 +1518,6 @@ process_newconn(struct iw_cm_id *parent_cm_id, struct socket *child_so)
struct sockaddr_in *local;
struct sockaddr_in *remote;
struct iwch_ep *parent_ep = parent_cm_id->provider_data;
#ifdef KTR
char buf[INET_ADDRSTRLEN];
#endif
CTR3(KTR_IW_CXGB, "%s parent ep %p so %p", __FUNCTION__, parent_ep, parent_ep->com.so);
if (!child_so) {
@ -1544,8 +1537,8 @@ process_newconn(struct iw_cm_id *parent_cm_id, struct socket *child_so)
in_getsockaddr(child_so, (struct sockaddr **)&local);
in_getpeeraddr(child_so, (struct sockaddr **)&remote);
CTR3(KTR_IW_CXGB, "%s remote addr %s port %d", __FUNCTION__,
inet_ntoa_r(remote->sin_addr, buf), ntohs(remote->sin_port));
CTR3(KTR_IW_CXGB, "%s remote addr 0x%08x port %d", __FUNCTION__,
remote->sin_addr.s_addr, ntohs(remote->sin_port));
child_ep->com.tdev = parent_ep->com.tdev;
child_ep->com.local_addr.sin_family = parent_ep->com.local_addr.sin_family;
child_ep->com.local_addr.sin_port = parent_ep->com.local_addr.sin_port;

View File

@ -312,17 +312,6 @@ igmp_scrub_context(struct mbuf *m)
m->m_pkthdr.flowid = 0;
}
#ifdef KTR
static __inline char *
inet_ntoa_haddr(in_addr_t haddr, char *addrbuf)
{
struct in_addr ia;
ia.s_addr = htonl(haddr);
return (inet_ntoa_r(ia, addrbuf));
}
#endif
/*
* Restore context from a queued IGMP output chain.
* Return saved ifindex.
@ -804,9 +793,6 @@ igmp_input_v2_query(struct ifnet *ifp, const struct ip *ip,
struct in_multi *inm;
int is_general_query;
uint16_t timer;
#ifdef KTR
char addrbuf[INET_ADDRSTRLEN];
#endif
is_general_query = 0;
@ -875,9 +861,9 @@ igmp_input_v2_query(struct ifnet *ifp, const struct ip *ip,
*/
inm = inm_lookup(ifp, igmp->igmp_group);
if (inm != NULL) {
CTR3(KTR_IGMPV3, "process v2 query %s on ifp %p(%s)",
inet_ntoa_r(igmp->igmp_group, addrbuf), ifp,
ifp->if_xname);
CTR3(KTR_IGMPV3,
"process v2 query 0x%08x on ifp %p(%s)",
igmp->igmp_group.s_addr, ifp, ifp->if_xname);
igmp_v2_update_group(inm, timer);
}
}
@ -907,12 +893,9 @@ igmp_input_v2_query(struct ifnet *ifp, const struct ip *ip,
static void
igmp_v2_update_group(struct in_multi *inm, const int timer)
{
#ifdef KTR
char addrbuf[INET_ADDRSTRLEN];
#endif
CTR4(KTR_IGMPV3, "%s: %s/%s timer=%d", __func__,
inet_ntoa_r(inm->inm_addr, addrbuf), inm->inm_ifp->if_xname, timer);
CTR4(KTR_IGMPV3, "0x%08x: %s/%s timer=%d", __func__,
inm->inm_addr.s_addr, inm->inm_ifp->if_xname, timer);
IN_MULTI_LOCK_ASSERT();
@ -963,9 +946,6 @@ igmp_input_v3_query(struct ifnet *ifp, const struct ip *ip,
uint32_t maxresp, nsrc, qqi;
uint16_t timer;
uint8_t qrv;
#ifdef KTR
char addrbuf[INET_ADDRSTRLEN];
#endif
is_general_query = 0;
@ -1095,9 +1075,8 @@ igmp_input_v3_query(struct ifnet *ifp, const struct ip *ip,
goto out_locked;
}
}
CTR3(KTR_IGMPV3, "process v3 %s query on ifp %p(%s)",
inet_ntoa_r(igmpv3->igmp_group, addrbuf), ifp,
ifp->if_xname);
CTR3(KTR_IGMPV3, "process v3 0x%08x query on ifp %p(%s)",
igmpv3->igmp_group.s_addr, ifp, ifp->if_xname);
/*
* If there is a pending General Query response
* scheduled sooner than the selected delay, no
@ -1230,9 +1209,6 @@ igmp_input_v1_report(struct ifnet *ifp, /*const*/ struct ip *ip,
struct rm_priotracker in_ifa_tracker;
struct in_ifaddr *ia;
struct in_multi *inm;
#ifdef KTR
char addrbuf[INET_ADDRSTRLEN];
#endif
IGMPSTAT_INC(igps_rcv_reports);
@ -1260,8 +1236,8 @@ igmp_input_v1_report(struct ifnet *ifp, /*const*/ struct ip *ip,
}
}
CTR3(KTR_IGMPV3, "process v1 report %s on ifp %p(%s)",
inet_ntoa_r(igmp->igmp_group, addrbuf), ifp, ifp->if_xname);
CTR3(KTR_IGMPV3, "process v1 report 0x%08x on ifp %p(%s)",
igmp->igmp_group.s_addr, ifp, ifp->if_xname);
/*
* IGMPv1 report suppression.
@ -1303,16 +1279,16 @@ igmp_input_v1_report(struct ifnet *ifp, /*const*/ struct ip *ip,
case IGMP_LAZY_MEMBER:
case IGMP_AWAKENING_MEMBER:
CTR3(KTR_IGMPV3,
"report suppressed for %s on ifp %p(%s)",
inet_ntoa_r(igmp->igmp_group, addrbuf), ifp,
"report suppressed for 0x%08x on ifp %p(%s)",
igmp->igmp_group.s_addr, ifp,
ifp->if_xname);
case IGMP_SLEEPING_MEMBER:
inm->inm_state = IGMP_SLEEPING_MEMBER;
break;
case IGMP_REPORTING_MEMBER:
CTR3(KTR_IGMPV3,
"report suppressed for %s on ifp %p(%s)",
inet_ntoa_r(igmp->igmp_group, addrbuf), ifp,
"report suppressed for 0x%08x on ifp %p(%s)",
igmp->igmp_group.s_addr, ifp,
ifp->if_xname);
if (igi->igi_version == IGMP_VERSION_1)
inm->inm_state = IGMP_LAZY_MEMBER;
@ -1344,9 +1320,6 @@ igmp_input_v2_report(struct ifnet *ifp, /*const*/ struct ip *ip,
struct rm_priotracker in_ifa_tracker;
struct in_ifaddr *ia;
struct in_multi *inm;
#ifdef KTR
char addrbuf[INET_ADDRSTRLEN];
#endif
/*
* Make sure we don't hear our own membership report. Fast
@ -1389,8 +1362,8 @@ igmp_input_v2_report(struct ifnet *ifp, /*const*/ struct ip *ip,
if (ia != NULL)
ifa_free(&ia->ia_ifa);
CTR3(KTR_IGMPV3, "process v2 report %s on ifp %p(%s)",
inet_ntoa_r(igmp->igmp_group, addrbuf), ifp, ifp->if_xname);
CTR3(KTR_IGMPV3, "process v2 report 0x%08x on ifp %p(%s)",
igmp->igmp_group.s_addr, ifp, ifp->if_xname);
/*
* IGMPv2 report suppression.
@ -1430,9 +1403,8 @@ igmp_input_v2_report(struct ifnet *ifp, /*const*/ struct ip *ip,
case IGMP_IDLE_MEMBER:
case IGMP_AWAKENING_MEMBER:
CTR3(KTR_IGMPV3,
"report suppressed for %s on ifp %p(%s)",
inet_ntoa_r(igmp->igmp_group, addrbuf), ifp,
ifp->if_xname);
"report suppressed for 0x%08x on ifp %p(%s)",
igmp->igmp_group.s_addr, ifp, ifp->if_xname);
case IGMP_LAZY_MEMBER:
inm->inm_state = IGMP_LAZY_MEMBER;
break;
@ -1834,9 +1806,6 @@ igmp_v3_process_group_timers(struct igmp_ifsoftc *igi,
{
int query_response_timer_expired;
int state_change_retransmit_timer_expired;
#ifdef KTR
char addrbuf[INET_ADDRSTRLEN];
#endif
IN_MULTI_LOCK_ASSERT();
IGMP_LOCK_ASSERT();
@ -1922,9 +1891,8 @@ igmp_v3_process_group_timers(struct igmp_ifsoftc *igi,
(void)igmp_v3_merge_state_changes(inm, scq);
inm_commit(inm);
CTR3(KTR_IGMPV3, "%s: T1 -> T0 for %s/%s", __func__,
inet_ntoa_r(inm->inm_addr, addrbuf),
inm->inm_ifp->if_xname);
CTR3(KTR_IGMPV3, "%s: T1 -> T0 for 0x%08x/%s", __func__,
inm->inm_addr.s_addr, inm->inm_ifp->if_xname);
/*
* If we are leaving the group for good, make sure
@ -2370,13 +2338,9 @@ igmp_initial_join(struct in_multi *inm, struct igmp_ifsoftc *igi)
struct ifnet *ifp;
struct mbufq *mq;
int error, retval, syncstates;
#ifdef KTR
char addrbuf[INET_ADDRSTRLEN];
#endif
CTR4(KTR_IGMPV3, "%s: initial join %s on ifp %p(%s)",
__func__, inet_ntoa_r(inm->inm_addr, addrbuf), inm->inm_ifp,
inm->inm_ifp->if_xname);
CTR4(KTR_IGMPV3, "%s: initial join 0x%08x on ifp %p(%s)", __func__,
inm->inm_addr.s_addr, inm->inm_ifp, inm->inm_ifp->if_xname);
error = 0;
syncstates = 1;
@ -2485,9 +2449,8 @@ igmp_initial_join(struct in_multi *inm, struct igmp_ifsoftc *igi)
*/
if (syncstates) {
inm_commit(inm);
CTR3(KTR_IGMPV3, "%s: T1 -> T0 for %s/%s", __func__,
inet_ntoa_r(inm->inm_addr, addrbuf),
inm->inm_ifp->if_xname);
CTR3(KTR_IGMPV3, "%s: T1 -> T0 for 0x%08x/%s", __func__,
inm->inm_addr.s_addr, inm->inm_ifp->if_xname);
}
return (error);
@ -2501,13 +2464,9 @@ igmp_handle_state_change(struct in_multi *inm, struct igmp_ifsoftc *igi)
{
struct ifnet *ifp;
int retval;
#ifdef KTR
char addrbuf[INET_ADDRSTRLEN];
#endif
CTR4(KTR_IGMPV3, "%s: state change for %s on ifp %p(%s)",
__func__, inet_ntoa_r(inm->inm_addr, addrbuf), inm->inm_ifp,
inm->inm_ifp->if_xname);
CTR4(KTR_IGMPV3, "%s: state change for 0x%08x on ifp %p(%s)", __func__,
inm->inm_addr.s_addr, inm->inm_ifp, inm->inm_ifp->if_xname);
ifp = inm->inm_ifp;
@ -2526,9 +2485,8 @@ igmp_handle_state_change(struct in_multi *inm, struct igmp_ifsoftc *igi)
}
CTR1(KTR_IGMPV3, "%s: nothing to do", __func__);
inm_commit(inm);
CTR3(KTR_IGMPV3, "%s: T1 -> T0 for %s/%s", __func__,
inet_ntoa_r(inm->inm_addr, addrbuf),
inm->inm_ifp->if_xname);
CTR3(KTR_IGMPV3, "%s: T1 -> T0 for 0x%08x/%s", __func__,
inm->inm_addr.s_addr, inm->inm_ifp->if_xname);
return (0);
}
@ -2563,14 +2521,11 @@ static void
igmp_final_leave(struct in_multi *inm, struct igmp_ifsoftc *igi)
{
int syncstates;
#ifdef KTR
char addrbuf[INET_ADDRSTRLEN];
#endif
syncstates = 1;
CTR4(KTR_IGMPV3, "%s: final leave %s on ifp %p(%s)",
__func__, inet_ntoa_r(inm->inm_addr, addrbuf), inm->inm_ifp,
CTR4(KTR_IGMPV3, "%s: final leave 0x%08x on ifp %p(%s)",
__func__, inm->inm_addr.s_addr, inm->inm_ifp,
inm->inm_ifp->if_xname);
IN_MULTI_LOCK_ASSERT();
@ -2611,9 +2566,9 @@ igmp_final_leave(struct in_multi *inm, struct igmp_ifsoftc *igi)
} else {
inm->inm_scrv = igi->igi_rv;
}
CTR4(KTR_IGMPV3, "%s: Leaving %s/%s with %d "
CTR4(KTR_IGMPV3, "%s: Leaving 0x%08x/%s with %d "
"pending retransmissions.", __func__,
inet_ntoa_r(inm->inm_addr, addrbuf),
inm->inm_addr.s_addr,
inm->inm_ifp->if_xname, inm->inm_scrv);
if (inm->inm_scrv == 0) {
inm->inm_state = IGMP_NOT_MEMBER;
@ -2646,13 +2601,11 @@ igmp_final_leave(struct in_multi *inm, struct igmp_ifsoftc *igi)
if (syncstates) {
inm_commit(inm);
CTR3(KTR_IGMPV3, "%s: T1 -> T0 for %s/%s", __func__,
inet_ntoa_r(inm->inm_addr, addrbuf),
inm->inm_ifp->if_xname);
CTR3(KTR_IGMPV3, "%s: T1 -> T0 for 0x%08x/%s", __func__,
inm->inm_addr.s_addr, inm->inm_ifp->if_xname);
inm->inm_st[1].iss_fmode = MCAST_UNDEFINED;
CTR3(KTR_IGMPV3, "%s: T1 now MCAST_UNDEFINED for %s/%s",
__func__, inet_ntoa_r(inm->inm_addr, addrbuf),
inm->inm_ifp->if_xname);
CTR3(KTR_IGMPV3, "%s: T1 now MCAST_UNDEFINED for 0x%08x/%s",
__func__, inm->inm_addr.s_addr, inm->inm_ifp->if_xname);
}
}
@ -2700,9 +2653,6 @@ igmp_v3_enqueue_group_record(struct mbufq *mq, struct in_multi *inm,
int type;
in_addr_t naddr;
uint8_t mode;
#ifdef KTR
char addrbuf[INET_ADDRSTRLEN];
#endif
IN_MULTI_LOCK_ASSERT();
@ -2780,9 +2730,8 @@ igmp_v3_enqueue_group_record(struct mbufq *mq, struct in_multi *inm,
return (igmp_v3_enqueue_filter_change(mq, inm));
if (type == IGMP_DO_NOTHING) {
CTR3(KTR_IGMPV3, "%s: nothing to do for %s/%s",
__func__, inet_ntoa_r(inm->inm_addr, addrbuf),
inm->inm_ifp->if_xname);
CTR3(KTR_IGMPV3, "%s: nothing to do for 0x%08x/%s", __func__,
inm->inm_addr.s_addr, inm->inm_ifp->if_xname);
return (0);
}
@ -2795,8 +2744,8 @@ igmp_v3_enqueue_group_record(struct mbufq *mq, struct in_multi *inm,
if (record_has_sources)
minrec0len += sizeof(in_addr_t);
CTR4(KTR_IGMPV3, "%s: queueing %s for %s/%s", __func__,
igmp_rec_type_to_str(type), inet_ntoa_r(inm->inm_addr, addrbuf),
CTR4(KTR_IGMPV3, "%s: queueing %s for 0x%08x/%s", __func__,
igmp_rec_type_to_str(type), inm->inm_addr.s_addr,
inm->inm_ifp->if_xname);
/*
@ -2884,8 +2833,8 @@ igmp_v3_enqueue_group_record(struct mbufq *mq, struct in_multi *inm,
}
msrcs = 0;
RB_FOREACH_SAFE(ims, ip_msource_tree, &inm->inm_srcs, nims) {
CTR2(KTR_IGMPV3, "%s: visit node %s", __func__,
inet_ntoa_haddr(ims->ims_haddr, addrbuf));
CTR2(KTR_IGMPV3, "%s: visit node 0x%08x", __func__,
htonl(ims->ims_haddr));
now = ims_get_mode(inm, ims, 1);
CTR2(KTR_IGMPV3, "%s: node is %d", __func__, now);
if ((now != mode) ||
@ -2980,8 +2929,8 @@ igmp_v3_enqueue_group_record(struct mbufq *mq, struct in_multi *inm,
msrcs = 0;
RB_FOREACH_FROM(ims, ip_msource_tree, nims) {
CTR2(KTR_IGMPV3, "%s: visit node %s", __func__,
inet_ntoa_haddr(ims->ims_haddr, addrbuf));
CTR2(KTR_IGMPV3, "%s: visit node 0x%08x", __func__,
htonl(ims->ims_haddr));
now = ims_get_mode(inm, ims, 1);
if ((now != mode) ||
(now == mode && mode == MCAST_UNDEFINED)) {
@ -3064,9 +3013,6 @@ igmp_v3_enqueue_filter_change(struct mbufq *mq, struct in_multi *inm)
int nallow, nblock;
uint8_t mode, now, then;
rectype_t crt, drt, nrt;
#ifdef KTR
char addrbuf[INET_ADDRSTRLEN];
#endif
IN_MULTI_LOCK_ASSERT();
@ -3175,9 +3121,8 @@ igmp_v3_enqueue_filter_change(struct mbufq *mq, struct in_multi *inm)
if (nims == NULL)
nims = RB_MIN(ip_msource_tree, &inm->inm_srcs);
RB_FOREACH_FROM(ims, ip_msource_tree, nims) {
CTR2(KTR_IGMPV3, "%s: visit node %s",
__func__,
inet_ntoa_haddr(ims->ims_haddr, addrbuf));
CTR2(KTR_IGMPV3, "%s: visit node 0x%08x",
__func__, htonl(ims->ims_haddr));
now = ims_get_mode(inm, ims, 1);
then = ims_get_mode(inm, ims, 0);
CTR3(KTR_IGMPV3, "%s: mode: t0 %d, t1 %d",

View File

@ -877,10 +877,6 @@ inm_get_source(struct in_multi *inm, const in_addr_t haddr,
{
struct ip_msource find;
struct ip_msource *ims, *nims;
#ifdef KTR
struct in_addr ia;
char addrbuf[INET_ADDRSTRLEN];
#endif
find.ims_haddr = haddr;
ims = RB_FIND(ip_msource_tree, &inm->inm_srcs, &find);
@ -896,9 +892,8 @@ inm_get_source(struct in_multi *inm, const in_addr_t haddr,
++inm->inm_nsrc;
ims = nims;
#ifdef KTR
ia.s_addr = htonl(haddr);
CTR3(KTR_IGMPV3, "%s: allocated %s as %p", __func__,
inet_ntoa_r(ia, addrbuf), ims);
CTR3(KTR_IGMPV3, "%s: allocated 0x%08x as %p", __func__,
htonl(haddr), ims);
#endif
}
@ -916,29 +911,28 @@ ims_merge(struct ip_msource *ims, const struct in_msource *lims,
{
int n = rollback ? -1 : 1;
#ifdef KTR
char addrbuf[INET_ADDRSTRLEN];
struct in_addr ia;
uint32_t addr;
ia.s_addr = htonl(ims->ims_haddr);
addr = htonl(ims->ims_haddr);
#endif
if (lims->imsl_st[0] == MCAST_EXCLUDE) {
CTR3(KTR_IGMPV3, "%s: t1 ex -= %d on %s",
__func__, n, inet_ntoa_r(ia, addrbuf));
CTR3(KTR_IGMPV3, "%s: t1 ex -= %d on 0x%08x",
__func__, n, addr);
ims->ims_st[1].ex -= n;
} else if (lims->imsl_st[0] == MCAST_INCLUDE) {
CTR3(KTR_IGMPV3, "%s: t1 in -= %d on %s",
__func__, n, inet_ntoa_r(ia, addrbuf));
CTR3(KTR_IGMPV3, "%s: t1 in -= %d on 0x%08x",
__func__, n, addr);
ims->ims_st[1].in -= n;
}
if (lims->imsl_st[1] == MCAST_EXCLUDE) {
CTR3(KTR_IGMPV3, "%s: t1 ex += %d on %s",
__func__, n, inet_ntoa_r(ia, addrbuf));
CTR3(KTR_IGMPV3, "%s: t1 ex += %d on 0x%08x",
__func__, n, addr);
ims->ims_st[1].ex += n;
} else if (lims->imsl_st[1] == MCAST_INCLUDE) {
CTR3(KTR_IGMPV3, "%s: t1 in += %d on %s",
__func__, n, inet_ntoa_r(ia, addrbuf));
CTR3(KTR_IGMPV3, "%s: t1 in += %d on 0x%08x",
__func__, n, addr);
ims->ims_st[1].in += n;
}
}
@ -1171,14 +1165,11 @@ in_joingroup_locked(struct ifnet *ifp, const struct in_addr *gina,
struct in_mfilter timf;
struct in_multi *inm;
int error;
#ifdef KTR
char addrbuf[INET_ADDRSTRLEN];
#endif
IN_MULTI_LOCK_ASSERT();
CTR4(KTR_IGMPV3, "%s: join %s on %p(%s))", __func__,
inet_ntoa_r(*gina, addrbuf), ifp, ifp->if_xname);
CTR4(KTR_IGMPV3, "%s: join 0x%08x on %p(%s))", __func__,
gina->s_addr, ifp, ifp->if_xname);
error = 0;
inm = NULL;
@ -1256,16 +1247,13 @@ in_leavegroup_locked(struct in_multi *inm, /*const*/ struct in_mfilter *imf)
{
struct in_mfilter timf;
int error;
#ifdef KTR
char addrbuf[INET_ADDRSTRLEN];
#endif
error = 0;
IN_MULTI_LOCK_ASSERT();
CTR5(KTR_IGMPV3, "%s: leave inm %p, %s/%s, imf %p", __func__,
inm, inet_ntoa_r(inm->inm_addr, addrbuf),
CTR5(KTR_IGMPV3, "%s: leave inm %p, 0x%08x/%s, imf %p", __func__,
inm, inm->inm_addr.s_addr,
(inm_is_ifp_detached(inm) ? "null" : inm->inm_ifp->if_xname),
imf);
@ -1364,9 +1352,6 @@ inp_block_unblock_source(struct inpcb *inp, struct sockopt *sopt)
size_t idx;
uint16_t fmode;
int error, doblock;
#ifdef KTR
char addrbuf[INET_ADDRSTRLEN];
#endif
ifp = NULL;
error = 0;
@ -1401,8 +1386,8 @@ inp_block_unblock_source(struct inpcb *inp, struct sockopt *sopt)
if (sopt->sopt_name == IP_BLOCK_SOURCE)
doblock = 1;
CTR3(KTR_IGMPV3, "%s: imr_interface = %s, ifp = %p",
__func__, inet_ntoa_r(mreqs.imr_interface, addrbuf), ifp);
CTR3(KTR_IGMPV3, "%s: imr_interface = 0x%08x, ifp = %p",
__func__, mreqs.imr_interface.s_addr, ifp);
break;
}
@ -1474,9 +1459,8 @@ inp_block_unblock_source(struct inpcb *inp, struct sockopt *sopt)
*/
ims = imo_match_source(imo, idx, &ssa->sa);
if ((ims != NULL && doblock) || (ims == NULL && !doblock)) {
CTR3(KTR_IGMPV3, "%s: source %s %spresent", __func__,
inet_ntoa_r(ssa->sin.sin_addr, addrbuf),
doblock ? "" : "not ");
CTR3(KTR_IGMPV3, "%s: source 0x%08x %spresent", __func__,
ssa->sin.sin_addr.s_addr, doblock ? "" : "not ");
error = EADDRNOTAVAIL;
goto out_inp_locked;
}
@ -1953,9 +1937,6 @@ inp_join_group(struct inpcb *inp, struct sockopt *sopt)
struct in_msource *lims;
size_t idx;
int error, is_new;
#ifdef KTR
char addrbuf[INET_ADDRSTRLEN];
#endif
ifp = NULL;
imf = NULL;
@ -2007,8 +1988,8 @@ inp_join_group(struct inpcb *inp, struct sockopt *sopt)
ifp = inp_lookup_mcast_ifp(inp, &gsa->sin,
mreqs.imr_interface);
CTR3(KTR_IGMPV3, "%s: imr_interface = %s, ifp = %p",
__func__, inet_ntoa_r(mreqs.imr_interface, addrbuf), ifp);
CTR3(KTR_IGMPV3, "%s: imr_interface = 0x%08x, ifp = %p",
__func__, mreqs.imr_interface.s_addr, ifp);
break;
}
@ -2255,9 +2236,6 @@ inp_leave_group(struct inpcb *inp, struct sockopt *sopt)
struct in_multi *inm;
size_t idx;
int error, is_final;
#ifdef KTR
char addrbuf[INET_ADDRSTRLEN];
#endif
ifp = NULL;
error = 0;
@ -2311,8 +2289,8 @@ inp_leave_group(struct inpcb *inp, struct sockopt *sopt)
if (!in_nullhost(mreqs.imr_interface))
INADDR_TO_IFP(mreqs.imr_interface, ifp);
CTR3(KTR_IGMPV3, "%s: imr_interface = %s, ifp = %p",
__func__, inet_ntoa_r(mreqs.imr_interface, addrbuf), ifp);
CTR3(KTR_IGMPV3, "%s: imr_interface = 0x%08x, ifp = %p",
__func__, mreqs.imr_interface.s_addr, ifp);
break;
@ -2392,8 +2370,8 @@ inp_leave_group(struct inpcb *inp, struct sockopt *sopt)
}
ims = imo_match_source(imo, idx, &ssa->sa);
if (ims == NULL) {
CTR3(KTR_IGMPV3, "%s: source %s %spresent", __func__,
inet_ntoa_r(ssa->sin.sin_addr, addrbuf), "not ");
CTR3(KTR_IGMPV3, "%s: source 0x%08x %spresent",
__func__, ssa->sin.sin_addr.s_addr, "not ");
error = EADDRNOTAVAIL;
goto out_inp_locked;
}
@ -2475,9 +2453,6 @@ inp_set_multicast_if(struct inpcb *inp, struct sockopt *sopt)
struct ifnet *ifp;
struct ip_moptions *imo;
int error;
#ifdef KTR
char addrbuf[INET_ADDRSTRLEN];
#endif
if (sopt->sopt_valsize == sizeof(struct ip_mreqn)) {
/*
@ -2515,8 +2490,8 @@ inp_set_multicast_if(struct inpcb *inp, struct sockopt *sopt)
if (ifp == NULL)
return (EADDRNOTAVAIL);
}
CTR3(KTR_IGMPV3, "%s: ifp = %p, addr = %s", __func__, ifp,
inet_ntoa_r(addr, addrbuf));
CTR3(KTR_IGMPV3, "%s: ifp = %p, addr = 0x%08x", __func__, ifp,
addr.s_addr);
}
/* Reject interfaces which do not support multicast. */
@ -2874,9 +2849,6 @@ sysctl_ip_mcast_filters(SYSCTL_HANDLER_ARGS)
int retval;
u_int namelen;
uint32_t fmode, ifindex;
#ifdef KTR
char addrbuf[INET_ADDRSTRLEN];
#endif
name = (int *)arg1;
namelen = arg2;
@ -2896,8 +2868,8 @@ sysctl_ip_mcast_filters(SYSCTL_HANDLER_ARGS)
group.s_addr = name[1];
if (!IN_MULTICAST(ntohl(group.s_addr))) {
CTR2(KTR_IGMPV3, "%s: group %s is not multicast",
__func__, inet_ntoa_r(group, addrbuf));
CTR2(KTR_IGMPV3, "%s: group 0x%08x is not multicast",
__func__, group.s_addr);
return (EINVAL);
}
@ -2928,12 +2900,8 @@ sysctl_ip_mcast_filters(SYSCTL_HANDLER_ARGS)
if (retval != 0)
break;
RB_FOREACH(ims, ip_msource_tree, &inm->inm_srcs) {
#ifdef KTR
struct in_addr ina;
ina.s_addr = htonl(ims->ims_haddr);
CTR2(KTR_IGMPV3, "%s: visit node %s", __func__,
inet_ntoa_r(ina, addrbuf));
#endif
CTR2(KTR_IGMPV3, "%s: visit node 0x%08x", __func__,
htonl(ims->ims_haddr));
/*
* Only copy-out sources which are in-mode.
*/

View File

@ -845,9 +845,6 @@ add_vif(struct vifctl *vifcp)
struct ifaddr *ifa;
struct ifnet *ifp;
int error;
#ifdef KTR
char addrbuf[INET_ADDRSTRLEN];
#endif
VIF_LOCK();
if (vifcp->vifc_vifi >= MAXVIFS) {
@ -931,8 +928,8 @@ add_vif(struct vifctl *vifcp)
VIF_UNLOCK();
CTR4(KTR_IPMF, "%s: add vif %d laddr %s thresh %x", __func__,
(int)vifcp->vifc_vifi, inet_ntoa_r(vifcp->vifc_lcl_addr, addrbuf),
CTR4(KTR_IPMF, "%s: add vif %d laddr 0x%08x thresh %x", __func__,
(int)vifcp->vifc_vifi, vifcp->vifc_lcl_addr.s_addr,
(int)vifcp->vifc_threshold);
return 0;
@ -1055,9 +1052,6 @@ add_mfc(struct mfcctl2 *mfccp)
struct rtdetq *rte, *nrte;
u_long hash = 0;
u_short nstl;
#ifdef KTR
char addrbuf[INET_ADDRSTRLEN];
#endif
VIF_LOCK();
MFC_LOCK();
@ -1066,8 +1060,8 @@ add_mfc(struct mfcctl2 *mfccp)
/* If an entry already exists, just update the fields */
if (rt) {
CTR4(KTR_IPMF, "%s: update mfc orig %s group %lx parent %x",
__func__, inet_ntoa_r(mfccp->mfcc_origin, addrbuf),
CTR4(KTR_IPMF, "%s: update mfc orig 0x%08x group %lx parent %x",
__func__, mfccp->mfcc_origin.s_addr,
(u_long)ntohl(mfccp->mfcc_mcastgrp.s_addr),
mfccp->mfcc_parent);
update_mfc_params(rt, mfccp);
@ -1086,8 +1080,8 @@ add_mfc(struct mfcctl2 *mfccp)
in_hosteq(rt->mfc_mcastgrp, mfccp->mfcc_mcastgrp) &&
!TAILQ_EMPTY(&rt->mfc_stall)) {
CTR5(KTR_IPMF,
"%s: add mfc orig %s group %lx parent %x qh %p",
__func__, inet_ntoa_r(mfccp->mfcc_origin, addrbuf),
"%s: add mfc orig 0x%08x group %lx parent %x qh %p",
__func__, mfccp->mfcc_origin.s_addr,
(u_long)ntohl(mfccp->mfcc_mcastgrp.s_addr),
mfccp->mfcc_parent,
TAILQ_FIRST(&rt->mfc_stall));
@ -1161,15 +1155,12 @@ del_mfc(struct mfcctl2 *mfccp)
struct in_addr origin;
struct in_addr mcastgrp;
struct mfc *rt;
#ifdef KTR
char addrbuf[INET_ADDRSTRLEN];
#endif
origin = mfccp->mfcc_origin;
mcastgrp = mfccp->mfcc_mcastgrp;
CTR3(KTR_IPMF, "%s: delete mfc orig %s group %lx", __func__,
inet_ntoa_r(origin, addrbuf), (u_long)ntohl(mcastgrp.s_addr));
CTR3(KTR_IPMF, "%s: delete mfc orig 0x%08x group %lx", __func__,
origin.s_addr, (u_long)ntohl(mcastgrp.s_addr));
MFC_LOCK();
@ -1232,13 +1223,9 @@ X_ip_mforward(struct ip *ip, struct ifnet *ifp, struct mbuf *m,
struct mfc *rt;
int error;
vifi_t vifi;
#ifdef KTR
char addrbuf[INET_ADDRSTRLEN];
#endif
CTR3(KTR_IPMF, "ip_mforward: delete mfc orig %s group %lx ifp %p",
inet_ntoa_r(ip->ip_src, addrbuf), (u_long)ntohl(ip->ip_dst.s_addr),
ifp);
CTR3(KTR_IPMF, "ip_mforward: delete mfc orig 0x%08x group %lx ifp %p",
ntohl(ip->ip_src.s_addr), (u_long)ntohl(ip->ip_dst.s_addr), ifp);
if (ip->ip_hl < (sizeof(struct ip) + TUNNEL_LEN) >> 2 ||
((u_char *)(ip + 1))[1] != IPOPT_LSRR ) {
@ -1300,8 +1287,8 @@ X_ip_mforward(struct ip *ip, struct ifnet *ifp, struct mbuf *m,
MRTSTAT_INC(mrts_mfc_misses);
MRTSTAT_INC(mrts_no_route);
CTR2(KTR_IPMF, "ip_mforward: no mfc for (%s,%lx)",
inet_ntoa_r(ip->ip_src, addrbuf), (u_long)ntohl(ip->ip_dst.s_addr));
CTR2(KTR_IPMF, "ip_mforward: no mfc for (0x%08x,%lx)",
ntohl(ip->ip_src.s_addr), (u_long)ntohl(ip->ip_dst.s_addr));
/*
* Allocate mbufs early so that we don't do extra work if we are
@ -2583,9 +2570,6 @@ pim_input(struct mbuf **mp, int *offp, int proto)
int minlen;
int datalen = ntohs(ip->ip_len) - iphlen;
int ip_tos;
#ifdef KTR
char addrbuf[INET_ADDRSTRLEN];
#endif
*mp = NULL;
@ -2598,8 +2582,8 @@ pim_input(struct mbuf **mp, int *offp, int proto)
*/
if (datalen < PIM_MINLEN) {
PIMSTAT_INC(pims_rcv_tooshort);
CTR3(KTR_IPMF, "%s: short packet (%d) from %s",
__func__, datalen, inet_ntoa_r(ip->ip_src, addrbuf));
CTR3(KTR_IPMF, "%s: short packet (%d) from 0x%08x",
__func__, datalen, ntohl(ip->ip_src.s_addr));
m_freem(m);
return (IPPROTO_DONE);
}
@ -2698,8 +2682,8 @@ pim_input(struct mbuf **mp, int *offp, int proto)
reghdr = (u_int32_t *)(pim + 1);
encap_ip = (struct ip *)(reghdr + 1);
CTR3(KTR_IPMF, "%s: register: encap ip src %s len %d",
__func__, inet_ntoa_r(encap_ip->ip_src, addrbuf),
CTR3(KTR_IPMF, "%s: register: encap ip src 0x%08x len %d",
__func__, ntohl(encap_ip->ip_src.s_addr),
ntohs(encap_ip->ip_len));
/* verify the version number of the inner packet */
@ -2713,8 +2697,8 @@ pim_input(struct mbuf **mp, int *offp, int proto)
/* verify the inner packet is destined to a mcast group */
if (!IN_MULTICAST(ntohl(encap_ip->ip_dst.s_addr))) {
PIMSTAT_INC(pims_rcv_badregisters);
CTR2(KTR_IPMF, "%s: bad encap ip dest %s", __func__,
inet_ntoa_r(encap_ip->ip_dst, addrbuf));
CTR2(KTR_IPMF, "%s: bad encap ip dest 0x%08x", __func__,
ntohl(encap_ip->ip_dst.s_addr));
m_freem(m);
return (IPPROTO_DONE);
}