Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet/ip_divert.c
Show First 20 Lines • Show All 681 Lines • ▼ Show 20 Lines | if (m->m_len < sizeof (struct ip) && | ||||
m_freem(m); | m_freem(m); | ||||
return EINVAL; | return EINVAL; | ||||
} | } | ||||
/* Send packet */ | /* Send packet */ | ||||
return div_output(so, m, (struct sockaddr_in *)nam, control); | return div_output(so, m, (struct sockaddr_in *)nam, control); | ||||
} | } | ||||
static void | |||||
div_ctlinput(int cmd, struct sockaddr *sa, void *vip) | |||||
{ | |||||
struct in_addr faddr; | |||||
faddr = ((struct sockaddr_in *)sa)->sin_addr; | |||||
if (sa->sa_family != AF_INET || faddr.s_addr == INADDR_ANY) | |||||
return; | |||||
if (PRC_IS_REDIRECT(cmd)) | |||||
return; | |||||
} | |||||
static int | static int | ||||
div_pcblist(SYSCTL_HANDLER_ARGS) | div_pcblist(SYSCTL_HANDLER_ARGS) | ||||
{ | { | ||||
struct xinpgen xig; | struct xinpgen xig; | ||||
struct epoch_tracker et; | struct epoch_tracker et; | ||||
struct inpcb *inp; | struct inpcb *inp; | ||||
int error; | int error; | ||||
▲ Show 20 Lines • Show All 76 Lines • ▼ Show 20 Lines | struct pr_usrreqs div_usrreqs = { | ||||
.pru_sosetlabel = in_pcbsosetlabel | .pru_sosetlabel = in_pcbsosetlabel | ||||
}; | }; | ||||
struct protosw div_protosw = { | struct protosw div_protosw = { | ||||
.pr_type = SOCK_RAW, | .pr_type = SOCK_RAW, | ||||
.pr_protocol = IPPROTO_DIVERT, | .pr_protocol = IPPROTO_DIVERT, | ||||
.pr_flags = PR_ATOMIC|PR_ADDR, | .pr_flags = PR_ATOMIC|PR_ADDR, | ||||
.pr_input = div_input, | .pr_input = div_input, | ||||
.pr_ctlinput = div_ctlinput, | |||||
.pr_ctloutput = ip_ctloutput, | .pr_ctloutput = ip_ctloutput, | ||||
.pr_init = div_init, | .pr_init = div_init, | ||||
.pr_usrreqs = &div_usrreqs | .pr_usrreqs = &div_usrreqs | ||||
}; | }; | ||||
static int | static int | ||||
div_modevent(module_t mod, int type, void *unused) | div_modevent(module_t mod, int type, void *unused) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 66 Lines • Show Last 20 Lines |