Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet6/icmp6.c
Show First 20 Lines • Show All 254 Lines • ▼ Show 20 Lines | |||||
/* | /* | ||||
* Generate an error packet of type error in response to bad IP6 packet. | * Generate an error packet of type error in response to bad IP6 packet. | ||||
*/ | */ | ||||
void | void | ||||
icmp6_error(struct mbuf *m, int type, int code, int param) | icmp6_error(struct mbuf *m, int type, int code, int param) | ||||
{ | { | ||||
struct ip6_hdr *oip6, *nip6; | struct ip6_hdr *oip6, *nip6; | ||||
struct icmp6_hdr *icmp6; | struct icmp6_hdr *icmp6; | ||||
struct epoch_tracker et; | |||||
u_int preplen; | u_int preplen; | ||||
int off; | int off; | ||||
int nxt; | int nxt; | ||||
ICMP6STAT_INC(icp6s_error); | ICMP6STAT_INC(icp6s_error); | ||||
/* count per-type-code statistics */ | /* count per-type-code statistics */ | ||||
icmp6_errcount(type, code); | icmp6_errcount(type, code); | ||||
▲ Show 20 Lines • Show All 103 Lines • ▼ Show 20 Lines | #endif | ||||
in6_clearscope(&oip6->ip6_dst); | in6_clearscope(&oip6->ip6_dst); | ||||
icmp6 = (struct icmp6_hdr *)(nip6 + 1); | icmp6 = (struct icmp6_hdr *)(nip6 + 1); | ||||
icmp6->icmp6_type = type; | icmp6->icmp6_type = type; | ||||
icmp6->icmp6_code = code; | icmp6->icmp6_code = code; | ||||
icmp6->icmp6_pptr = htonl((u_int32_t)param); | icmp6->icmp6_pptr = htonl((u_int32_t)param); | ||||
ICMP6STAT_INC(icp6s_outhist[type]); | ICMP6STAT_INC(icp6s_outhist[type]); | ||||
NET_EPOCH_ENTER(et); | |||||
icmp6_reflect(m, sizeof(struct ip6_hdr)); /* header order: IPv6 - ICMPv6 */ | icmp6_reflect(m, sizeof(struct ip6_hdr)); /* header order: IPv6 - ICMPv6 */ | ||||
NET_EPOCH_EXIT(et); | |||||
return; | return; | ||||
freeit: | freeit: | ||||
/* | /* | ||||
* If we can't tell whether or not we can generate ICMP6, free it. | * If we can't tell whether or not we can generate ICMP6, free it. | ||||
*/ | */ | ||||
m_freem(m); | m_freem(m); | ||||
▲ Show 20 Lines • Show All 2,415 Lines • Show Last 20 Lines |