igmp.c (254523) | igmp.c (254804) |
---|---|
1/*- 2 * Copyright (c) 2007-2009 Bruce Simpson. 3 * Copyright (c) 1988 Stephen Deering. 4 * Copyright (c) 1992, 1993 5 * The Regents of the University of California. All rights reserved. 6 * 7 * This code is derived from software contributed to Berkeley by 8 * Stephen Deering of Stanford University. --- 34 unchanged lines hidden (view full) --- 43 * Modified by Bill Fenner, Xerox PARC, Feb 1995. 44 * Modified to fully comply to IGMPv2 by Bill Fenner, Oct 1995. 45 * Significantly rewritten for IGMPv3, VIMAGE, and SMP by Bruce Simpson. 46 * 47 * MULTICAST Revision: 3.5.1.4 48 */ 49 50#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2007-2009 Bruce Simpson. 3 * Copyright (c) 1988 Stephen Deering. 4 * Copyright (c) 1992, 1993 5 * The Regents of the University of California. All rights reserved. 6 * 7 * This code is derived from software contributed to Berkeley by 8 * Stephen Deering of Stanford University. --- 34 unchanged lines hidden (view full) --- 43 * Modified by Bill Fenner, Xerox PARC, Feb 1995. 44 * Modified to fully comply to IGMPv2 by Bill Fenner, Oct 1995. 45 * Significantly rewritten for IGMPv3, VIMAGE, and SMP by Bruce Simpson. 46 * 47 * MULTICAST Revision: 3.5.1.4 48 */ 49 50#include <sys/cdefs.h> |
51__FBSDID("$FreeBSD: head/sys/netinet/igmp.c 254523 2013-08-19 13:27:32Z andre $"); | 51__FBSDID("$FreeBSD: head/sys/netinet/igmp.c 254804 2013-08-24 19:51:18Z andre $"); |
52 53#include <sys/param.h> 54#include <sys/systm.h> 55#include <sys/module.h> 56#include <sys/malloc.h> 57#include <sys/mbuf.h> 58#include <sys/socket.h> 59#include <sys/protosw.h> --- 224 unchanged lines hidden (view full) --- 284 CTLFLAG_RD | CTLFLAG_MPSAFE, sysctl_igmp_ifinfo, 285 "Per-interface IGMPv3 state"); 286 287static __inline void 288igmp_save_context(struct mbuf *m, struct ifnet *ifp) 289{ 290 291#ifdef VIMAGE | 52 53#include <sys/param.h> 54#include <sys/systm.h> 55#include <sys/module.h> 56#include <sys/malloc.h> 57#include <sys/mbuf.h> 58#include <sys/socket.h> 59#include <sys/protosw.h> --- 224 unchanged lines hidden (view full) --- 284 CTLFLAG_RD | CTLFLAG_MPSAFE, sysctl_igmp_ifinfo, 285 "Per-interface IGMPv3 state"); 286 287static __inline void 288igmp_save_context(struct mbuf *m, struct ifnet *ifp) 289{ 290 291#ifdef VIMAGE |
292 m->m_pkthdr.header = ifp->if_vnet; | 292 m->m_pkthdr.PH_loc.ptr = ifp->if_vnet; |
293#endif /* VIMAGE */ 294 m->m_pkthdr.flowid = ifp->if_index; 295} 296 297static __inline void 298igmp_scrub_context(struct mbuf *m) 299{ 300 | 293#endif /* VIMAGE */ 294 m->m_pkthdr.flowid = ifp->if_index; 295} 296 297static __inline void 298igmp_scrub_context(struct mbuf *m) 299{ 300 |
301 m->m_pkthdr.header = NULL; | 301 m->m_pkthdr.PH_loc.ptr = NULL; |
302 m->m_pkthdr.flowid = 0; 303} 304 305#ifdef KTR 306static __inline char * 307inet_ntoa_haddr(in_addr_t haddr) 308{ 309 struct in_addr ia; --- 11 unchanged lines hidden (view full) --- 321 * actually called CURVNET_SET() with what's in the mbuf chain. 322 */ 323static __inline uint32_t 324igmp_restore_context(struct mbuf *m) 325{ 326 327#ifdef notyet 328#if defined(VIMAGE) && defined(INVARIANTS) | 302 m->m_pkthdr.flowid = 0; 303} 304 305#ifdef KTR 306static __inline char * 307inet_ntoa_haddr(in_addr_t haddr) 308{ 309 struct in_addr ia; --- 11 unchanged lines hidden (view full) --- 321 * actually called CURVNET_SET() with what's in the mbuf chain. 322 */ 323static __inline uint32_t 324igmp_restore_context(struct mbuf *m) 325{ 326 327#ifdef notyet 328#if defined(VIMAGE) && defined(INVARIANTS) |
329 KASSERT(curvnet == (m->m_pkthdr.header), | 329 KASSERT(curvnet == (m->m_pkthdr.PH_loc.ptr), |
330 ("%s: called when curvnet was not restored", __func__)); 331#endif 332#endif 333 return (m->m_pkthdr.flowid); 334} 335 336/* 337 * Retrieve or set default IGMP version. --- 3060 unchanged lines hidden (view full) --- 3398 CTR2(KTR_IGMPV3, "%s: transmit %p", __func__, m); 3399 3400 /* 3401 * Set VNET image pointer from enqueued mbuf chain 3402 * before doing anything else. Whilst we use interface 3403 * indexes to guard against interface detach, they are 3404 * unique to each VIMAGE and must be retrieved. 3405 */ | 330 ("%s: called when curvnet was not restored", __func__)); 331#endif 332#endif 333 return (m->m_pkthdr.flowid); 334} 335 336/* 337 * Retrieve or set default IGMP version. --- 3060 unchanged lines hidden (view full) --- 3398 CTR2(KTR_IGMPV3, "%s: transmit %p", __func__, m); 3399 3400 /* 3401 * Set VNET image pointer from enqueued mbuf chain 3402 * before doing anything else. Whilst we use interface 3403 * indexes to guard against interface detach, they are 3404 * unique to each VIMAGE and must be retrieved. 3405 */ |
3406 CURVNET_SET((struct vnet *)(m->m_pkthdr.header)); | 3406 CURVNET_SET((struct vnet *)(m->m_pkthdr.PH_loc.ptr)); |
3407 ifindex = igmp_restore_context(m); 3408 3409 /* 3410 * Check if the ifnet still exists. This limits the scope of 3411 * any race in the absence of a global ifp lock for low cost 3412 * (an array lookup). 3413 */ 3414 ifp = ifnet_byindex(ifindex); --- 236 unchanged lines hidden --- | 3407 ifindex = igmp_restore_context(m); 3408 3409 /* 3410 * Check if the ifnet still exists. This limits the scope of 3411 * any race in the absence of a global ifp lock for low cost 3412 * (an array lookup). 3413 */ 3414 ifp = ifnet_byindex(ifindex); --- 236 unchanged lines hidden --- |