3544. If the `ports` parameter is missing, or set to `any`, all ports will be
inspected for possible presence of Teredo.
+IP-in-IP
+~~~~~~~~
+
+IPv4
+^^^^
+
+Enable decoding IP-in-IP tunneling for IPv4. There is also a dedicated option to
+set the parent flow for packets, when the engine sees such IP-in-IP packets. This
+option can be enabled regardless of enabled the ipip tunneling.
+As this may impact signature matching and flow tracking, these are disabled by default.
+
+::
+
+ # IP-in-IP tunneling for ipv4 over ipv4 handling.
+ # Disabled by default, as these will impact number of alerts seen, as well as
+ # number of flows.
+ # ipv4:
+ # ipip:
+ # enabled: true
+ # track-parent-flow: true # disabled by default
+
Advanced Options
----------------
#include "flow.h"
#include "util-print.h"
+static bool g_ipv4_ipip_enabled = false;
+static bool g_ipv4_ipip_parent_flow_enabled = false;
+
+void DecodeIPV4IpInIpConfig(void)
+{
+ int enabled = 0;
+
+ if (ConfGetBool("decoder.ipv4.ipip.enabled", &enabled) == 1) {
+ if (enabled) {
+ g_ipv4_ipip_enabled = true;
+ } else {
+ g_ipv4_ipip_enabled = false;
+ }
+ enabled = 0;
+ }
+ if (ConfGetBool("decoder.ipv4.ipip.track-parent-flow", &enabled) == 1) {
+ if (enabled) {
+ g_ipv4_ipip_parent_flow_enabled = true;
+ } else {
+ g_ipv4_ipip_parent_flow_enabled = false;
+ }
+ }
+}
+
/* Generic validation
*
* [--type--][--len---]
case IPPROTO_ESP:
DecodeESP(tv, dtv, p, pkt + IPV4_GET_HLEN(p), IPV4_GET_IPLEN(p) - IPV4_GET_HLEN(p));
break;
-
+ case IPPROTO_IPIP: {
+ /* optional in Suricata 7 as it wasn't always present */
+ if (g_ipv4_ipip_enabled) {
+ /* spawn off tunnel packet */
+ Packet *tp = PacketTunnelPktSetup(tv, dtv, p, pkt + IPV4_GET_HLEN(p),
+ IPV4_GET_IPLEN(p) - IPV4_GET_HLEN(p), DECODE_TUNNEL_IPV4);
+ if (tp != NULL) {
+ PKT_SET_SRC(tp, PKT_SRC_DECODER_IPV4);
+ PacketEnqueueNoLock(&tv->decode_pq, tp);
+ }
+ }
+ if (g_ipv4_ipip_parent_flow_enabled) {
+ FlowSetupPacket(p);
+ }
+ break;
+ }
case IPPROTO_IPV6:
{
/* spawn off tunnel packet */
# maximum number of decoder layers for a packet
# max-layers: 16
+ # IP-in-IP tunneling for ipv4 over ipv4 handling.
+ # Disabled by default, as these will impact number of alerts seen, as well as
+ # number of flows.
+ # ipv4:
+ # ipip:
+ # enabled: true
+ # track-parent-flow: true # disabled by default
+
##
## Performance tuning and profiling
##