Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet/ip_divert.c
Show First 20 Lines • Show All 321 Lines • ▼ Show 20 Lines | div_output(struct socket *so, struct mbuf *m, struct sockaddr_in *sin, | ||||
struct mbuf *control) | struct mbuf *control) | ||||
{ | { | ||||
struct epoch_tracker et; | struct epoch_tracker et; | ||||
const struct ip *ip; | const struct ip *ip; | ||||
struct m_tag *mtag; | struct m_tag *mtag; | ||||
struct ipfw_rule_ref *dt; | struct ipfw_rule_ref *dt; | ||||
int error, family; | int error, family; | ||||
if (sin != NULL) { | |||||
if (sin->sin_family != AF_INET) | |||||
return (EAFNOSUPPORT); | |||||
if (sin->sin_len != sizeof(*sin)) | |||||
return (EINVAL); | |||||
} | |||||
/* | /* | ||||
* An mbuf may hasn't come from userland, but we pretend | * An mbuf may hasn't come from userland, but we pretend | ||||
* that it has. | * that it has. | ||||
*/ | */ | ||||
m->m_pkthdr.rcvif = NULL; | m->m_pkthdr.rcvif = NULL; | ||||
m->m_nextpkt = NULL; | m->m_nextpkt = NULL; | ||||
M_SETFIB(m, so->so_fibnum); | M_SETFIB(m, so->so_fibnum); | ||||
▲ Show 20 Lines • Show All 285 Lines • ▼ Show 20 Lines | div_bind(struct socket *so, struct sockaddr *nam, struct thread *td) | ||||
* and in_pcbbind requires a valid address. Since divert | * and in_pcbbind requires a valid address. Since divert | ||||
* sockets don't we need to make sure the address is | * sockets don't we need to make sure the address is | ||||
* filled in properly. | * filled in properly. | ||||
* XXX -- divert should not be abusing in_pcbind | * XXX -- divert should not be abusing in_pcbind | ||||
* and should probably have its own family. | * and should probably have its own family. | ||||
*/ | */ | ||||
if (nam->sa_family != AF_INET) | if (nam->sa_family != AF_INET) | ||||
return EAFNOSUPPORT; | return EAFNOSUPPORT; | ||||
if (nam->sa_len != sizeof(struct sockaddr_in)) | |||||
Lint: Possible Spelling Mistake: Possible spelling error. You wrote 'nam', but did you mean 'name'? | |||||
return EINVAL; | |||||
((struct sockaddr_in *)nam)->sin_addr.s_addr = INADDR_ANY; | ((struct sockaddr_in *)nam)->sin_addr.s_addr = INADDR_ANY; | ||||
INP_INFO_WLOCK(&V_divcbinfo); | INP_INFO_WLOCK(&V_divcbinfo); | ||||
INP_WLOCK(inp); | INP_WLOCK(inp); | ||||
INP_HASH_WLOCK(&V_divcbinfo); | INP_HASH_WLOCK(&V_divcbinfo); | ||||
error = in_pcbbind(inp, nam, td->td_ucred); | error = in_pcbbind(inp, nam, td->td_ucred); | ||||
INP_HASH_WUNLOCK(&V_divcbinfo); | INP_HASH_WUNLOCK(&V_divcbinfo); | ||||
INP_WUNLOCK(inp); | INP_WUNLOCK(inp); | ||||
INP_INFO_WUNLOCK(&V_divcbinfo); | INP_INFO_WUNLOCK(&V_divcbinfo); | ||||
▲ Show 20 Lines • Show All 212 Lines • Show Last 20 Lines |
Possible spelling error. You wrote 'nam', but did you mean 'name'?