diff --git a/doc/guide/dhcp4-srv.xml b/doc/guide/dhcp4-srv.xml index 21ebaa8052..12bbd83a09 100644 --- a/doc/guide/dhcp4-srv.xml +++ b/doc/guide/dhcp4-srv.xml @@ -1293,6 +1293,11 @@ It is a part of the DDNS/D2 configuration It is merely echoed by the server dhcp-agent-options82emptyfalsefalse --> +nds-server85ipv4-addresstruefalse +nds-tree-name86stringfalsefalse +nds-context87stringfalsefalse +bcms-controller-names88fqdntruefalse +bcms-controller-address89ipv4-addresstruefalse @@ -1303,10 +1308,26 @@ It is merely echoed by the server client-system93uint16truefalse client-ndi94record (uint8, uint8, uint8)falsefalse uuid-guid97record (uint8, binary)falsefalse +uap-servers98stringfalsefalse +geoconf-civic99binaryfalsefalse +pcode100stringfalsefalse +tcode101stringfalsefalse +netinfo-server-address112ipv4-addresstruefalse +netinfo-server-tag113stringfalsefalse +default-url114stringfalsefalse +auto-config116uint8falsefalse +name-service-search117uint16truefalse subnet-selection118ipv4-addressfalsefalse domain-search119fqdntruefalse vivco-suboptions124binaryfalsefalse vivso-suboptions125binaryfalsefalse +pana-agent136ipv4-addresstruefalse +v4-lost137fqdnfalsefalse +capwap-ac-v4138ipv4-addresstruefalse +sip-ua-cs-domains142fqdntruefalse +v4-portparams159record (uint8, uint8, uint16)falsefalse +v4-captive-portal160stringfalsefalse +v4-access-domain213fqdnfalsefalse diff --git a/src/lib/dhcp/dhcp4.h b/src/lib/dhcp/dhcp4.h index e079e03230..a7f0b0e488 100644 --- a/src/lib/dhcp/dhcp4.h +++ b/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 * * This Source Code Form is subject to the terms of the Mozilla Public @@ -146,16 +146,16 @@ enum DHCPOptionType { DHO_USER_CLASS = 77, // DHO_DIRECTORY_AGENT = 78, // DHO_SERVICE_SCOPE = 79, -// DHO_RAPID_COMMIT = 80,, +// DHO_RAPID_COMMIT = 80, DHO_FQDN = 81, DHO_DHCP_AGENT_OPTIONS = 82, // DHO_ISNS = 83, // 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_CLIENT_LAST_TRANSACTION_TIME = 91, DHO_ASSOCIATED_IP = 92, @@ -164,17 +164,17 @@ enum DHCPOptionType { // DHO_LDAP = 95, // 96 is removed/unassigned 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 -// 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 -// DHO_AUTO_CONFIG = 116, -// DHO_NAME_SERVICE_SEARCH = 117, + DHO_AUTO_CONFIG = 116, + DHO_NAME_SERVICE_SEARCH = 117, DHO_SUBNET_SELECTION = 118, /* RFC3011 */ DHO_DOMAIN_SEARCH = 119, /* RFC3397 */ // DHO_SIP_SERVERS = 120, @@ -185,12 +185,12 @@ enum DHCPOptionType { DHO_VIVSO_SUBOPTIONS = 125, // 126-127 are removed/unassigned // 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_FQDN_MOS = 140, -// DHO_SIP_UA_CONF_SERVICE_DOMAINS = 141, + DHO_SIP_UA_CONF_SERVICE_DOMAINS = 141, // DHO_IPV4_ADDR_ANDSF = 142, // 143 is removed/unassigned // DHO_GEOLOC = 144, @@ -206,10 +206,11 @@ enum DHCPOptionType { // DHO_DHCP_STATE = 156, // DHO_DATA_SOURCE = 157, // DHO_V4_PCP_SERVER = 158, -// DHO_V4_PORTPARAMS = 159, + DHO_V4_PORTPARAMS = 159, + DHO_V4_CAPTIVE_PORTAL = 160, // 160-211 are removed/unassigned // DHO_6RD = 212, -// DHO_V4_ACCESS_DOMAIN = 213, + DHO_V4_ACCESS_DOMAIN = 213, // 214-219 are removed/unassigned // DHO_SUBNET_ALLOC = 220, // DHO_VSS = 221, diff --git a/src/lib/dhcp/std_option_defs.h b/src/lib/dhcp/std_option_defs.h index ddc917ec19..5507211c81 100644 --- a/src/lib/dhcp/std_option_defs.h +++ b/src/lib/dhcp/std_option_defs.h @@ -60,6 +60,11 @@ RECORD_DECL(CLIENT_NDI_RECORDS, OPT_UINT8_TYPE, OPT_UINT8_TYPE, OPT_UINT8_TYPE); // A client identifer: a 1 byte type field followed by opaque data depending on the 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. const OptionDefParams STANDARD_V4_OPTION_DEFINITIONS[] = { { "subnet-mask", DHO_SUBNET_MASK, OPT_IPV4_ADDRESS_TYPE, false, NO_RECORD_DEF, "" }, @@ -177,6 +182,11 @@ const OptionDefParams STANDARD_V4_OPTION_DEFINITIONS[] = { { "fqdn", DHO_FQDN, OPT_RECORD_TYPE, false, RECORD_DEF(FQDN_RECORDS), "" }, { "dhcp-agent-options", DHO_DHCP_AGENT_OPTIONS, OPT_EMPTY_TYPE, false, NO_RECORD_DEF, "dhcp-agent-options-space" }, + { "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 // as a record field to a custom option. Also, there is no @@ -190,6 +200,15 @@ const OptionDefParams STANDARD_V4_OPTION_DEFINITIONS[] = { { "client-system", DHO_SYSTEM, OPT_UINT16_TYPE, true, NO_RECORD_DEF, "" }, { "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), "" }, + { "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, OPT_IPV4_ADDRESS_TYPE, false, NO_RECORD_DEF, "" }, { "domain-search", DHO_DOMAIN_SEARCH, OPT_FQDN_TYPE, true, NO_RECORD_DEF, "" }, @@ -208,7 +227,15 @@ const OptionDefParams STANDARD_V4_OPTION_DEFINITIONS[] = { /// 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. { "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. }; diff --git a/src/lib/dhcp/tests/libdhcp++_unittest.cc b/src/lib/dhcp/tests/libdhcp++_unittest.cc index 827443e42c..b0c049effb 100644 --- a/src/lib/dhcp/tests/libdhcp++_unittest.cc +++ b/src/lib/dhcp/tests/libdhcp++_unittest.cc @@ -1297,27 +1297,14 @@ TEST_F(LibDhcpTest, stdOptionDefs4) { typeid(OptionCustom), "dhcp-agent-options-space"); - LibDhcpTest::testStdOptionDefs4(DHO_AUTHENTICATE, begin, end, - typeid(Option)); - - LibDhcpTest::testStdOptionDefs4(DHO_CLIENT_LAST_TRANSACTION_TIME, - begin, begin + 4, - typeid(OptionInt)); - - LibDhcpTest::testStdOptionDefs4(DHO_ASSOCIATED_IP, begin, end, + LibDhcpTest::testStdOptionDefs4(DHO_NDS_SERVERS, begin, end, typeid(Option4AddrLst)); - LibDhcpTest::testStdOptionDefs4(DHO_SUBNET_SELECTION, begin, end, - typeid(OptionCustom)); + LibDhcpTest::testStdOptionDefs4(DHO_NDS_TREE_NAME, begin, end, + typeid(OptionString)); - LibDhcpTest::testStdOptionDefs4(DHO_SYSTEM, begin, end, - typeid(OptionIntArray)); - - LibDhcpTest::testStdOptionDefs4(DHO_NDI, begin, begin + 3, - typeid(OptionCustom)); - - LibDhcpTest::testStdOptionDefs4(DHO_UUID_GUID, begin, begin + 17, - typeid(OptionCustom)); + LibDhcpTest::testStdOptionDefs4(DHO_NDS_CONTEXT, begin, end, + typeid(OptionString)); // Prepare buffer holding an array of FQDNs. const char fqdn_data[] = { @@ -1332,6 +1319,63 @@ TEST_F(LibDhcpTest, stdOptionDefs4) { // Initialize a vector with the FQDN data. std::vector 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, + typeid(Option)); + + LibDhcpTest::testStdOptionDefs4(DHO_CLIENT_LAST_TRANSACTION_TIME, + begin, begin + 4, + typeid(OptionInt)); + + LibDhcpTest::testStdOptionDefs4(DHO_ASSOCIATED_IP, begin, end, + typeid(Option4AddrLst)); + + LibDhcpTest::testStdOptionDefs4(DHO_AUTO_CONFIG, begin, begin + 1, + typeid(OptionInt)); + + LibDhcpTest::testStdOptionDefs4(DHO_NAME_SERVICE_SEARCH, begin, begin + 4, + typeid(OptionIntArray)); + + LibDhcpTest::testStdOptionDefs4(DHO_SUBNET_SELECTION, begin, end, + typeid(OptionCustom)); + + LibDhcpTest::testStdOptionDefs4(DHO_SYSTEM, begin, end, + typeid(OptionIntArray)); + + LibDhcpTest::testStdOptionDefs4(DHO_NDI, begin, begin + 3, + typeid(OptionCustom)); + + LibDhcpTest::testStdOptionDefs4(DHO_UUID_GUID, begin, begin + 17, + typeid(OptionCustom)); + + 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(), fqdn_buf.end(), typeid(OptionCustom)); @@ -1354,6 +1398,40 @@ TEST_F(LibDhcpTest, stdOptionDefs4) { LibDhcpTest::testStdOptionDefs4(DHO_VIVSO_SUBOPTIONS, vivsio_buf.begin(), 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 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