Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet6/icmp6.c
| Show First 20 Lines • Show All 153 Lines • ▼ Show 20 Lines | |||||
| static struct mbuf *ni6_input(struct mbuf *, int, struct prison *); | static struct mbuf *ni6_input(struct mbuf *, int, struct prison *); | ||||
| static struct mbuf *ni6_nametodns(const char *, int, int); | static struct mbuf *ni6_nametodns(const char *, int, int); | ||||
| static int ni6_dnsmatch(const char *, int, const char *, int); | static int ni6_dnsmatch(const char *, int, const char *, int); | ||||
| static int ni6_addrs(struct icmp6_nodeinfo *, struct mbuf *, | static int ni6_addrs(struct icmp6_nodeinfo *, struct mbuf *, | ||||
| struct ifnet **, struct in6_addr *); | struct ifnet **, struct in6_addr *); | ||||
| static int ni6_store_addrs(struct icmp6_nodeinfo *, struct icmp6_nodeinfo *, | static int ni6_store_addrs(struct icmp6_nodeinfo *, struct icmp6_nodeinfo *, | ||||
| struct ifnet *, int); | struct ifnet *, int); | ||||
| static int icmp6_notify_error(struct mbuf **, int, int); | static int icmp6_notify_error(struct mbuf **, int, int); | ||||
| static void icmp6_mtudisc_update(struct ip6ctlparam *ip6cp); | |||||
| /* | /* | ||||
| * Kernel module interface for updating icmp6stat. The argument is an index | * Kernel module interface for updating icmp6stat. The argument is an index | ||||
| * into icmp6stat treated as an array of u_quad_t. While this encodes the | * into icmp6stat treated as an array of u_quad_t. While this encodes the | ||||
| * general layout of icmp6stat into the caller, it doesn't encode its | * general layout of icmp6stat into the caller, it doesn't encode its | ||||
| * location, so that future changes to add, for example, per-CPU stats | * location, so that future changes to add, for example, per-CPU stats | ||||
| * support won't cause binary compatibility problems for kernel modules. | * support won't cause binary compatibility problems for kernel modules. | ||||
| */ | */ | ||||
| ▲ Show 20 Lines • Show All 940 Lines • ▼ Show 20 Lines | /* Detect the upper level protocol */ | ||||
| ip6cp.ip6c_off = eoff; | ip6cp.ip6c_off = eoff; | ||||
| ip6cp.ip6c_finaldst = &icmp6dst; | ip6cp.ip6c_finaldst = &icmp6dst; | ||||
| ip6cp.ip6c_src = &icmp6src; | ip6cp.ip6c_src = &icmp6src; | ||||
| 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); | ||||
| } | } | ||||
| if (ip6_ctlprotox[nxt] != NULL) | if (ip6_ctlprotox[nxt] != NULL) | ||||
| ip6_ctlprotox[nxt](&ip6cp); | ip6_ctlprotox[nxt](&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); | ||||
| } | } | ||||
| void | static void | ||||
| icmp6_mtudisc_update(struct ip6ctlparam *ip6cp, int validated) | icmp6_mtudisc_update(struct ip6ctlparam *ip6cp) | ||||
tuexen: Right now validated is not used, but I have a change in mind which would use it. But I can… | |||||
| { | { | ||||
| struct in6_addr *dst = &ip6cp->ip6c_finaldst->sin6_addr; | struct in6_addr *dst = &ip6cp->ip6c_finaldst->sin6_addr; | ||||
| struct icmp6_hdr *icmp6 = ip6cp->ip6c_icmp6; | struct icmp6_hdr *icmp6 = ip6cp->ip6c_icmp6; | ||||
| struct mbuf *m = ip6cp->ip6c_m; /* will be necessary for scope issue */ | struct mbuf *m = ip6cp->ip6c_m; | ||||
| u_int mtu = ntohl(icmp6->icmp6_mtu); | u_int mtu = ntohl(icmp6->icmp6_mtu); | ||||
| struct in_conninfo inc; | struct in_conninfo inc; | ||||
| uint32_t max_mtu; | uint32_t max_mtu; | ||||
| #if 0 | |||||
| /* | |||||
| * RFC2460 section 5, last paragraph. | |||||
| * even though minimum link MTU for IPv6 is IPV6_MMTU, | |||||
| * we may see ICMPv6 too big with mtu < IPV6_MMTU | |||||
| * due to packet translator in the middle. | |||||
| * see ip6_output() and ip6_getpmtu() "alwaysfrag" case for | |||||
| * special handling. | |||||
| */ | |||||
| if (mtu < IPV6_MMTU) | if (mtu < IPV6_MMTU) | ||||
| return; | |||||
| #endif | |||||
| /* | |||||
| * we reject ICMPv6 too big with abnormally small value. | |||||
| * XXX what is the good definition of "abnormally small"? | |||||
| */ | |||||
| if (mtu < sizeof(struct ip6_hdr) + sizeof(struct ip6_frag) + 8) | |||||
| return; | |||||
| if (!validated) | |||||
| return; | return; | ||||
| /* | |||||
| * In case the suggested mtu is less than IPV6_MMTU, we | |||||
| * only need to remember that it was for above mentioned | |||||
| * "alwaysfrag" case. | |||||
| * Try to be as close to the spec as possible. | |||||
| */ | |||||
| if (mtu < IPV6_MMTU) | |||||
| mtu = IPV6_MMTU - 8; | |||||
| bzero(&inc, sizeof(inc)); | bzero(&inc, sizeof(inc)); | ||||
| inc.inc_fibnum = M_GETFIB(m); | inc.inc_fibnum = M_GETFIB(m); | ||||
| inc.inc_flags |= INC_ISIPV6; | inc.inc_flags |= INC_ISIPV6; | ||||
| inc.inc6_faddr = *dst; | inc.inc6_faddr = *dst; | ||||
| if (in6_setscope(&inc.inc6_faddr, m->m_pkthdr.rcvif, NULL)) | if (in6_setscope(&inc.inc6_faddr, m->m_pkthdr.rcvif, NULL)) | ||||
| return; | return; | ||||
| max_mtu = tcp_hc_getmtu(&inc); | max_mtu = tcp_hc_getmtu(&inc); | ||||
| ▲ Show 20 Lines • Show All 1,752 Lines • Show Last 20 Lines | |||||
Right now validated is not used, but I have a change in mind which would use it. But I can bring this back (as a boolean), when I actually need it.