[PATCH 3/5] Add DHCP client identifier for IB

Daniel M. Weeks weeksd2 at rpi.edu
Fri Apr 17 04:02:21 AEST 2020


When using DHCP to configure an interface, assume it's an Infiniband
interface if its address length is >6 bytes, in which case add DHCP
option 61 containing an industry-standard client identifier.

Signed-off-by: Daniel M. Weeks <weeksd2 at rpi.edu>
---
 discover/network.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/discover/network.c b/discover/network.c
index bb76109..5f3a05c 100644
--- a/discover/network.c
+++ b/discover/network.c
@@ -375,7 +375,7 @@ static void configure_interface_dhcp(struct network *network,
 		struct interface *interface)
 {
 	const struct platform *platform;
-	char pidfile[256], id[10];
+	char pidfile[256], id[10], id2[45] = "0x3d:ff000000000002000002c900";
 	struct process *process;
 	int rc;
 	const char *argv[] = {
@@ -388,6 +388,7 @@ static void configure_interface_dhcp(struct network *network,
 		"-p", pidfile,
 		"-i", interface->name,
 		"-x", id, /* [11,12] - dhcp client identifier */
+		"-x", id2,
 		NULL,
 	};
 
@@ -403,6 +404,12 @@ static void configure_interface_dhcp(struct network *network,
 	else
 		argv[11] = NULL;
 
+	if (interface->hwaddr_len > 6) {
+		append_hwaddr_str(interface->hwaddr, interface->hwaddr_len, id2+strlen(id2));
+	} else {
+		argv[15] = NULL;
+	}
+
 	process = process_create(interface);
 
 	process->path = pb_system_apps.udhcpc;
-- 
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 Petitboot mailing list