version 1.42, 1997/07/28 22:19:53 |
version 1.47, 1999/01/19 23:03:22 |
|
|
/* $NetBSD$ */ |
/* $NetBSD$ */ |
|
|
/* |
/* |
* Copyright (c) 1982, 1986, 1988, 1990, 1993 |
* Copyright (c) 1982, 1986, 1988, 1990, 1993, 1995 |
* The Regents of the University of California. All rights reserved. |
* The Regents of the University of California. All rights reserved. |
* |
* |
* Redistribution and use in source and binary forms, with or without |
* Redistribution and use in source and binary forms, with or without |
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
* SUCH DAMAGE. |
* SUCH DAMAGE. |
* |
* |
* @(#)udp_usrreq.c 8.4 (Berkeley) 1/21/94 |
* @(#)udp_usrreq.c 8.6 (Berkeley) 5/23/95 |
*/ |
*/ |
#include "ipkdb.h" |
#include "ipkdb.h" |
|
|
Line 143 udp_input(m, va_alist) |
|
Line 143 udp_input(m, va_alist) |
|
* If not enough data to reflect UDP length, drop. |
* If not enough data to reflect UDP length, drop. |
*/ |
*/ |
len = ntohs((u_int16_t)uh->uh_ulen); |
len = ntohs((u_int16_t)uh->uh_ulen); |
if (ip->ip_len != len) { |
if (ip->ip_len != iphlen + len) { |
if (len > ip->ip_len) { |
if (ip->ip_len < iphlen + len) { |
udpstat.udps_badlen++; |
udpstat.udps_badlen++; |
goto bad; |
goto bad; |
} |
} |
m_adj(m, len - ip->ip_len); |
m_adj(m, iphlen + len - ip->ip_len); |
/* ip->ip_len = len; */ |
|
} |
} |
/* |
/* |
* Save a copy of the IP header in case we want restore it |
* Save a copy of the IP header in case we want restore it |
Line 164 udp_input(m, va_alist) |
|
Line 163 udp_input(m, va_alist) |
|
bzero(((struct ipovly *)ip)->ih_x1, |
bzero(((struct ipovly *)ip)->ih_x1, |
sizeof ((struct ipovly *)ip)->ih_x1); |
sizeof ((struct ipovly *)ip)->ih_x1); |
((struct ipovly *)ip)->ih_len = uh->uh_ulen; |
((struct ipovly *)ip)->ih_len = uh->uh_ulen; |
if ((uh->uh_sum = in_cksum(m, len + sizeof (struct ip))) != 0) { |
if (in_cksum(m, len + sizeof (struct ip)) != 0) { |
udpstat.udps_badsum++; |
udpstat.udps_badsum++; |
m_freem(m); |
m_freem(m); |
return; |
return; |
Line 199 udp_input(m, va_alist) |
|
Line 198 udp_input(m, va_alist) |
|
udpsrc.sin_port = uh->uh_sport; |
udpsrc.sin_port = uh->uh_sport; |
bzero((caddr_t)udpsrc.sin_zero, sizeof(udpsrc.sin_zero)); |
bzero((caddr_t)udpsrc.sin_zero, sizeof(udpsrc.sin_zero)); |
|
|
m->m_len -= sizeof (struct udpiphdr); |
iphlen += sizeof(struct udphdr); |
m->m_data += sizeof (struct udpiphdr); |
m->m_len -= iphlen; |
|
m->m_pkthdr.len -= iphlen; |
|
m->m_data += iphlen; |
/* |
/* |
* Locate pcb(s) for datagram. |
* Locate pcb(s) for datagram. |
* (Algorithm copied from raw_intr().) |
* (Algorithm copied from raw_intr().) |