snort: add support for DIOCTL_GET_PRIV_DATA_LEN 09/43609/2
authorMohsin Kazmi <[email protected]>
Fri, 19 Sep 2025 16:07:56 +0000 (16:07 +0000)
committerDamjan Marion <[email protected]>
Sun, 21 Sep 2025 11:23:03 +0000 (11:23 +0000)
Type: improvement

This patch implements support for retrieving private data length via ioctl.
The private data pointer is set in the message header,
and when Snort processes the packet, it can request the length
of this private data through the ioctl interface.

Signed-off-by: Mohsin Kazmi <[email protected]>
Change-Id: I02a831557b349bab7c9c8fe2e00cd8b085d3e5f7

src/plugins/snort/daq/main.c

index 8c03ede..448ad83 100644 (file)
@@ -787,6 +787,21 @@ daq_vpp_ioctl (void *handle, DAQ_IoctlCmd cmd, void *arg, size_t arglen)
 
       return DAQ_ERROR_NODEV;
     }
+  else if (cmd == DIOCTL_GET_PRIV_DATA_LEN)
+    {
+      DIOCTL_GetPrivDataLen *gpl = (DIOCTL_GetPrivDataLen *) arg;
+
+      if (arglen != sizeof (DIOCTL_GetPrivDataLen))
+       return DAQ_ERROR_NOTSUP;
+      if (gpl->msg->priv != NULL)
+       gpl->priv_data_len = sizeof (daq_vpp_msg_pool_entry_t);
+      else
+       gpl->priv_data_len = 0;
+
+      DEBUG ("ioctl cmd %s %u", daq_vpp_ioctl_cmd_to_str (cmd),
+            gpl->priv_data_len);
+      return DAQ_SUCCESS;
+    }
 
   return DAQ_ERROR_NOTSUP;
 }