From: Francis Dupont Date: Sat, 31 Oct 2015 05:35:23 +0000 (+0100) Subject: [4107] Added the 2 private options (now update the doc) X-Git-Tag: trac4109_base^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bd535576f1869a9be98337a79abdf295660eb5f1;p=thirdparty%2Fkea.git [4107] Added the 2 private options (now update the doc) --- diff --git a/src/lib/dhcp/dhcp6.h b/src/lib/dhcp/dhcp6.h index c18d53b9ec..1380b1ae07 100644 --- a/src/lib/dhcp/dhcp6.h +++ b/src/lib/dhcp/dhcp6.h @@ -223,6 +223,10 @@ extern const int dhcpv6_type_name_max; // Taken from http://www.iana.org/assignments/enterprise-numbers #define ENTERPRISE_ID_ISC 2495 +/* DHCPv4-over-DHCPv6 (RFC 7341) inter-process communication */ +#define ISC_V6_4O6_INTERFACE 60000 +#define ISC_V6_4O6_SRC_ADDRESS 60001 + /* 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 */ diff --git a/src/lib/dhcp/libdhcp++.cc b/src/lib/dhcp/libdhcp++.cc index db484cce36..069f09a04a 100644 --- a/src/lib/dhcp/libdhcp++.cc +++ b/src/lib/dhcp/libdhcp++.cc @@ -110,6 +110,11 @@ LibDHCP::getVendorOption6Defs(const uint32_t vendor_id) { initVendorOptsDocsis6(); } + if (vendor_id == ENTERPRISE_ID_ISC && + vendor6_defs_.find(ENTERPRISE_ID_ISC) == vendor6_defs_.end()) { + initVendorOptsIsc6(); + } + VendorOptionDefContainers::const_iterator def = vendor6_defs_.find(vendor_id); if (def == vendor6_defs_.end()) { // No such vendor-id space @@ -737,6 +742,12 @@ LibDHCP::initVendorOptsDocsis6() { initOptionSpace(vendor6_defs_[VENDOR_ID_CABLE_LABS], DOCSIS3_V6_DEFS, DOCSIS3_V6_DEFS_SIZE); } +void +LibDHCP::initVendorOptsIsc6() { + vendor6_defs_[ENTERPRISE_ID_ISC] = OptionDefContainer(); + initOptionSpace(vendor6_defs_[ENTERPRISE_ID_ISC], ISC_V6_DEFS, ISC_V6_DEFS_SIZE); +} + void initOptionSpace(OptionDefContainer& defs, const OptionDefParams* params, size_t params_size) { diff --git a/src/lib/dhcp/libdhcp++.h b/src/lib/dhcp/libdhcp++.h index 380e0aeacb..57fac075bf 100644 --- a/src/lib/dhcp/libdhcp++.h +++ b/src/lib/dhcp/libdhcp++.h @@ -281,6 +281,9 @@ private: static void initVendorOptsDocsis6(); + /// Initialize private DHCPv6 option definitions. + static void initVendorOptsIsc6(); + /// pointers to factories that produce DHCPv6 options static FactoryMap v4factories_; diff --git a/src/lib/dhcp/std_option_defs.h b/src/lib/dhcp/std_option_defs.h index d75048e9a7..da27a19408 100644 --- a/src/lib/dhcp/std_option_defs.h +++ b/src/lib/dhcp/std_option_defs.h @@ -346,7 +346,7 @@ const OptionDefParams OPTION_DEF_PARAMS6[] = { 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, - NO_RECORD_DEF, "" } + NO_RECORD_DEF, "" }, { "bootfile-url", D6O_BOOTFILE_URL, OPT_STRING_TYPE, false, NO_RECORD_DEF, "" }, { "bootfile-param", D6O_BOOTFILE_PARAM, OPT_BINARY_TYPE, false, NO_RECORD_DEF, "" }, { "client-arch-type", D6O_CLIENT_ARCH_TYPE, OPT_UINT16_TYPE, true, NO_RECORD_DEF, "" }, @@ -374,6 +374,14 @@ const OptionDefParams OPTION_DEF_PARAMS6[] = { const int OPTION_DEF_PARAMS_SIZE6 = sizeof(OPTION_DEF_PARAMS6) / sizeof(OPTION_DEF_PARAMS6[0]); +/// @brief Definitions of private DHCPv6 options +const OptionDefParams ISC_V6_DEFS[] = { + { "4o6-interface", ISC_V6_4O6_INTERFACE, OPT_STRING_TYPE, false, NO_RECORD_DEF, "" }, + { "4o6-source-address", ISC_V6_4O6_SRC_ADDRESS, OPT_IPV6_ADDRESS_TYPE, false, NO_RECORD_DEF, "" } +}; + +const int ISC_V6_DEFS_SIZE = sizeof(ISC_V6_DEFS) / sizeof(OptionDefParams); + } // unnamed namespace } // namespace dhcp