summaryrefslogtreecommitdiffstats
path: root/freebsd/sys/netinet/in_mcast.c
diff options
context:
space:
mode:
Diffstat (limited to 'freebsd/sys/netinet/in_mcast.c')
-rw-r--r--freebsd/sys/netinet/in_mcast.c89
1 files changed, 42 insertions, 47 deletions
diff --git a/freebsd/sys/netinet/in_mcast.c b/freebsd/sys/netinet/in_mcast.c
index 3d68718e..635b2579 100644
--- a/freebsd/sys/netinet/in_mcast.c
+++ b/freebsd/sys/netinet/in_mcast.c
@@ -497,9 +497,12 @@ in_getmulti(struct ifnet *ifp, const struct in_addr *group,
("%s: ifma not AF_INET", __func__));
KASSERT(inm != NULL, ("%s: no ifma_protospec", __func__));
if (inm->inm_ifma != ifma || inm->inm_ifp != ifp ||
- !in_hosteq(inm->inm_addr, *group))
+ !in_hosteq(inm->inm_addr, *group)) {
+ char addrbuf[INET_ADDRSTRLEN];
+
panic("%s: ifma %p is inconsistent with %p (%s)",
- __func__, ifma, inm, inet_ntoa(*group));
+ __func__, ifma, inm, inet_ntoa_r(*group, addrbuf));
+ }
#endif
++inm->inm_refcount;
*pinm = inm;
@@ -876,9 +879,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;
-#endif
find.ims_haddr = haddr;
ims = RB_FIND(ip_msource_tree, &inm->inm_srcs, &find);
@@ -894,9 +894,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(ia), ims);
+ CTR3(KTR_IGMPV3, "%s: allocated 0x%08x as %p", __func__,
+ haddr, ims);
#endif
}
@@ -913,29 +912,24 @@ ims_merge(struct ip_msource *ims, const struct in_msource *lims,
const int rollback)
{
int n = rollback ? -1 : 1;
-#ifdef KTR
- struct in_addr ia;
-
- ia.s_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(ia));
+ CTR3(KTR_IGMPV3, "%s: t1 ex -= %d on 0x%08x",
+ __func__, n, ims->ims_haddr);
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(ia));
+ CTR3(KTR_IGMPV3, "%s: t1 in -= %d on 0x%08x",
+ __func__, n, ims->ims_haddr);
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(ia));
+ CTR3(KTR_IGMPV3, "%s: t1 ex += %d on 0x%08x",
+ __func__, n, ims->ims_haddr);
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(ia));
+ CTR3(KTR_IGMPV3, "%s: t1 in += %d on 0x%08x",
+ __func__, n, ims->ims_haddr);
ims->ims_st[1].in += n;
}
}
@@ -1171,8 +1165,8 @@ in_joingroup_locked(struct ifnet *ifp, const struct in_addr *gina,
IN_MULTI_LOCK_ASSERT();
- CTR4(KTR_IGMPV3, "%s: join %s on %p(%s))", __func__,
- inet_ntoa(*gina), ifp, ifp->if_xname);
+ CTR4(KTR_IGMPV3, "%s: join 0x%08x on %p(%s))", __func__,
+ ntohl(gina->s_addr), ifp, ifp->if_xname);
error = 0;
inm = NULL;
@@ -1255,8 +1249,8 @@ in_leavegroup_locked(struct in_multi *inm, /*const*/ struct in_mfilter *imf)
IN_MULTI_LOCK_ASSERT();
- CTR5(KTR_IGMPV3, "%s: leave inm %p, %s/%s, imf %p", __func__,
- inm, inet_ntoa(inm->inm_addr),
+ CTR5(KTR_IGMPV3, "%s: leave inm %p, 0x%08x/%s, imf %p", __func__,
+ inm, ntohl(inm->inm_addr.s_addr),
(inm_is_ifp_detached(inm) ? "null" : inm->inm_ifp->if_xname),
imf);
@@ -1304,9 +1298,13 @@ in_addmulti(struct in_addr *ap, struct ifnet *ifp)
{
struct in_multi *pinm;
int error;
+#ifdef INVARIANTS
+ char addrbuf[INET_ADDRSTRLEN];
+#endif
KASSERT(IN_LOCAL_GROUP(ntohl(ap->s_addr)),
- ("%s: %s not in 224.0.0.0/24", __func__, inet_ntoa(*ap)));
+ ("%s: %s not in 224.0.0.0/24", __func__,
+ inet_ntoa_r(*ap, addrbuf)));
error = in_joingroup(ifp, ap, NULL, &pinm);
if (error != 0)
@@ -1385,8 +1383,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(mreqs.imr_interface), ifp);
+ CTR3(KTR_IGMPV3, "%s: imr_interface = 0x%08x, ifp = %p",
+ __func__, ntohl(mreqs.imr_interface.s_addr), ifp);
break;
}
@@ -1458,8 +1456,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(ssa->sin.sin_addr), doblock ? "" : "not ");
+ CTR3(KTR_IGMPV3, "%s: source 0x%08x %spresent", __func__,
+ ntohl(ssa->sin.sin_addr.s_addr), doblock ? "" : "not ");
error = EADDRNOTAVAIL;
goto out_inp_locked;
}
@@ -1987,8 +1985,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(mreqs.imr_interface), ifp);
+ CTR3(KTR_IGMPV3, "%s: imr_interface = 0x%08x, ifp = %p",
+ __func__, ntohl(mreqs.imr_interface.s_addr), ifp);
break;
}
@@ -2288,8 +2286,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(mreqs.imr_interface), ifp);
+ CTR3(KTR_IGMPV3, "%s: imr_interface = 0x%08x, ifp = %p",
+ __func__, ntohl(mreqs.imr_interface.s_addr), ifp);
break;
@@ -2369,8 +2367,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(ssa->sin.sin_addr), "not ");
+ CTR3(KTR_IGMPV3, "%s: source 0x%08x %spresent",
+ __func__, ntohl(ssa->sin.sin_addr.s_addr), "not ");
error = EADDRNOTAVAIL;
goto out_inp_locked;
}
@@ -2489,8 +2487,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(addr));
+ CTR3(KTR_IGMPV3, "%s: ifp = %p, addr = 0x%08x", __func__, ifp,
+ ntohl(addr.s_addr));
}
/* Reject interfaces which do not support multicast. */
@@ -2867,8 +2865,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(group));
+ CTR2(KTR_IGMPV3, "%s: group 0x%08x is not multicast",
+ __func__, ntohl(group.s_addr));
return (EINVAL);
}
@@ -2899,12 +2897,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(ina));
-#endif
+ CTR2(KTR_IGMPV3, "%s: visit node 0x%08x", __func__,
+ ims->ims_haddr);
/*
* Only copy-out sources which are in-mode.
*/
@@ -2967,13 +2961,14 @@ void
inm_print(const struct in_multi *inm)
{
int t;
+ char addrbuf[INET_ADDRSTRLEN];
if ((ktr_mask & KTR_IGMPV3) == 0)
return;
printf("%s: --- begin inm %p ---\n", __func__, inm);
printf("addr %s ifp %p(%s) ifma %p\n",
- inet_ntoa(inm->inm_addr),
+ inet_ntoa_r(inm->inm_addr, addrbuf),
inm->inm_ifp,
inm->inm_ifp->if_xname,
inm->inm_ifma);