summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Lemon <source@isc.org>1999-11-11 16:10:59 +0000
committerTed Lemon <source@isc.org>1999-11-11 16:10:59 +0000
commit98c83345a13c3094c8d45ec935d379740f9758fc (patch)
tree32ef0a89199a0e50dc87e5344cf3ae0a4e275e8c
parent3107c7f9bb8eeaa8055e59b0a22f8bc37d76fcc5 (diff)
downloadisc-dhcp-98c83345a13c3094c8d45ec935d379740f9758fc.tar.gz
Fix a struct size problem on Linux/ARM32.
-rw-r--r--common/ethernet.c8
-rw-r--r--includes/netinet/if_ether.h1
2 files changed, 5 insertions, 4 deletions
diff --git a/common/ethernet.c b/common/ethernet.c
index e7cbea2a..1a1162b7 100644
--- a/common/ethernet.c
+++ b/common/ethernet.c
@@ -22,7 +22,7 @@
#ifndef lint
static char copyright[] =
-"$Id: ethernet.c,v 1.2 1999/10/07 06:35:42 mellon Exp $ Copyright (c) 1996 The Internet Software Consortium. All rights reserved.\n";
+"$Id: ethernet.c,v 1.3 1999/11/11 16:10:57 mellon Exp $ Copyright (c) 1996 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -59,8 +59,8 @@ void assemble_ethernet_header (interface, buf, bufix, to)
eh.ether_type = htons (ETHERTYPE_IP);
#endif
- memcpy (&buf [*bufix], &eh, sizeof eh);
- *bufix += sizeof eh;
+ memcpy (&buf [*bufix], &eh, ETHER_HEADER_SIZE);
+ *bufix += ETHER_HEADER_SIZE;
}
#endif /* PACKET_ASSEMBLY */
@@ -75,7 +75,7 @@ ssize_t decode_ethernet_header (interface, buf, bufix, from)
{
struct ether_header eh;
- memcpy (&eh, buf + bufix, sizeof eh);
+ memcpy (&eh, buf + bufix, ETHER_HEADER_SIZE);
#ifdef USERLAND_FILTER
if (ntohs (eh.ether_type) != ETHERTYPE_IP)
diff --git a/includes/netinet/if_ether.h b/includes/netinet/if_ether.h
index cae53863..f61b18b6 100644
--- a/includes/netinet/if_ether.h
+++ b/includes/netinet/if_ether.h
@@ -72,3 +72,4 @@ struct ether_header {
#define ETHERMTU 1500
#define ETHERMIN (60-14)
+#define ETHER_HEADER_SIZE (ETHER_ADDR_LEN * 2 + sizeof (u_int16_t))