]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#1680] added ChangeLog entry and addressed comments
authorRazvan Becheriu <razvan@isc.org>
Fri, 23 Apr 2021 17:32:11 +0000 (20:32 +0300)
committerRazvan Becheriu <razvan@isc.org>
Wed, 5 May 2021 17:12:49 +0000 (20:12 +0300)
ChangeLog
doc/sphinx/arm/hooks.rst
src/lib/eval/tests/context_unittest.cc
src/lib/eval/token.cc

index 977defd04d55ee0549cea4a1bd7b047d95b24ff3..ba1dd47879c30bb3344abd365d3ae560a7432c03 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+1895.  [func]          razvan
+       Added additional evaluation tokens to extract and print data:
+       addrtotext, int8totext, int16totext, int32totext, uint8totext,
+       uint16totext, uint32totext.
+       (Gitlab #1680)
+
 1894.  [func]          fdupont
        Implemented 'auth' logger, dedicated to logging access
        control information, such as basic HTTP authentication.
index eb4be73687d1277898d8c0eaf7b6eb91cc8c23ed..5f4f03b591250798a65b853021e2d9f12330c7db 100644 (file)
@@ -321,7 +321,9 @@ loaded by the correct process per the table below.
    |                 |               |sufficient it may be used directly. If your jurisdiction    |
    |                 |               |requires that you save a different set of information, you  |
    |                 |               |may use it as a template or example and create your own     |
-   |                 |               |custom logging hooks.                                       |
+   |                 |               |custom logging hooks. In Kea 1.9.7 additional parameters    |
+   |                 |               |have been added to give users more flexibility regarding    |
+   |                 |               |what information should be logged.                          |
    +-----------------+---------------+------------------------------------------------------------+
    | Flexible        | Support       |Kea software provides a way to handle host reservations that|
    | Identifier      | customers     |include addresses, prefixes, options, client classes and    |
index 13eb9b8a772589ab9928d3b01becf2c6f43f5d2e..617204dea84530321890aa12c41885f56cef381f 100644 (file)
@@ -493,12 +493,12 @@ public:
     }
 
     /// @brief checks if the given token is a inttotext operator
-    template <typename IntegerType, typename TokenInteger>
+    template <typename IntegerType, typename TokenIntegerType>
     void checkTokenIntToText(const TokenPtr& token,
                              const std::string& expected) {
         ASSERT_TRUE(token);
-        boost::shared_ptr<TokenInteger> inttotext =
-            boost::dynamic_pointer_cast<TokenInteger>(token);
+        boost::shared_ptr<TokenIntegerType> inttotext =
+            boost::dynamic_pointer_cast<TokenIntegerType>(token);
         EXPECT_TRUE(inttotext);
 
         Pkt4Ptr pkt4(new Pkt4(DHCPDISCOVER, 12345));
index 4bc96daf9454dbf171d840dbb71386c5ea62d027..18e9782f872abb14ef953faf131ae73ea3121417 100644 (file)
@@ -116,6 +116,7 @@ TokenIpAddressToText::evaluate(Pkt& /*pkt*/, ValueStack& values) {
     if (!size) {
         return;
     }
+
     values.pop();
 
     if ((size != V4ADDRESS_LEN) && (size != V6ADDRESS_LEN)) {
@@ -143,12 +144,13 @@ TokenInt8ToText::evaluate(Pkt& /*pkt*/, ValueStack& values) {
         isc_throw(EvalBadStack, "Incorrect empty stack.");
     }
 
-    size_t size;
     string op = values.top();
+    size_t size = op.size();
 
-    if (!(size = op.size())) {
+    if (!size) {
         return;
     }
+
     values.pop();
 
     if (size != sizeof(int8_t)) {
@@ -171,12 +173,13 @@ TokenInt16ToText::evaluate(Pkt& /*pkt*/, ValueStack& values) {
         isc_throw(EvalBadStack, "Incorrect empty stack.");
     }
 
-    size_t size;
     string op = values.top();
+    size_t size = op.size();
 
-    if (!(size = op.size())) {
+    if (!size) {
         return;
     }
+
     values.pop();
 
     if (size != sizeof(int16_t)) {
@@ -201,12 +204,13 @@ TokenInt32ToText::evaluate(Pkt& /*pkt*/, ValueStack& values) {
         isc_throw(EvalBadStack, "Incorrect empty stack.");
     }
 
-    size_t size;
     string op = values.top();
+    size_t size = op.size();
 
-    if (!(size = op.size())) {
+    if (!size) {
         return;
     }
+
     values.pop();
 
     if (size != sizeof(int32_t)) {
@@ -231,12 +235,13 @@ TokenUInt8ToText::evaluate(Pkt& /*pkt*/, ValueStack& values) {
         isc_throw(EvalBadStack, "Incorrect empty stack.");
     }
 
-    size_t size;
     string op = values.top();
+    size_t size = op.size();
 
-    if (!(size = op.size())) {
+    if (!size) {
         return;
     }
+
     values.pop();
 
     if (size != sizeof(uint8_t)) {
@@ -259,12 +264,13 @@ TokenUInt16ToText::evaluate(Pkt& /*pkt*/, ValueStack& values) {
         isc_throw(EvalBadStack, "Incorrect empty stack.");
     }
 
-    size_t size;
     string op = values.top();
+    size_t size = op.size();
 
-    if (!(size = op.size())) {
+    if (!size) {
         return;
     }
+
     values.pop();
 
     if (size != sizeof(uint16_t)) {
@@ -289,12 +295,13 @@ TokenUInt32ToText::evaluate(Pkt& /*pkt*/, ValueStack& values) {
         isc_throw(EvalBadStack, "Incorrect empty stack.");
     }
 
-    size_t size;
     string op = values.top();
+    size_t size = op.size();
 
-    if (!(size = op.size())) {
+    if (!size) {
         return;
     }
+
     values.pop();
 
     if (size != sizeof(uint32_t)) {