Requesting help appending relay agent option in v6

David W. Hankins David_Hankins at
Wed Apr 1 17:32:23 UTC 2009

On Wed, Apr 01, 2009 at 12:05:49PM -0400, Petrin, Benjamin wrote:
> I'm attempting to make changes to the relay agent for v6 to add an option to the packets being processed upwards (client to server) that contains the hardware address of the client. I have developed code that will retrieve the hardware address for the client from the relay agent's neighbor discovery table based on the IPv6 source address (thanks David Hankins for the hint there).


> So I now need to append this as an option to the packet. I'm looking at "process_up6" in /relay/dhcrelay.c and I can see where the interface-id and relay-msg are added to the packet. I'm looking for a bit of assistance on how I can go about adding another option without breaking anything...I'm getting a little lost in the "save_option_buffer" function being called in common/options.c as well as "prepare_option_buffer". Is there someone that wouldn't mind explaining a bit how these work and go about affecting the outward bound packet? 

There are several DHCP authors at ISC now, and it wasn't me who wrote
the DHCPv6 relay bits, so I'm going to have to also pick up sourcecode
to refresh my memory.

As a starting place, you need an option code to use; you can use ISC's
Vendor Specific Information Option space.  We used a couple option
codes recently for default-router and prefix related work, so use the
next code after that;

Index: DHCP/common/tables.c
diff -u DHCP/common/tables.c:1.73 DHCP/common/tables.c:
--- DHCP/common/tables.c:1.73   Thu Jan 24 02:43:04 2008
+++ DHCP/common/tables.c        Fri Mar 20 00:28:08 2009
@@ -559,7 +559,9 @@
 struct universe isc6_universe;
 static struct option isc6_options[] = {
        { "media", "t",                         &isc6_universe,     1, 1 },
-       { "update-assist", "X",                 &isc6_universe,     2, 1 },
+       { "update-assist", "X",                 &isc6_universe,     2, 1 },
+       { "router", "6TXo",                     &isc6_universe,     3, 1 },
+       { "prefix", "6BTT",                     &isc6_universe,     4, 1 },
        { NULL, NULL, NULL, 0, 0 }

So use code 5 for now.  You probably want an "X" format;

	{ "relay-observed-mac", "X",		&isc6_universe,	    5, 1 },

Put a #define for the code in includes/dhcp6.h (before the 'OFFSET'
defines but after the 'DUID' enumeration defines);


The save option buffer and so forth calls are the way ISC DHCP works
with DHCP option state.  We create an 'option cache', an empty bucket
into which we put option code and content buffer pairs.  At packet
creation time, we interrogate the cache while constructing the packet.

This is so we can do complete processing around a received packet, and
delay the question of "which values to send" until the last moment.

I'm going to have to pick up the sourcecode to see how to get VSIO
options into the relay's output.  It probably isn't very
straightforward.  I'm back from IETF anyway, so I should be able to
help out soon.
David W. Hankins	"If you don't do it right the first time,
Software Engineer		     you'll just have to do it again."
Internet Systems Consortium, Inc.		-- Jack T. Hankins
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 194 bytes
Desc: not available
URL: <>

More information about the dhcp-workers mailing list