Browse Source

[5227] Did easy DHCPv6 options (so remain not easy cases)

Francis Dupont 7 years ago
parent
commit
be76f1bd2c
4 changed files with 255 additions and 166 deletions
  1. 10 0
      doc/guide/dhcp6-srv.xml
  2. 172 162
      src/lib/dhcp/dhcp6.h
  3. 16 0
      src/lib/dhcp/std_option_defs.h
  4. 57 4
      src/lib/dhcp/tests/libdhcp++_unittest.cc

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

@@ -1238,6 +1238,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>
@@ -1247,8 +1252,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>

+ 172 - 162
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,180 @@
 /// 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_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 */
+   // 104-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
+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,
 /* draft-ietf-dhc-dhcpv6-active-leasequery-04 */
 /* draft-ietf-dhc-dhcpv6-active-leasequery-04 */
-//#define STATUS_DataMissing              12
-//#define STATUS_CatchUpComplete          13
-//#define STATUS_NotSupported             14
-//#define STATUS_TLSConnectionRefused     15
+// STATUS_DataMissing               = 12,
+// STATUS_CatchUpComplete           = 13,
+// STATUS_NotSupported              = 14,
+// STATUS_TLSConnectionRefused      = 15,
 
 
 // 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
+};
 
 
 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 +200,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 +212,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

+ 16 - 0
src/lib/dhcp/std_option_defs.h

@@ -376,6 +376,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, "" },
@@ -386,9 +394,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,

+ 57 - 4
src/lib/dhcp/tests/libdhcp++_unittest.cc

@@ -1447,6 +1447,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"
@@ -1520,6 +1530,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));
 
 
@@ -1637,6 +1653,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));
 
 
@@ -1650,6 +1684,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");
@@ -1657,16 +1698,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));
 
 
@@ -1678,8 +1733,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