| version 1.80.2.3, 2002/06/23 17:51:04 |
version 1.80.2.4, 2002/09/06 08:49:23 |
| Line 216 udp_input(m, va_alist) |
|
| Line 216 udp_input(m, va_alist) |
|
| int iphlen, proto; |
int iphlen, proto; |
| int len; |
int len; |
| int n; |
int n; |
| |
u_int16_t ip_len; |
| |
|
| va_start(ap, m); |
va_start(ap, m); |
| iphlen = va_arg(ap, int); |
iphlen = va_arg(ap, int); |
| Line 262 udp_input(m, va_alist) |
|
| Line 263 udp_input(m, va_alist) |
|
| return; |
return; |
| } |
} |
| #endif |
#endif |
| |
KASSERT(UDP_HDR_ALIGNED_P(uh)); |
| |
|
| /* destination port of 0 is illegal, based on RFC768. */ |
/* destination port of 0 is illegal, based on RFC768. */ |
| if (uh->uh_dport == 0) |
if (uh->uh_dport == 0) |
| Line 271 udp_input(m, va_alist) |
|
| Line 273 udp_input(m, va_alist) |
|
| * Make mbuf data length reflect UDP length. |
* Make mbuf data length reflect UDP length. |
| * If not enough data to reflect UDP length, drop. |
* If not enough data to reflect UDP length, drop. |
| */ |
*/ |
| |
ip_len = ntohs(ip->ip_len); |
| len = ntohs((u_int16_t)uh->uh_ulen); |
len = ntohs((u_int16_t)uh->uh_ulen); |
| if (ip->ip_len != iphlen + len) { |
if (ip_len != iphlen + len) { |
| if (ip->ip_len < iphlen + len || len < sizeof(struct udphdr)) { |
if (ip_len < iphlen + len || len < sizeof(struct udphdr)) { |
| udpstat.udps_badlen++; |
udpstat.udps_badlen++; |
| goto bad; |
goto bad; |
| } |
} |
| m_adj(m, iphlen + len - ip->ip_len); |
m_adj(m, iphlen + len - ip_len); |
| } |
} |
| |
|
| /* |
/* |
| Line 418 udp6_input(mp, offp, proto) |
|
| Line 421 udp6_input(mp, offp, proto) |
|
| return IPPROTO_DONE; |
return IPPROTO_DONE; |
| } |
} |
| #endif |
#endif |
| |
KASSERT(UDP_HDR_ALIGNED_P(uh)); |
| ulen = ntohs((u_short)uh->uh_ulen); |
ulen = ntohs((u_short)uh->uh_ulen); |
| /* |
/* |
| * RFC2675 section 4: jumbograms will have 0 in the UDP header field, |
* RFC2675 section 4: jumbograms will have 0 in the UDP header field, |
| Line 890 udp_output(m, va_alist) |
|
| Line 894 udp_output(m, va_alist) |
|
| * Compute the packet length of the IP header, and |
* Compute the packet length of the IP header, and |
| * punt if the length looks bogus. |
* punt if the length looks bogus. |
| */ |
*/ |
| if ((len + sizeof(struct udpiphdr)) > IP_MAXPACKET) { |
if (len + sizeof(struct udpiphdr) > IP_MAXPACKET) { |
| error = EMSGSIZE; |
error = EMSGSIZE; |
| goto release; |
goto release; |
| } |
} |
| Line 922 udp_output(m, va_alist) |
|
| Line 926 udp_output(m, va_alist) |
|
| m->m_pkthdr.csum_data = offsetof(struct udphdr, uh_sum); |
m->m_pkthdr.csum_data = offsetof(struct udphdr, uh_sum); |
| } else |
} else |
| ui->ui_sum = 0; |
ui->ui_sum = 0; |
| ((struct ip *)ui)->ip_len = sizeof (struct udpiphdr) + len; |
((struct ip *)ui)->ip_len = htons(sizeof (struct udpiphdr) + len); |
| ((struct ip *)ui)->ip_ttl = inp->inp_ip.ip_ttl; /* XXX */ |
((struct ip *)ui)->ip_ttl = inp->inp_ip.ip_ttl; /* XXX */ |
| ((struct ip *)ui)->ip_tos = inp->inp_ip.ip_tos; /* XXX */ |
((struct ip *)ui)->ip_tos = inp->inp_ip.ip_tos; /* XXX */ |
| udpstat.udps_opackets++; |
udpstat.udps_opackets++; |