]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#4368] Addressed comments
authorFrancis Dupont <fdupont@isc.org>
Thu, 7 May 2026 12:36:48 +0000 (14:36 +0200)
committerFrancis Dupont <fdupont@isc.org>
Thu, 7 May 2026 14:13:01 +0000 (16:13 +0200)
changelog_unreleased/4368-rfc9915-support
doc/sphinx/arm/dhcp6-srv.rst
src/bin/dhcp6/dhcp6_lexer.cc
src/bin/dhcp6/dhcp6_messages.mes
src/bin/dhcp6/dhcp6_srv.cc
src/bin/dhcp6/dhcp6_srv.h

index d5f7a1a421348934cfb1dedf4fa2cb1b5d92f785..68482022dc6b91a8752dc2ea91fb42d6ca9904ea 100644 (file)
@@ -1,4 +1,4 @@
 [func]*                fdupont
-       Added support fo the last DHCP RFC 9915 including
+       Added support for the last DHCP RFC 9915 including
        the deprecation of the unicast option.
        (Gitlab #4368)
index a110848fad79bc8d3ff0987a7c13f777f1ef91d8..c965ab2636fbd4c2c859734461dfe48787368bf0 100644 (file)
@@ -1152,7 +1152,8 @@ allows clients to send unicast messages to the server.
 
 .. note::
 
-   The unicast option was deprecated by the last DHCPv6 RFC, trying
+   The unicast option was deprecated by the `RFC 9915
+   <https://datatracker.ietf.org/doc/html/rfc9915>`__, trying
    to add one in responses triggers a warning and the server no
    longer accepts unicast direct queries (vs unicast relayed queries).
 
@@ -1898,7 +1899,8 @@ types are given in :ref:`dhcp-types`.
    | addr-reg-enable          | 148             | empty           | false           |
    +--------------------------+-----------------+-----------------+-----------------+
 
-The unicast option was deprecated by the last DHCPv6 RFC, it is still
+The unicast option was deprecated by the `RFC 9915
+<https://datatracker.ietf.org/doc/html/rfc9915>`__, it is still
 supported but not be used and will be removed in a further Kea release.
 
 Options marked with (1) have option definitions, but the logic behind
index c268ecb155f1ddc02285cd9f08f136727655b9ec..602aeab537bfae81cebddd3cac9555408a31ceb7 100644 (file)
@@ -328,7 +328,6 @@ typedef int16_t flex_int16_t;
 typedef uint16_t flex_uint16_t;
 typedef int32_t flex_int32_t;
 typedef uint32_t flex_uint32_t;
-typedef uint64_t flex_uint64_t;
 #else
 typedef signed char flex_int8_t;
 typedef short int flex_int16_t;
@@ -453,7 +452,7 @@ typedef size_t yy_size_t;
 #endif
 
 /* %if-not-reentrant */
-extern yy_size_t yyleng;
+extern int yyleng;
 /* %endif */
 
 /* %if-c-only */
@@ -506,7 +505,7 @@ struct yy_buffer_state
        /* Number of characters read into yy_ch_buf, not including EOB
         * characters.
         */
-       yy_size_t yy_n_chars;
+       int yy_n_chars;
 
        /* Whether we "own" the buffer - i.e., we know we created it,
         * and can realloc() it to grow it, and should free() it to
@@ -587,8 +586,8 @@ static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */
 /* %not-for-header */
 /* yy_hold_char holds the character lost when yytext is formed. */
 static char yy_hold_char;
-static yy_size_t yy_n_chars;           /* number of characters read into yy_ch_buf */
-yy_size_t yyleng;
+static int yy_n_chars;         /* number of characters read into yy_ch_buf */
+int yyleng;
 
 /* Points to current character in buffer. */
 static char *yy_c_buf_p = NULL;
@@ -618,7 +617,7 @@ static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file  );
 
 YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size  );
 YY_BUFFER_STATE yy_scan_string ( const char *yy_str  );
-YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, yy_size_t len  );
+YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len  );
 
 /* %endif */
 
@@ -686,7 +685,7 @@ static void yynoreturn yy_fatal_error ( const char* msg  );
 #define YY_DO_BEFORE_ACTION \
        (yytext_ptr) = yy_bp; \
 /* %% [2.0] code to fiddle yytext and yyleng for yymore() goes here \ */\
-       yyleng = (yy_size_t) (yy_cp - yy_bp); \
+       yyleng = (int) (yy_cp - yy_bp); \
        (yy_hold_char) = *yy_cp; \
        *yy_cp = '\0'; \
 /* %% [3.0] code to copy yytext_ptr to yytext[] goes here, if %array \ */\
@@ -2309,7 +2308,7 @@ using namespace isc::dhcp;
 
 /* To avoid the call to exit... oops! */
 #define YY_FATAL_ERROR(msg) isc::dhcp::Parser6Context::fatal(msg)
-#line 2312 "dhcp6_lexer.cc"
+#line 2311 "dhcp6_lexer.cc"
 /* noyywrap disables automatic rewinding for the next file to parse. Since we
    always parse only a single string, there's no need to do any wraps. And
    using yywrap requires linking with -lfl, which provides the default yywrap
@@ -2335,8 +2334,8 @@ using namespace isc::dhcp;
    by moving it ahead by yyleng bytes. yyleng specifies the length of the
    currently matched token. */
 #define YY_USER_ACTION  driver.loc_.columns(yyleng);
+#line 2337 "dhcp6_lexer.cc"
 #line 2338 "dhcp6_lexer.cc"
-#line 2339 "dhcp6_lexer.cc"
 
 #define INITIAL 0
 #define COMMENT 1
@@ -2392,7 +2391,7 @@ FILE *yyget_out ( void );
 
 void yyset_out  ( FILE * _out_str  );
 
-                       yy_size_t yyget_leng ( void );
+                       int yyget_leng ( void );
 
 char *yyget_text ( void );
 
@@ -2479,7 +2478,7 @@ static int input ( void );
        if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
                { \
                int c = '*'; \
-               yy_size_t n; \
+               int n; \
                for ( n = 0; n < max_size && \
                             (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
                        buf[n] = (char) c; \
@@ -2666,7 +2665,7 @@ YY_DECL
     }
 
 
-#line 2669 "dhcp6_lexer.cc"
+#line 2668 "dhcp6_lexer.cc"
 
        while ( /*CONSTCOND*/1 )                /* loops until end-of-file is reached */
                {
@@ -6081,7 +6080,7 @@ YY_RULE_SETUP
 #line 2702 "dhcp6_lexer.ll"
 ECHO;
        YY_BREAK
-#line 6084 "dhcp6_lexer.cc"
+#line 6083 "dhcp6_lexer.cc"
 
        case YY_END_OF_BUFFER:
                {
@@ -6283,7 +6282,7 @@ static int yy_get_next_buffer (void)
 
        else
                {
-                       yy_size_t num_to_read =
+                       int num_to_read =
                        YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
 
                while ( num_to_read <= 0 )
@@ -6297,7 +6296,7 @@ static int yy_get_next_buffer (void)
 
                        if ( b->yy_is_our_buffer )
                                {
-                               yy_size_t new_size = b->yy_buf_size * 2;
+                               int new_size = b->yy_buf_size * 2;
 
                                if ( new_size <= 0 )
                                        b->yy_buf_size += b->yy_buf_size / 8;
@@ -6355,7 +6354,7 @@ static int yy_get_next_buffer (void)
 
        if (((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
                /* Extend the array by 50%, plus the number we really need. */
-               yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
+               int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
                YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc(
                        (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size  );
                if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
@@ -6476,7 +6475,7 @@ static int yy_get_next_buffer (void)
 
                else
                        { /* need more input */
-                       yy_size_t offset = (yy_c_buf_p) - (yytext_ptr);
+                       int offset = (int) ((yy_c_buf_p) - (yytext_ptr));
                        ++(yy_c_buf_p);
 
                        switch ( yy_get_next_buffer(  ) )
@@ -6919,12 +6918,12 @@ YY_BUFFER_STATE yy_scan_string (const char * yystr )
  * 
  * @return the newly allocated buffer state object.
  */
-YY_BUFFER_STATE yy_scan_bytes  (const char * yybytes, yy_size_t  _yybytes_len )
+YY_BUFFER_STATE yy_scan_bytes  (const char * yybytes, int  _yybytes_len )
 {
        YY_BUFFER_STATE b;
        char *buf;
        yy_size_t n;
-       yy_size_t i;
+       int i;
     
        /* Get memory for full buffer, including space for trailing EOB's. */
        n = (yy_size_t) (_yybytes_len + 2);
@@ -6971,7 +6970,7 @@ static void yynoreturn yy_fatal_error (const char* msg )
        do \
                { \
                /* Undo effects of setting up yytext. */ \
-        yy_size_t yyless_macro_arg = (n); \
+        int yyless_macro_arg = (n); \
         YY_LESS_LINENO(yyless_macro_arg);\
                yytext[yyleng] = (yy_hold_char); \
                (yy_c_buf_p) = yytext + yyless_macro_arg; \
@@ -7015,7 +7014,7 @@ FILE *yyget_out  (void)
 /** Get the length of the current token.
  * 
  */
-yy_size_t yyget_leng  (void)
+int yyget_leng  (void)
 {
         return yyleng;
 }
index 00167e26043337b3a564be2be4a7a36a7d1adb7f..508b349e249d83fee2a64f13d92acce7955fd4bc 100644 (file)
@@ -54,9 +54,8 @@ register, and the description of the problem are printed.
 
 % DHCP6_ADD_DEPRECATED_UNICAST %1: adding deprecated unicast option
 The warning is logged when the deprecated unicast option is added
-to a response which is displayed. Outside testing purpose the
-server configuration should be fixed as unicast queries are no
-longer accepted.
+to the response. Outside testing purpose the server configuration should
+be fixed as direct unicast queries are no longer accepted.
 
 % DHCP6_ADD_GLOBAL_STATUS_CODE %1: adding Status Code to DHCPv6 packet: %2
 Logged at debug log level 50.
index 3bcc25e25b766de0beeb5b22b4d022f6a95d2930..854b08daca40e62c10aa8663dd8bff35ccc0f6fd 100644 (file)
@@ -408,12 +408,12 @@ Dhcpv6Srv::testServerID(const Pkt6Ptr& pkt) {
 bool
 Dhcpv6Srv::testUnicast(const Pkt6Ptr& pkt) const {
     if (pkt->relay_info_.empty() && !pkt->getLocalAddr().isV6Multicast()) {
-       LOG_DEBUG(bad_packet6_logger, DBGLVL_PKT_HANDLING, DHCP6_PACKET_DROP_UNICAST)
-           .arg(pkt->getLabel())
-           .arg(pkt->getName());
-       StatsMgr::instance().addValue("pkt6-rfc-violation",
-                                     static_cast<int64_t>(1));
-       return (false);
+        LOG_DEBUG(bad_packet6_logger, DBGLVL_PKT_HANDLING, DHCP6_PACKET_DROP_UNICAST)
+            .arg(pkt->getLabel())
+            .arg(pkt->getName());
+        StatsMgr::instance().addValue("pkt6-rfc-violation",
+                                      static_cast<int64_t>(1));
+        return (false);
     }
     return (true);
 }
index f37f1d338b639855e816621aac8fcd676e160831..8c9195384928f6ad45597c98c1e7ea467c5fdefd 100644 (file)
@@ -330,10 +330,10 @@ protected:
 
     /// @brief Check if the message can be sent to unicast.
     ///
-    /// RFC 9915 updated to refuse all messages from clients.
+    /// RFC 9915 updated to refuse direct messages that are unicast.
     ///
     /// @param pkt DHCPv6 message to be checked.
-    /// @return false if the message has been sent to unicast address.
+    /// @return false if the message is direct and to unicast address.
     bool testUnicast(const Pkt6Ptr& pkt) const;
 
     /// @brief Verifies if specified packet meets RFC requirements