Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet6/udp6_usrreq.c
Show First 20 Lines • Show All 541 Lines • ▼ Show 20 Lines | |||||
badunlocked: | badunlocked: | ||||
m_freem(m); | m_freem(m); | ||||
*mp = NULL; | *mp = NULL; | ||||
return (IPPROTO_DONE); | return (IPPROTO_DONE); | ||||
} | } | ||||
static void | static void | ||||
udp6_common_ctlinput(int cmd, struct sockaddr *sa, void *d, | udp6_common_ctlinput(int cmd, struct sockaddr_in6 *sin6, | ||||
struct inpcbinfo *pcbinfo) | struct ip6ctlparam *ip6cp, struct inpcbinfo *pcbinfo) | ||||
{ | { | ||||
struct udphdr uh; | struct udphdr uh; | ||||
struct ip6_hdr *ip6; | struct ip6_hdr *ip6; | ||||
struct mbuf *m; | struct mbuf *m; | ||||
int off = 0; | int off = 0; | ||||
struct ip6ctlparam *ip6cp = NULL; | |||||
const struct sockaddr_in6 *sa6_src = NULL; | const struct sockaddr_in6 *sa6_src = NULL; | ||||
void *cmdarg; | void *cmdarg; | ||||
struct inpcb *(*notify)(struct inpcb *, int) = udp_notify; | struct inpcb *(*notify)(struct inpcb *, int) = udp_notify; | ||||
struct udp_portonly { | struct udp_portonly { | ||||
u_int16_t uh_sport; | u_int16_t uh_sport; | ||||
u_int16_t uh_dport; | u_int16_t uh_dport; | ||||
} *uhp; | } *uhp; | ||||
if (sa->sa_family != AF_INET6 || | |||||
sa->sa_len != sizeof(struct sockaddr_in6)) | |||||
return; | |||||
if ((unsigned)cmd >= PRC_NCMDS) | if ((unsigned)cmd >= PRC_NCMDS) | ||||
return; | return; | ||||
if (PRC_IS_REDIRECT(cmd)) | if (PRC_IS_REDIRECT(cmd)) | ||||
notify = in6_rtchange, d = NULL; | notify = in6_rtchange, ip6cp = NULL; | ||||
else if (cmd == PRC_HOSTDEAD) | else if (cmd == PRC_HOSTDEAD) | ||||
d = NULL; | ip6cp = NULL; | ||||
else if (inet6ctlerrmap[cmd] == 0) | else if (inet6ctlerrmap[cmd] == 0) | ||||
return; | return; | ||||
/* if the parameter is from icmp6, decode it. */ | /* if the parameter is from icmp6, decode it. */ | ||||
if (d != NULL) { | if (ip6cp != NULL) { | ||||
ip6cp = (struct ip6ctlparam *)d; | |||||
m = ip6cp->ip6c_m; | m = ip6cp->ip6c_m; | ||||
ip6 = ip6cp->ip6c_ip6; | ip6 = ip6cp->ip6c_ip6; | ||||
off = ip6cp->ip6c_off; | off = ip6cp->ip6c_off; | ||||
cmdarg = ip6cp->ip6c_cmdarg; | cmdarg = ip6cp->ip6c_cmdarg; | ||||
sa6_src = ip6cp->ip6c_src; | sa6_src = ip6cp->ip6c_src; | ||||
} else { | } else { | ||||
m = NULL; | m = NULL; | ||||
ip6 = NULL; | ip6 = NULL; | ||||
Show All 24 Lines | if (!PRC_IS_REDIRECT(cmd)) { | ||||
if (inp != NULL) { | if (inp != NULL) { | ||||
struct udpcb *up; | struct udpcb *up; | ||||
up = intoudpcb(inp); | up = intoudpcb(inp); | ||||
if (up->u_icmp_func) { | if (up->u_icmp_func) { | ||||
/* Yes it is. */ | /* Yes it is. */ | ||||
INP_RUNLOCK(inp); | INP_RUNLOCK(inp); | ||||
(*up->u_icmp_func)(cmd, (struct sockaddr *)ip6cp->ip6c_src, | (*up->u_icmp_func)(cmd, (struct sockaddr *)ip6cp->ip6c_src, | ||||
d, up->u_tun_ctx); | ip6cp, up->u_tun_ctx); | ||||
return; | return; | ||||
} else { | } else { | ||||
/* Can't find it. */ | /* Can't find it. */ | ||||
INP_RUNLOCK(inp); | INP_RUNLOCK(inp); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
(void)in6_pcbnotify(pcbinfo, sa, uh.uh_dport, | in6_pcbnotify(pcbinfo, sin6, uh.uh_dport, ip6cp->ip6c_src, | ||||
(struct sockaddr *)ip6cp->ip6c_src, uh.uh_sport, cmd, | uh.uh_sport, cmd, cmdarg, notify); | ||||
cmdarg, notify); | |||||
} else | } else | ||||
(void)in6_pcbnotify(pcbinfo, sa, 0, | in6_pcbnotify(pcbinfo, sin6, 0, sa6_src, 0, cmd, cmdarg, | ||||
(const struct sockaddr *)sa6_src, 0, cmd, cmdarg, notify); | notify); | ||||
} | } | ||||
void | static void | ||||
udp6_ctlinput(int cmd, struct sockaddr *sa, void *d) | udp6_ctlinput(int cmd, struct sockaddr_in6 *sin6, struct ip6ctlparam *ctl) | ||||
{ | { | ||||
return (udp6_common_ctlinput(cmd, sa, d, &V_udbinfo)); | return (udp6_common_ctlinput(cmd, sin6, ctl, &V_udbinfo)); | ||||
} | } | ||||
void | static void | ||||
udplite6_ctlinput(int cmd, struct sockaddr *sa, void *d) | udplite6_ctlinput(int cmd, struct sockaddr_in6 *sin6, struct ip6ctlparam *ctl) | ||||
{ | { | ||||
return (udp6_common_ctlinput(cmd, sa, d, &V_ulitecbinfo)); | return (udp6_common_ctlinput(cmd, sin6, ctl, &V_ulitecbinfo)); | ||||
} | } | ||||
static int | static int | ||||
udp6_getcred(SYSCTL_HANDLER_ARGS) | udp6_getcred(SYSCTL_HANDLER_ARGS) | ||||
{ | { | ||||
struct xucred xuc; | struct xucred xuc; | ||||
struct sockaddr_in6 addrs[2]; | struct sockaddr_in6 addrs[2]; | ||||
struct epoch_tracker et; | struct epoch_tracker et; | ||||
▲ Show 20 Lines • Show All 704 Lines • Show Last 20 Lines |