dhcpcd-discuss

Re: Custom dhcp options

Roy Marples

Tue Apr 19 13:18:24 2016

Hi

On 18/04/2016 22:14, Shahid Mahmood wrote:
> Is is possible to extract custom options from the lease that are not
> part of standard dhcp options? (ie they are not in dhcp.h)
> 
> We have some custom options configured in our DHCP server that the
> client needs to retrieve. So far, the only solution at hand is to patch
> dhcp.c (and related files).

You can define custom options in dhcpcd.conf, which will override any
dhcpcd defined option.

For example I recently added an option to extract the fairly complex
iSNS option from RFC4174

# iSNS, RFC4174
define 83	embed			isns
embed		byte			reserved1
embed		bitflags=00000SAE	functions
embed		byte			reserved2
embed		bitflags=00fFsSCE	dd
embed		byte			reserved3
embed		bitflags=0000DMHE	admin
embed		uint16			reserved4
embed		byte			reserved5
embed		bitflags=0TXPAMSE	server_security
embed		array ipaddress		servers

You should read dhcpcd.conf(5) for more details on this :)

Once defined, you can then request the option like any other:
option isns

Then you'll find new variables available to dhcpcd-run-hooks(8)
new_isns_functions, new_isns_dd, new_isns_admin,
new_isns_server_security and new_isns_servers.

Roy

Follow-Ups:
Re: Custom dhcp optionsShahid Mahmood
References:
Custom dhcp optionsShahid Mahmood
Archive administrator: postmaster@marples.name