| version 1.98, 2003/02/26 06:31:17 |
version 1.99, 2003/05/14 06:47:37 |
| Line 106 __KERNEL_RCSID(0, "$NetBSD$"); |
|
| Line 106 __KERNEL_RCSID(0, "$NetBSD$"); |
|
| #include <netinet6/udp6_var.h> |
#include <netinet6/udp6_var.h> |
| #endif |
#endif |
| |
|
| #ifdef PULLDOWN_TEST |
|
| #ifndef INET6 |
#ifndef INET6 |
| /* always need ip6.h for IP6_EXTHDR_GET */ |
/* always need ip6.h for IP6_EXTHDR_GET */ |
| #include <netinet/ip6.h> |
#include <netinet/ip6.h> |
| #endif |
#endif |
| #endif |
|
| |
|
| #include "faith.h" |
#include "faith.h" |
| #if defined(NFAITH) && NFAITH > 0 |
#if defined(NFAITH) && NFAITH > 0 |
| Line 236 udp_input(m, va_alist) |
|
| Line 234 udp_input(m, va_alist) |
|
| MCLAIM(m, &udp_rx_mowner); |
MCLAIM(m, &udp_rx_mowner); |
| udpstat.udps_ipackets++; |
udpstat.udps_ipackets++; |
| |
|
| #ifndef PULLDOWN_TEST |
|
| /* |
|
| * Strip IP options, if any; should skip this, |
|
| * make available to user, and use on returned packets, |
|
| * but we don't yet have a way to check the checksum |
|
| * with options still present. |
|
| */ |
|
| if (iphlen > sizeof (struct ip)) { |
|
| ip_stripoptions(m, (struct mbuf *)0); |
|
| iphlen = sizeof(struct ip); |
|
| } |
|
| #else |
|
| /* |
|
| * we may enable the above code if we save and pass IPv4 options |
|
| * to the userland. |
|
| */ |
|
| #endif |
|
| |
|
| /* |
/* |
| * Get IP and UDP header together in first mbuf. |
* Get IP and UDP header together in first mbuf. |
| */ |
*/ |
| ip = mtod(m, struct ip *); |
ip = mtod(m, struct ip *); |
| #ifndef PULLDOWN_TEST |
|
| if (m->m_len < iphlen + sizeof(struct udphdr)) { |
|
| if ((m = m_pullup(m, iphlen + sizeof(struct udphdr))) == 0) { |
|
| udpstat.udps_hdrops++; |
|
| return; |
|
| } |
|
| ip = mtod(m, struct ip *); |
|
| } |
|
| uh = (struct udphdr *)((caddr_t)ip + iphlen); |
|
| #else |
|
| IP6_EXTHDR_GET(uh, struct udphdr *, m, iphlen, sizeof(struct udphdr)); |
IP6_EXTHDR_GET(uh, struct udphdr *, m, iphlen, sizeof(struct udphdr)); |
| if (uh == NULL) { |
if (uh == NULL) { |
| udpstat.udps_hdrops++; |
udpstat.udps_hdrops++; |
| return; |
return; |
| } |
} |
| #endif |
|
| KASSERT(UDP_HDR_ALIGNED_P(uh)); |
KASSERT(UDP_HDR_ALIGNED_P(uh)); |
| |
|
| /* destination port of 0 is illegal, based on RFC768. */ |
/* destination port of 0 is illegal, based on RFC768. */ |
| Line 406 udp6_input(mp, offp, proto) |
|
| Line 375 udp6_input(mp, offp, proto) |
|
| struct udphdr *uh; |
struct udphdr *uh; |
| u_int32_t plen, ulen; |
u_int32_t plen, ulen; |
| |
|
| #ifndef PULLDOWN_TEST |
|
| IP6_EXTHDR_CHECK(m, off, sizeof(struct udphdr), IPPROTO_DONE); |
|
| #endif |
|
| ip6 = mtod(m, struct ip6_hdr *); |
ip6 = mtod(m, struct ip6_hdr *); |
| |
|
| #if defined(NFAITH) && 0 < NFAITH |
#if defined(NFAITH) && 0 < NFAITH |
| Line 423 udp6_input(mp, offp, proto) |
|
| Line 389 udp6_input(mp, offp, proto) |
|
| |
|
| /* check for jumbogram is done in ip6_input. we can trust pkthdr.len */ |
/* check for jumbogram is done in ip6_input. we can trust pkthdr.len */ |
| plen = m->m_pkthdr.len - off; |
plen = m->m_pkthdr.len - off; |
| #ifndef PULLDOWN_TEST |
|
| uh = (struct udphdr *)((caddr_t)ip6 + off); |
|
| #else |
|
| IP6_EXTHDR_GET(uh, struct udphdr *, m, off, sizeof(struct udphdr)); |
IP6_EXTHDR_GET(uh, struct udphdr *, m, off, sizeof(struct udphdr)); |
| if (uh == NULL) { |
if (uh == NULL) { |
| ip6stat.ip6s_tooshort++; |
ip6stat.ip6s_tooshort++; |
| return IPPROTO_DONE; |
return IPPROTO_DONE; |
| } |
} |
| #endif |
|
| KASSERT(UDP_HDR_ALIGNED_P(uh)); |
KASSERT(UDP_HDR_ALIGNED_P(uh)); |
| ulen = ntohs((u_short)uh->uh_ulen); |
ulen = ntohs((u_short)uh->uh_ulen); |
| /* |
/* |