Commit 14a8341a authored by Francis Dupont's avatar Francis Dupont
Browse files

[master] Merged trac4107 (HCPv4-over-DHCPv6 message and option definitions)

parents caa98afd e15b2e1e
......@@ -961,6 +961,8 @@ temporarily override a list of interface names and listen on all interfaces.
<row><entry>erp-local-domain-name</entry><entry>65</entry><entry>fqdn</entry><entry>false</entry></row>
<row><entry>rsoo</entry><entry>66</entry><entry>empty</entry><entry>false</entry></row>
<row><entry>client-linklayer-addr</entry><entry>79</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>
</tbody>
</tgroup>
</table>
......
......@@ -110,8 +110,8 @@
//#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_DHCPV4_MSG 87 /* RFC7341 */
#define D6O_DHCPV4_O_DHCPV6_SERVER 88 /* RFC7341 */
//#define D6O_S46_RULE 89 /* RFC7598 */
//#define D6O_S46_BR 90 /* RFC7598 */
//#define D6O_S46_DMR 91 /* RFC7598 */
......@@ -123,10 +123,9 @@
//#define D6O_4RD 97 /* RFC7600 */
//#define D6O_4RD_MAP_RULE 98 /* RFC7600 */
//#define D6O_4RD_NON_MAP_RULE 99 /* RFC7600 */
/* draft-ietf-dhc-dhcpv6-active-leasequery-04 */
//#define D6O_LQ_BASE_TIME 100
//#define D6O_LQ_START_TIME 101
//#define D6O_LQ_END_TIME 102
//#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 */
......@@ -195,8 +194,8 @@
//#define DHCPV6_RECONFIGURE_REQUEST 18
//#define DHCPV6_RECONFIGURE_REPLY 19
/* RFC 7341 */
//#define DHCPV6_DHCPV4_QUERY 20
//#define DHCPV6_DHCPV4_RESPONSE 21
#define DHCPV6_DHCPV4_QUERY 20
#define DHCPV6_DHCPV4_RESPONSE 21
/* draft-ietf-dhc-dhcpv6-active-leasequery-04 */
//#define DHCPV6_ACTIVELEASEQUERY 22
//#define DHCPV6_STARTTLS 23
......@@ -223,6 +222,11 @@ 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. These are option
codes for the ISC vendor specific options used in 4o6 */
#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 */
......@@ -298,4 +302,7 @@ extern const int dhcpv6_type_name_max;
#define IRT_DEFAULT 86400
#define IRT_MINIMUM 600
/* DHCPv4-query message flags (see RFC7341) */
#define DHCPV4_QUERY_FLAGS_UNICAST (1 << 23)
#endif /* DHCP6_H */
......@@ -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) {
......
......@@ -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_;
......
......@@ -289,6 +289,8 @@ Pkt6::unpackUDP() {
case DHCPV6_DECLINE:
case DHCPV6_RECONFIGURE:
case DHCPV6_INFORMATION_REQUEST:
case DHCPV6_DHCPV4_QUERY:
case DHCPV6_DHCPV4_RESPONSE:
default: // assume that uknown messages are not using relay format
{
return (unpackMsg(data_.begin(), data_.end()));
......@@ -586,6 +588,8 @@ Pkt6::getName(const uint8_t type) {
static const char* REPLY = "REPLY";
static const char* REQUEST = "REQUEST";
static const char* SOLICIT = "SOLICIT";
static const char* DHCPV4_QUERY = "DHCPV4_QUERY";
static const char* DHCPV4_RESPONSE = "DHCPV4_RESPONSE";
static const char* UNKNOWN = "UNKNOWN";
switch (type) {
......@@ -634,6 +638,12 @@ Pkt6::getName(const uint8_t type) {
case DHCPV6_SOLICIT:
return (SOLICIT);
case DHCPV6_DHCPV4_QUERY:
return (DHCPV4_QUERY);
case DHCPV6_DHCPV4_RESPONSE:
return (DHCPV4_RESPONSE);
default:
;
}
......
......@@ -353,6 +353,9 @@ const OptionDefParams OPTION_DEF_PARAMS6[] = {
{ "rsoo", D6O_RSOO, OPT_EMPTY_TYPE, false, NO_RECORD_DEF, "rsoo-opts" },
{ "client-linklayer-addr", D6O_CLIENT_LINKLAYER_ADDR, 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,
NO_RECORD_DEF, "" },
{ "public-key", D6O_PUBLIC_KEY, OPT_BINARY_TYPE, false,
NO_RECORD_DEF, "" },
{ "certificate", D6O_CERTIFICATE, OPT_BINARY_TYPE, false,
......@@ -371,6 +374,19 @@ const OptionDefParams OPTION_DEF_PARAMS6[] = {
const int OPTION_DEF_PARAMS_SIZE6 =
sizeof(OPTION_DEF_PARAMS6) / sizeof(OPTION_DEF_PARAMS6[0]);
/// @brief Definitions of vendor-specific DHCPv6 options, defined by ISC.
/// 4o6-* options are used for inter-process communication. For details, see
/// http://kea.isc.org/wiki/Dhcp4o6Design
///
/// @todo: As those options are defined by ISC, they do not belong in std_option_defs.h.
/// We need to move them to a separate file, e.g. isc_option_defs.h
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
......
......@@ -1200,6 +1200,12 @@ TEST_F(LibDhcpTest, stdOptionDefs6) {
fqdn_buf.begin(), fqdn_buf.end(),
typeid(OptionCustom));
LibDhcpTest::testStdOptionDefs6(D6O_DHCPV4_MSG, begin, end,
typeid(Option));
LibDhcpTest::testStdOptionDefs6(D6O_DHCPV4_O_DHCPV6_SERVER, begin, end,
typeid(Option6AddrLst));
LibDhcpTest::testStdOptionDefs6(D6O_PUBLIC_KEY, begin, end,
typeid(Option));
......
......@@ -594,6 +594,14 @@ TEST_F(Pkt6Test, getName) {
EXPECT_STREQ("DECLINE", Pkt6::getName(type));
break;
case DHCPV6_DHCPV4_QUERY:
EXPECT_STREQ("DHCPV4_QUERY", Pkt6::getName(type));
break;
case DHCPV6_DHCPV4_RESPONSE:
EXPECT_STREQ("DHCPV4_RESPONSE", Pkt6::getName(type));
break;
case DHCPV6_INFORMATION_REQUEST:
EXPECT_STREQ("INFORMATION_REQUEST",
Pkt6::getName(type));
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment