Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet6/icmp6.c
Show First 20 Lines • Show All 108 Lines • ▼ Show 20 Lines | |||||
#include <netinet6/in6_pcb.h> | #include <netinet6/in6_pcb.h> | ||||
#include <netinet6/ip6protosw.h> | #include <netinet6/ip6protosw.h> | ||||
#include <netinet6/ip6_var.h> | #include <netinet6/ip6_var.h> | ||||
#include <netinet6/scope6_var.h> | #include <netinet6/scope6_var.h> | ||||
#include <netinet6/mld6_var.h> | #include <netinet6/mld6_var.h> | ||||
#include <netinet6/nd6.h> | #include <netinet6/nd6.h> | ||||
#include <netinet6/send.h> | #include <netinet6/send.h> | ||||
extern struct domain inet6domain; | extern ipproto_ctlinput_t *ip6_ctlprotox[]; | ||||
VNET_PCPUSTAT_DEFINE(struct icmp6stat, icmp6stat); | VNET_PCPUSTAT_DEFINE(struct icmp6stat, icmp6stat); | ||||
VNET_PCPUSTAT_SYSINIT(icmp6stat); | VNET_PCPUSTAT_SYSINIT(icmp6stat); | ||||
#ifdef VIMAGE | #ifdef VIMAGE | ||||
VNET_PCPUSTAT_SYSUNINIT(icmp6stat); | VNET_PCPUSTAT_SYSUNINIT(icmp6stat); | ||||
#endif /* VIMAGE */ | #endif /* VIMAGE */ | ||||
▲ Show 20 Lines • Show All 791 Lines • ▼ Show 20 Lines | if (m->m_len < off + sizeof(*icmp6) + sizeof(struct ip6_hdr)) { | ||||
} | } | ||||
} | } | ||||
icmp6 = (struct icmp6_hdr *)(mtod(m, caddr_t) + off); | icmp6 = (struct icmp6_hdr *)(mtod(m, caddr_t) + off); | ||||
eip6 = (struct ip6_hdr *)(icmp6 + 1); | eip6 = (struct ip6_hdr *)(icmp6 + 1); | ||||
bzero(&icmp6dst, sizeof(icmp6dst)); | bzero(&icmp6dst, sizeof(icmp6dst)); | ||||
/* Detect the upper level protocol */ | /* Detect the upper level protocol */ | ||||
{ | { | ||||
void (*ctlfunc)(int, struct sockaddr *, void *); | |||||
u_int8_t nxt = eip6->ip6_nxt; | u_int8_t nxt = eip6->ip6_nxt; | ||||
int eoff = off + sizeof(struct icmp6_hdr) + | int eoff = off + sizeof(struct icmp6_hdr) + | ||||
sizeof(struct ip6_hdr); | sizeof(struct ip6_hdr); | ||||
struct ip6ctlparam ip6cp; | struct ip6ctlparam ip6cp; | ||||
int icmp6type = icmp6->icmp6_type; | int icmp6type = icmp6->icmp6_type; | ||||
struct ip6_frag *fh; | struct ip6_frag *fh; | ||||
struct ip6_rthdr *rth; | struct ip6_rthdr *rth; | ||||
struct ip6_rthdr0 *rth0; | struct ip6_rthdr0 *rth0; | ||||
▲ Show 20 Lines • Show All 148 Lines • ▼ Show 20 Lines | /* Detect the upper level protocol */ | ||||
ip6cp.ip6c_nxt = nxt; | ip6cp.ip6c_nxt = nxt; | ||||
if (icmp6type == ICMP6_PACKET_TOO_BIG) { | if (icmp6type == ICMP6_PACKET_TOO_BIG) { | ||||
notifymtu = ntohl(icmp6->icmp6_mtu); | notifymtu = ntohl(icmp6->icmp6_mtu); | ||||
ip6cp.ip6c_cmdarg = (void *)¬ifymtu; | ip6cp.ip6c_cmdarg = (void *)¬ifymtu; | ||||
icmp6_mtudisc_update(&ip6cp, 1); /*XXX*/ | icmp6_mtudisc_update(&ip6cp, 1); /*XXX*/ | ||||
} | } | ||||
ctlfunc = (void (*)(int, struct sockaddr *, void *)) | if (ip6_ctlprotox[nxt] != NULL) | ||||
(inet6sw[ip6_protox[nxt]].pr_ctlinput); | ip6_ctlprotox[nxt](code, (struct sockaddr *)&icmp6dst, | ||||
if (ctlfunc) { | |||||
(void) (*ctlfunc)(code, (struct sockaddr *)&icmp6dst, | |||||
&ip6cp); | &ip6cp); | ||||
} | |||||
} | } | ||||
*mp = m; | *mp = m; | ||||
return (0); | return (0); | ||||
freeit: | freeit: | ||||
m_freem(m); | m_freem(m); | ||||
*mp = NULL; | *mp = NULL; | ||||
return (-1); | return (-1); | ||||
▲ Show 20 Lines • Show All 1,649 Lines • Show Last 20 Lines |