Parcourir la source

[master] Finished merge of trac5227 (adding easy missing option defs)

Francis Dupont il y a 7 ans
Parent
commit
d85d342805

+ 5 - 0
ChangeLog

@@ -1,3 +1,8 @@
+1300.	[func]		fdupont
+	Added some standard option definitions which are supported
+	by ISC DHCP but not (yet) by Kea.
+	(Trac #5227, git xxx)
+
 1299.	[doc]		fdupont, tmark
 1299.	[doc]		fdupont, tmark
 	Added an example stunnel configuration file to demonstrate
 	Added an example stunnel configuration file to demonstrate
 	using kea-shell through https.
 	using kea-shell through https.

+ 22 - 0
doc/guide/dhcp4-srv.xml

@@ -1333,6 +1333,7 @@ This rather belong to the DDNS configuration
 <row><entry>streettalk-server</entry><entry>75</entry><entry>ipv4-address</entry><entry>true</entry><entry>false</entry></row>
 <row><entry>streettalk-server</entry><entry>75</entry><entry>ipv4-address</entry><entry>true</entry><entry>false</entry></row>
 <row><entry>streettalk-directory-assistance-server</entry><entry>76</entry><entry>ipv4-address</entry><entry>true</entry><entry>false</entry></row>
 <row><entry>streettalk-directory-assistance-server</entry><entry>76</entry><entry>ipv4-address</entry><entry>true</entry><entry>false</entry></row>
 <row><entry>user-class</entry><entry>77</entry><entry>binary</entry><entry>false</entry><entry>false</entry></row>
 <row><entry>user-class</entry><entry>77</entry><entry>binary</entry><entry>false</entry><entry>false</entry></row>
+<row><entry>slp-service-scope</entry><entry>79</entry><entry>record (boolean, string)</entry><entry>false</entry><entry>false</entry></row>
 <!-- The Client FQDN option value is not explicitly configured.
 <!-- The Client FQDN option value is not explicitly configured.
 It is a part of the DDNS/D2 configuration
 It is a part of the DDNS/D2 configuration
 <row><entry>fqdn</entry><entry>81</entry><entry>record</entry><entry>false</entry><entry>true</entry></row>
 <row><entry>fqdn</entry><entry>81</entry><entry>record</entry><entry>false</entry><entry>true</entry></row>
@@ -1341,6 +1342,11 @@ It is a part of the DDNS/D2 configuration
 It is merely echoed by the server
 It is merely echoed by the server
 <row><entry>dhcp-agent-options</entry><entry>82</entry><entry>empty</entry><entry>false</entry><entry>false</entry></row>
 <row><entry>dhcp-agent-options</entry><entry>82</entry><entry>empty</entry><entry>false</entry><entry>false</entry></row>
 -->
 -->
+<row><entry>nds-server</entry><entry>85</entry><entry>ipv4-address</entry><entry>true</entry><entry>false</entry></row>
+<row><entry>nds-tree-name</entry><entry>86</entry><entry>string</entry><entry>false</entry><entry>false</entry></row>
+<row><entry>nds-context</entry><entry>87</entry><entry>string</entry><entry>false</entry><entry>false</entry></row>
+<row><entry>bcms-controller-names</entry><entry>88</entry><entry>fqdn</entry><entry>true</entry><entry>false</entry></row>
+<row><entry>bcms-controller-address</entry><entry>89</entry><entry>ipv4-address</entry><entry>true</entry><entry>false</entry></row>
 <!-- Authentication option requires special processing
 <!-- Authentication option requires special processing
 <row><entry>authenticate</entry><entry>90</entry><entry>binary</entry><entry>false</entry><entry>false</entry></row>
 <row><entry>authenticate</entry><entry>90</entry><entry>binary</entry><entry>false</entry><entry>false</entry></row>
 -->
 -->
@@ -1351,10 +1357,26 @@ It is merely echoed by the server
 <row><entry>client-system</entry><entry>93</entry><entry>uint16</entry><entry>true</entry><entry>false</entry></row>
 <row><entry>client-system</entry><entry>93</entry><entry>uint16</entry><entry>true</entry><entry>false</entry></row>
 <row><entry>client-ndi</entry><entry>94</entry><entry>record (uint8, uint8, uint8)</entry><entry>false</entry><entry>false</entry></row>
 <row><entry>client-ndi</entry><entry>94</entry><entry>record (uint8, uint8, uint8)</entry><entry>false</entry><entry>false</entry></row>
 <row><entry>uuid-guid</entry><entry>97</entry><entry>record (uint8, binary)</entry><entry>false</entry><entry>false</entry></row>
 <row><entry>uuid-guid</entry><entry>97</entry><entry>record (uint8, binary)</entry><entry>false</entry><entry>false</entry></row>
+<row><entry>uap-servers</entry><entry>98</entry><entry>string</entry><entry>false</entry><entry>false</entry></row>
+<row><entry>geoconf-civic</entry><entry>99</entry><entry>binary</entry><entry>false</entry><entry>false</entry></row>
+<row><entry>pcode</entry><entry>100</entry><entry>string</entry><entry>false</entry><entry>false</entry></row>
+<row><entry>tcode</entry><entry>101</entry><entry>string</entry><entry>false</entry><entry>false</entry></row>
+<row><entry>netinfo-server-address</entry><entry>112</entry><entry>ipv4-address</entry><entry>true</entry><entry>false</entry></row>
+<row><entry>netinfo-server-tag</entry><entry>113</entry><entry>string</entry><entry>false</entry><entry>false</entry></row>
+<row><entry>default-url</entry><entry>114</entry><entry>string</entry><entry>false</entry><entry>false</entry></row>
+<row><entry>auto-config</entry><entry>116</entry><entry>uint8</entry><entry>false</entry><entry>false</entry></row>
+<row><entry>name-service-search</entry><entry>117</entry><entry>uint16</entry><entry>true</entry><entry>false</entry></row>
 <row><entry>subnet-selection</entry><entry>118</entry><entry>ipv4-address</entry><entry>false</entry><entry>false</entry></row>
 <row><entry>subnet-selection</entry><entry>118</entry><entry>ipv4-address</entry><entry>false</entry><entry>false</entry></row>
 <row><entry>domain-search</entry><entry>119</entry><entry>fqdn</entry><entry>true</entry><entry>false</entry></row>
 <row><entry>domain-search</entry><entry>119</entry><entry>fqdn</entry><entry>true</entry><entry>false</entry></row>
 <row><entry>vivco-suboptions</entry><entry>124</entry><entry>binary</entry><entry>false</entry><entry>false</entry></row>
 <row><entry>vivco-suboptions</entry><entry>124</entry><entry>binary</entry><entry>false</entry><entry>false</entry></row>
 <row><entry>vivso-suboptions</entry><entry>125</entry><entry>binary</entry><entry>false</entry><entry>false</entry></row>
 <row><entry>vivso-suboptions</entry><entry>125</entry><entry>binary</entry><entry>false</entry><entry>false</entry></row>
+<row><entry>pana-agent</entry><entry>136</entry><entry>ipv4-address</entry><entry>true</entry><entry>false</entry></row>
+<row><entry>v4-lost</entry><entry>137</entry><entry>fqdn</entry><entry>false</entry><entry>false</entry></row>
+<row><entry>capwap-ac-v4</entry><entry>138</entry><entry>ipv4-address</entry><entry>true</entry><entry>false</entry></row>
+<row><entry>sip-ua-cs-domains</entry><entry>142</entry><entry>fqdn</entry><entry>true</entry><entry>false</entry></row>
+<row><entry>v4-portparams</entry><entry>159</entry><entry>record (uint8, uint8, uint16)</entry><entry>false</entry><entry>false</entry></row>
+<row><entry>v4-captive-portal</entry><entry>160</entry><entry>string</entry><entry>false</entry><entry>false</entry></row>
+<row><entry>v4-access-domain</entry><entry>213</entry><entry>fqdn</entry><entry>false</entry><entry>false</entry></row>
           </tbody>
           </tbody>
           </tgroup>
           </tgroup>
         </table>
         </table>

+ 10 - 0
doc/guide/dhcp6-srv.xml

@@ -1284,6 +1284,11 @@ temporarily override a list of interface names and listen on all interfaces.
 <row><entry>clt-time</entry><entry>46</entry><entry>uint32</entry><entry>false</entry></row>
 <row><entry>clt-time</entry><entry>46</entry><entry>uint32</entry><entry>false</entry></row>
 <row><entry>lq-relay-data</entry><entry>47</entry><entry>record (ipv6-address, binary)</entry><entry>false</entry></row>
 <row><entry>lq-relay-data</entry><entry>47</entry><entry>record (ipv6-address, binary)</entry><entry>false</entry></row>
 <row><entry>lq-client-link</entry><entry>48</entry><entry>ipv6-address</entry><entry>true</entry></row>
 <row><entry>lq-client-link</entry><entry>48</entry><entry>ipv6-address</entry><entry>true</entry></row>
+<row><entry>v6-lost</entry><entry>51</entry><entry>fqdn</entry><entry>false</entry></row>
+<row><entry>capwap-ac-v6</entry><entry>52</entry><entry>ipv6-address</entry><entry>true</entry></row>
+<row><entry>relay-id</entry><entry>53</entry><entry>binary</entry><entry>false</entry></row>
+<row><entry>v6-access-domain</entry><entry>57</entry><entry>fqdn</entry><entry>false</entry></row>
+<row><entry>sip-ua-cs-list</entry><entry>58</entry><entry>fqdn</entry><entry>true</entry></row>
 <row><entry>bootfile-url</entry><entry>59</entry><entry>string</entry><entry>false</entry></row>
 <row><entry>bootfile-url</entry><entry>59</entry><entry>string</entry><entry>false</entry></row>
 <row><entry>bootfile-param</entry><entry>60</entry><entry>tuple</entry><entry>true</entry></row>
 <row><entry>bootfile-param</entry><entry>60</entry><entry>tuple</entry><entry>true</entry></row>
 <row><entry>client-arch-type</entry><entry>61</entry><entry>uint16</entry><entry>true</entry></row>
 <row><entry>client-arch-type</entry><entry>61</entry><entry>uint16</entry><entry>true</entry></row>
@@ -1293,8 +1298,13 @@ temporarily override a list of interface names and listen on all interfaces.
 <row><entry>rsoo</entry><entry>66</entry><entry>empty</entry><entry>false</entry></row>
 <row><entry>rsoo</entry><entry>66</entry><entry>empty</entry><entry>false</entry></row>
 <row><entry>pd-exclude</entry><entry>67</entry><entry>binary</entry><entry>false</entry></row>
 <row><entry>pd-exclude</entry><entry>67</entry><entry>binary</entry><entry>false</entry></row>
 <row><entry>client-linklayer-addr</entry><entry>79</entry><entry>binary</entry><entry>false</entry></row>
 <row><entry>client-linklayer-addr</entry><entry>79</entry><entry>binary</entry><entry>false</entry></row>
+<row><entry>link-address</entry><entry>80</entry><entry>ipv6-address</entry><entry>false</entry></row>
+<row><entry>solmax-rt</entry><entry>82</entry><entry>uint32</entry><entry>false</entry></row>
+<row><entry>inf-max-rt</entry><entry>83</entry><entry>uint32</entry><entry>false</entry></row>
 <!-- <row><entry>dhcpv4-message</entry><entry>87</entry><entry>binary</entry><entry>false</entry></row> -->
 <!-- <row><entry>dhcpv4-message</entry><entry>87</entry><entry>binary</entry><entry>false</entry></row> -->
 <row><entry>dhcp4o6-server-addr</entry><entry>88</entry><entry>ipv6-address</entry><entry>true</entry></row>
 <row><entry>dhcp4o6-server-addr</entry><entry>88</entry><entry>ipv6-address</entry><entry>true</entry></row>
+<row><entry>v6-captive-portal</entry><entry>103</entry><entry>string</entry><entry>false</entry></row>
+<row><entry>ipv6-address-andsf</entry><entry>143</entry><entry>ipv6-address</entry><entry>true</entry></row>
         </tbody>
         </tbody>
         </tgroup>
         </tgroup>
       </table>
       </table>

+ 6 - 10
src/bin/dhcp4/tests/config_parser_unittest.cc

@@ -2218,15 +2218,11 @@ TEST_F(Dhcp4ParserTest, optionStandardDefOverride) {
     checkResult(status, 1);
     checkResult(status, 1);
     EXPECT_TRUE(errorContainsPosition(status, "<string>"));
     EXPECT_TRUE(errorContainsPosition(status, "<string>"));
 
 
-    /// @todo The option 213 is a standard DHCPv4 option. However, at
-    /// this point there is no definition for this option in
-    /// libdhcp++, so it should be allowed to define it from the
-    /// configuration interface. This test will have to be removed
-    /// once definitions for remaining standard options are created.
+    /// There is no definition for unassigned option 170.
     config =
     config =
         "{ \"option-def\": [ {"
         "{ \"option-def\": [ {"
-        "      \"name\": \"access-network-domain-name\","
-        "      \"code\": 213,"
+        "      \"name\": \"unassigned-option-170\","
+        "      \"code\": 170,"
         "      \"type\": \"string\","
         "      \"type\": \"string\","
         "      \"space\": \"dhcp4\""
         "      \"space\": \"dhcp4\""
         "  } ]"
         "  } ]"
@@ -2241,12 +2237,12 @@ TEST_F(Dhcp4ParserTest, optionStandardDefOverride) {
     checkResult(status, 0);
     checkResult(status, 0);
 
 
     def = CfgMgr::instance().getStagingCfg()->
     def = CfgMgr::instance().getStagingCfg()->
-        getCfgOptionDef()->get(DHCP4_OPTION_SPACE, 213);
+        getCfgOptionDef()->get(DHCP4_OPTION_SPACE, 170);
     ASSERT_TRUE(def);
     ASSERT_TRUE(def);
 
 
     // Check the option data.
     // Check the option data.
-    EXPECT_EQ("access-network-domain-name", def->getName());
-    EXPECT_EQ(213, def->getCode());
+    EXPECT_EQ("unassigned-option-170", def->getName());
+    EXPECT_EQ(170, def->getCode());
     EXPECT_EQ(OPT_STRING_TYPE, def->getType());
     EXPECT_EQ(OPT_STRING_TYPE, def->getType());
     EXPECT_FALSE(def->getArrayType());
     EXPECT_FALSE(def->getArrayType());
 
 

+ 4 - 4
src/bin/dhcp4/tests/get_config_unittest.cc

@@ -533,8 +533,8 @@ const char* EXTRACTED_CONFIGS[] = {
 "{\n"
 "{\n"
 "        \"option-def\": [\n"
 "        \"option-def\": [\n"
 "            {\n"
 "            {\n"
-"                \"code\": 213,\n"
-"                \"name\": \"access-network-domain-name\",\n"
+"                \"code\": 170,\n"
+"                \"name\": \"unassigned-option-170\",\n"
 "                \"space\": \"dhcp4\",\n"
 "                \"space\": \"dhcp4\",\n"
 "                \"type\": \"string\"\n"
 "                \"type\": \"string\"\n"
 "            }\n"
 "            }\n"
@@ -3208,9 +3208,9 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"option-def\": [\n"
 "        \"option-def\": [\n"
 "            {\n"
 "            {\n"
 "                \"array\": false,\n"
 "                \"array\": false,\n"
-"                \"code\": 213,\n"
+"                \"code\": 170,\n"
 "                \"encapsulate\": \"\",\n"
 "                \"encapsulate\": \"\",\n"
-"                \"name\": \"access-network-domain-name\",\n"
+"                \"name\": \"unassigned-option-170\",\n"
 "                \"record-types\": \"\",\n"
 "                \"record-types\": \"\",\n"
 "                \"space\": \"dhcp4\",\n"
 "                \"space\": \"dhcp4\",\n"
 "                \"type\": \"string\"\n"
 "                \"type\": \"string\"\n"

+ 36 - 24
src/lib/dhcp/dhcp4.h

@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (C) 2004-2016 Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 2004-2017 Internet Systems Consortium, Inc. ("ISC")
  * Copyright (c) 1995-2003 by Internet Software Consortium
  * Copyright (c) 1995-2003 by Internet Software Consortium
  *
  *
  * This Source Code Form is subject to the terms of the Mozilla Public
  * This Source Code Form is subject to the terms of the Mozilla Public
@@ -145,17 +145,17 @@ enum DHCPOptionType {
     DHO_STDASERVER                   = 76,
     DHO_STDASERVER                   = 76,
     DHO_USER_CLASS                   = 77,
     DHO_USER_CLASS                   = 77,
 //  DHO_DIRECTORY_AGENT              = 78,
 //  DHO_DIRECTORY_AGENT              = 78,
-//  DHO_SERVICE_SCOPE                = 79,
-//  DHO_RAPID_COMMIT                 = 80,,
+    DHO_SERVICE_SCOPE                = 79,
+//  DHO_RAPID_COMMIT                 = 80,
     DHO_FQDN                         = 81,
     DHO_FQDN                         = 81,
     DHO_DHCP_AGENT_OPTIONS           = 82,
     DHO_DHCP_AGENT_OPTIONS           = 82,
 //  DHO_ISNS                         = 83,
 //  DHO_ISNS                         = 83,
     // 84 is removed/unassigned
     // 84 is removed/unassigned
-//  DHO_NDS_SERVERS                  = 85,
-//  DHO_NDS_TREE_NAME                = 86,
-//  DHO_NDS_CONTEXT                  = 87,
-//  DHO_BCMCS_DOMAIN_NAME_LIST       = 88,
-//  DHO_BCMCS_IPV4_ADDR              = 89,
+    DHO_NDS_SERVERS                  = 85,
+    DHO_NDS_TREE_NAME                = 86,
+    DHO_NDS_CONTEXT                  = 87,
+    DHO_BCMCS_DOMAIN_NAME_LIST       = 88,
+    DHO_BCMCS_IPV4_ADDR              = 89,
     DHO_AUTHENTICATE                 = 90,  /* RFC3118, was 210 */
     DHO_AUTHENTICATE                 = 90,  /* RFC3118, was 210 */
     DHO_CLIENT_LAST_TRANSACTION_TIME = 91,
     DHO_CLIENT_LAST_TRANSACTION_TIME = 91,
     DHO_ASSOCIATED_IP                = 92,
     DHO_ASSOCIATED_IP                = 92,
@@ -164,17 +164,17 @@ enum DHCPOptionType {
 //  DHO_LDAP                         = 95,
 //  DHO_LDAP                         = 95,
     // 96 is removed/unassigned
     // 96 is removed/unassigned
     DHO_UUID_GUID                    = 97, /* RFC4578 */
     DHO_UUID_GUID                    = 97, /* RFC4578 */
-//  DHO_USER_AUTH                    = 98,
-//  DHO_GEOCONF_CIVIC                = 99,
-//  DHO_PCODE                        = 100,
-//  DHO_TCODE                        = 101,
+    DHO_USER_AUTH                    = 98,
+    DHO_GEOCONF_CIVIC                = 99,
+    DHO_PCODE                        = 100,
+    DHO_TCODE                        = 101,
     // 102-111 are removed/unassigned
     // 102-111 are removed/unassigned
-//  DHO_NETINFO_ADDR                 = 112,
-//  DHO_NETINFO_TAG                  = 113,
-//  DHO_URL                          = 114,
+    DHO_NETINFO_ADDR                 = 112,
+    DHO_NETINFO_TAG                  = 113,
+    DHO_URL                          = 114,
     // 115 is removed/unassigned
     // 115 is removed/unassigned
-//  DHO_AUTO_CONFIG                  = 116,
-//  DHO_NAME_SERVICE_SEARCH          = 117,
+    DHO_AUTO_CONFIG                  = 116,
+    DHO_NAME_SERVICE_SEARCH          = 117,
     DHO_SUBNET_SELECTION             = 118, /* RFC3011 */
     DHO_SUBNET_SELECTION             = 118, /* RFC3011 */
     DHO_DOMAIN_SEARCH                = 119, /* RFC3397 */
     DHO_DOMAIN_SEARCH                = 119, /* RFC3397 */
 //  DHO_SIP_SERVERS                  = 120,
 //  DHO_SIP_SERVERS                  = 120,
@@ -185,12 +185,12 @@ enum DHCPOptionType {
     DHO_VIVSO_SUBOPTIONS             = 125,
     DHO_VIVSO_SUBOPTIONS             = 125,
     // 126-127 are removed/unassigned
     // 126-127 are removed/unassigned
     // 128-135 have multiple definitions including PXE
     // 128-135 have multiple definitions including PXE
-//  DHO_PANA_AGENT                   = 136,
-//  DHO_V4_LOST                      = 137,
-//  DHO_CAPWAP_AC_V4                 = 138,
+    DHO_PANA_AGENT                   = 136,
+    DHO_V4_LOST                      = 137,
+    DHO_CAPWAP_AC_V4                 = 138,
 //  DHO_IPV4_ADDR_MOS                = 139,
 //  DHO_IPV4_ADDR_MOS                = 139,
 //  DHO_IPV4_FQDN_MOS                = 140,
 //  DHO_IPV4_FQDN_MOS                = 140,
-//  DHO_SIP_UA_CONF_SERVICE_DOMAINS  = 141,
+    DHO_SIP_UA_CONF_SERVICE_DOMAINS  = 141,
 //  DHO_IPV4_ADDR_ANDSF              = 142,
 //  DHO_IPV4_ADDR_ANDSF              = 142,
     // 143 is removed/unassigned
     // 143 is removed/unassigned
 //  DHO_GEOLOC                       = 144,
 //  DHO_GEOLOC                       = 144,
@@ -206,10 +206,13 @@ enum DHCPOptionType {
 //  DHO_DHCP_STATE                   = 156,
 //  DHO_DHCP_STATE                   = 156,
 //  DHO_DATA_SOURCE                  = 157,
 //  DHO_DATA_SOURCE                  = 157,
 //  DHO_V4_PCP_SERVER                = 158,
 //  DHO_V4_PCP_SERVER                = 158,
-//  DHO_V4_PORTPARAMS                = 159,
-    // 160-211 are removed/unassigned
+    DHO_V4_PORTPARAMS                = 159,
+    DHO_V4_CAPTIVE_PORTAL            = 160,
+    // 161-209 are removed/unassigned
+//  DHO_PATH_PREFIX                  = 210,
+//  DHO_REBOOT_TIME                  = 211,    
 //  DHO_6RD                          = 212,
 //  DHO_6RD                          = 212,
-//  DHO_V4_ACCESS_DOMAIN             = 213,
+    DHO_V4_ACCESS_DOMAIN             = 213,
     // 214-219 are removed/unassigned
     // 214-219 are removed/unassigned
 //  DHO_SUBNET_ALLOC                 = 220,
 //  DHO_SUBNET_ALLOC                 = 220,
 //  DHO_VSS                          = 221,
 //  DHO_VSS                          = 221,
@@ -237,6 +240,9 @@ enum DHCPMessageType {
     DHCPLEASEACTIVE     =  13,
     DHCPLEASEACTIVE     =  13,
     DHCPBULKLEASEQUERY  =  14,
     DHCPBULKLEASEQUERY  =  14,
     DHCPLEASEQUERYDONE  =  15
     DHCPLEASEQUERYDONE  =  15
+// DHCPACTIVELEASEQUERY =  16,
+// DHCPLEASEQUERYSTATUS =  17,
+// DHCPTLS              =  18
 };
 };
 
 
 static const uint16_t DHCP4_CLIENT_PORT = 68;
 static const uint16_t DHCP4_CLIENT_PORT = 68;
@@ -260,6 +266,12 @@ static const uint16_t RAI_OPTION_VSI = 9; // RFC4243
 static const uint16_t RAI_OPTION_RELAY_FLAGS = 10; // RFC5010
 static const uint16_t RAI_OPTION_RELAY_FLAGS = 10; // RFC5010
 static const uint16_t RAI_OPTION_SERVER_ID_OVERRIDE = 11; // RFC5107
 static const uint16_t RAI_OPTION_SERVER_ID_OVERRIDE = 11; // RFC5107
 static const uint16_t RAI_OPTION_RELAY_ID = 12; //RFC6925
 static const uint16_t RAI_OPTION_RELAY_ID = 12; //RFC6925
+static const uint16_t RAI_OPTION_ACCESS_TECHNO_TYPE = 13; // RFC7839
+static const uint16_t RAI_OPTION_ACCESS_NETWORK_NAME = 14; // RFC7839
+static const uint16_t RAI_OPTION_ACCESS_POINT_NAME = 15; // RFC7839
+static const uint16_t RAI_OPTION_ACCESS_POINT_BSSID = 16; // RFC7839
+static const uint16_t RAI_OPTION_OPERATOR_ID = 17; // RFC7839
+static const uint16_t RAI_OPTION_OPERATOR_REALM = 18; // RFC7839
 static const uint16_t RAI_OPTION_VIRTUAL_SUBNET_SELECT = 151; //RFC6607
 static const uint16_t RAI_OPTION_VIRTUAL_SUBNET_SELECT = 151; //RFC6607
 static const uint16_t RAI_OPTION_VIRTUAL_SUBNET_SELECT_CTRL = 152; //RFC6607
 static const uint16_t RAI_OPTION_VIRTUAL_SUBNET_SELECT_CTRL = 152; //RFC6607
 
 

+ 233 - 163
src/lib/dhcp/dhcp6.h

@@ -7,6 +7,8 @@
 #ifndef DHCP6_H
 #ifndef DHCP6_H
 #define DHCP6_H
 #define DHCP6_H
 
 
+#include <stdint.h>
+
 /// @note Code points in comments are those assigned by IANA
 /// @note Code points in comments are those assigned by IANA
 /// but not yet implemented in Kea.
 /// but not yet implemented in Kea.
 /// To implement a standard option, remove the comment characters,
 /// To implement a standard option, remove the comment characters,
@@ -15,174 +17,240 @@
 /// the dhcp6-srv.xml source file of the user guide.
 /// the dhcp6-srv.xml source file of the user guide.
 
 
 /* DHCPv6 Option codes: */
 /* DHCPv6 Option codes: */
-
-#define D6O_CLIENTID                            1 /* RFC3315 */
-#define D6O_SERVERID                            2
-#define D6O_IA_NA                               3
-#define D6O_IA_TA                               4
-#define D6O_IAADDR                              5
-#define D6O_ORO                                 6
-#define D6O_PREFERENCE                          7
-#define D6O_ELAPSED_TIME                        8
-#define D6O_RELAY_MSG                           9
-/* Option code 10 unassigned. */
-#define D6O_AUTH                                11
-#define D6O_UNICAST                             12
-#define D6O_STATUS_CODE                         13
-#define D6O_RAPID_COMMIT                        14
-#define D6O_USER_CLASS                          15
-#define D6O_VENDOR_CLASS                        16
-#define D6O_VENDOR_OPTS                         17
-#define D6O_INTERFACE_ID                        18
-#define D6O_RECONF_MSG                          19
-#define D6O_RECONF_ACCEPT                       20
-#define D6O_SIP_SERVERS_DNS                     21 /* RFC3319 */
-#define D6O_SIP_SERVERS_ADDR                    22 /* RFC3319 */
-#define D6O_NAME_SERVERS                        23 /* RFC3646 */
-#define D6O_DOMAIN_SEARCH                       24 /* RFC3646 */
-#define D6O_IA_PD                               25 /* RFC3633 */
-#define D6O_IAPREFIX                            26 /* RFC3633 */
-#define D6O_NIS_SERVERS                         27 /* RFC3898 */
-#define D6O_NISP_SERVERS                        28 /* RFC3898 */
-#define D6O_NIS_DOMAIN_NAME                     29 /* RFC3898 */
-#define D6O_NISP_DOMAIN_NAME                    30 /* RFC3898 */
-#define D6O_SNTP_SERVERS                        31 /* RFC4075 */
-#define D6O_INFORMATION_REFRESH_TIME            32 /* RFC4242 */
-#define D6O_BCMCS_SERVER_D                      33 /* RFC4280 */
-#define D6O_BCMCS_SERVER_A                      34 /* RFC4280 */
-/* 35 is unassigned */
-#define D6O_GEOCONF_CIVIC                       36 /* RFC4776 */
-#define D6O_REMOTE_ID                           37 /* RFC4649 */
-#define D6O_SUBSCRIBER_ID                       38 /* RFC4580 */
-#define D6O_CLIENT_FQDN                         39 /* RFC4704 */
-#define D6O_PANA_AGENT                          40 /* paa-option */
-#define D6O_NEW_POSIX_TIMEZONE                  41 /* RFC4833 */
-#define D6O_NEW_TZDB_TIMEZONE                   42 /* RFC4833 */
-#define D6O_ERO                                 43 /* RFC4994 */
-#define D6O_LQ_QUERY                            44 /* RFC5007 */
-#define D6O_CLIENT_DATA                         45 /* RFC5007 */
-#define D6O_CLT_TIME                            46 /* RFC5007 */
-#define D6O_LQ_RELAY_DATA                       47 /* RFC5007 */
-#define D6O_LQ_CLIENT_LINK                      48 /* RFC5007 */
-//#define D6O_MIP6_HNIDF                          49 /* RFC6610 */
-//#define D6O_MIP6_VDINF                          50 /* RFC6610 */
-//#define D6O_V6_LOST                             51 /* RFC5223 */
-//#define D6O_CAPWAP_AC_V6                        52 /* RFC5417 */
-//#define D6O_RELAY_ID                            53 /* RFC5460 */
-//#define D6O_IPV6_ADDRESS_MOS                    54 /* RFC5678 */
-//#define D6O_IPV6_FQDN_MOS                       55 /* RFC5678 */
-//#define D6O_NTP_SERVER                          56 /* RFC5908 */
-//#define D6O_V6_ACCESS_DOMAIN                    57 /* RFC5986 */
-//#define D6O_SIP_UA_CS_LIST                      58 /* RFC6011 */
-#define D6O_BOOTFILE_URL                        59 /* RFC5970 */
-#define D6O_BOOTFILE_PARAM                      60 /* RFC5970 */
-#define D6O_CLIENT_ARCH_TYPE                    61 /* RFC5970 */
-#define D6O_NII                                 62 /* RFC5970 */
-//#define D6O_GEOLOCATION                         63 /* RFC6225 */
-#define D6O_AFTR_NAME                           64 /* RFC6334 */
-#define D6O_ERP_LOCAL_DOMAIN_NAME               65 /* RFC6440 */
-#define D6O_RSOO                                66 /* RFC6422 */
-#define D6O_PD_EXCLUDE                          67 /* RFC6603 */
-//#define D6O_VSS                                 68 /* RFC6607 */
-//#define D6O_MIP6_IDINF                          69 /* RFC6610 */
-//#define D6O_MIP6_UDINF                          70 /* RFC6610 */
-//#define D6O_MIP6_HNP                            71 /* RFC6610 */
-//#define D6O_MIP6_HAA                            72 /* RFC6610 */
-//#define D6O_MIP6_HAF                            73 /* RFC6610 */
-//#define D6O_RDNSS_SELECTION                     74 /* RFC6731 */
-//#define D6O_KRB_PRINCIPAL_NAME                  75 /* RFC6784 */
-//#define D6O_KRB_REALM_NAME                      76 /* RFC6784 */
-//#define D6O_KRB_DEFAULT_REALM_NAME              77 /* RFC6784 */
-//#define D6O_KRB_KDC                             78 /* RFC6784 */
-#define D6O_CLIENT_LINKLAYER_ADDR               79 /* RFC6939 */
-//#define D6O_LINK_ADDRESS                        80 /* RFC6977 */
-//#define D6O_RADIUS                              81 /* RFC7037 */
-//#define D6O_SOL_MAX_RT                          82 /* RFC7083 */
-//#define D6O_INF_MAX_RT                          83 /* RFC7083 */
-//#define D6O_ADDRSEL                             84 /* RFC7078 */
-//#define D6O_ADDRSEL_TABLE                       85 /* RFC7078 */
-//#define D6O_V6_PCP_SERVER                       86 /* RFC7291 */
-#define D6O_DHCPV4_MSG                          87 /* RFC7341 */
-#define D6O_DHCPV4_O_DHCPV6_SERVER              88 /* RFC7341 */
-//#define D6O_4RD                                 97 /* RFC7600 */
-//#define D6O_4RD_MAP_RULE                        98 /* RFC7600 */
-//#define D6O_4RD_NON_MAP_RULE                    99 /* RFC7600 */
-//#define D6O_LQ_BASE_TIME                       100 /* RFC7653 */
-//#define D6O_LQ_START_TIME                      101 /* RFC7653 */
-//#define D6O_LQ_END_TIME                        102 /* RFC7653 */
-/* 103-142 unassigned */
-//#define D6O_IPV6_ADDRESS_ANDSF                 143 /* RFC6153 */
+enum DHCPv6OptionType {
+   D6O_CLIENTID                            = 1, /* RFC3315 */
+   D6O_SERVERID                            = 2,
+   D6O_IA_NA                               = 3,
+   D6O_IA_TA                               = 4,
+   D6O_IAADDR                              = 5,
+   D6O_ORO                                 = 6,
+   D6O_PREFERENCE                          = 7,
+   D6O_ELAPSED_TIME                        = 8,
+   D6O_RELAY_MSG                           = 9,
+   // Option code 10 unassigned.
+   D6O_AUTH                                = 11,
+   D6O_UNICAST                             = 12,
+   D6O_STATUS_CODE                         = 13,
+   D6O_RAPID_COMMIT                        = 14,
+   D6O_USER_CLASS                          = 15,
+   D6O_VENDOR_CLASS                        = 16,
+   D6O_VENDOR_OPTS                         = 17,
+   D6O_INTERFACE_ID                        = 18,
+   D6O_RECONF_MSG                          = 19,
+   D6O_RECONF_ACCEPT                       = 20,
+   D6O_SIP_SERVERS_DNS                     = 21, /* RFC3319 */
+   D6O_SIP_SERVERS_ADDR                    = 22, /* RFC3319 */
+   D6O_NAME_SERVERS                        = 23, /* RFC3646 */
+   D6O_DOMAIN_SEARCH                       = 24, /* RFC3646 */
+   D6O_IA_PD                               = 25, /* RFC3633 */
+   D6O_IAPREFIX                            = 26, /* RFC3633 */
+   D6O_NIS_SERVERS                         = 27, /* RFC3898 */
+   D6O_NISP_SERVERS                        = 28, /* RFC3898 */
+   D6O_NIS_DOMAIN_NAME                     = 29, /* RFC3898 */
+   D6O_NISP_DOMAIN_NAME                    = 30, /* RFC3898 */
+   D6O_SNTP_SERVERS                        = 31, /* RFC4075 */
+   D6O_INFORMATION_REFRESH_TIME            = 32, /* RFC4242 */
+   D6O_BCMCS_SERVER_D                      = 33, /* RFC4280 */
+   D6O_BCMCS_SERVER_A                      = 34, /* RFC4280 */
+   // 35 is unassigned
+   D6O_GEOCONF_CIVIC                       = 36, /* RFC4776 */
+   D6O_REMOTE_ID                           = 37, /* RFC4649 */
+   D6O_SUBSCRIBER_ID                       = 38, /* RFC4580 */
+   D6O_CLIENT_FQDN                         = 39, /* RFC4704 */
+   D6O_PANA_AGENT                          = 40, /* paa-option */
+   D6O_NEW_POSIX_TIMEZONE                  = 41, /* RFC4833 */
+   D6O_NEW_TZDB_TIMEZONE                   = 42, /* RFC4833 */
+   D6O_ERO                                 = 43, /* RFC4994 */
+   D6O_LQ_QUERY                            = 44, /* RFC5007 */
+   D6O_CLIENT_DATA                         = 45, /* RFC5007 */
+   D6O_CLT_TIME                            = 46, /* RFC5007 */
+   D6O_LQ_RELAY_DATA                       = 47, /* RFC5007 */
+   D6O_LQ_CLIENT_LINK                      = 48, /* RFC5007 */
+// D6O_MIP6_HNIDF                          = 49, /* RFC6610 */
+// D6O_MIP6_VDINF                          = 50, /* RFC6610 */
+   D6O_V6_LOST                             = 51, /* RFC5223 */
+   D6O_CAPWAP_AC_V6                        = 52, /* RFC5417 */
+   D6O_RELAY_ID                            = 53, /* RFC5460 */
+// D6O_IPV6_ADDRESS_MOS                    = 54, /* RFC5678 */
+// D6O_IPV6_FQDN_MOS                       = 55, /* RFC5678 */
+// D6O_NTP_SERVER                          = 56, /* RFC5908 */
+   D6O_V6_ACCESS_DOMAIN                    = 57, /* RFC5986 */
+   D6O_SIP_UA_CS_LIST                      = 58, /* RFC6011 */
+   D6O_BOOTFILE_URL                        = 59, /* RFC5970 */
+   D6O_BOOTFILE_PARAM                      = 60, /* RFC5970 */
+   D6O_CLIENT_ARCH_TYPE                    = 61, /* RFC5970 */
+   D6O_NII                                 = 62, /* RFC5970 */
+// D6O_GEOLOCATION                         = 63, /* RFC6225 */
+   D6O_AFTR_NAME                           = 64, /* RFC6334 */
+   D6O_ERP_LOCAL_DOMAIN_NAME               = 65, /* RFC6440 */
+   D6O_RSOO                                = 66, /* RFC6422 */
+   D6O_PD_EXCLUDE                          = 67, /* RFC6603 */
+// D6O_VSS                                 = 68, /* RFC6607 */
+// D6O_MIP6_IDINF                          = 69, /* RFC6610 */
+// D6O_MIP6_UDINF                          = 70, /* RFC6610 */
+// D6O_MIP6_HNP                            = 71, /* RFC6610 */
+// D6O_MIP6_HAA                            = 72, /* RFC6610 */
+// D6O_MIP6_HAF                            = 73, /* RFC6610 */
+// D6O_RDNSS_SELECTION                     = 74, /* RFC6731 */
+// D6O_KRB_PRINCIPAL_NAME                  = 75, /* RFC6784 */
+// D6O_KRB_REALM_NAME                      = 76, /* RFC6784 */
+// D6O_KRB_DEFAULT_REALM_NAME              = 77, /* RFC6784 */
+// D6O_KRB_KDC                             = 78, /* RFC6784 */
+   D6O_CLIENT_LINKLAYER_ADDR               = 79, /* RFC6939 */
+   D6O_LINK_ADDRESS                        = 80, /* RFC6977 */
+// D6O_RADIUS                              = 81, /* RFC7037 */
+   D6O_SOL_MAX_RT                          = 82, /* RFC7083 */
+   D6O_INF_MAX_RT                          = 83, /* RFC7083 */
+// D6O_ADDRSEL                             = 84, /* RFC7078 */
+// D6O_ADDRSEL_TABLE                       = 85, /* RFC7078 */
+// D6O_V6_PCP_SERVER                       = 86, /* RFC7291 */
+   D6O_DHCPV4_MSG                          = 87, /* RFC7341 */
+   D6O_DHCPV4_O_DHCPV6_SERVER              = 88, /* RFC7341 */
+// D6O_S46_RULE                            = 89, /* RFC7598 */
+// D6O_S46_BR                              = 90, /* RFC7598 */
+// D6O_S46_DMR                             = 91, /* RFC7598 */
+// D6O_S46_V4V6BIND                        = 92, /* RFC7598 */
+// D6O_S46_PORTPARAMS                      = 93, /* RFC7598 */
+// D6O_S46_CONT_MAPE                       = 94, /* RFC7598 */
+// D6O_S46_CONT_MAPT                       = 95, /* RFC7598 */
+// D6O_S46_CONT_LW                         = 96, /* RFC7598 */
+// D6O_4RD                                 = 97, /* RFC7600 */
+// D6O_4RD_MAP_RULE                        = 98, /* RFC7600 */
+// D6O_4RD_NON_MAP_RULE                    = 99, /* RFC7600 */
+// D6O_LQ_BASE_TIME                       = 100, /* RFC7653 */
+// D6O_LQ_START_TIME                      = 101, /* RFC7653 */
+// D6O_LQ_END_TIME                        = 102, /* RFC7653 */
+   D6O_V6_CAPTIVE_PORTAL                  = 103, /* RFC7710 */
+// D6O_MPL_PARAMETERS                     = 104, /* RFC7774 */
+// D6O_ANI_ATT                            = 105, /* RFC7839 */
+// D6O_ANI_NETWORK_NAME                   = 106, /* RFC7839 */
+// D6O_ANI_AP_NAME                        = 107, /* RFC7839 */
+// D6O_ANI_AP_BSSID                       = 108, /* RFC7839 */
+// D6O_ANI_OPERATOR_ID                    = 109, /* RFC7839 */
+// D6O_ANI_OPERATOR_REALM                 = 110, /* RFC7839 */
+// D6O_S46_PRIORITY                       = 111, /* RFC8026 */
+   // 112 unassigned
+// D6O_V6_PREFIX64                        = 113, /* RFC8115 */
+// D6O_F_BINDING_STATUS                   = 114, /* RFC8156 */
+// D6O_F_CONNECT_FLAGS                    = 115, /* RFC8156 */
+// D6O_F_DNS_REMOVAL_INFO                 = 116, /* RFC8156 */
+// D6O_F_DNS_HOST_NAME                    = 117, /* RFC8156 */
+// D6O_F_DNS_ZONE_NAME                    = 118, /* RFC8156 */
+// D6O_F_DNS_FLAGS                        = 119, /* RFC8156 */
+// D6O_F_EXPIRATION_TIME                  = 120, /* RFC8156 */
+// D6O_F_MAX_UNACKED_BNDUPD               = 121, /* RFC8156 */
+// D6O_F_MCLT                             = 122, /* RFC8156 */
+// D6O_F_PARTNER_LIFETIME                 = 123, /* RFC8156 */
+// D6O_F_PARTNER_LIFETIME_SENT            = 124, /* RFC8156 */
+// D6O_F_PARTNER_DOWN_TIME                = 125, /* RFC8156 */
+// D6O_F_PARTNER_RAW_CLT_TIME             = 126, /* RFC8156 */
+// D6O_F_PROTOCOL_VERSION                 = 127, /* RFC8156 */
+// D6O_F_KEEPALIVE_TIME                   = 128, /* RFC8156 */
+// D6O_F_RECONFIGURE_DATA                 = 129, /* RFC8156 */
+// D6O_F_RELATIONSHIP_NAME                = 130, /* RFC8156 */
+// D6O_F_SERVER_FLAGS                     = 131, /* RFC8156 */
+// D6O_F_SERVER_STATE                     = 132, /* RFC8156 */
+// D6O_F_START_TIME_OF_STATE              = 133, /* RFC8156 */
+// D6O_F_STATE_EXPIRATION_TIME            = 134, /* RFC8156 */
+   // 135-142 unassigned
+   D6O_IPV6_ADDRESS_ANDSF                 = 143, /* RFC6153 */
 
 
 // The following are EXPERIMENTAL and may change when IANA assigns official
 // The following are EXPERIMENTAL and may change when IANA assigns official
 // values.
 // values.
 /* secure DHCPv6 (draft-ietf-dhc-sedhcpv6-08) */
 /* secure DHCPv6 (draft-ietf-dhc-sedhcpv6-08) */
 /* temporary values for hackathon 93 */
 /* temporary values for hackathon 93 */
-#define D6O_PUBLIC_KEY                         701
-#define D6O_CERTIFICATE                        702
-#define D6O_SIGNATURE                          703
-#define D6O_TIMESTAMP                          704
+   D6O_PUBLIC_KEY                         = 701,
+   D6O_CERTIFICATE                        = 702,
+   D6O_SIGNATURE                          = 703,
+   D6O_TIMESTAMP                          = 704
+};
 
 
 /*
 /*
  * Status Codes, from RFC 3315 section 24.4, and RFC 3633, 5007, 5460.
  * Status Codes, from RFC 3315 section 24.4, and RFC 3633, 5007, 5460.
  */
  */
-#define STATUS_Success                   0
-#define STATUS_UnspecFail                1
-#define STATUS_NoAddrsAvail              2
-#define STATUS_NoBinding                 3
-#define STATUS_NotOnLink                 4
-#define STATUS_UseMulticast              5
-#define STATUS_NoPrefixAvail             6
-#define STATUS_UnknownQueryType          7
-#define STATUS_MalformedQuery            8
-#define STATUS_NotConfigured             9
-#define STATUS_NotAllowed               10
-//#define STATUS_QueryTerminated          11
-/* draft-ietf-dhc-dhcpv6-active-leasequery-04 */
-//#define STATUS_DataMissing              12
-//#define STATUS_CatchUpComplete          13
-//#define STATUS_NotSupported             14
-//#define STATUS_TLSConnectionRefused     15
+enum DHCPv6StatusCode {
+   STATUS_Success                    = 0,
+   STATUS_UnspecFail                 = 1,
+   STATUS_NoAddrsAvail               = 2,
+   STATUS_NoBinding                  = 3,
+   STATUS_NotOnLink                  = 4,
+   STATUS_UseMulticast               = 5,
+   STATUS_NoPrefixAvail              = 6,
+   STATUS_UnknownQueryType           = 7,
+   STATUS_MalformedQuery             = 8,
+   STATUS_NotConfigured              = 9,
+   STATUS_NotAllowed                 = 10,
+// STATUS_QueryTerminated            = 11,
+/* RFC7653 */
+// STATUS_DataMissing                = 12,
+// STATUS_CatchUpComplete            = 13,
+// STATUS_NotSupported               = 14,
+// STATUS_TLSConnectionRefused       = 15,
+/* RFC8156 */
+// STATUS_AddressInUse               = 16,
+// STATUS_ConfigurationConflict      = 17,
+// STATUS_MissingBindingInformation  = 18,
+// STATUS_OutdatedBindingInformation = 19,
+// STATUS_ServerShuttingDown         = 20,
+// STATUS_DNSUpdateNotSupported      = 21,
+// STATUS_ExcessiveTimeSkew          = 22,
 
 
 // The following are EXPERIMENTAL and may change when IANA assigns official
 // The following are EXPERIMENTAL and may change when IANA assigns official
 // values.
 // values.
 /* secure DHCPv6 (draft-ietf-dhc-sedhcpv6-08) */
 /* secure DHCPv6 (draft-ietf-dhc-sedhcpv6-08) */
 /* temporary values for hackathon 93 */
 /* temporary values for hackathon 93 */
-#define STATUS_AlgorithmNotSupported   705
-#define STATUS_AuthenticationFail      706
-#define STATUS_TimestampFail           707
-#define STATUS_SignatureFail           708
+   STATUS_AlgorithmNotSupported     = 705,
+   STATUS_AuthenticationFail        = 706,
+   STATUS_TimestampFail             = 707,
+   STATUS_SignatureFail             = 708
+};
 
 
 /*
 /*
  * DHCPv6 message types, defined in section 5.3 of RFC 3315
  * DHCPv6 message types, defined in section 5.3 of RFC 3315
  */
  */
-#define DHCPV6_SOLICIT              1
-#define DHCPV6_ADVERTISE            2
-#define DHCPV6_REQUEST              3
-#define DHCPV6_CONFIRM              4
-#define DHCPV6_RENEW                5
-#define DHCPV6_REBIND               6
-#define DHCPV6_REPLY                7
-#define DHCPV6_RELEASE              8
-#define DHCPV6_DECLINE              9
-#define DHCPV6_RECONFIGURE         10
-#define DHCPV6_INFORMATION_REQUEST 11
-#define DHCPV6_RELAY_FORW          12
-#define DHCPV6_RELAY_REPL          13
-/* RFC 5007 */
-#define DHCPV6_LEASEQUERY          14
-#define DHCPV6_LEASEQUERY_REPLY    15
-/* RFC 5460 */
-//#define DHCPV6_LEASEQUERY_DONE     16
-//#define DHCPV6_LEASEQUERY_DATA     17
-/* RFC 6977 */
-//#define DHCPV6_RECONFIGURE_REQUEST 18
-//#define DHCPV6_RECONFIGURE_REPLY   19
-/* RFC 7341 */
-#define DHCPV6_DHCPV4_QUERY        20
-#define DHCPV6_DHCPV4_RESPONSE     21
-/* RFC 7653 */
-//#define DHCPV6_ACTIVELEASEQUERY    22
-//#define DHCPV6_STARTTLS            23
+enum DHCPv6MessageType {
+   DHCPV6_SOLICIT              = 1,
+   DHCPV6_ADVERTISE            = 2,
+   DHCPV6_REQUEST              = 3,
+   DHCPV6_CONFIRM              = 4,
+   DHCPV6_RENEW                = 5,
+   DHCPV6_REBIND               = 6,
+   DHCPV6_REPLY                = 7,
+   DHCPV6_RELEASE              = 8,
+   DHCPV6_DECLINE              = 9,
+   DHCPV6_RECONFIGURE          = 10,
+   DHCPV6_INFORMATION_REQUEST  = 11,
+   DHCPV6_RELAY_FORW           = 12,
+   DHCPV6_RELAY_REPL           = 13,
+   /* RFC 5007 */
+   DHCPV6_LEASEQUERY           = 14,
+   DHCPV6_LEASEQUERY_REPLY     = 15,
+   /* RFC 5460 */
+// DHCPV6_LEASEQUERY_DONE      = 16,
+// DHCPV6_LEASEQUERY_DATA      = 17,
+   /* RFC 6977 */
+// DHCPV6_RECONFIGURE_REQUEST  = 18,
+// DHCPV6_RECONFIGURE_REPLY    = 19,
+   /* RFC 7341 */
+   DHCPV6_DHCPV4_QUERY         = 20,
+   DHCPV6_DHCPV4_RESPONSE      = 21
+   /* RFC 7653 */
+// DHCPV6_ACTIVELEASEQUERY     = 22,
+// DHCPV6_STARTTLS             = 23,
+   /* RFC 8156 */
+// DHCPV6_BNDUPD               = 24,
+// DHCPV6_BNDREPLY             = 25,
+// DHCPV6_POOLREQ              = 26,
+// DHCPV6_POOLRESP             = 27,
+// DHCPV6_UPDREQ               = 28,
+// DHCPV6_UPDREQALL            = 29,
+// DHCPV6_UPDDONE              = 30,
+// DHCPV6_CONNECT              = 31,
+// DHCPV6_CONNECTREPLY         = 32,
+// DHCPV6_DISCONNECT           = 33,
+// DHCPV6_STATE                = 34,
+// DHCPV6_CONTACT              = 35
+};
 
 
 extern const char *dhcpv6_type_names[];
 extern const char *dhcpv6_type_names[];
 extern const int dhcpv6_type_name_max;
 extern const int dhcpv6_type_name_max;
@@ -192,8 +260,8 @@ extern const int dhcpv6_type_name_max;
 
 
 // Define hardware types
 // Define hardware types
 // Taken from http://www.iana.org/assignments/arp-parameters/
 // Taken from http://www.iana.org/assignments/arp-parameters/
-#define HWTYPE_ETHERNET    0x0001
-#define HWTYPE_INFINIBAND  0x0020
+static const uint16_t HWTYPE_ETHERNET = 0x0001;
+static const uint16_t HWTYPE_INFINIBAND = 0x0020;
 
 
 // The following are EXPERIMENTAL and may change when IANA assigns official
 // The following are EXPERIMENTAL and may change when IANA assigns official
 // values.
 // values.
@@ -204,40 +272,42 @@ extern const int dhcpv6_type_name_max;
 #define RSASSA_PKCS1v1_5        1
 #define RSASSA_PKCS1v1_5        1
 
 
 // Taken from http://www.iana.org/assignments/enterprise-numbers
 // Taken from http://www.iana.org/assignments/enterprise-numbers
-#define ENTERPRISE_ID_ISC 2495
+static const uint32_t ENTERPRISE_ID_ISC = 2495;
 
 
 /* DHCPv4-over-DHCPv6 (RFC 7341) inter-process communication. These are option
 /* DHCPv4-over-DHCPv6 (RFC 7341) inter-process communication. These are option
    codes for the ISC vendor specific options used in 4o6 */
    codes for the ISC vendor specific options used in 4o6 */
-#define ISC_V6_4O6_INTERFACE                 60000
-#define ISC_V6_4O6_SRC_ADDRESS               60001
+static const uint16_t ISC_V6_4O6_INTERFACE = 60000;
+static const uint16_t ISC_V6_4O6_SRC_ADDRESS = 60001;
 
 
 /* Offsets into IA_*'s where Option spaces commence.  */
 /* Offsets into IA_*'s where Option spaces commence.  */
-#define IA_NA_OFFSET 12 /* IAID, T1, T2, all 4 octets each */
-#define IA_TA_OFFSET  4 /* IAID only, 4 octets */
-#define IA_PD_OFFSET 12 /* IAID, T1, T2, all 4 octets each */
+static const uint16_t IA_NA_OFFSET = 12; /* IAID, T1, T2, all 4 octets each */
+static const uint16_t IA_TA_OFFSET = 4; /* IAID only, 4 octets */
+static const uint16_t IA_PD_OFFSET = 12; /* IAID, T1, T2, all 4 octets each */
 
 
 /* Offset into IAADDR's where Option spaces commence. */
 /* Offset into IAADDR's where Option spaces commence. */
-#define IAADDR_OFFSET 24
+static const uint16_t IAADDR_OFFSET = 24;
 
 
 /* Offset into IAPREFIX's where Option spaces commence. */
 /* Offset into IAPREFIX's where Option spaces commence. */
-#define IAPREFIX_OFFSET 25
+static const uint16_t IAPREFIX_OFFSET = 25;
 
 
 /* Offset into LQ_QUERY's where Option spaces commence. */
 /* Offset into LQ_QUERY's where Option spaces commence. */
-#define LQ_QUERY_OFFSET 17
+static const uint16_t LQ_QUERY_OFFSET = 17;
 
 
 /*
 /*
  * DHCPv6 well-known multicast addresses, from section 5.1 of RFC 3315
  * DHCPv6 well-known multicast addresses, from section 5.1 of RFC 3315
  */
  */
+// TODO
 #define ALL_DHCP_RELAY_AGENTS_AND_SERVERS "ff02::1:2"
 #define ALL_DHCP_RELAY_AGENTS_AND_SERVERS "ff02::1:2"
 #define ALL_DHCP_SERVERS "ff05::1:3"
 #define ALL_DHCP_SERVERS "ff05::1:3"
 
 
-#define DHCP6_CLIENT_PORT 546
-#define DHCP6_SERVER_PORT 547
+static const uint16_t DHCP6_CLIENT_PORT = 546;
+static const uint16_t DHCP6_SERVER_PORT = 547;
 
 
 /*
 /*
  * DHCPv6 Retransmission Constants (RFC3315 section 5.5, RFC 5007)
  * DHCPv6 Retransmission Constants (RFC3315 section 5.5, RFC 5007)
  */
  */
 
 
+// TODO
 #define SOL_MAX_DELAY     1
 #define SOL_MAX_DELAY     1
 #define SOL_TIMEOUT       1
 #define SOL_TIMEOUT       1
 #define SOL_MAX_RT      120
 #define SOL_MAX_RT      120

+ 81 - 2
src/lib/dhcp/option6_status_code.cc

@@ -1,4 +1,4 @@
-// Copyright (C) 2015-2016 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2015-2017 Internet Systems Consortium, Inc. ("ISC")
 //
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -6,8 +6,10 @@
 
 
 #include <config.h>
 #include <config.h>
 
 
+#include <dhcp/dhcp4.h>
 #include <dhcp/dhcp6.h>
 #include <dhcp/dhcp6.h>
 #include <dhcp/option6_status_code.h>
 #include <dhcp/option6_status_code.h>
+#include <dhcp/option_data_types.h>
 #include <util/io_utilities.h>
 #include <util/io_utilities.h>
 #include <iterator>
 #include <iterator>
 #include <sstream>
 #include <sstream>
@@ -19,6 +21,7 @@ namespace {
 
 
 /// @brief Minimum length of the option (when status message is empty).
 /// @brief Minimum length of the option (when status message is empty).
 const size_t OPTION6_STATUS_CODE_MIN_LEN = sizeof(uint16_t);
 const size_t OPTION6_STATUS_CODE_MIN_LEN = sizeof(uint16_t);
+const size_t OPTION4_SLP_SERVICE_SCOPEMIN_LEN = sizeof(uint8_t);
 
 
 }; // end of anonymous namespace
 }; // end of anonymous namespace
 
 
@@ -36,7 +39,7 @@ Option6StatusCode::Option6StatusCode(OptionBufferConstIter begin,
     : Option(Option::V6, D6O_STATUS_CODE),
     : Option(Option::V6, D6O_STATUS_CODE),
       status_code_(STATUS_Success), status_message_() {
       status_code_(STATUS_Success), status_message_() {
 
 
-    // Parse data 
+    // Parse data
     unpack(begin, end);
     unpack(begin, end);
 }
 }
 
 
@@ -135,5 +138,81 @@ Option6StatusCode::getStatusCodeName() const {
     return ("(unknown status code)");
     return ("(unknown status code)");
 }
 }
 
 
+Option4SlpServiceScope::Option4SlpServiceScope(const bool mandatory_flag,
+                                               const std::string& scope_list)
+    : Option(Option::V4, DHO_SERVICE_SCOPE),
+      mandatory_flag_(mandatory_flag), scope_list_(scope_list) {
+}
+
+Option4SlpServiceScope::Option4SlpServiceScope(OptionBufferConstIter begin,
+                                               OptionBufferConstIter end)
+    : Option(Option::V4, DHO_SERVICE_SCOPE),
+      mandatory_flag_(false), scope_list_() {
+
+    // Parse data
+    unpack(begin, end);
+}
+
+OptionPtr
+Option4SlpServiceScope::clone() const {
+    return (cloneInternal<Option4SlpServiceScope>());
+}
+
+void
+Option4SlpServiceScope::pack(isc::util::OutputBuffer& buf) const {
+    // Pack option header.
+    packHeader(buf);
+    // Write mandatory flag.
+    buf.writeUint8(static_cast<uint8_t>(getMandatoryFlag() ? 1 : 0));
+    // If there is any scope list, write it.
+    if (!scope_list_.empty()) {
+        buf.writeData(&scope_list_[0], scope_list_.size());
+    }
+
+    // SLP service scope has no options, so leave here.
+}
+
+void
+Option4SlpServiceScope::unpack(OptionBufferConstIter begin, OptionBufferConstIter end) {
+    // Make sure that the option is not truncated.
+    if (std::distance(begin, end) < OPTION4_SLP_SERVICE_SCOPEMIN_LEN) {
+        isc_throw(OutOfRange, "SLP Service Scope option ("
+                  << DHO_SERVICE_SCOPE << ") truncated");
+    }
+
+    if (*begin == 1) {
+        mandatory_flag_ = true;
+    } else if (*begin == 0) {
+        mandatory_flag_ = false;
+    } else {
+        isc_throw(BadDataTypeCast, "unable to read the buffer as boolean"
+                  << " value. Invalid value " << static_cast<int>(*begin));
+    }
+    begin += sizeof(uint8_t);
+
+    scope_list_.assign(begin, end);
+}
+
+uint16_t
+Option4SlpServiceScope::len() const {
+    return (getHeaderLen() + sizeof(bool) + scope_list_.size());
+}
+
+std::string
+Option4SlpServiceScope::toText(int indent) const {
+    std::ostringstream output;
+    output << headerToText(indent) << ": " << dataToText();
+
+    return (output.str());
+}
+
+std::string
+Option4SlpServiceScope::dataToText() const {
+    std::ostringstream output;
+    output << "mandatory:" << getMandatoryFlag();
+    output << ", scope-list:\"" << scope_list_ << "\"";
+    return (output.str());
+}
+
 } // end of namespace isc::dhcp
 } // end of namespace isc::dhcp
 } // end of namespace isc
 } // end of namespace isc

+ 97 - 1
src/lib/dhcp/option6_status_code.h

@@ -1,4 +1,4 @@
-// Copyright (C) 2015-2016 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2015-2017 Internet Systems Consortium, Inc. ("ISC")
 //
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -50,6 +50,8 @@ public:
 
 
     /// @brief Parses received buffer.
     /// @brief Parses received buffer.
     ///
     ///
+    /// @throw OutOfRange if specified option is truncated
+    ///
     /// @param begin Iterator to first byte of option data
     /// @param begin Iterator to first byte of option data
     /// @param end Iterator to end of option data (first byte after option end)
     /// @param end Iterator to end of option data (first byte after option end)
     virtual void unpack(OptionBufferConstIter begin, OptionBufferConstIter end);
     virtual void unpack(OptionBufferConstIter begin, OptionBufferConstIter end);
@@ -107,6 +109,100 @@ private:
 
 
 };
 };
 
 
+/// The SLP Service Scope option has a similar layout...
+
+class Option4SlpServiceScope;
+
+/// @brief Pointer to the @c isc::dhcp::Option4SlpServiceScope.
+typedef boost::shared_ptr<Option4SlpServiceScope> Option4SlpServiceScopePtr;
+
+/// @brief This class represents SLP Service Scope option (79) from RFC2610.
+class Option4SlpServiceScope: public Option {
+public:
+    /// @brief Constructor, used for options constructed (during transmission).
+    ///
+    /// @param mandatory_flag Mandatory flag.
+    /// @param scope_list Textual scope list, may be empty
+    Option4SlpServiceScope(const bool mandatory_flag, const std::string& scope_list);
+
+    /// @brief Constructor, used for received options.
+    ///
+    /// @throw OutOfRange if specified option is truncated
+    ///
+    /// @param begin Iterator to first byte of option data
+    /// @param end Iterator to end of option data (first byte after option end).
+    Option4SlpServiceScope(OptionBufferConstIter begin, OptionBufferConstIter end);
+
+    /// @brief Copies this option and returns a pointer to the copy.
+    virtual OptionPtr clone() const;
+
+    /// @brief Writes option in wire-format.
+    ///
+    /// Writes option in wire-format to buf, returns pointer to first unused
+    /// byte after stored option.
+    ///
+    /// @param [out] buf Pointer to the output buffer.
+    virtual void pack(isc::util::OutputBuffer& buf) const;
+
+    /// @brief Parses received buffer.
+    ///
+    /// @throw OutOfRange if specified option is truncated
+    /// @throw BadDataTypeCast if first byte is not 0 or 1
+    ///
+    /// @param begin Iterator to first byte of option data
+    /// @param end Iterator to end of option data (first byte after option end)
+    virtual void unpack(OptionBufferConstIter begin, OptionBufferConstIter end);
+
+    /// @brief Returns total length of the option.
+    ///
+    /// The returned length is a sum of the option header and data fields.
+    virtual uint16_t len() const;
+
+    /// @brief Returns textual representation of the option.
+    ///
+    /// @param indent Number of spaces before printing text.
+    virtual std::string toText(int indent = 0) const;
+
+    /// @brief Returns textual representation of the option data.
+    ///
+    /// This method returns only the status code and the status
+    /// message. It excludes the option header.
+    std::string dataToText() const;
+
+    /// @brief Returns mandatory flag
+    bool getMandatoryFlag() const {
+        return (mandatory_flag_);        
+    }
+
+    /// @brief Sets new mandatory flag.
+    ///
+    /// @param status_code New numeric status code.
+    void setMandatoryFlag(const bool mandatory_flag) {
+        mandatory_flag_ = mandatory_flag;
+    }
+
+    /// @brief Returns scope list.
+    const std::string& getScopeList() const {
+        return (scope_list_);
+    }
+
+    /// @brief Sets new scope list.
+    ///
+    /// @param scope_list New scope list (empty string is allowed).
+    void setScopeList(std::string& scope_list) {
+        scope_list_ = scope_list;
+    }
+
+private:
+
+    /// @brief Mandatory flag.
+    bool mandatory_flag_;
+
+    /// @brief Scope list.
+    std::string scope_list_;
+
+};
+
 } // isc::dhcp namespace
 } // isc::dhcp namespace
 } // isc namespace
 } // isc namespace
 
 

+ 11 - 1
src/lib/dhcp/option_definition.cc

@@ -442,6 +442,14 @@ OptionDefinition::haveStatusCodeFormat() const {
 }
 }
 
 
 bool
 bool
+OptionDefinition::haveServiceScopeFormat() const {
+    return (haveType(OPT_RECORD_TYPE) &&
+            (record_fields_.size() == 2) &&
+            (record_fields_[0] == OPT_BOOLEAN_TYPE) &&
+            (record_fields_[1] == OPT_STRING_TYPE));
+}
+
+bool
 OptionDefinition::haveOpaqueDataTuplesFormat() const {
 OptionDefinition::haveOpaqueDataTuplesFormat() const {
     return (haveType(OPT_TUPLE_TYPE) && getArrayType());
     return (haveType(OPT_TUPLE_TYPE) && getArrayType());
 }
 }
@@ -856,7 +864,9 @@ OptionDefinition::factorySpecialFormatOption(Option::Universe u,
             return (OptionPtr(new Option6PDExclude(begin, end)));
             return (OptionPtr(new Option6PDExclude(begin, end)));
         }
         }
     } else {
     } else {
-        if ((getCode() == DHO_FQDN) && haveFqdn4Format()) {
+        if ((getCode() == DHO_SERVICE_SCOPE) && haveServiceScopeFormat()) {
+            return (OptionPtr(new Option4SlpServiceScope(begin, end)));
+        } else if ((getCode() == DHO_FQDN) && haveFqdn4Format()) {
             return (OptionPtr(new Option4ClientFqdn(begin, end)));
             return (OptionPtr(new Option4ClientFqdn(begin, end)));
         } else if (haveCompressedFqdnListFormat()) {
         } else if (haveCompressedFqdnListFormat()) {
             return (factoryFqdnList(Option::V4, begin, end));
             return (factoryFqdnList(Option::V4, begin, end));

+ 9 - 0
src/lib/dhcp/option_definition.h

@@ -364,6 +364,15 @@ public:
     /// @return true if option has the format of DHCPv6 Vendor Class option.
     /// @return true if option has the format of DHCPv6 Vendor Class option.
     bool haveVendorClass6Format() const;
     bool haveVendorClass6Format() const;
 
 
+    /// @brief Check if option has format of the SLP Service Scope
+    /// %Option.
+    ///
+    /// The scope list in the SLP Service Scope option is optional
+    /// (i.e., as the error message in the DHCPv6 Status code option).
+    ///
+    /// @return true if option has the format of SLP Service Scope %Option.
+    bool haveServiceScopeFormat() const;
+
     /// @brief Check if the option has format of DHCPv6 Status Code option.
     /// @brief Check if the option has format of DHCPv6 Status Code option.
     ///
     ///
     /// @return true if option has the format of DHCPv6 Status code option.
     /// @return true if option has the format of DHCPv6 Status code option.

+ 52 - 2
src/lib/dhcp/std_option_defs.h

@@ -37,6 +37,11 @@ namespace {
 #define NO_RECORD_DEF 0, 0
 #define NO_RECORD_DEF 0, 0
 #endif
 #endif
 
 
+// SLP Service Scope option.
+//
+// The scope list is optional.
+RECORD_DECL(SERVICE_SCOPE_RECORDS, OPT_BOOLEAN_TYPE, OPT_STRING_TYPE);
+
 // fqdn option record fields.
 // fqdn option record fields.
 //
 //
 // Note that the flags field indicates the type of domain
 // Note that the flags field indicates the type of domain
@@ -60,6 +65,11 @@ RECORD_DECL(CLIENT_NDI_RECORDS, OPT_UINT8_TYPE, OPT_UINT8_TYPE, OPT_UINT8_TYPE);
 // A client identifier: a 1 byte type field followed by opaque data depending on the type
 // A client identifier: a 1 byte type field followed by opaque data depending on the type
 RECORD_DECL(UUID_GUID_RECORDS, OPT_UINT8_TYPE, OPT_BINARY_TYPE);
 RECORD_DECL(UUID_GUID_RECORDS, OPT_UINT8_TYPE, OPT_BINARY_TYPE);
 
 
+// RFC7618 DHCPv4 Port Parameter option.
+//
+// PSID offset, PSID-len and PSID
+RECORD_DECL(V4_PORTPARAMS_RECORDS, OPT_UINT8_TYPE, OPT_UINT8_TYPE, OPT_UINT16_TYPE);
+
 /// @brief Definitions of standard DHCPv4 options.
 /// @brief Definitions of standard DHCPv4 options.
 const OptionDefParams STANDARD_V4_OPTION_DEFINITIONS[] = {
 const OptionDefParams STANDARD_V4_OPTION_DEFINITIONS[] = {
     { "subnet-mask", DHO_SUBNET_MASK, OPT_IPV4_ADDRESS_TYPE, false, NO_RECORD_DEF, "" },
     { "subnet-mask", DHO_SUBNET_MASK, OPT_IPV4_ADDRESS_TYPE, false, NO_RECORD_DEF, "" },
@@ -174,10 +184,17 @@ const OptionDefParams STANDARD_V4_OPTION_DEFINITIONS[] = {
     { "streettalk-server", DHO_STREETTALK_SERVER, OPT_IPV4_ADDRESS_TYPE, true, NO_RECORD_DEF, "" },
     { "streettalk-server", DHO_STREETTALK_SERVER, OPT_IPV4_ADDRESS_TYPE, true, NO_RECORD_DEF, "" },
     { "streettalk-directory-assistance-server", DHO_STDASERVER, OPT_IPV4_ADDRESS_TYPE, true, NO_RECORD_DEF, "" },
     { "streettalk-directory-assistance-server", DHO_STDASERVER, OPT_IPV4_ADDRESS_TYPE, true, NO_RECORD_DEF, "" },
     { "user-class", DHO_USER_CLASS, OPT_BINARY_TYPE, false, NO_RECORD_DEF, "" },
     { "user-class", DHO_USER_CLASS, OPT_BINARY_TYPE, false, NO_RECORD_DEF, "" },
+    { "slp-service-scope", DHO_SERVICE_SCOPE, OPT_RECORD_TYPE, false,
+      RECORD_DEF(SERVICE_SCOPE_RECORDS), "" },
     { "fqdn", DHO_FQDN, OPT_RECORD_TYPE, false, RECORD_DEF(FQDN_RECORDS), "" },
     { "fqdn", DHO_FQDN, OPT_RECORD_TYPE, false, RECORD_DEF(FQDN_RECORDS), "" },
     { "dhcp-agent-options", DHO_DHCP_AGENT_OPTIONS,
     { "dhcp-agent-options", DHO_DHCP_AGENT_OPTIONS,
       OPT_EMPTY_TYPE, false, NO_RECORD_DEF, "dhcp-agent-options-space" },
       OPT_EMPTY_TYPE, false, NO_RECORD_DEF, "dhcp-agent-options-space" },
-    // Unfortunately the AUTHENTICATE option contains a 64-bit
+    { "nds-servers", DHO_NDS_SERVERS, OPT_IPV4_ADDRESS_TYPE, true, NO_RECORD_DEF, "" },
+    { "nds-tree-name", DHO_NDS_TREE_NAME, OPT_STRING_TYPE, false, NO_RECORD_DEF, "" },
+    { "nds-context", DHO_NDS_CONTEXT, OPT_STRING_TYPE, false, NO_RECORD_DEF, "" },
+    { "bcms-controller-names", DHO_BCMCS_DOMAIN_NAME_LIST, OPT_FQDN_TYPE, true, NO_RECORD_DEF, "" },
+    { "bcms-controller-address", DHO_BCMCS_IPV4_ADDR, OPT_IPV4_ADDRESS_TYPE, true, NO_RECORD_DEF, "" },
+    // Unfortunatelly the AUTHENTICATE option contains a 64-bit
     // data field called 'replay-detection' that can't be added
     // data field called 'replay-detection' that can't be added
     // as a record field to a custom option. Also, there is no
     // as a record field to a custom option. Also, there is no
     // dedicated option class to handle it so we simply return
     // dedicated option class to handle it so we simply return
@@ -190,6 +207,15 @@ const OptionDefParams STANDARD_V4_OPTION_DEFINITIONS[] = {
     { "client-system", DHO_SYSTEM, OPT_UINT16_TYPE, true, NO_RECORD_DEF, "" },
     { "client-system", DHO_SYSTEM, OPT_UINT16_TYPE, true, NO_RECORD_DEF, "" },
     { "client-ndi", DHO_NDI, OPT_RECORD_TYPE, false, RECORD_DEF(CLIENT_NDI_RECORDS), "" },
     { "client-ndi", DHO_NDI, OPT_RECORD_TYPE, false, RECORD_DEF(CLIENT_NDI_RECORDS), "" },
     { "uuid-guid", DHO_UUID_GUID, OPT_RECORD_TYPE, false, RECORD_DEF(UUID_GUID_RECORDS), "" },
     { "uuid-guid", DHO_UUID_GUID, OPT_RECORD_TYPE, false, RECORD_DEF(UUID_GUID_RECORDS), "" },
+    { "uap-servers", DHO_USER_AUTH, OPT_STRING_TYPE, false, NO_RECORD_DEF, "" },
+    { "geoconf-civic", DHO_GEOCONF_CIVIC, OPT_BINARY_TYPE, false, NO_RECORD_DEF, "" },
+    { "pcode", DHO_PCODE, OPT_STRING_TYPE, false, NO_RECORD_DEF, "" },
+    { "tcode", DHO_TCODE, OPT_STRING_TYPE, false, NO_RECORD_DEF, "" },
+    { "netinfo-server-address", DHO_NETINFO_ADDR, OPT_IPV4_ADDRESS_TYPE, true, NO_RECORD_DEF, "" },
+    { "netinfo-server-tag", DHO_NETINFO_TAG, OPT_STRING_TYPE, false, NO_RECORD_DEF, "" },
+    { "default-url", DHO_URL, OPT_STRING_TYPE, false, NO_RECORD_DEF, "" },
+    { "auto-config", DHO_AUTO_CONFIG, OPT_UINT8_TYPE, false, NO_RECORD_DEF, "" },
+    { "name-service-search", DHO_NAME_SERVICE_SEARCH, OPT_UINT16_TYPE, true, NO_RECORD_DEF, "" },
     { "subnet-selection", DHO_SUBNET_SELECTION,
     { "subnet-selection", DHO_SUBNET_SELECTION,
       OPT_IPV4_ADDRESS_TYPE, false, NO_RECORD_DEF, "" },
       OPT_IPV4_ADDRESS_TYPE, false, NO_RECORD_DEF, "" },
     { "domain-search", DHO_DOMAIN_SEARCH, OPT_FQDN_TYPE, true, NO_RECORD_DEF, "" },
     { "domain-search", DHO_DOMAIN_SEARCH, OPT_FQDN_TYPE, true, NO_RECORD_DEF, "" },
@@ -208,7 +234,15 @@ const OptionDefParams STANDARD_V4_OPTION_DEFINITIONS[] = {
     /// ok to specify multiple instances of the "vivso-suboptions" which will be
     /// ok to specify multiple instances of the "vivso-suboptions" which will be
     /// combined in a single option by the server before responding to a client.
     /// combined in a single option by the server before responding to a client.
     { "vivso-suboptions", DHO_VIVSO_SUBOPTIONS, OPT_UINT32_TYPE,
     { "vivso-suboptions", DHO_VIVSO_SUBOPTIONS, OPT_UINT32_TYPE,
-      false, NO_RECORD_DEF, "" }
+      false, NO_RECORD_DEF, "" },
+    { "pana-agent", DHO_PANA_AGENT, OPT_IPV4_ADDRESS_TYPE, true, NO_RECORD_DEF, "" },
+    { "v4-lost", DHO_V4_LOST, OPT_FQDN_TYPE, false, NO_RECORD_DEF, "" },
+    { "capwap-ac-v4", DHO_CAPWAP_AC_V4, OPT_IPV4_ADDRESS_TYPE, true, NO_RECORD_DEF, "" },
+    { "sip-ua-cs-domains", DHO_SIP_UA_CONF_SERVICE_DOMAINS, OPT_FQDN_TYPE, true, NO_RECORD_DEF, "" },
+    { "v4-portparams", DHO_V4_PORTPARAMS, OPT_RECORD_TYPE, false,
+      RECORD_DEF(V4_PORTPARAMS_RECORDS), "" },
+    { "v4-captive-portal", DHO_V4_CAPTIVE_PORTAL, OPT_STRING_TYPE, false, NO_RECORD_DEF, "" },
+    { "v4-access-domain", DHO_V4_ACCESS_DOMAIN, OPT_FQDN_TYPE, false, NO_RECORD_DEF, "" }
 
 
         // @todo add definitions for all remaining options.
         // @todo add definitions for all remaining options.
 };
 };
@@ -349,6 +383,14 @@ const OptionDefParams STANDARD_V6_OPTION_DEFINITIONS[] = {
       RECORD_DEF(LQ_RELAY_DATA_RECORDS), "" },
       RECORD_DEF(LQ_RELAY_DATA_RECORDS), "" },
     { "lq-client-link", D6O_LQ_CLIENT_LINK, OPT_IPV6_ADDRESS_TYPE, true,
     { "lq-client-link", D6O_LQ_CLIENT_LINK, OPT_IPV6_ADDRESS_TYPE, true,
       NO_RECORD_DEF, "" },
       NO_RECORD_DEF, "" },
+    { "v6-lost", D6O_V6_LOST, OPT_FQDN_TYPE, false, NO_RECORD_DEF, "" },
+    { "capwap-ac-v6", D6O_CAPWAP_AC_V6, OPT_IPV6_ADDRESS_TYPE, true,
+      NO_RECORD_DEF, "" },
+    { "relay-id", D6O_RELAY_ID, OPT_BINARY_TYPE, false, NO_RECORD_DEF, "" },
+    { "v6-access-domain", D6O_V6_ACCESS_DOMAIN, OPT_FQDN_TYPE, false,
+      NO_RECORD_DEF, "" },
+    { "sip-ua-cs-list", D6O_SIP_UA_CS_LIST, OPT_FQDN_TYPE, true,
+      NO_RECORD_DEF, "" },      
     { "bootfile-url", D6O_BOOTFILE_URL, OPT_STRING_TYPE, false, NO_RECORD_DEF, "" },
     { "bootfile-url", D6O_BOOTFILE_URL, OPT_STRING_TYPE, false, NO_RECORD_DEF, "" },
     { "bootfile-param", D6O_BOOTFILE_PARAM, OPT_TUPLE_TYPE, true, NO_RECORD_DEF, "" },
     { "bootfile-param", D6O_BOOTFILE_PARAM, OPT_TUPLE_TYPE, true, NO_RECORD_DEF, "" },
     { "client-arch-type", D6O_CLIENT_ARCH_TYPE, OPT_UINT16_TYPE, true, NO_RECORD_DEF, "" },
     { "client-arch-type", D6O_CLIENT_ARCH_TYPE, OPT_UINT16_TYPE, true, NO_RECORD_DEF, "" },
@@ -359,9 +401,17 @@ const OptionDefParams STANDARD_V6_OPTION_DEFINITIONS[] = {
     { "pd-exclude", D6O_PD_EXCLUDE, OPT_IPV6_PREFIX_TYPE, false, NO_RECORD_DEF, "" },
     { "pd-exclude", D6O_PD_EXCLUDE, OPT_IPV6_PREFIX_TYPE, false, NO_RECORD_DEF, "" },
     { "client-linklayer-addr", D6O_CLIENT_LINKLAYER_ADDR, OPT_BINARY_TYPE, false,
     { "client-linklayer-addr", D6O_CLIENT_LINKLAYER_ADDR, OPT_BINARY_TYPE, false,
       NO_RECORD_DEF, "" },
       NO_RECORD_DEF, "" },
+    { "link-address", D6O_LINK_ADDRESS, OPT_IPV6_ADDRESS_TYPE, false,
+      NO_RECORD_DEF, "" },
+    { "solmax-rt", D6O_SOL_MAX_RT, OPT_UINT32_TYPE, false, NO_RECORD_DEF, "" },
+    { "inf-max-rt", D6O_INF_MAX_RT, OPT_UINT32_TYPE, false, NO_RECORD_DEF, "" },
     { "dhcpv4-message", D6O_DHCPV4_MSG, OPT_BINARY_TYPE, false, NO_RECORD_DEF, "" },
     { "dhcpv4-message", D6O_DHCPV4_MSG, OPT_BINARY_TYPE, false, NO_RECORD_DEF, "" },
     { "dhcp4o6-server-addr", D6O_DHCPV4_O_DHCPV6_SERVER, OPT_IPV6_ADDRESS_TYPE, true,
     { "dhcp4o6-server-addr", D6O_DHCPV4_O_DHCPV6_SERVER, OPT_IPV6_ADDRESS_TYPE, true,
       NO_RECORD_DEF, "" },
       NO_RECORD_DEF, "" },
+    { "v6-captive-portal", D6O_V6_CAPTIVE_PORTAL, OPT_STRING_TYPE, false,
+      NO_RECORD_DEF, "" },
+    { "ipv6-address-andsf", D6O_IPV6_ADDRESS_ANDSF, OPT_IPV6_ADDRESS_TYPE, true,
+      NO_RECORD_DEF, "" },
     { "public-key", D6O_PUBLIC_KEY, OPT_BINARY_TYPE, false,
     { "public-key", D6O_PUBLIC_KEY, OPT_BINARY_TYPE, false,
       NO_RECORD_DEF, "" },
       NO_RECORD_DEF, "" },
     { "certificate", D6O_CERTIFICATE, OPT_BINARY_TYPE, false,
     { "certificate", D6O_CERTIFICATE, OPT_BINARY_TYPE, false,

+ 154 - 16
src/lib/dhcp/tests/libdhcp++_unittest.cc

@@ -1285,6 +1285,13 @@ TEST_F(LibDhcpTest, stdOptionDefs4) {
     LibDhcpTest::testStdOptionDefs4(DHO_USER_CLASS, begin, end,
     LibDhcpTest::testStdOptionDefs4(DHO_USER_CLASS, begin, end,
                                     typeid(Option));
                                     typeid(Option));
 
 
+    LibDhcpTest::testStdOptionDefs4(DHO_SERVICE_SCOPE, begin, end,
+                                    typeid(Option4SlpServiceScope));
+
+    // Check also with empty scope list
+    LibDhcpTest::testStdOptionDefs4(DHO_SERVICE_SCOPE, begin, begin + 1,
+                                    typeid(Option4SlpServiceScope));
+
     LibDhcpTest::testStdOptionDefs4(DHO_FQDN, begin, begin + 3,
     LibDhcpTest::testStdOptionDefs4(DHO_FQDN, begin, begin + 3,
                                     typeid(Option4ClientFqdn));
                                     typeid(Option4ClientFqdn));
 
 
@@ -1297,6 +1304,36 @@ TEST_F(LibDhcpTest, stdOptionDefs4) {
                                     typeid(OptionCustom),
                                     typeid(OptionCustom),
                                     "dhcp-agent-options-space");
                                     "dhcp-agent-options-space");
 
 
+    LibDhcpTest::testStdOptionDefs4(DHO_NDS_SERVERS, begin, end,
+                                    typeid(Option4AddrLst));
+
+    LibDhcpTest::testStdOptionDefs4(DHO_NDS_TREE_NAME, begin, end,
+                                    typeid(OptionString));
+
+    LibDhcpTest::testStdOptionDefs4(DHO_NDS_CONTEXT, begin, end,
+                                    typeid(OptionString));
+
+    // Prepare buffer holding an array of FQDNs.
+    const char fqdn_data[] = {
+        8, 109, 121, 100, 111, 109, 97, 105, 110, // "mydomain"
+        7, 101, 120, 97, 109, 112, 108, 101,      // "example"
+        3, 99, 111, 109,                          // "com"
+        0,
+        7, 101, 120, 97, 109, 112, 108, 101,      // "example"
+        3, 99, 111, 109,                          // "com"
+        0
+    };
+    // Initialize a vector with the FQDN data.
+    std::vector<uint8_t> fqdn_buf(fqdn_data, fqdn_data + sizeof(fqdn_data));
+
+    LibDhcpTest::testStdOptionDefs4(DHO_BCMCS_DOMAIN_NAME_LIST,
+                                    fqdn_buf.begin(),
+                                    fqdn_buf.end(),
+                                    typeid(OptionCustom));
+
+    LibDhcpTest::testStdOptionDefs4(DHO_BCMCS_IPV4_ADDR, begin, end,
+                                    typeid(Option4AddrLst));
+
     LibDhcpTest::testStdOptionDefs4(DHO_AUTHENTICATE, begin, end,
     LibDhcpTest::testStdOptionDefs4(DHO_AUTHENTICATE, begin, end,
                                     typeid(Option));
                                     typeid(Option));
 
 
@@ -1307,6 +1344,12 @@ TEST_F(LibDhcpTest, stdOptionDefs4) {
     LibDhcpTest::testStdOptionDefs4(DHO_ASSOCIATED_IP, begin, end,
     LibDhcpTest::testStdOptionDefs4(DHO_ASSOCIATED_IP, begin, end,
                                     typeid(Option4AddrLst));
                                     typeid(Option4AddrLst));
 
 
+    LibDhcpTest::testStdOptionDefs4(DHO_AUTO_CONFIG, begin, begin + 1,
+                                    typeid(OptionInt<uint8_t>));
+
+    LibDhcpTest::testStdOptionDefs4(DHO_NAME_SERVICE_SEARCH, begin, begin + 4,
+                                    typeid(OptionIntArray<uint16_t>));
+
     LibDhcpTest::testStdOptionDefs4(DHO_SUBNET_SELECTION, begin, end,
     LibDhcpTest::testStdOptionDefs4(DHO_SUBNET_SELECTION, begin, end,
                                     typeid(OptionCustom));
                                     typeid(OptionCustom));
 
 
@@ -1319,18 +1362,26 @@ TEST_F(LibDhcpTest, stdOptionDefs4) {
     LibDhcpTest::testStdOptionDefs4(DHO_UUID_GUID, begin, begin + 17,
     LibDhcpTest::testStdOptionDefs4(DHO_UUID_GUID, begin, begin + 17,
                                     typeid(OptionCustom));
                                     typeid(OptionCustom));
 
 
-    // Prepare buffer holding an array of FQDNs.
-    const char fqdn_data[] = {
-        8, 109, 121, 100, 111, 109, 97, 105, 110, // "mydomain"
-        7, 101, 120, 97, 109, 112, 108, 101,      // "example"
-        3, 99, 111, 109,                          // "com"
-        0,
-        7, 101, 120, 97, 109, 112, 108, 101,      // "example"
-        3, 99, 111, 109,                          // "com"
-        0
-    };
-    // Initialize a vector with the FQDN data.
-    std::vector<uint8_t> fqdn_buf(fqdn_data, fqdn_data + sizeof(fqdn_data));
+    LibDhcpTest::testStdOptionDefs4(DHO_USER_AUTH, begin, end,
+                                    typeid(OptionString));
+
+    LibDhcpTest::testStdOptionDefs4(DHO_GEOCONF_CIVIC, begin, end,
+                                    typeid(Option));
+
+    LibDhcpTest::testStdOptionDefs4(DHO_PCODE, begin, end,
+                                    typeid(OptionString));
+
+    LibDhcpTest::testStdOptionDefs4(DHO_TCODE, begin, end,
+                                    typeid(OptionString));
+
+    LibDhcpTest::testStdOptionDefs4(DHO_NETINFO_ADDR, begin, end,
+                                    typeid(Option4AddrLst));
+
+    LibDhcpTest::testStdOptionDefs4(DHO_NETINFO_TAG, begin, end,
+                                    typeid(OptionString));
+
+    LibDhcpTest::testStdOptionDefs4(DHO_URL, begin, end,
+                                    typeid(OptionString));
 
 
     LibDhcpTest::testStdOptionDefs4(DHO_DOMAIN_SEARCH, fqdn_buf.begin(),
     LibDhcpTest::testStdOptionDefs4(DHO_DOMAIN_SEARCH, fqdn_buf.begin(),
                                     fqdn_buf.end(), typeid(OptionCustom));
                                     fqdn_buf.end(), typeid(OptionCustom));
@@ -1354,6 +1405,40 @@ TEST_F(LibDhcpTest, stdOptionDefs4) {
 
 
     LibDhcpTest::testStdOptionDefs4(DHO_VIVSO_SUBOPTIONS, vivsio_buf.begin(),
     LibDhcpTest::testStdOptionDefs4(DHO_VIVSO_SUBOPTIONS, vivsio_buf.begin(),
                                     vivsio_buf.end(), typeid(OptionVendor));
                                     vivsio_buf.end(), typeid(OptionVendor));
+
+    LibDhcpTest::testStdOptionDefs4(DHO_PANA_AGENT, begin, end,
+                                    typeid(Option4AddrLst));
+
+    // Prepare buffer holding one FQDN.
+    const char fqdn1_data[] = {
+        8, 109, 121, 100, 111, 109, 97, 105, 110, // "mydomain"
+        7, 101, 120, 97, 109, 112, 108, 101,      // "example"
+        3, 99, 111, 109,                          // "com"
+        0
+    };
+    // Initialize a vector with the FQDN data.
+    std::vector<uint8_t> fqdn1_buf(fqdn1_data,
+                                   fqdn1_data + sizeof(fqdn1_data));
+
+    LibDhcpTest::testStdOptionDefs4(DHO_V4_LOST, fqdn1_buf.begin(),
+                                    fqdn1_buf.end(), typeid(OptionCustom));
+
+    LibDhcpTest::testStdOptionDefs4(DHO_CAPWAP_AC_V4, begin, end,
+                                    typeid(Option4AddrLst));
+
+    LibDhcpTest::testStdOptionDefs4(DHO_SIP_UA_CONF_SERVICE_DOMAINS,
+                                    fqdn_buf.begin(),
+                                    fqdn_buf.end(),
+                                    typeid(OptionCustom));
+
+    LibDhcpTest::testStdOptionDefs4(DHO_V4_PORTPARAMS, begin, begin + 4,
+                                    typeid(OptionCustom));
+
+    LibDhcpTest::testStdOptionDefs4(DHO_V4_CAPTIVE_PORTAL, begin, end,
+                                    typeid(OptionString));
+
+    LibDhcpTest::testStdOptionDefs4(DHO_V4_ACCESS_DOMAIN, fqdn1_buf.begin(),
+                                    fqdn1_buf.end(), typeid(OptionCustom));
 }
 }
 
 
 // Test that definitions of standard options have been initialized
 // Test that definitions of standard options have been initialized
@@ -1369,6 +1454,16 @@ TEST_F(LibDhcpTest, stdOptionDefs6) {
     OptionBufferConstIter begin = buf.begin();
     OptionBufferConstIter begin = buf.begin();
     OptionBufferConstIter end = buf.end();
     OptionBufferConstIter end = buf.end();
 
 
+    // Prepare buffer holding one FQDN.
+    const char data1[] = {
+        8, 109, 121, 100, 111, 109, 97, 105, 110, // "mydomain"
+        7, 101, 120, 97, 109, 112, 108, 101,      // "example"
+        3, 99, 111, 109,                          // "com"
+        0
+    };
+    // Initialize a vector with the FQDN data1.
+    std::vector<uint8_t> fqdn1_buf(data1, data1 + sizeof(data1));
+
     // Prepare buffer holding an array of FQDNs.
     // Prepare buffer holding an array of FQDNs.
     const char data[] = {
     const char data[] = {
         8, 109, 121, 100, 111, 109, 97, 105, 110, // "mydomain"
         8, 109, 121, 100, 111, 109, 97, 105, 110, // "mydomain"
@@ -1442,6 +1537,12 @@ TEST_F(LibDhcpTest, stdOptionDefs6) {
     LibDhcpTest::testStdOptionDefs6(D6O_RELAY_MSG, begin, end,
     LibDhcpTest::testStdOptionDefs6(D6O_RELAY_MSG, begin, end,
                                     typeid(Option));
                                     typeid(Option));
 
 
+    LibDhcpTest::testStdOptionDefs6(D6O_AUTH, begin, end,
+                                    typeid(Option));
+
+    LibDhcpTest::testStdOptionDefs6(D6O_UNICAST, begin, begin + 16,
+                                    typeid(OptionCustom));
+
     LibDhcpTest::testStdOptionDefs6(D6O_STATUS_CODE, begin, end,
     LibDhcpTest::testStdOptionDefs6(D6O_STATUS_CODE, begin, end,
                                     typeid(Option6StatusCode));
                                     typeid(Option6StatusCode));
 
 
@@ -1559,6 +1660,24 @@ TEST_F(LibDhcpTest, stdOptionDefs6) {
     LibDhcpTest::testStdOptionDefs6(D6O_LQ_CLIENT_LINK, begin, end,
     LibDhcpTest::testStdOptionDefs6(D6O_LQ_CLIENT_LINK, begin, end,
                                     typeid(Option6AddrLst));
                                     typeid(Option6AddrLst));
 
 
+    LibDhcpTest::testStdOptionDefs6(D6O_V6_LOST,
+                                    fqdn1_buf.begin(), fqdn1_buf.end(),
+                                    typeid(OptionCustom));
+
+    LibDhcpTest::testStdOptionDefs6(D6O_CAPWAP_AC_V6, begin, end,
+                                    typeid(Option6AddrLst));
+
+    LibDhcpTest::testStdOptionDefs6(D6O_RELAY_ID, begin, end,
+                                    typeid(Option));
+
+    LibDhcpTest::testStdOptionDefs6(D6O_V6_ACCESS_DOMAIN,
+                                    fqdn1_buf.begin(), fqdn1_buf.end(),
+                                    typeid(OptionCustom));
+
+    LibDhcpTest::testStdOptionDefs6(D6O_SIP_UA_CS_LIST,
+                                    fqdn_buf.begin(), fqdn_buf.end(),
+                                    typeid(OptionCustom));
+
     LibDhcpTest::testStdOptionDefs6(D6O_BOOTFILE_URL, begin, end,
     LibDhcpTest::testStdOptionDefs6(D6O_BOOTFILE_URL, begin, end,
                                     typeid(OptionString));
                                     typeid(OptionString));
 
 
@@ -1572,6 +1691,13 @@ TEST_F(LibDhcpTest, stdOptionDefs6) {
     LibDhcpTest::testStdOptionDefs6(D6O_NII, begin, begin + 3,
     LibDhcpTest::testStdOptionDefs6(D6O_NII, begin, begin + 3,
                                     typeid(OptionCustom));
                                     typeid(OptionCustom));
 
 
+    LibDhcpTest::testStdOptionDefs6(D6O_AFTR_NAME, fqdn1_buf.begin(),
+                                    fqdn1_buf.end(), typeid(OptionCustom));
+
+    LibDhcpTest::testStdOptionDefs6(D6O_ERP_LOCAL_DOMAIN_NAME,
+                                    fqdn_buf.begin(), fqdn_buf.end(),
+                                    typeid(OptionCustom));
+
     LibDhcpTest::testStdOptionDefs6(D6O_RSOO, begin, end,
     LibDhcpTest::testStdOptionDefs6(D6O_RSOO, begin, end,
                                     typeid(OptionCustom),
                                     typeid(OptionCustom),
                                     "rsoo-opts");
                                     "rsoo-opts");
@@ -1579,16 +1705,30 @@ TEST_F(LibDhcpTest, stdOptionDefs6) {
     LibDhcpTest::testStdOptionDefs6(D6O_PD_EXCLUDE, begin, end,
     LibDhcpTest::testStdOptionDefs6(D6O_PD_EXCLUDE, begin, end,
                                     typeid(Option6PDExclude));
                                     typeid(Option6PDExclude));
 
 
-    LibDhcpTest::testStdOptionDefs6(D6O_ERP_LOCAL_DOMAIN_NAME,
-                                    fqdn_buf.begin(), fqdn_buf.end(),
+    LibDhcpTest::testStdOptionDefs6(D6O_CLIENT_LINKLAYER_ADDR, begin, end,
+                                    typeid(Option));
+
+    LibDhcpTest::testStdOptionDefs6(D6O_LINK_ADDRESS, begin, begin + 16,
                                     typeid(OptionCustom));
                                     typeid(OptionCustom));
 
 
+    LibDhcpTest::testStdOptionDefs6(D6O_SOL_MAX_RT, begin, begin + 4,
+                                    typeid(OptionInt<uint32_t>));
+
+    LibDhcpTest::testStdOptionDefs6(D6O_INF_MAX_RT, begin, begin + 4,
+                                    typeid(OptionInt<uint32_t>));
+
     LibDhcpTest::testStdOptionDefs6(D6O_DHCPV4_MSG, begin, end,
     LibDhcpTest::testStdOptionDefs6(D6O_DHCPV4_MSG, begin, end,
                                     typeid(Option));
                                     typeid(Option));
 
 
     LibDhcpTest::testStdOptionDefs6(D6O_DHCPV4_O_DHCPV6_SERVER, begin, end,
     LibDhcpTest::testStdOptionDefs6(D6O_DHCPV4_O_DHCPV6_SERVER, begin, end,
                                     typeid(Option6AddrLst));
                                     typeid(Option6AddrLst));
 
 
+    LibDhcpTest::testStdOptionDefs6(D6O_V6_CAPTIVE_PORTAL, begin, end,
+                                    typeid(OptionString));
+
+    LibDhcpTest::testStdOptionDefs6(D6O_IPV6_ADDRESS_ANDSF, begin, end,
+                                    typeid(Option6AddrLst));
+
     LibDhcpTest::testStdOptionDefs6(D6O_PUBLIC_KEY, begin, end,
     LibDhcpTest::testStdOptionDefs6(D6O_PUBLIC_KEY, begin, end,
                                     typeid(Option));
                                     typeid(Option));
 
 
@@ -1600,8 +1740,6 @@ TEST_F(LibDhcpTest, stdOptionDefs6) {
 
 
     LibDhcpTest::testStdOptionDefs6(D6O_TIMESTAMP, begin, begin + 8,
     LibDhcpTest::testStdOptionDefs6(D6O_TIMESTAMP, begin, begin + 8,
                                     typeid(Option));
                                     typeid(Option));
-
-
 }
 }
 
 
 // This test checks if the DHCPv6 option definition can be searched by
 // This test checks if the DHCPv6 option definition can be searched by

+ 4 - 6
src/lib/dhcpsrv/tests/cfg_option_def_unittest.cc

@@ -211,10 +211,8 @@ TEST(CfgOptionDefTest, overrideStdOptionDef) {
     def.reset(new OptionDefinition("routers", DHO_ROUTERS, "uint32"));
     def.reset(new OptionDefinition("routers", DHO_ROUTERS, "uint32"));
     EXPECT_THROW(cfg.add(def, DHCP4_OPTION_SPACE), isc::BadValue);
     EXPECT_THROW(cfg.add(def, DHCP4_OPTION_SPACE), isc::BadValue);
 
 
-    /// There is no definition for the Access Network Domain Name Option
-    /// (RFC5986, option code 213) in libdhcp++. Once it is implemented it
-    /// should be not allowed to add a custom definition for it.
-    def.reset(new OptionDefinition("access-network-domain-name", 213, "string"));
+    /// There is no definition for unassigned option 170.
+    def.reset(new OptionDefinition("unassigned-option-170", 170, "string"));
     EXPECT_NO_THROW(cfg.add(def, DHCP4_OPTION_SPACE));
     EXPECT_NO_THROW(cfg.add(def, DHCP4_OPTION_SPACE));
 
 
     // It is not allowed to override the definition of the option which
     // It is not allowed to override the definition of the option which
@@ -222,9 +220,9 @@ TEST(CfgOptionDefTest, overrideStdOptionDef) {
     def.reset(new OptionDefinition("sntp-servers", D6O_SNTP_SERVERS,
     def.reset(new OptionDefinition("sntp-servers", D6O_SNTP_SERVERS,
                                    "ipv4-address"));
                                    "ipv4-address"));
     EXPECT_THROW(cfg.add(def, DHCP6_OPTION_SPACE), isc::BadValue);
     EXPECT_THROW(cfg.add(def, DHCP6_OPTION_SPACE), isc::BadValue);
-    // There is no definition for option 63 in libdhcp++ yet, so it should
+    // There is no definition for option 163 in libdhcp++ yet, so it should
     // be possible provide a custom definition.
     // be possible provide a custom definition.
-    def.reset(new OptionDefinition("geolocation", 63, "uint32"));
+    def.reset(new OptionDefinition("geolocation", 163, "uint32"));
     EXPECT_NO_THROW(cfg.add(def, DHCP6_OPTION_SPACE));
     EXPECT_NO_THROW(cfg.add(def, DHCP6_OPTION_SPACE));
 }
 }