DHCPv6 Vendor-Specific Options
------------------------------
-Currently there are two option spaces defined for the DHCPv6 daemon:
-"dhcp6" (for the top-level DHCPv6 options) and "vendor-opts-space", which is
-empty by default but in which options can be defined. Those options are
-carried in the Vendor-Specific Information option (code 17). The
-following examples show how to define an option "foo" with code 1 that
-consists of an IPv6 address, an unsigned 16-bit integer, and a string.
-The "foo" option is conveyed in a Vendor-Specific Information option,
-which comprises a single uint32 value that is set to "12345". The
-sub-option "foo" follows the data field holding this value.
+Vendor options in DHCPv6 are carried in the Vendor-Specific
+Information option (code 17). The following examples show how to
+define an option "foo" with code 1 that consists of an IPv6 address,
+an unsigned 16-bit integer, and a string. The "foo" option is
+conveyed in a Vendor-Specific Information option, which comprises a
+single uint32 value that is set to "12345". The sub-option "foo"
+follows the data field holding this value.
The first step is to define the format of the option:
{
"name": "foo",
"code": 1,
- "space": "vendor-opts-space",
+ "space": "vendor-12345",
"type": "record",
"array": false,
"record-types": "ipv6-address, uint16, string",
...
}
-(Note that the option space is set to ``vendor-opts-space``.) Once the
+(Note that the option space is set to ``vendor-12345``.) Once the
option format is defined, the next step is to define actual values for
that option:
"option-data": [
{
"name": "foo",
- "space": "vendor-opts-space",
+ "space": "vendor-12345",
"data": "2001:db8:1::10, 123, Hello World"
},
...
...
}
+A common configuration is to set the always-send flag to true so the
+vendor option is sent even when the client did not mention it in the query.
+
.. _dhcp6-option-spaces:
Nested DHCPv6 Options (Custom Option Spaces)
// standard option #17. This option comprises an enterprise
// number and sub options. By convention (introduced in
// std_option_defs.h) option named 'vendor-opts'
- // encapsulates the option space named 'vendor-opts-space'.
+ // encapsulates the option space named 'vendor-encapsulated-options-space'.
// We add our dummy options to this option space and thus
// they should be included as sub-options in the 'vendor-opts'
// option.
"\"renew-timer\": 1000,"
"\"option-data\": [ {"
" \"name\": \"foo\","
- " \"space\": \"vendor-opts-space\","
+ " \"space\": \"a-vendor-space\","
" \"data\": \"1234\""
" },"
" {"
" \"name\": \"foo2\","
- " \"space\": \"vendor-opts-space\","
+ " \"space\": \"a-vendor-space\","
" \"data\": \"192.168.2.1\""
" } ],"
"\"option-def\": [ {"
" \"name\": \"foo\","
" \"code\": 110,"
" \"type\": \"uint32\","
- " \"space\": \"vendor-opts-space\""
+ " \"space\": \"a-vendor-space\""
" },"
" {"
" \"name\": \"foo2\","
" \"code\": 111,"
" \"type\": \"ipv4-address\","
- " \"space\": \"vendor-opts-space\""
+ " \"space\": \"a-vendor-space\""
" } ]"
"}";
// standard option #17. This option comprises an enterprise
// number and sub options. By convention (introduced in
// std_option_defs.h) option named 'vendor-opts'
- // encapsulates the option space named 'vendor-opts-space'.
+ // encapsulates the option space named 'vendor-<vendor-id>'.
// We add our dummy options to this option space and thus
// they should be included as sub-options in the 'vendor-opts'
// option.
" },"
" {"
" \"name\": \"foo\","
- " \"space\": \"vendor-opts-space\","
+ " \"space\": \"vendor-1234\","
" \"data\": \"1234\""
" },"
" {"
" \"name\": \"foo2\","
- " \"space\": \"vendor-opts-space\","
+ " \"space\": \"vendor-1234\","
" \"data\": \"192.168.2.1\""
" } ],"
"\"option-def\": [ {"
" \"name\": \"foo\","
" \"code\": 110,"
" \"type\": \"uint32\","
- " \"space\": \"vendor-opts-space\""
+ " \"space\": \"vendor-1234\""
" },"
" {"
" \"name\": \"foo2\","
" \"code\": 111,"
" \"type\": \"ipv4-address\","
- " \"space\": \"vendor-opts-space\""
+ " \"space\": \"vendor-1234\""
" } ],"
"\"subnet6\": [ { "
" \"pools\": [ { \"pool\": \"2001:db8:1::/80\" } ],"
"\"renew-timer\": 1000,"
"\"option-data\": [ {"
" \"name\": \"foo\","
- " \"space\": \"vendor-opts-space\","
+ " \"space\": \"a-vendor-space\","
" \"data\": \"1234\""
" },"
" {"
" \"name\": \"foo2\","
- " \"space\": \"vendor-opts-space\","
+ " \"space\": \"a-vendor-space\","
" \"data\": \"192.168.2.1\""
" } ],"
"\"option-def\": [ {"
" \"name\": \"foo\","
" \"code\": 110,"
" \"type\": \"uint32\","
- " \"space\": \"vendor-opts-space\""
+ " \"space\": \"a-vendor-space\""
" },"
" {"
" \"name\": \"foo2\","
" \"code\": 111,"
" \"type\": \"ipv4-address\","
- " \"space\": \"vendor-opts-space\""
+ " \"space\": \"a-vendor-space\""
" } ]");
if (multi_threading) {
/// @brief encapsulated option spaces
#define DHCP_AGENT_OPTION_SPACE "dhcp-agent-options-space"
-#define VENDOR_OPTION_SPACE "vendor-opts-space"
#define VENDOR_ENCAPSULATED_OPTION_SPACE "vendor-encapsulated-options-space"
// NOTE:
{ "vendor-class", D6O_VENDOR_CLASS, OPT_RECORD_TYPE, false,
RECORD_DEF(VENDOR_CLASS_RECORDS), "" },
{ "vendor-opts", D6O_VENDOR_OPTS, OPT_UINT32_TYPE, false,
- NO_RECORD_DEF, VENDOR_OPTION_SPACE },
+ NO_RECORD_DEF, "" },
{ "interface-id", D6O_INTERFACE_ID, OPT_BINARY_TYPE, false, NO_RECORD_DEF, "" },
{ "reconf-msg", D6O_RECONF_MSG, OPT_UINT8_TYPE, false, NO_RECORD_DEF, "" },
{ "reconf-accept", D6O_RECONF_ACCEPT, OPT_EMPTY_TYPE, false,
LibDhcpTest::testStdOptionDefs6(D6O_VENDOR_OPTS, vopt_buf.begin(),
vopt_buf.end(),
- typeid(OptionVendor),
- VENDOR_OPTION_SPACE);
+ typeid(OptionVendor));
LibDhcpTest::testStdOptionDefs6(D6O_INTERFACE_ID, begin, end,
typeid(Option));