]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/patches/dhcp/dhcp-gpxe-cid.patch
Merge remote-tracking branch 'origin/master' into next
[people/pmueller/ipfire-2.x.git] / src / patches / dhcp / dhcp-gpxe-cid.patch
1 diff -up dhcp-4.3.0a1/client/dhclient.c.gpxe-cid dhcp-4.3.0a1/client/dhclient.c
2 --- dhcp-4.3.0a1/client/dhclient.c.gpxe-cid 2013-12-20 13:28:45.105048317 +0100
3 +++ dhcp-4.3.0a1/client/dhclient.c 2013-12-20 13:28:45.109048261 +0100
4 @@ -47,6 +47,14 @@
5 const char *path_dhclient_pid = NULL;
6 static char path_dhclient_script_array[] = _PATH_DHCLIENT_SCRIPT;
7 char *path_dhclient_script = path_dhclient_script_array;
8 +
9 +/* Default Prefix */
10 +static unsigned char default_prefix[12] = {
11 + 0xff, 0x00, 0x00, 0x00,
12 + 0x00, 0x00, 0x02, 0x00,
13 + 0x00, 0x02, 0xc9, 0x00
14 +};
15 +
16 const char *path_dhclient_duid = NULL;
17
18 /* False (default) => we write and use a pid file */
19 @@ -1253,6 +1260,12 @@ int find_subnet (struct subnet **sp,
20 static void setup_ib_interface(struct interface_info *ip)
21 {
22 struct group *g;
23 + struct hardware *hw = &ip->hw_address;
24 + char client_id[64];
25 + char *arg_conf = NULL;
26 + int arg_conf_len = 0;
27 + isc_result_t status;
28 + struct parse *cfile = (struct parse *)0;
29
30 /* Set the broadcast flag */
31 ip->client->config->bootp_broadcast_always = 1;
32 @@ -1269,8 +1282,39 @@ static void setup_ib_interface(struct in
33 }
34 }
35
36 - /* No client ID specified */
37 - log_fatal("dhcp-client-identifier must be specified for InfiniBand");
38 + /*
39 + * No client ID specified, make up one based on a default
40 + * "prefix" and the port GUID.
41 + *
42 + * NOTE: This is compatible with what gpxe does.
43 + */
44 + sprintf(client_id, "%.2x:%.2x:%.2x:%.2x:%.2x:%.2x:%.2x:%.2x:%.2x:%.2x:%.2x:%.2x:%.2x:%.2x:%.2x:%.2x:%.2x:%.2x:%.2x:%.2x",
45 + default_prefix[0], default_prefix[1], default_prefix[2],
46 + default_prefix[3], default_prefix[4], default_prefix[5],
47 + default_prefix[6], default_prefix[7], default_prefix[8],
48 + default_prefix[9], default_prefix[10], default_prefix[11],
49 + hw->hbuf[1], hw->hbuf[2], hw->hbuf[3], hw->hbuf[4],
50 + hw->hbuf[5], hw->hbuf[6], hw->hbuf[7], hw->hbuf[8]);
51 +
52 + arg_conf_len = asprintf(&arg_conf,
53 + "send dhcp-client-identifier %s;",
54 + client_id);
55 +
56 + if ((arg_conf == 0) || (arg_conf_len <= 0))
57 + log_fatal("Unable to send option dhcp-client-identifier");
58 +
59 + status = new_parse(&cfile, -1, arg_conf, arg_conf_len,
60 + "Automatic Infiniband client identifier", 0);
61 +
62 + if ((status != ISC_R_SUCCESS) || (cfile->warnings_occurred))
63 + log_fatal("Failed to parse Infiniband client identifier");
64 +
65 + parse_client_statement(cfile, NULL, ip->client->config);
66 +
67 + if (cfile->warnings_occurred)
68 + log_fatal("Failed to parse Infiniband client identifier");
69 +
70 + end_parse(&cfile);
71 }
72
73 /* Individual States: