From 3f3cba24f9a8b74b25ddbf62c150b717ee97c6da Mon Sep 17 00:00:00 2001 From: Ted Lemon Date: Thu, 11 Nov 1999 16:10:43 +0000 Subject: [PATCH] Fix a struct size problem on Linux/ARM32. --- common/ethernet.c | 8 ++++---- includes/netinet/if_ether.h | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/common/ethernet.c b/common/ethernet.c index 311c3c9af..41c0a309e 100644 --- a/common/ethernet.c +++ b/common/ethernet.c @@ -42,7 +42,7 @@ #ifndef lint static char copyright[] = -"$Id: ethernet.c,v 1.1.2.1 1999/05/27 17:35:47 mellon Exp $ Copyright (c) 1996 The Internet Software Consortium. All rights reserved.\n"; +"$Id: ethernet.c,v 1.1.2.2 1999/11/11 16:10:41 mellon Exp $ Copyright (c) 1996 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -79,8 +79,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 */ @@ -95,7 +95,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 cae53863c..f61b18b62 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)) -- 2.47.3