summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorthorpej <thorpej@NetBSD.org>1996-10-25 06:22:24 +0000
committerthorpej <thorpej@NetBSD.org>1996-10-25 06:22:24 +0000
commitee34a9ab6dd00d64d578efb2870f184ddaeeb0cd (patch)
tree9f0da585b9b3df22eeb093c9b849806f64b3f265
parent702e7ec138c8aa743f8927231a8b90fd2cca64a2 (diff)
Make length and offset fields unsigned. From Kevin M. Lahey <kml@nas.nasa.gov>
-rw-r--r--sys/netinet/ip.h10
-rw-r--r--sys/netinet/udp.h4
2 files changed, 5 insertions, 9 deletions
diff --git a/sys/netinet/ip.h b/sys/netinet/ip.h
index acc9ad67579..17e1a61c32c 100644
--- a/sys/netinet/ip.h
+++ b/sys/netinet/ip.h
@@ -1,4 +1,4 @@
-/* $NetBSD: ip.h,v 1.14 1996/09/21 19:44:32 perry Exp $ */
+/* $NetBSD: ip.h,v 1.15 1996/10/25 06:22:24 thorpej Exp $ */
/*
* Copyright (c) 1982, 1986, 1993
@@ -43,10 +43,6 @@
/*
* Structure of an internet header, naked of options.
- *
- * We declare ip_len and ip_off to be short, rather than u_short
- * pragmatically since otherwise unsigned comparisons can result
- * against negative integers quite easily, and fail in subtle ways.
*/
struct ip {
#if BYTE_ORDER == LITTLE_ENDIAN
@@ -58,9 +54,9 @@ struct ip {
ip_hl:4; /* header length */
#endif
u_int8_t ip_tos; /* type of service */
- int16_t ip_len; /* total length */
+ u_int16_t ip_len; /* total length */
u_int16_t ip_id; /* identification */
- int16_t ip_off; /* fragment offset field */
+ u_int16_t ip_off; /* fragment offset field */
#define IP_RF 0x8000 /* reserved flag (must be zero) */
#define IP_DF 0x4000 /* dont fragment flag */
#define IP_MF 0x2000 /* more fragments flag */
diff --git a/sys/netinet/udp.h b/sys/netinet/udp.h
index c7964dfd30f..05390dd199a 100644
--- a/sys/netinet/udp.h
+++ b/sys/netinet/udp.h
@@ -1,4 +1,4 @@
-/* $NetBSD: udp.h,v 1.6 1995/04/13 06:37:10 cgd Exp $ */
+/* $NetBSD: udp.h,v 1.7 1996/10/25 06:22:25 thorpej Exp $ */
/*
* Copyright (c) 1982, 1986, 1993
@@ -42,6 +42,6 @@
struct udphdr {
u_int16_t uh_sport; /* source port */
u_int16_t uh_dport; /* destination port */
- int16_t uh_ulen; /* udp length */
+ u_int16_t uh_ulen; /* udp length */
u_int16_t uh_sum; /* udp checksum */
};