dhcrelay '-A' command line option does nothing

mark mckinstry mark.mckinstry at alliedtelesis.co.nz
Mon May 5 23:06:13 UTC 2008

The '-A' command line option for dhcrelay does not work. According to dhcrelay(8)  it is supposed to set the maximum size to which a DHCP request packet can grow after dhcrelay inserts option 82, before forwarding the packet to the server - but the code to achieve this is missing. In the code the '-A' option does set the value of global variable dhcp_max_agent_option_packet_length, but this variable is then never used! Currently dhcrelay will insert option 82 only if there is sufficient option padding, otherwise it drops the packet! - it never increases the size of the packet.

Some DHCP clients seem to insert sufficient option padding to allow option 82 insertion (e.g. ISC dhclient), but others don't (e.g. Windows XP), and this is a problem for us.

We are currently using dhcrelay 3.0.4, but comparing it to 4.0.0 I can see no relevant code changes, so presumably the issue still exists. I searched the forum archives, but could find nothing relevant. I'm surprised nobody has noticed this before!

We have done our own fix for this - see patch below - but we'd prefer not to have to maintain such patches, so could ISC please implement a fix in the next release?

--- dhcp-3.0.4/relay/dhcrelay.c	2008-04-22 10:02:20.000000000 +1200
+++ dhcp-3.0.4/relay/dhcrelay.c.new	2008-04-22 10:05:02.000000000 +1200
@@ -873,6 +873,17 @@
 	if (memcmp(packet->options, DHCP_OPTIONS_COOKIE, 4))
 		return length;
+  /* ATL addition - for support when the option 82 cannot be inserted to the DHCP message, 
+   * if there is not enough paddings after the option field in the DHCP message.
+   * Change the DHCP msg length. It is actually implementing the -A option setting that 
+   * was missing in the code.
+   */
+  if ( length != dhcp_max_agent_option_packet_length )
+  {
+    length = dhcp_max_agent_option_packet_length;
+  }
+  /* ATL addition end */
 	max = ((u_int8_t *)packet) + length;
 	/* Commence processing after the cookie. */


Mark McKinstry
Senior Software Engineer
Allied Telesis Labs
Christchurch, New Zealand

More information about the dhcp-users mailing list