<html>
    <head>
      <base href="https://bugzilla.netfilter.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - ULOGD_RET_RAWSTR type is not listed on ulogd_key_size() and type_to_string()"
   href="https://bugzilla.netfilter.org/show_bug.cgi?id=1192">1192</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>ULOGD_RET_RAWSTR type is not listed on ulogd_key_size() and type_to_string()
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>ulogd
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>SVN (please provide timestamp)
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P5
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>ulogd
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>netfilter-buglog@lists.netfilter.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>jean@phpnet.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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");
     }</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are watching all bug changes.</li>
      </ul>
    </body>
</html>