dhcp/dhcp-duidv4.patch
Jiri Popelka 7b69e548fb 4.3.1b1
2014-07-10 19:01:31 +02:00

79 lines
2.9 KiB
Diff

diff -up dhcp-4.3.1b1/client/dhclient.8.KrJcIv dhcp-4.3.1b1/client/dhclient.8
--- dhcp-4.3.1b1/client/dhclient.8.KrJcIv 2014-07-10 17:39:25.852763873 +0200
+++ dhcp-4.3.1b1/client/dhclient.8 2014-07-10 17:54:26.841012988 +0200
@@ -458,6 +458,9 @@ used to construct a RFC4361 style client
in the client's messages. This client id can be overridden by
setting a client id in the configuration file. Overridding the
client id in this fashion is discouraged.
+This option is turned on by default, if you want to redefine or turn off
+sending of client id, use send dhcp-client-identifier = "better identifier"
+or send dhcp-client-identifier = "" in /etc/dhcp/dhclient.conf.
.TP
.BI \-I
Use the standard DDNS scheme from RFCs 4701 & 4702.
diff -up dhcp-4.3.1b1/client/dhclient.c.KrJcIv dhcp-4.3.1b1/client/dhclient.c
--- dhcp-4.3.1b1/client/dhclient.c.KrJcIv 2014-07-10 17:54:26.829013157 +0200
+++ dhcp-4.3.1b1/client/dhclient.c 2014-07-10 17:55:50.155835918 +0200
@@ -73,7 +73,7 @@ struct sockaddr_in sockaddr_broadcast;
struct in_addr giaddr;
struct data_string default_duid;
int duid_type = 0;
-int duid_v4 = 0;
+int duid_v4 = 1;
int std_dhcid = 0;
/* ASSERT_STATE() does nothing now; it used to be
@@ -1301,7 +1301,7 @@ static void setup_ib_interface(struct in
}
/* No client ID specified */
- log_fatal("dhcp-client-identifier must be specified for InfiniBand");
+ //log_fatal("dhcp-client-identifier must be specified for InfiniBand");
}
/* Individual States:
@@ -3342,6 +3342,7 @@ form_duid(struct data_string *duid, cons
struct interface_info *ip;
int len;
char *str;
+ unsigned hlen;
/* For now, just use the first interface on the list. */
ip = interfaces;
@@ -3365,6 +3366,11 @@ form_duid(struct data_string *duid, cons
if (duid_type == 0)
duid_type = stateless ? DUID_LL : DUID_LLT;
+ if (ip->hw_address.hbuf[0] == HTYPE_INFINIBAND)
+ hlen = 9;
+ else
+ hlen = ip->hw_address.hlen;
+
/*
* 2 bytes for the 'duid type' field.
* 2 bytes for the 'htype' field.
@@ -3372,7 +3378,7 @@ form_duid(struct data_string *duid, cons
* enough bytes for the hardware address (note that hw_address has
* the 'htype' on byte zero).
*/
- len = 4 + (ip->hw_address.hlen - 1);
+ len = 4 + (hlen - 1);
if (duid_type == DUID_LLT)
len += 4;
if (!buffer_allocate(&duid->buffer, len, MDL))
@@ -3386,12 +3392,12 @@ form_duid(struct data_string *duid, cons
putUShort(duid->buffer->data + 2, ip->hw_address.hbuf[0]);
putULong(duid->buffer->data + 4, cur_time - DUID_TIME_EPOCH);
memcpy(duid->buffer->data + 8, ip->hw_address.hbuf + 1,
- ip->hw_address.hlen - 1);
+ hlen - 1);
} else {
putUShort(duid->buffer->data, DUID_LL);
putUShort(duid->buffer->data + 2, ip->hw_address.hbuf[0]);
memcpy(duid->buffer->data + 4, ip->hw_address.hbuf + 1,
- ip->hw_address.hlen - 1);
+ hlen - 1);
}
str = quotify_buf(duid->data, duid->len, MDL);