Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/sys/netinet/udp_usrreq.c,v retrieving revision 1.93.2.3 retrieving revision 1.94 diff -u -p -r1.93.2.3 -r1.94 --- src/sys/netinet/udp_usrreq.c 2002/08/29 00:56:49 1.93.2.3 +++ src/sys/netinet/udp_usrreq.c 2002/06/09 16:33:45 1.94 @@ -1,4 +1,4 @@ -/* $NetBSD: udp_usrreq.c,v 1.93.2.3 2002/08/29 00:56:49 gehenna Exp $ */ +/* $NetBSD: udp_usrreq.c,v 1.94 2002/06/09 16:33:45 itojun Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -65,7 +65,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: udp_usrreq.c,v 1.93.2.3 2002/08/29 00:56:49 gehenna Exp $"); +__KERNEL_RCSID(0, "$NetBSD: udp_usrreq.c,v 1.94 2002/06/09 16:33:45 itojun Exp $"); #include "opt_inet.h" #include "opt_ipsec.h" @@ -216,7 +216,6 @@ udp_input(m, va_alist) int iphlen, proto; int len; int n; - u_int16_t ip_len; va_start(ap, m); iphlen = va_arg(ap, int); @@ -263,7 +262,6 @@ udp_input(m, va_alist) return; } #endif - KASSERT(UDP_HDR_ALIGNED_P(uh)); /* destination port of 0 is illegal, based on RFC768. */ if (uh->uh_dport == 0) @@ -273,14 +271,13 @@ udp_input(m, va_alist) * Make mbuf data length reflect UDP length. * If not enough data to reflect UDP length, drop. */ - ip_len = ntohs(ip->ip_len); len = ntohs((u_int16_t)uh->uh_ulen); - if (ip_len != iphlen + len) { - if (ip_len < iphlen + len || len < sizeof(struct udphdr)) { + if (ip->ip_len != iphlen + len) { + if (ip->ip_len < iphlen + len || len < sizeof(struct udphdr)) { udpstat.udps_badlen++; goto bad; } - m_adj(m, iphlen + len - ip_len); + m_adj(m, iphlen + len - ip->ip_len); } /* @@ -421,7 +418,6 @@ udp6_input(mp, offp, proto) return IPPROTO_DONE; } #endif - KASSERT(UDP_HDR_ALIGNED_P(uh)); ulen = ntohs((u_short)uh->uh_ulen); /* * RFC2675 section 4: jumbograms will have 0 in the UDP header field, @@ -894,7 +890,7 @@ udp_output(m, va_alist) * Compute the packet length of the IP header, and * punt if the length looks bogus. */ - if (len + sizeof(struct udpiphdr) > IP_MAXPACKET) { + if ((len + sizeof(struct udpiphdr)) > IP_MAXPACKET) { error = EMSGSIZE; goto release; } @@ -926,7 +922,7 @@ udp_output(m, va_alist) m->m_pkthdr.csum_data = offsetof(struct udphdr, uh_sum); } else ui->ui_sum = 0; - ((struct ip *)ui)->ip_len = htons(sizeof (struct udpiphdr) + len); + ((struct ip *)ui)->ip_len = sizeof (struct udpiphdr) + len; ((struct ip *)ui)->ip_ttl = inp->inp_ip.ip_ttl; /* XXX */ ((struct ip *)ui)->ip_tos = inp->inp_ip.ip_tos; /* XXX */ udpstat.udps_opackets++;