summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkrw <krw@openbsd.org>2013-12-05 21:03:40 +0000
committerkrw <krw@openbsd.org>2013-12-05 21:03:40 +0000
commit3aa1ef9ae475a7fc027009424f3393937ea5f3e7 (patch)
tree809b6a25ed2d26a2bf055dc9f21e0d2cdd71fa46
parentuse dv_unit rather than storing local version (removed sc_unit in (diff)
downloadwireguard-openbsd-3aa1ef9ae475a7fc027009424f3393937ea5f3e7.tar.xz
wireguard-openbsd-3aa1ef9ae475a7fc027009424f3393937ea5f3e7.zip
Nuke local #define ETHER_HEADER_SIZE and use the identical value'd
ETHER_HDR_LEN from if_ether.h. dhclient change ok matthew@ as part of larger diff.
-rw-r--r--sbin/dhclient/packet.c10
-rw-r--r--usr.sbin/dhcpd/packet.c10
2 files changed, 8 insertions, 12 deletions
diff --git a/sbin/dhclient/packet.c b/sbin/dhclient/packet.c
index 915863cb4c0..b793ea9cc91 100644
--- a/sbin/dhclient/packet.c
+++ b/sbin/dhclient/packet.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: packet.c,v 1.19 2013/12/04 19:39:50 krw Exp $ */
+/* $OpenBSD: packet.c,v 1.20 2013/12/05 21:03:40 krw Exp $ */
/* Packet assembly code, originally contributed by Archie Cobbs. */
@@ -46,8 +46,6 @@
#include <netinet/ip.h>
#include <netinet/udp.h>
-#define ETHER_HEADER_SIZE (ETHER_ADDR_LEN * 2 + sizeof(u_int16_t))
-
u_int32_t checksum(unsigned char *, unsigned, u_int32_t);
u_int32_t wrapsum(u_int32_t);
@@ -101,8 +99,8 @@ assemble_hw_header(unsigned char *buf, int *bufix, struct hardware *to)
eh.ether_type = htons(ETHERTYPE_IP);
- memcpy(&buf[*bufix], &eh, ETHER_HEADER_SIZE);
- *bufix += ETHER_HEADER_SIZE;
+ memcpy(&buf[*bufix], &eh, ETHER_HDR_LEN);
+ *bufix += ETHER_HDR_LEN;
}
void
@@ -147,7 +145,7 @@ decode_hw_header(unsigned char *buf, int bufix, struct hardware *from)
{
struct ether_header eh;
- memcpy(&eh, buf + bufix, ETHER_HEADER_SIZE);
+ memcpy(&eh, buf + bufix, ETHER_HDR_LEN);
memcpy(from->haddr, eh.ether_shost, sizeof(eh.ether_shost));
from->htype = ARPHRD_ETHER;
diff --git a/usr.sbin/dhcpd/packet.c b/usr.sbin/dhcpd/packet.c
index 30d221605a7..30efac86779 100644
--- a/usr.sbin/dhcpd/packet.c
+++ b/usr.sbin/dhcpd/packet.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: packet.c,v 1.5 2013/02/03 21:04:19 krw Exp $ */
+/* $OpenBSD: packet.c,v 1.6 2013/12/05 21:03:40 krw Exp $ */
/* Packet assembly code, originally contributed by Archie Cobbs. */
@@ -47,8 +47,6 @@
#include <netinet/udp.h>
#include <netinet/if_ether.h>
-#define ETHER_HEADER_SIZE (ETHER_ADDR_LEN * 2 + sizeof(u_int16_t))
-
u_int32_t checksum(unsigned char *, unsigned, u_int32_t);
u_int32_t wrapsum(u_int32_t);
@@ -101,8 +99,8 @@ assemble_hw_header(struct interface_info *interface, unsigned char *buf,
eh.ether_type = htons(ETHERTYPE_IP);
- memcpy(&buf[*bufix], &eh, ETHER_HEADER_SIZE);
- *bufix += ETHER_HEADER_SIZE;
+ memcpy(&buf[*bufix], &eh, ETHER_HDR_LEN);
+ *bufix += ETHER_HDR_LEN;
}
void
@@ -149,7 +147,7 @@ decode_hw_header(struct interface_info *interface, unsigned char *buf,
{
struct ether_header eh;
- memcpy(&eh, buf + bufix, ETHER_HEADER_SIZE);
+ memcpy(&eh, buf + bufix, ETHER_HDR_LEN);
memcpy(from->haddr, eh.ether_shost, sizeof(eh.ether_shost));
from->htype = ARPHRD_ETHER;