From f050b4cb94a569536e4d44530c6c4e114461ffe4 Mon Sep 17 00:00:00 2001 From: krw Date: Fri, 7 Jul 2017 15:14:47 +0000 Subject: [PATCH] assemble_eh_header() needs only to know about hw_addr. No more struct interface_info knowledge in packet.c --- sbin/dhclient/bpf.c | 4 ++-- sbin/dhclient/dhcpd.h | 4 ++-- sbin/dhclient/packet.c | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/sbin/dhclient/bpf.c b/sbin/dhclient/bpf.c index d3d6761ffad..c374d1e3039 100644 --- a/sbin/dhclient/bpf.c +++ b/sbin/dhclient/bpf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bpf.c,v 1.55 2017/07/03 22:06:11 krw Exp $ */ +/* $OpenBSD: bpf.c,v 1.56 2017/07/07 15:14:47 krw Exp $ */ /* BPF socket interface code, originally contributed by Archie Cobbs. */ @@ -272,7 +272,7 @@ send_packet(struct interface_info *ifi, struct in_addr from, struct in_addr to) dest.sin_addr.s_addr = to.s_addr; if (to.s_addr == INADDR_BROADCAST) { - assemble_eh_header(ifi, &eh); + assemble_eh_header(ifi->hw_address, &eh); iov[0].iov_base = &eh; iov[0].iov_len = sizeof(eh); iovcnt++; diff --git a/sbin/dhclient/dhcpd.h b/sbin/dhclient/dhcpd.h index 5b3e7f7caa6..86b4f7c37f2 100644 --- a/sbin/dhclient/dhcpd.h +++ b/sbin/dhclient/dhcpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: dhcpd.h,v 1.205 2017/07/07 14:53:06 krw Exp $ */ +/* $OpenBSD: dhcpd.h,v 1.206 2017/07/07 15:14:47 krw Exp $ */ /* * Copyright (c) 2004 Henning Brauer @@ -229,7 +229,7 @@ void free_client_lease(struct client_lease *); void routehandler(struct interface_info *, int); /* packet.c */ -void assemble_eh_header(struct interface_info *, struct ether_header *); +void assemble_eh_header(struct ether_addr, struct ether_header *); ssize_t decode_hw_header(unsigned char *, u_int32_t, struct ether_addr *); ssize_t decode_udp_ip_header(unsigned char *, u_int32_t, struct sockaddr_in *); u_int32_t checksum(unsigned char *, u_int32_t, u_int32_t); diff --git a/sbin/dhclient/packet.c b/sbin/dhclient/packet.c index 14cf4538085..b2c6fe38b61 100644 --- a/sbin/dhclient/packet.c +++ b/sbin/dhclient/packet.c @@ -1,4 +1,4 @@ -/* $OpenBSD: packet.c,v 1.35 2017/04/18 13:59:09 krw Exp $ */ +/* $OpenBSD: packet.c,v 1.36 2017/07/07 15:14:47 krw Exp $ */ /* Packet assembly code, originally contributed by Archie Cobbs. */ @@ -93,11 +93,11 @@ wrapsum(u_int32_t sum) } void -assemble_eh_header(struct interface_info *ifi, struct ether_header *eh) +assemble_eh_header(struct ether_addr shost, struct ether_header *eh) { memset(eh->ether_dhost, 0xff, sizeof(eh->ether_dhost)); - memcpy(eh->ether_shost, ifi->hw_address.ether_addr_octet, + memcpy(eh->ether_shost, shost.ether_addr_octet, sizeof(eh->ether_shost)); eh->ether_type = htons(ETHERTYPE_IP); -- 2.20.1