diff mbox series

[3/5] Add DHCP client identifier for IB

Message ID bf87e513d06aa2c84218c3db43c852f600084dbd.1587059223.git.weeksd2@rpi.edu
State New
Headers show
Series IB netboot 3/3: IB interface bring up | expand

Commit Message

Daniel M. Weeks April 16, 2020, 6:02 p.m. UTC
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@rpi.edu>
---
 discover/network.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
diff mbox series

Patch

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;