]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
tweaked option definitions, added documentation
authorAndrei Pavel <andrei.pavel@qualitance.com>
Fri, 8 Jul 2016 08:49:52 +0000 (11:49 +0300)
committerAndrei Pavel <andrei.pavel@qualitance.com>
Fri, 8 Jul 2016 08:49:52 +0000 (11:49 +0300)
doc/guide/dhcp6-srv.xml
src/lib/dhcp/std_option_defs.h
src/lib/dhcp/tests/option6_pdexclude_unittest.cc

index 7bc1de9e8188243d642185ef6a00b885438dbe30..1f3c40e2080f0f4aed3ee8fce85ec5510b0159d6 100644 (file)
@@ -800,17 +800,21 @@ temporarily override a list of interface names and listen on all interfaces.
     ...
 }</screen>
       </para>
-      <section>
-       <title>Prefix Exclude Option</title>
-       <para>
-       For each delegated prefix configured as above, the delegating router may
-       choose to exclude a subprefix (i.e. with greater prefix length) as proposed in
-       <ulink url="http://tools.ietf.org/html/rfc6603"> RFC 6603</ulink>.
-        The IA PD option responsible for specifying IPv^ address prefixes limits the
-       amount of PD Exclude options that it can encapsulate to one at most, thus it
-       can only exclude one prefix from a given delegated prefix.
-       </para>
-       </section>
+    
+    </section>
+        
+    <section id="pd-exclude-option">
+        <title>Prefix Exclude Option</title>
+        <para>
+            For each delegated prefix configured as above, the delegating router
+            may choose to exclude a subprefix (i.e. with greater prefix length)
+            as proposed in
+            <ulink url="http://tools.ietf.org/html/rfc6603"> RFC 6603</ulink>.
+            The IA PD option responsible for specifying IPv6 address prefixes
+            limits the amount of PD Exclude options that it can encapsulate to
+            at most one, thus it can only exclude one prefix from a given
+            delegated prefix.
+        </para>
     </section>
 
     <section id="dhcp6-std-options">
@@ -1082,6 +1086,56 @@ temporarily override a list of interface names and listen on all interfaces.
     </para>
     </section>
 
+    <section id="s46-options">
+        <title>Common Softwire46 Options</title>
+        <para>TODO: S46 Rule</para>
+<screen>
+{
+    "code": 92, 
+    "csv-format": true, 
+    "data": "2001:db8::cafe::/48", 
+    "name": "s46-v4v6bind", 
+    "space": "4over6-lw"
+}
+</screen>
+        <para>TODO: S46 BR</para>
+<screen>
+{
+    "code": 90, 
+    "csv-format": true, 
+    "data": "2001:db8::cafe::/48", 
+    "name": "s46-br", 
+    "space": "4over6-lw"
+}
+</screen>
+        <para>TODO: S46 DMR. No config required. Config example?</para>
+        <para>TODO: S46 IPv4/IPv6 Address Binding. Config example?</para>
+        <para>TODO: S46 Port Parameters</para>
+<screen>
+{
+    "code": 93, 
+    "csv-format": true, 
+    "data": "0,2,12288", 
+    "name": "s46-portparams", 
+    "space": "v4v6bind"
+}
+</screen>
+    </section>
+    <section id="s46-containers">
+        <title>Softwire46 Containers</title>
+        <para>TODO: S46 MAP-E container. Config example?</para>
+        <para>TODO: S46 MAP-T container. Config example?</para>
+        <para>TODO: S46 Lightweight 4over6 container</para>
+<screen>
+{
+    "code": 96, 
+    "name": "s46-cont-lw", 
+    "space": "dhcp6"
+}
+
+</screen>
+    </section>
+
     <section id="dhcp6-custom-options">
       <title>Custom DHCPv6 options</title>
       <para>It is also possible to define options other than the standard ones.
index 366f48bc9a60c1a4334f04cd1794dd4939636279..fa7414c63fb8d7605245dfe868da634d99d33e36 100644 (file)
@@ -376,9 +376,12 @@ const OptionDefParams STANDARD_V6_OPTION_DEFINITIONS[] = {
     { "timestamp", D6O_TIMESTAMP, OPT_BINARY_TYPE, false,
       NO_RECORD_DEF, "" },
     { "aftr-name", D6O_AFTR_NAME, OPT_FQDN_TYPE, false, NO_RECORD_DEF, "" },
-    { "s46-cont-mape", D6O_S46_CONT_MAPE, OPT_EMPTY_TYPE, false, NO_RECORD_DEF, MAPE_V6_OPTION_SPACE },
-    { "s46-cont-mapt", D6O_S46_CONT_MAPT, OPT_EMPTY_TYPE, false, NO_RECORD_DEF, MAPT_V6_OPTION_SPACE },
-    { "s46-cont-lw", D6O_S46_CONT_LW, OPT_EMPTY_TYPE, false, NO_RECORD_DEF, LW_V6_OPTION_SPACE }
+    { "s46-cont-mape", D6O_S46_CONT_MAPE, OPT_EMPTY_TYPE, false, NO_RECORD_DEF,
+        MAPE_V6_OPTION_SPACE },
+    { "s46-cont-mapt", D6O_S46_CONT_MAPT, OPT_EMPTY_TYPE, false, NO_RECORD_DEF,
+        MAPT_V6_OPTION_SPACE },
+    { "s46-cont-lw", D6O_S46_CONT_LW, OPT_EMPTY_TYPE, false, NO_RECORD_DEF,
+        LW_V6_OPTION_SPACE }
 
     // @todo There is still a bunch of options for which we have to provide
     // definitions but we don't do it because they are not really
@@ -387,7 +390,16 @@ const OptionDefParams STANDARD_V6_OPTION_DEFINITIONS[] = {
 
 /// Number of option definitions defined.
 const int STANDARD_V6_OPTION_DEFINITIONS_SIZE =
-    sizeof(STANDARD_V6_OPTION_DEFINITIONS) / sizeof(STANDARD_V6_OPTION_DEFINITIONS[0]);
+    sizeof(STANDARD_V6_OPTION_DEFINITIONS) /
+    sizeof(STANDARD_V6_OPTION_DEFINITIONS[0]);
+
+// Option definitions that belong to two or more option spaces are defined here.
+const OptionDefParams OPTION_DEF_PARAMS_S46_BR = { "s46-br", D6O_S46_BR,
+    OPT_IPV6_ADDRESS_TYPE, false, NO_RECORD_DEF, "" };
+const OptionDefParams OPTION_DEF_PARAMS_S46_RULE = { "s46-rule", D6O_S46_RULE,
+    OPT_RECORD_TYPE, false, RECORD_DEF(S46_RULE), V4V6_RULE_OPTION_SPACE };
+const OptionDefParams OPTION_DEF_PARAMS_S46_PORTPARAMS = { "s46-portparams",
+    D6O_S46_PORTPARAMS, OPT_RECORD_TYPE, false, RECORD_DEF(S46_PORTPARAMS), "" };
 
 /// @brief Definitions of vendor-specific DHCPv6 options, defined by ISC.
 /// 4o6-* options are used for inter-process communication. For details, see
@@ -396,60 +408,69 @@ const int STANDARD_V6_OPTION_DEFINITIONS_SIZE =
 /// @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_OPTION_DEFINITIONS[] = {
-    { "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, "" }
+    { "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_OPTION_DEFINITIONS_SIZE =
-    sizeof(ISC_V6_OPTION_DEFINITIONS) / sizeof(ISC_V6_OPTION_DEFINITIONS[0]);
+    sizeof(ISC_V6_OPTION_DEFINITIONS) /
+    sizeof(ISC_V6_OPTION_DEFINITIONS[0]);
 
 /// @brief MAPE option definitions
 /// @todo: Maybe move this to a separate file, e.g. mape_option_defs.h
 const OptionDefParams MAPE_V6_OPTION_DEFINITIONS[] = {
-    { "s46-br", D6O_S46_BR, OPT_IPV6_ADDRESS_TYPE, false, NO_RECORD_DEF, "" },
-    { "s46-rule", D6O_S46_RULE, OPT_RECORD_TYPE, false, RECORD_DEF(S46_RULE), V4V6_RULE_OPTION_SPACE }
+    OPTION_DEF_PARAMS_S46_BR,
+    OPTION_DEF_PARAMS_S46_RULE
 };
 
 const int MAPE_V6_OPTION_DEFINITIONS_SIZE =
-    sizeof(MAPE_V6_OPTION_DEFINITIONS) / sizeof(MAPE_V6_OPTION_DEFINITIONS[0]);
+    sizeof(MAPE_V6_OPTION_DEFINITIONS) /
+    sizeof(MAPE_V6_OPTION_DEFINITIONS[0]);
 
 /// @brief MAPT option definitions
 /// @todo: Maybe move this to a separate file, e.g. mapt_option_defs.h
 const OptionDefParams MAPT_V6_OPTION_DEFINITIONS[] = {
-    { "s46-rule", D6O_S46_RULE, OPT_RECORD_TYPE, false, RECORD_DEF(S46_RULE), V4V6_RULE_OPTION_SPACE },
-    { "s46-dmr", D6O_S46_DMR, OPT_IPV6_PREFIX_TYPE, false, NO_RECORD_DEF, "" },
+    OPTION_DEF_PARAMS_S46_RULE,
+    { "s46-dmr", D6O_S46_DMR, OPT_IPV6_PREFIX_TYPE, false, NO_RECORD_DEF, "" }
 };
 
 const int MAPT_V6_OPTION_DEFINITIONS_SIZE =
-    sizeof(MAPT_V6_OPTION_DEFINITIONS) / sizeof(MAPT_V6_OPTION_DEFINITIONS[0]);
+    sizeof(MAPT_V6_OPTION_DEFINITIONS) /
+    sizeof(MAPT_V6_OPTION_DEFINITIONS[0]);
 
 /// @brief LW option definitions
 /// @todo: Maybe move this to a separate file, e.g. lw_option_defs.h
 const OptionDefParams LW_V6_OPTION_DEFINITIONS[] = {
-    { "s46-br", D6O_S46_BR, OPT_IPV6_ADDRESS_TYPE, false, NO_RECORD_DEF, "" },
-    { "s46-v4v6bind", D6O_S46_V4V6BIND, OPT_RECORD_TYPE, false, RECORD_DEF(S46_V4V6BIND), V4V6_BIND_OPTION_SPACE },
+    OPTION_DEF_PARAMS_S46_BR,
+    { "s46-v4v6bind", D6O_S46_V4V6BIND, OPT_RECORD_TYPE, false,
+        RECORD_DEF(S46_V4V6BIND), V4V6_BIND_OPTION_SPACE }
 };
 
 const int LW_V6_OPTION_DEFINITIONS_SIZE =
-    sizeof(LW_V6_OPTION_DEFINITIONS) / sizeof(LW_V6_OPTION_DEFINITIONS[0]);
+    sizeof(LW_V6_OPTION_DEFINITIONS) /
+    sizeof(LW_V6_OPTION_DEFINITIONS[0]);
 
 /// @brief Rule option definitions
 /// @todo: Maybe move this to a separate file, e.g. rule_option_defs.h
 const OptionDefParams V4V6_RULE_OPTION_DEFINITIONS[] = {
-    { "s46-portparams", D6O_S46_PORTPARAMS, OPT_RECORD_TYPE, false, RECORD_DEF(S46_PORTPARAMS), "" },
+    OPTION_DEF_PARAMS_S46_PORTPARAMS
 };
 
 const int V4V6_RULE_OPTION_DEFINITIONS_SIZE =
-    sizeof(V4V6_RULE_OPTION_DEFINITIONS) / sizeof(V4V6_RULE_OPTION_DEFINITIONS[0]);
+    sizeof(V4V6_RULE_OPTION_DEFINITIONS) /
+    sizeof(V4V6_RULE_OPTION_DEFINITIONS[0]);
 
 /// @brief Bind option definitions
 /// @todo: Maybe move this to a separate file, e.g. bind_option_defs.h
 const OptionDefParams V4V6_BIND_OPTION_DEFINITIONS[] = {
-    { "s46-portparams", D6O_S46_PORTPARAMS, OPT_RECORD_TYPE, false, RECORD_DEF(S46_PORTPARAMS), "" }
+    OPTION_DEF_PARAMS_S46_PORTPARAMS
 };
 
 const int V4V6_BIND_OPTION_DEFINITIONS_SIZE =
-    sizeof(V4V6_BIND_OPTION_DEFINITIONS) / sizeof(V4V6_BIND_OPTION_DEFINITIONS[0]);
+    sizeof(V4V6_BIND_OPTION_DEFINITIONS) /
+    sizeof(V4V6_BIND_OPTION_DEFINITIONS[0]);
 
 } // unnamed namespace
 
index 1d625dea8da2cf2f8c6fbe6d4583101f78a3fc99..eea68a8f25e0da20bb8420b29a70a5d2b8210f6f 100644 (file)
@@ -26,9 +26,11 @@ const IOAddress beef01("2001:db8:dead:beef::01"); // /56 prefix length
 
 // Description
 TEST(Option6PDExcludeTest, testName) {
-    /*
     Option6PDExclude option = Option6PDExclude(beef, 56, beef01, 60);
 
+    EXPECT_EQ(option.getExcludedPrefixLength(), 60);
+    /*
+
     OptionBuffer data(option.getData());
 
     util::OutputBuffer buf(128);