Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet/in_pcb.c
Show First 20 Lines • Show All 80 Lines • ▼ Show 20 Lines | |||||
#include <net/if_llatbl.h> | #include <net/if_llatbl.h> | ||||
#include <net/route.h> | #include <net/route.h> | ||||
#include <net/rss_config.h> | #include <net/rss_config.h> | ||||
#include <net/vnet.h> | #include <net/vnet.h> | ||||
#if defined(INET) || defined(INET6) | #if defined(INET) || defined(INET6) | ||||
#include <netinet/in.h> | #include <netinet/in.h> | ||||
#include <netinet/in_pcb.h> | #include <netinet/in_pcb.h> | ||||
#ifdef INET | |||||
#include <netinet/in_var.h> | |||||
#endif | |||||
#include <netinet/ip_var.h> | #include <netinet/ip_var.h> | ||||
#include <netinet/tcp_var.h> | #include <netinet/tcp_var.h> | ||||
#ifdef TCPHPTS | #ifdef TCPHPTS | ||||
#include <netinet/tcp_hpts.h> | #include <netinet/tcp_hpts.h> | ||||
#endif | #endif | ||||
#include <netinet/udp.h> | #include <netinet/udp.h> | ||||
#include <netinet/udp_var.h> | #include <netinet/udp_var.h> | ||||
#endif | |||||
#ifdef INET | |||||
#include <netinet/in_var.h> | |||||
#endif | |||||
#ifdef INET6 | #ifdef INET6 | ||||
#include <netinet/ip6.h> | #include <netinet/ip6.h> | ||||
#include <netinet6/in6_pcb.h> | #include <netinet6/in6_pcb.h> | ||||
#include <netinet6/in6_var.h> | #include <netinet6/in6_var.h> | ||||
#include <netinet6/ip6_var.h> | #include <netinet6/ip6_var.h> | ||||
#endif /* INET6 */ | #endif /* INET6 */ | ||||
#endif | |||||
#include <netipsec/ipsec_support.h> | #include <netipsec/ipsec_support.h> | ||||
#include <security/mac/mac_framework.h> | #include <security/mac/mac_framework.h> | ||||
#define INPCBLBGROUP_SIZMIN 8 | #define INPCBLBGROUP_SIZMIN 8 | ||||
#define INPCBLBGROUP_SIZMAX 256 | #define INPCBLBGROUP_SIZMAX 256 | ||||
▲ Show 20 Lines • Show All 1,660 Lines • ▼ Show 20 Lines | #endif | ||||
} | } | ||||
INP_INFO_WUNLOCK(pcbinfo); | INP_INFO_WUNLOCK(pcbinfo); | ||||
} | } | ||||
void | void | ||||
in_pcbpurgeif0(struct inpcbinfo *pcbinfo, struct ifnet *ifp) | in_pcbpurgeif0(struct inpcbinfo *pcbinfo, struct ifnet *ifp) | ||||
{ | { | ||||
struct inpcb *inp; | struct inpcb *inp; | ||||
struct in_multi *inm; | |||||
struct in_mfilter *imf; | |||||
struct ip_moptions *imo; | struct ip_moptions *imo; | ||||
int i, gap; | |||||
INP_INFO_WLOCK(pcbinfo); | INP_INFO_WLOCK(pcbinfo); | ||||
CK_LIST_FOREACH(inp, pcbinfo->ipi_listhead, inp_list) { | CK_LIST_FOREACH(inp, pcbinfo->ipi_listhead, inp_list) { | ||||
INP_WLOCK(inp); | INP_WLOCK(inp); | ||||
imo = inp->inp_moptions; | imo = inp->inp_moptions; | ||||
if ((inp->inp_vflag & INP_IPV4) && | if ((inp->inp_vflag & INP_IPV4) && | ||||
imo != NULL) { | imo != NULL) { | ||||
/* | /* | ||||
* Unselect the outgoing interface if it is being | * Unselect the outgoing interface if it is being | ||||
* detached. | * detached. | ||||
*/ | */ | ||||
if (imo->imo_multicast_ifp == ifp) | if (imo->imo_multicast_ifp == ifp) | ||||
imo->imo_multicast_ifp = NULL; | imo->imo_multicast_ifp = NULL; | ||||
/* | /* | ||||
* Drop multicast group membership if we joined | * Drop multicast group membership if we joined | ||||
* through the interface being detached. | * through the interface being detached. | ||||
* | * | ||||
* XXX This can all be deferred to an epoch_call | * XXX This can all be deferred to an epoch_call | ||||
*/ | */ | ||||
for (i = 0, gap = 0; i < imo->imo_num_memberships; | for (imf = NULL; ip_next_mfilter(&imo->imo_head, &imf); ) { | ||||
i++) { | if ((inm = imf->imf_inm) == NULL) | ||||
if (imo->imo_membership[i]->inm_ifp == ifp) { | continue; | ||||
if (inm->inm_ifp == ifp) { | |||||
ip_remove_mfilter(&imo->imo_head, imf); | |||||
IN_MULTI_LOCK_ASSERT(); | IN_MULTI_LOCK_ASSERT(); | ||||
in_leavegroup_locked(imo->imo_membership[i], NULL); | in_leavegroup_locked(inm, NULL); | ||||
gap++; | ip_free_mfilter(imf); | ||||
} else if (gap != 0) | imf = NULL; /* re-start search */ | ||||
imo->imo_membership[i - gap] = | |||||
imo->imo_membership[i]; | |||||
} | } | ||||
imo->imo_num_memberships -= gap; | } | ||||
} | } | ||||
INP_WUNLOCK(inp); | INP_WUNLOCK(inp); | ||||
} | } | ||||
INP_INFO_WUNLOCK(pcbinfo); | INP_INFO_WUNLOCK(pcbinfo); | ||||
} | } | ||||
/* | /* | ||||
* Lookup a PCB based on the local address and port. Caller must hold the | * Lookup a PCB based on the local address and port. Caller must hold the | ||||
▲ Show 20 Lines • Show All 1,612 Lines • Show Last 20 Lines |