Page MenuHomeFreeBSD

D55345.diff
No OneTemporary

D55345.diff

diff --git a/sys/netinet/igmp.c b/sys/netinet/igmp.c
--- a/sys/netinet/igmp.c
+++ b/sys/netinet/igmp.c
@@ -213,8 +213,8 @@
* Obviously the IGMPv3 per-interface state has per-vimage granularity
* also as a result.
*
- * FUTURE: Stop using IFP_TO_IA/INADDR_ANY, and use source address selection
- * policy to control the address used by IGMP on the link.
+ * FUTURE: Use source address selection policy to control the address
+ * used by IGMP on the link.
*/
VNET_DEFINE_STATIC(int, interface_timers_running); /* IGMPv3 general
* query response */
@@ -1283,7 +1283,7 @@
* Replace 0.0.0.0 with the subnet address if told to do so.
*/
if (V_igmp_recvifkludge && in_nullhost(ip->ip_src)) {
- IFP_TO_IA(ifp, ia);
+ ia = in_ifprimaryaddr(ifp);
if (ia != NULL)
ip->ip_src.s_addr = htonl(ia->ia_subnet);
}
@@ -1377,7 +1377,7 @@
* leave requires knowing that we are the only member of a
* group.
*/
- IFP_TO_IA(ifp, ia);
+ ia = in_ifprimaryaddr(ifp);
if (ia != NULL && in_hosteq(ip->ip_src, IA_SIN(ia)->sin_addr)) {
return (0);
}
@@ -3598,7 +3598,7 @@
if (m->m_flags & M_IGMP_LOOP) {
struct in_ifaddr *ia;
- IFP_TO_IA(ifp, ia);
+ ia = in_ifprimaryaddr(ifp);
if (ia != NULL)
ip->ip_src = ia->ia_addr.sin_addr;
}
diff --git a/sys/netinet/in_mcast.c b/sys/netinet/in_mcast.c
--- a/sys/netinet/in_mcast.c
+++ b/sys/netinet/in_mcast.c
@@ -1766,7 +1766,7 @@
mreqn.imr_ifindex = ifp->if_index;
NET_EPOCH_ENTER(et);
- IFP_TO_IA(ifp, ia);
+ ia = in_ifprimaryaddr(ifp);
if (ia != NULL)
mreqn.imr_address =
IA_SIN(ia)->sin_addr;
diff --git a/sys/netinet/in_var.h b/sys/netinet/in_var.h
--- a/sys/netinet/in_var.h
+++ b/sys/netinet/in_var.h
@@ -151,21 +151,6 @@
(ifp) = (ia == NULL) ? NULL : ia->ia_ifp; \
}
-/*
- * Macro for finding the internet address structure (in_ifaddr) corresponding
- * to a given interface (ifnet structure). DEPRECATED.
- */
-#define IFP_TO_IA(ifp, ia) \
- /* struct ifnet *ifp; */ \
- /* struct in_ifaddr *ia; */ \
-do { \
- NET_EPOCH_ASSERT(); \
- for ((ia) = CK_STAILQ_FIRST(&V_in_ifaddrhead); \
- (ia) != NULL && (ia)->ia_ifp != (ifp); \
- (ia) = CK_STAILQ_NEXT((ia), ia_link)) \
- continue; \
-} while (0)
-
/*
* Legacy IPv4 IGMP per-link structure.
*/
diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c
--- a/sys/netinet/ip_output.c
+++ b/sys/netinet/ip_output.c
@@ -460,7 +460,7 @@
*/
ifp = imo->imo_multicast_ifp;
mtu = ifp->if_mtu;
- IFP_TO_IA(ifp, ia);
+ ia = in_ifprimaryaddr(ifp);
isbroadcast = false;
/* Interface may have no addresses. */
if (ia != NULL)
diff --git a/sys/netinet6/in6_mcast.c b/sys/netinet6/in6_mcast.c
--- a/sys/netinet6/in6_mcast.c
+++ b/sys/netinet6/in6_mcast.c
@@ -1912,15 +1912,16 @@
goto out;
}
- /*
- * XXX: Allow the primary IP to be 0.0.0.0 for bootstrap;
- * otherwise, check in_nullhost(ia->ia_addr.sin_addr.s_addr).
- */
- IFP_TO_IA(ifp, ia);
+ ia = in_ifprimaryaddr(ifp);
if (ia == NULL) {
error = EADDRNOTAVAIL;
goto out;
}
+
+ /*
+ * XXX: We allow the primary IP to be 0.0.0.0 for bootstrap;
+ * otherwise, check for in_nullhost(IA_SIN(ia)->sin_addr.s_addr)).
+ */
mreq_v4->imr_interface.s_addr = IA_SIN(ia)->sin_addr.s_addr;
error = 0;

File Metadata

Mime Type
text/plain
Expires
Sat, Apr 4, 10:32 PM (17 h, 42 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
30848886
Default Alt Text
D55345.diff (3 KB)

Event Timeline