[Bug 1192] New: ULOGD_RET_RAWSTR type is not listed on ulogd_key_size() and type_to_string()

bugzilla-daemon at netfilter.org bugzilla-daemon at netfilter.org
Thu Oct 19 14:13:19 CEST 2017


https://bugzilla.netfilter.org/show_bug.cgi?id=1192

            Bug ID: 1192
           Summary: ULOGD_RET_RAWSTR type is not listed on
                    ulogd_key_size() and type_to_string()
           Product: ulogd
           Version: SVN (please provide timestamp)
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P5
         Component: ulogd
          Assignee: netfilter-buglog at lists.netfilter.org
          Reporter: jean at phpnet.org

ULOGD_RET_RAWSTR value type is not defined on the functions ulogd_key_size()
and type_to_string() on ulogd.c.

ULOGD_RET_RAWSTR seems to be only used on IP2BIN which will always return a 34
char long value, some possible solutions :
 1. Make ulogd_key_size() return a length of 16 for the RAWSTR type as
   for the IP6ADDR type which would result in allocating 40 chars
 2. Add on sql_createstmt() "elseif(key->type == ULOGD_RET_RAWSTR) {
   size += 35; }"
 3. Use the ULOGD_RET_IP6ADDR type on IP2BIN (this type doesnt seems to be used
anywhere else) and remove ULOGD_RET_RAWSTR ; this type would also
   need to be added to the __format_query_db switch() on db.c

The first 2 solution might be problematic if RAWSTR is used by other plugins to
store lengthier informations.


Patch proposal implementing the 1st solution and adding the type on
type_to_string() :
--- src/ulogd.c    2016-12-17 16:25:45.000000000 +0100
+++ src/ulogd.c    2017-10-02 18:01:26.413740164 +0200
@@ -188,6 +188,7 @@
         ret = 8;
         break;
     case ULOGD_RET_IP6ADDR:
+    case ULOGD_RET_RAWSTR:
         ret = 16;
         break;
     case ULOGD_RET_STRING:
@@ -306,6 +307,9 @@
         case ULOGD_RET_RAW:
             return strdup("raw data");
             break;
+        case ULOGD_RET_RAWSTR:
+            return strdup("raw string");
+            break;
         default:
             return strdup("Unknown type");
     }

-- 
You are receiving this mail because:
You are watching all bug changes.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.netfilter.org/pipermail/netfilter-buglog/attachments/20171019/feee98e6/attachment.html>


More information about the netfilter-buglog mailing list