[PATCH] udhcp: Add config file option (code 209) definition

Jeremy Kerr jk at ozlabs.org
Mon Nov 4 11:00:11 UTC 2013


Hi Denys,

>> @@ -62,6 +62,7 @@ const struct dhcp_optflag dhcp_optflags[] = {
>>         { OPTION_U16                              , 0x84 }, /* DHCP_VLAN_ID       */
>>         { OPTION_U8                               , 0x85 }, /* DHCP_VLAN_PRIORITY */
>>  #endif
>> +       { OPTION_STRING | OPTION_REQ              , 0xd1 }, /* DHCP_CONF_FILE     */
> 
> OPTION_REQ means that udhcpc will request this option by default
> (meaning: even without "-O conffile").
> 
> Why do you want this?

This is more a shortcut for our use-case; I'm happy to drop OPTION_REQ
and just use the -O option.

>>         { OPTION_6RD                              , 0xd4 }, /* DHCP_6RD           */
>>         { OPTION_STATIC_ROUTES | OPTION_LIST      , 0xf9 }, /* DHCP_MS_STATIC_ROUTES */
>>         { OPTION_STRING                           , 0xfc }, /* DHCP_WPAD          */
>> @@ -128,6 +129,7 @@ const char dhcp_option_strings[] ALIGN1 =
>>         "vlanid" "\0"      /* DHCP_VLAN_ID        */
>>         "vlanpriority" "\0"/* DHCP_VLAN_PRIORITY  */
>>  #endif
>> +       "conffile" "\0"    /* DHCP_CONF_FILE      */
> 
> "conffile" sounds a bit too generic...
> 
> In general, I would like to avoid adding more and more custom options.
> "-O OPT" and "-x OPT:VAL" were added to make it possible
> to, respectively, request and send any options, even ones
> udhcpc does not know about: decimal and hex notations
> are supported.
> 
> Did you try using them?

I did, but it's a bit clunky for string options. With this change, the
environment variable set for the hook script is meaningful ("conffile"
rather than "opt209") and the value of the env var is decoded to ascii,
("/pxelinux.cfg") rather than a hex string
("2F7078656C696E75782E636667"), which can be a little messy to handle in
shell scripts.

It's not impossible to handle option 209 without this patch, but just
requires a bit of external infrastructure.

Cheers,


Jeremy



More information about the busybox mailing list