| version 1.145, 2005/12/11 12:24:58 |
version 1.145.2.1, 2006/02/01 14:52:41 |
| Line 106 __KERNEL_RCSID(0, "$NetBSD$"); |
|
| Line 106 __KERNEL_RCSID(0, "$NetBSD$"); |
|
| #include <netinet6/ip6_var.h> |
#include <netinet6/ip6_var.h> |
| #include <netinet6/in6_pcb.h> |
#include <netinet6/in6_pcb.h> |
| #include <netinet6/udp6_var.h> |
#include <netinet6/udp6_var.h> |
| |
#include <netinet6/scope6_var.h> |
| #endif |
#endif |
| |
|
| #ifndef INET6 |
#ifndef INET6 |
| Line 575 udp6_input(struct mbuf **mp, int *offp, |
|
| Line 576 udp6_input(struct mbuf **mp, int *offp, |
|
| |
|
| /* |
/* |
| * Construct source and dst sockaddrs. |
* Construct source and dst sockaddrs. |
| * Note that ifindex (s6_addr16[1]) is already filled. |
|
| */ |
*/ |
| bzero(&src, sizeof(src)); |
bzero(&src, sizeof(src)); |
| src.sin6_family = AF_INET6; |
src.sin6_family = AF_INET6; |
| src.sin6_len = sizeof(struct sockaddr_in6); |
src.sin6_len = sizeof(struct sockaddr_in6); |
| /* KAME hack: recover scopeid */ |
src.sin6_addr = ip6->ip6_src; |
| (void)in6_recoverscope(&src, &ip6->ip6_src, m->m_pkthdr.rcvif); |
|
| src.sin6_port = uh->uh_sport; |
src.sin6_port = uh->uh_sport; |
| bzero(&dst, sizeof(dst)); |
bzero(&dst, sizeof(dst)); |
| dst.sin6_family = AF_INET6; |
dst.sin6_family = AF_INET6; |
| dst.sin6_len = sizeof(struct sockaddr_in6); |
dst.sin6_len = sizeof(struct sockaddr_in6); |
| /* KAME hack: recover scopeid */ |
dst.sin6_addr = ip6->ip6_dst; |
| (void)in6_recoverscope(&dst, &ip6->ip6_dst, m->m_pkthdr.rcvif); |
|
| dst.sin6_port = uh->uh_dport; |
dst.sin6_port = uh->uh_dport; |
| |
|
| if (udp6_realinput(AF_INET6, &src, &dst, m, off) == 0) { |
if (udp6_realinput(AF_INET6, &src, &dst, m, off) == 0) { |
| Line 845 udp6_realinput(int af, struct sockaddr_i |
|
| Line 843 udp6_realinput(int af, struct sockaddr_i |
|
| { |
{ |
| u_int16_t sport, dport; |
u_int16_t sport, dport; |
| int rcvcnt; |
int rcvcnt; |
| struct in6_addr src6, dst6; |
struct in6_addr src6, *dst6; |
| const struct in_addr *dst4; |
const struct in_addr *dst4; |
| struct inpcb_hdr *inph; |
struct inpcb_hdr *inph; |
| struct in6pcb *in6p; |
struct in6pcb *in6p; |
| Line 858 udp6_realinput(int af, struct sockaddr_i |
|
| Line 856 udp6_realinput(int af, struct sockaddr_i |
|
| if (src->sin6_family != AF_INET6 || dst->sin6_family != AF_INET6) |
if (src->sin6_family != AF_INET6 || dst->sin6_family != AF_INET6) |
| goto bad; |
goto bad; |
| |
|
| in6_embedscope(&src6, src, NULL, NULL); |
src6 = src->sin6_addr; |
| |
if (sa6_recoverscope(src) != 0) { |
| |
/* XXX: should be impossible. */ |
| |
goto bad; |
| |
} |
| sport = src->sin6_port; |
sport = src->sin6_port; |
| in6_embedscope(&dst6, dst, NULL, NULL); |
|
| dport = dst->sin6_port; |
dport = dst->sin6_port; |
| dst4 = (struct in_addr *)&dst->sin6_addr.s6_addr[12]; |
dst4 = (struct in_addr *)&dst->sin6_addr.s6_addr[12]; |
| |
dst6 = &dst->sin6_addr; |
| |
|
| if (IN6_IS_ADDR_MULTICAST(&dst6) || |
if (IN6_IS_ADDR_MULTICAST(dst6) || |
| (af == AF_INET && IN_MULTICAST(dst4->s_addr))) { |
(af == AF_INET && IN_MULTICAST(dst4->s_addr))) { |
| /* |
/* |
| * Deliver a multicast or broadcast datagram to *all* sockets |
* Deliver a multicast or broadcast datagram to *all* sockets |
| Line 897 udp6_realinput(int af, struct sockaddr_i |
|
| Line 900 udp6_realinput(int af, struct sockaddr_i |
|
| if (in6p->in6p_lport != dport) |
if (in6p->in6p_lport != dport) |
| continue; |
continue; |
| if (!IN6_IS_ADDR_UNSPECIFIED(&in6p->in6p_laddr)) { |
if (!IN6_IS_ADDR_UNSPECIFIED(&in6p->in6p_laddr)) { |
| if (!IN6_ARE_ADDR_EQUAL(&in6p->in6p_laddr, &dst6)) |
if (!IN6_ARE_ADDR_EQUAL(&in6p->in6p_laddr, |
| |
dst6)) |
| continue; |
continue; |
| } else { |
} else { |
| if (IN6_IS_ADDR_V4MAPPED(&dst6) && |
if (IN6_IS_ADDR_V4MAPPED(dst6) && |
| (in6p->in6p_flags & IN6P_IPV6_V6ONLY)) |
(in6p->in6p_flags & IN6P_IPV6_V6ONLY)) |
| continue; |
continue; |
| } |
} |
| Line 934 udp6_realinput(int af, struct sockaddr_i |
|
| Line 938 udp6_realinput(int af, struct sockaddr_i |
|
| /* |
/* |
| * Locate pcb for datagram. |
* Locate pcb for datagram. |
| */ |
*/ |
| in6p = in6_pcblookup_connect(&udbtable, &src6, sport, |
in6p = in6_pcblookup_connect(&udbtable, &src6, sport, dst6, |
| &dst6, dport, 0); |
dport, 0); |
| if (in6p == 0) { |
if (in6p == 0) { |
| ++udpstat.udps_pcbhashmiss; |
++udpstat.udps_pcbhashmiss; |
| in6p = in6_pcblookup_bind(&udbtable, &dst6, dport, 0); |
in6p = in6_pcblookup_bind(&udbtable, dst6, dport, 0); |
| if (in6p == 0) |
if (in6p == 0) |
| return rcvcnt; |
return rcvcnt; |
| } |
} |