View | Details | Raw Unified | Return to bug 220078 | Differences between
and this patch

Collapse All | Expand All

(-)sys/netinet/in_mcast.c (-5 / +15 lines)
Lines 1338-1343 static int Link Here
1338
inp_block_unblock_source(struct inpcb *inp, struct sockopt *sopt)
1338
inp_block_unblock_source(struct inpcb *inp, struct sockopt *sopt)
1339
{
1339
{
1340
	struct group_source_req		 gsr;
1340
	struct group_source_req		 gsr;
1341
	struct rm_priotracker		 in_ifa_tracker;
1341
	sockunion_t			*gsa, *ssa;
1342
	sockunion_t			*gsa, *ssa;
1342
	struct ifnet			*ifp;
1343
	struct ifnet			*ifp;
1343
	struct in_mfilter		*imf;
1344
	struct in_mfilter		*imf;
Lines 1375-1383 inp_block_unblock_source(struct inpcb *i Link Here
1375
		ssa->sin.sin_len = sizeof(struct sockaddr_in);
1376
		ssa->sin.sin_len = sizeof(struct sockaddr_in);
1376
		ssa->sin.sin_addr = mreqs.imr_sourceaddr;
1377
		ssa->sin.sin_addr = mreqs.imr_sourceaddr;
1377
1378
1378
		if (!in_nullhost(mreqs.imr_interface))
1379
		if (!in_nullhost(mreqs.imr_interface)) {
1380
			IN_IFADDR_RLOCK(&in_ifa_tracker);
1379
			INADDR_TO_IFP(mreqs.imr_interface, ifp);
1381
			INADDR_TO_IFP(mreqs.imr_interface, ifp);
1380
1382
			IN_IFADDR_RUNLOCK(&in_ifa_tracker);
1383
		}
1381
		if (sopt->sopt_name == IP_BLOCK_SOURCE)
1384
		if (sopt->sopt_name == IP_BLOCK_SOURCE)
1382
			doblock = 1;
1385
			doblock = 1;
1383
1386
Lines 1873-1879 inp_getmoptions(struct inpcb *inp, struc Link Here
1873
 *
1876
 *
1874
 * Returns NULL if no ifp could be found.
1877
 * Returns NULL if no ifp could be found.
1875
 *
1878
 *
1876
 * SMPng: TODO: Acquire the appropriate locks for INADDR_TO_IFP.
1877
 * FUTURE: Implement IPv4 source-address selection.
1879
 * FUTURE: Implement IPv4 source-address selection.
1878
 */
1880
 */
1879
static struct ifnet *
1881
static struct ifnet *
Lines 1891-1897 inp_lookup_mcast_ifp(const struct inpcb Link Here
1891
1893
1892
	ifp = NULL;
1894
	ifp = NULL;
1893
	if (!in_nullhost(ina)) {
1895
	if (!in_nullhost(ina)) {
1896
		IN_IFADDR_RLOCK(&in_ifa_tracker);
1894
		INADDR_TO_IFP(ina, ifp);
1897
		INADDR_TO_IFP(ina, ifp);
1898
		IN_IFADDR_RUNLOCK(&in_ifa_tracker);
1895
	} else {
1899
	} else {
1896
		fibnum = inp ? inp->inp_inc.inc_fibnum : 0;
1900
		fibnum = inp ? inp->inp_inc.inc_fibnum : 0;
1897
		if (fib4_lookup_nh_basic(fibnum, gsin->sin_addr, 0, 0, &nh4)==0)
1901
		if (fib4_lookup_nh_basic(fibnum, gsin->sin_addr, 0, 0, &nh4)==0)
Lines 2223-2228 inp_leave_group(struct inpcb *inp, struc Link Here
2223
{
2227
{
2224
	struct group_source_req		 gsr;
2228
	struct group_source_req		 gsr;
2225
	struct ip_mreq_source		 mreqs;
2229
	struct ip_mreq_source		 mreqs;
2230
	struct rm_priotracker		 in_ifa_tracker;
2226
	sockunion_t			*gsa, *ssa;
2231
	sockunion_t			*gsa, *ssa;
2227
	struct ifnet			*ifp;
2232
	struct ifnet			*ifp;
2228
	struct in_mfilter		*imf;
2233
	struct in_mfilter		*imf;
Lines 2281-2289 inp_leave_group(struct inpcb *inp, struc Link Here
2281
		 * XXX NOTE WELL: The RFC 3678 API is preferred because
2286
		 * XXX NOTE WELL: The RFC 3678 API is preferred because
2282
		 * using an IPv4 address as a key is racy.
2287
		 * using an IPv4 address as a key is racy.
2283
		 */
2288
		 */
2284
		if (!in_nullhost(mreqs.imr_interface))
2289
		if (!in_nullhost(mreqs.imr_interface)) {
2290
			IN_IFADDR_RLOCK(&in_ifa_tracker);
2285
			INADDR_TO_IFP(mreqs.imr_interface, ifp);
2291
			INADDR_TO_IFP(mreqs.imr_interface, ifp);
2286
2292
			IN_IFADDR_RUNLOCK(&in_ifa_tracker);
2293
		}
2287
		CTR3(KTR_IGMPV3, "%s: imr_interface = 0x%08x, ifp = %p",
2294
		CTR3(KTR_IGMPV3, "%s: imr_interface = 0x%08x, ifp = %p",
2288
		    __func__, ntohl(mreqs.imr_interface.s_addr), ifp);
2295
		    __func__, ntohl(mreqs.imr_interface.s_addr), ifp);
2289
2296
Lines 2443-2448 out_inp_locked: Link Here
2443
static int
2450
static int
2444
inp_set_multicast_if(struct inpcb *inp, struct sockopt *sopt)
2451
inp_set_multicast_if(struct inpcb *inp, struct sockopt *sopt)
2445
{
2452
{
2453
	struct rm_priotracker	 in_ifa_tracker;
2446
	struct in_addr		 addr;
2454
	struct in_addr		 addr;
2447
	struct ip_mreqn		 mreqn;
2455
	struct ip_mreqn		 mreqn;
2448
	struct ifnet		*ifp;
2456
	struct ifnet		*ifp;
Lines 2481-2487 inp_set_multicast_if(struct inpcb *inp, Link Here
2481
		if (in_nullhost(addr)) {
2489
		if (in_nullhost(addr)) {
2482
			ifp = NULL;
2490
			ifp = NULL;
2483
		} else {
2491
		} else {
2492
			IN_IFADDR_RLOCK(&in_ifa_tracker);
2484
			INADDR_TO_IFP(addr, ifp);
2493
			INADDR_TO_IFP(addr, ifp);
2494
			IN_IFADDR_RUNLOCK(&in_ifa_tracker);
2485
			if (ifp == NULL)
2495
			if (ifp == NULL)
2486
				return (EADDRNOTAVAIL);
2496
				return (EADDRNOTAVAIL);
2487
		}
2497
		}

Return to bug 220078