[OpenPower-Firmware] [PATCH 6/7] udhcpc: Init DHCP headers with the correct htype

Daniel M. Weeks weeksd2 at rpi.edu
Fri Apr 17 06:19:39 AEST 2020


Signed-off-by: Daniel M. Weeks <weeksd2 at rpi.edu>
---
 networking/udhcp/common.h | 2 +-
 networking/udhcp/dhcpc.c  | 2 +-
 networking/udhcp/packet.c | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/networking/udhcp/common.h b/networking/udhcp/common.h
index d9cbf3b53..80ada8d48 100644
--- a/networking/udhcp/common.h
+++ b/networking/udhcp/common.h
@@ -306,7 +306,7 @@ int FAST_FUNC udhcp_str2optset(const char *str,
 		bool dhcpv6);
 
 #if ENABLE_UDHCPC || ENABLE_UDHCPD
-void udhcp_init_header(struct dhcp_packet *packet, char type) FAST_FUNC;
+void udhcp_init_header(struct dhcp_packet *packet, char type, char htype) FAST_FUNC;
 #endif
 
 int udhcp_recv_kernel_packet(struct dhcp_packet *packet, int fd) FAST_FUNC;
diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c
index 95f738841..8cf8a3e90 100644
--- a/networking/udhcp/dhcpc.c
+++ b/networking/udhcp/dhcpc.c
@@ -596,7 +596,7 @@ static void init_packet(struct dhcp_packet *packet, char type)
 	uint16_t secs;
 
 	/* Fill in: op, htype, hlen, cookie fields; message type option: */
-	udhcp_init_header(packet, type);
+	udhcp_init_header(packet, type, client_config.client_htype);
 
 	packet->xid = random_xid();
 
diff --git a/networking/udhcp/packet.c b/networking/udhcp/packet.c
index 530b5c2a1..4dcd62916 100644
--- a/networking/udhcp/packet.c
+++ b/networking/udhcp/packet.c
@@ -13,7 +13,7 @@
 #include <netpacket/packet.h>
 
 #if ENABLE_UDHCPC || ENABLE_UDHCPD
-void FAST_FUNC udhcp_init_header(struct dhcp_packet *packet, char type)
+void FAST_FUNC udhcp_init_header(struct dhcp_packet *packet, char type, char htype)
 {
 	memset(packet, 0, sizeof(*packet));
 	packet->op = BOOTREQUEST; /* if client to a server */
@@ -23,7 +23,7 @@ void FAST_FUNC udhcp_init_header(struct dhcp_packet *packet, char type)
 	case DHCPNAK:
 		packet->op = BOOTREPLY; /* if server to client */
 	}
-	packet->htype = 1; /* ethernet */
+	packet->htype = htype;
 	packet->hlen = 6;
 	packet->cookie = htonl(DHCP_MAGIC);
 	if (DHCP_END != 0)
-- 
Daniel M. Weeks


-- 
Daniel M. Weeks
Lead HPC Developer
Center for Computational Innovations
Rensselaer Polytechnic Institute
Troy, NY 12180
518-276-4458


More information about the OpenPower-Firmware mailing list