[PATCH RFC v2 2/3] dhclient: IPv6: support more than 256 IAIDs

H. Peter Anvin hpa at zytor.com
Wed Dec 2 19:21:16 UTC 2015


At least in some kind of theory, it is possible to have more than 256
IAIDs. More than 64K is, however, capped by option size.

Signed-off-by: H. Peter Anvin <hpa at zytor.com>
---
 client/dhc6.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/client/dhc6.c b/client/dhc6.c
index 8f77fafd7281..2fe9a7b2577f 100644
--- a/client/dhc6.c
+++ b/client/dhc6.c
@@ -75,7 +75,8 @@ void init_handler(struct packet *packet, struct client_state *client);
 void info_request_handler(struct packet *packet, struct client_state *client);
 void rapid_commit_handler(struct packet *packet, struct client_state *client);
 static void dhc6_new_iaid(unsigned char iaid[4],
-			  const struct client_state *client, int i);
+			  const struct client_state *client,
+			  unsigned int seq);
 void do_init6(void *input);
 void do_info_request6(void *input);
 void do_confirm6(void *input);
@@ -1514,7 +1515,8 @@ check_timing6 (struct client_state *client, u_int8_t msg_type,
 }
 
 static void
-dhc6_new_iaid(unsigned char iaid[4], const struct client_state *client, int i)
+dhc6_new_iaid(unsigned char iaid[4], const struct client_state *client,
+	      unsigned int seq)
 {
 	int idx, len;
 
@@ -1530,7 +1532,13 @@ dhc6_new_iaid(unsigned char iaid[4], const struct client_state *client, int i)
 	}
 	memset(iaid, 0, 4);
 	memcpy(iaid, client->interface->hw_address.hbuf + idx, len);
-	iaid[3] += i;
+
+	/*
+	 * For backwards compatibility there is intentionally no
+	 * carry between these two bytes.
+	 */
+	iaid[3] += seq;
+	iaid[2] += seq >> 8;
 }
 
 /*
-- 
2.4.3



More information about the dhcp-workers mailing list