summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Wright <jason@cvs.openbsd.org>2001-02-01 20:19:25 +0000
committerJason Wright <jason@cvs.openbsd.org>2001-02-01 20:19:25 +0000
commitc47b47293a6b69e6dee72577b6e8d34278fe56ba (patch)
tree114bc76e4c556077fdebfc304d7909c0dc8232b5
parentb903e4b4cffc69cd803e6845fec6fa1b34d175e4 (diff)
grr, don't forget to change the reserved field to the upper 4 bits of the header.
-rw-r--r--sys/netinet/ip_ether.c7
-rw-r--r--sys/netinet/ip_ether.h3
2 files changed, 6 insertions, 4 deletions
diff --git a/sys/netinet/ip_ether.c b/sys/netinet/ip_ether.c
index 5597f252af7..cb495529c98 100644
--- a/sys/netinet/ip_ether.c
+++ b/sys/netinet/ip_ether.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_ether.c,v 1.19 2001/02/01 20:14:26 jason Exp $ */
+/* $OpenBSD: ip_ether.c,v 1.20 2001/02/01 20:19:24 jason Exp $ */
/*
* The author of this code is Angelos D. Keromytis (kermit@adk.gr)
@@ -136,13 +136,14 @@ va_dcl
/* Verify EtherIP version number */
m_copydata(m, iphlen, sizeof(u_int8_t), &v);
- if ((v & ETHERIP_VERSION_MASK) != ETHERIP_VERSION) {
+ if ((v & ETHERIP_VERSION_MASK) != ETHERIP_VERSION)
+ {
/*
* Note that the other potential failure of the above check is that the
* second nibble of the EtherIP header (the reserved part) is not
* zero; this is also invalid protocol behaviour.
*/
- if (v & 0x0f)
+ if (v & ETHERIP_RSVD_MASK)
{
DPRINTF(("etherip_input(): received invalid EtherIP header (reserved field non-zero\n"));
}
diff --git a/sys/netinet/ip_ether.h b/sys/netinet/ip_ether.h
index c332ccf7139..d10102ad4cd 100644
--- a/sys/netinet/ip_ether.h
+++ b/sys/netinet/ip_ether.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_ether.h,v 1.5 2001/02/01 20:14:27 jason Exp $ */
+/* $OpenBSD: ip_ether.h,v 1.6 2001/02/01 20:19:24 jason Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@adk.gr)
@@ -42,6 +42,7 @@ struct etheripstat
#define ETHERIP_VERSION 0x02
#define ETHERIP_VERSION_MASK 0x0f
+#define ETHERIP_RSVD_MASK 0xf0
/*
* Names for Ether-IP sysctl objects