Blame SOURCES/dhcp-4.2.2-gpxe-cid.patch

c8bb8f
diff -up dhcp-4.2.2/client/dhclient.c.gpxe-cid dhcp-4.2.2/client/dhclient.c
c8bb8f
--- dhcp-4.2.2/client/dhclient.c.gpxe-cid	2011-09-16 18:23:20.190453902 +0200
c8bb8f
+++ dhcp-4.2.2/client/dhclient.c	2011-09-16 18:27:15.568463599 +0200
c8bb8f
@@ -58,6 +58,13 @@ const char *path_dhclient_pid = NULL;
c8bb8f
 static char path_dhclient_script_array[] = _PATH_DHCLIENT_SCRIPT;
c8bb8f
 char *path_dhclient_script = path_dhclient_script_array;
c8bb8f
 
c8bb8f
+/* Default Prefix */
c8bb8f
+static unsigned char default_prefix[12] = {
c8bb8f
+	0xff, 0x00, 0x00, 0x00,
c8bb8f
+	0x00, 0x00, 0x02, 0x00,
c8bb8f
+	0x00, 0x02, 0xc9, 0x00
c8bb8f
+};
c8bb8f
+
c8bb8f
 /* False (default) => we write and use a pid file */
c8bb8f
 isc_boolean_t no_pid_file = ISC_FALSE;
c8bb8f
 
c8bb8f
@@ -1250,6 +1257,12 @@ int find_subnet (struct subnet **sp,
c8bb8f
 static void setup_ib_interface(struct interface_info *ip)
c8bb8f
 {
c8bb8f
 	struct group *g;
c8bb8f
+	struct hardware *hw = &ip->hw_address;
c8bb8f
+	char client_id[64];
c8bb8f
+	char *arg_conf = NULL;
c8bb8f
+	int arg_conf_len = 0;
c8bb8f
+	isc_result_t status;
c8bb8f
+	struct parse *cfile = (struct parse *)0;
c8bb8f
 
c8bb8f
 	/* Set the broadcast flag */
c8bb8f
 	ip->client->config->bootp_broadcast_always = 1;
c8bb8f
@@ -1266,8 +1279,39 @@ static void setup_ib_interface(struct in
c8bb8f
 		}
c8bb8f
 	}
c8bb8f
 
c8bb8f
-	/* No client ID specified */
c8bb8f
-	log_fatal("dhcp-client-identifier must be specified for InfiniBand");
c8bb8f
+	/*
c8bb8f
+	 * No client ID specified, make up one based on a default
c8bb8f
+	 * "prefix" and the port GUID.
c8bb8f
+	 *
c8bb8f
+	 * NOTE: This is compatible with what gpxe does.
c8bb8f
+	 */
c8bb8f
+	sprintf(client_id, "%.2x:%.2x:%.2x:%.2x:%.2x:%.2x:%.2x:%.2x:%.2x:%.2x:%.2x:%.2x:%.2x:%.2x:%.2x:%.2x:%.2x:%.2x:%.2x:%.2x",
c8bb8f
+		default_prefix[0], default_prefix[1], default_prefix[2],
c8bb8f
+		default_prefix[3], default_prefix[4], default_prefix[5],
c8bb8f
+		default_prefix[6], default_prefix[7], default_prefix[8],
c8bb8f
+		default_prefix[9], default_prefix[10], default_prefix[11],
c8bb8f
+		hw->hbuf[1], hw->hbuf[2], hw->hbuf[3], hw->hbuf[4],
c8bb8f
+		hw->hbuf[5], hw->hbuf[6], hw->hbuf[7], hw->hbuf[8]);
c8bb8f
+
c8bb8f
+	arg_conf_len = asprintf(&arg_conf,
c8bb8f
+				"send dhcp-client-identifier %s;",
c8bb8f
+				client_id);
c8bb8f
+
c8bb8f
+	if ((arg_conf == 0) || (arg_conf_len <= 0))
c8bb8f
+		log_fatal("Unable to send option dhcp-client-identifier");
c8bb8f
+
c8bb8f
+	status = new_parse(&cfile, -1, arg_conf, arg_conf_len,
c8bb8f
+			   "Automatic Infiniband client identifier", 0);
c8bb8f
+
c8bb8f
+	if ((status != ISC_R_SUCCESS) || (cfile->warnings_occurred))
c8bb8f
+		log_fatal("Failed to parse Infiniband client identifier");
c8bb8f
+
c8bb8f
+	parse_client_statement(cfile, NULL, ip->client->config);
c8bb8f
+
c8bb8f
+	if (cfile->warnings_occurred)
c8bb8f
+		log_fatal("Failed to parse Infiniband client identifier");
c8bb8f
+
c8bb8f
+	end_parse(&cfile);
c8bb8f
 }
c8bb8f
 
c8bb8f
 /* Individual States: