]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#719] Addressed comments
authorFrancis Dupont <fdupont@isc.org>
Wed, 15 Mar 2023 13:14:40 +0000 (14:14 +0100)
committerFrancis Dupont <fdupont@isc.org>
Wed, 15 Mar 2023 13:14:40 +0000 (14:14 +0100)
ChangeLog
doc/sphinx/arm/dhcp4-srv.rst
doc/sphinx/arm/dhcp6-srv.rst
src/bin/dhcp4/dhcp4_srv.cc
src/bin/dhcp6/dhcp6_parser.cc
src/bin/dhcp6/dhcp6_parser.yy

index 28f43add5ff1c00869db809b6b7ec4396031de8d..a318aad0dca8010fc77474bdf37cfb305deb0f67 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2110.  [func]          fdupont
+       A new boolean configuration flag called "never-send" has been
+       added to the option data scope. When enabled, the option is not
+       sent in a response to the client, even if the client explicitly
+       requests it.
+       (Gitlab #719)
+
 2109.  [bug]           fdupont
        Compatibility flags e.g. lenient-option-parsing were not
        saved by config-get and similar commands.
index c308fe0eec23334a1a5677d1353b330ef7e13531..83d70841b45376356959b4c81eb53c3f23091974 100644 (file)
@@ -1527,6 +1527,17 @@ In the example above, ``domain-name-servers`` option is never added to
 responses on subnet ``192.0.3.0/24``. ``never-send`` has precedence over
 ``always-send`` so if both are true the option is not added.
 
+.. note::
+
+    The ``always-send`` and ``never-send`` flags are sticky, meaning
+    they do not follow the usual configuration inheritance rules.
+    Instead, if they are enabled at least once along the configuration
+    inheritance chain, they get applied regardless of them being
+    disabled in other places which would usually be more prioritized.
+    For instance, if one of the flags is enabled in the global scope,
+    but disabled at the subnet level, it will act as enabled,
+    disregarding the subnet-level setting.
+
 .. note::
 
    The ``never-send`` is less powerful than the :ref:`hooks-flex-option`,
@@ -2620,7 +2631,7 @@ Unfortunately, for many other vendors, such as Genexis (25167, discussed above),
 Kea does not have such a mechanism, so it cannot send any sub-options on its own.
 To solve this issue, we devised the concept of persistent options. Kea can be
 told to always send options, even if the client did not request them. This can
-be achieved by adding ``"always-send": true`` to the option definition. Note
+be achieved by adding ``"always-send": true`` to the option data entry. Note
 that in this particular case an option is defined in vendor space 25167. With
 ``always-send`` enabled, the option is sent every time there is a need to deal
 with vendor space 25167.
index a9ec10132b2b2654d661f162b27793b1af0a4994..76c964af867ef855beac6ff3c72d4b9a9b486d69 100644 (file)
@@ -1454,6 +1454,17 @@ In the example above, the ``dns-server`` option is never added to responses
 on subnet ``2001:db8:1::/64``. ``never-send`` has precedence over
 ``always-send`` so if both are true the option is not added.
 
+.. note::
+
+    The ``always-send`` and ``never-send`` flags are sticky, meaning
+    they do not follow the usual configuration inheritance rules.
+    Instead, if they are enabled at least once along the configuration
+    inheritance chain, they get applied regardless of them being
+    disabled in other places which would usually be more prioritized.
+    For instance, if one of the flags is enabled in the global scope,
+    but disabled at the subnet level, it will act as enabled,
+    disregarding the subnet-level setting.
+
 .. note::
 
    The ``never-send`` is less powerful than the :ref:`hooks-flex-option`,
index d5010555e67d782f1aabacb84efd89b6f8217b9b..2f8e0724b35d764e428591623a552ccd42b10f18 100644 (file)
@@ -1872,7 +1872,7 @@ Dhcpv4Srv::appendRequestedOptions(Dhcpv4Exchange& ex) {
                 static_cast<void>(cancelled_opts.insert(code));
             }
         }
-        }
+    }
 
     // For each requested option code get the first instance of the option
     // to be returned to the client.
index 43f31874958d6e4e4d6ffa2659e01d906eefde3f..aad89b24fac0c0a93e40b97fc6becf14ad240b8d 100644 (file)
@@ -3228,8 +3228,8 @@ namespace isc { namespace dhcp {
 #line 2013 "dhcp6_parser.yy"
                                                  {
     ctx.unique("csv-format", ctx.loc2pos(yystack_[2].location));
-    ElementPtr space(new BoolElement(yystack_[0].value.as < bool > (), ctx.loc2pos(yystack_[0].location)));
-    ctx.stack_.back()->set("csv-format", space);
+    ElementPtr csv(new BoolElement(yystack_[0].value.as < bool > (), ctx.loc2pos(yystack_[0].location)));
+    ctx.stack_.back()->set("csv-format", csv);
 }
 #line 3235 "dhcp6_parser.cc"
     break;
@@ -3248,8 +3248,8 @@ namespace isc { namespace dhcp {
 #line 2025 "dhcp6_parser.yy"
                                                  {
     ctx.unique("never-send", ctx.loc2pos(yystack_[2].location));
-    ElementPtr persist(new BoolElement(yystack_[0].value.as < bool > (), ctx.loc2pos(yystack_[0].location)));
-    ctx.stack_.back()->set("never-send", persist);
+    ElementPtr cancel(new BoolElement(yystack_[0].value.as < bool > (), ctx.loc2pos(yystack_[0].location)));
+    ctx.stack_.back()->set("never-send", cancel);
 }
 #line 3255 "dhcp6_parser.cc"
     break;
index 759f57afe0ada59b3987cc591ce417dace41fd81..2c0b7a9c7ea91a2731f72900171e8a980ae74feb 100644 (file)
@@ -2012,8 +2012,8 @@ option_data_space: space;
 
 option_data_csv_format: CSV_FORMAT COLON BOOLEAN {
     ctx.unique("csv-format", ctx.loc2pos(@1));
-    ElementPtr space(new BoolElement($3, ctx.loc2pos(@3)));
-    ctx.stack_.back()->set("csv-format", space);
+    ElementPtr csv(new BoolElement($3, ctx.loc2pos(@3)));
+    ctx.stack_.back()->set("csv-format", csv);
 };
 
 option_data_always_send: ALWAYS_SEND COLON BOOLEAN {
@@ -2024,8 +2024,8 @@ option_data_always_send: ALWAYS_SEND COLON BOOLEAN {
 
 option_data_never_send: NEVER_SEND COLON BOOLEAN {
     ctx.unique("never-send", ctx.loc2pos(@1));
-    ElementPtr persist(new BoolElement($3, ctx.loc2pos(@3)));
-    ctx.stack_.back()->set("never-send", persist);
+    ElementPtr cancel(new BoolElement($3, ctx.loc2pos(@3)));
+    ctx.stack_.back()->set("never-send", cancel);
 };
 
 // ---- pools ------------------------------------