Go to the documentation of this file.
47 #define TEREDO_ORIG_INDICATION_LENGTH 8
48 #define TEREDO_MAX_PORTS 4
49 #define TEREDO_UNSET_PORT -1
51 static bool g_teredo_enabled =
true;
52 static bool g_teredo_ports_any =
true;
53 static int g_teredo_ports_cnt = 0;
59 SCLogDebug(
"ports %u->%u ports %d %d %d %d", sp, dp, g_teredo_ports[0], g_teredo_ports[1],
60 g_teredo_ports[2], g_teredo_ports[3]);
62 if (g_teredo_enabled) {
64 if (g_teredo_ports_any) {
68 for (
int i = 0; i < g_teredo_ports_cnt; i++) {
71 const int port = g_teredo_ports[i];
72 if (port == (
const int)sp || port == (
const int)dp)
79 static void DecodeTeredoConfigPorts(
const char *pstr)
83 if (strcmp(pstr,
"any") == 0) {
84 g_teredo_ports_any =
true;
91 g_teredo_ports_any =
false;
92 g_teredo_ports_cnt = 0;
98 g_teredo_ports[g_teredo_ports_cnt++] = (int)p->port;
107 if (
ConfGetBool(
"decoder.teredo.enabled", &enabled) == 1) {
109 g_teredo_enabled =
true;
111 g_teredo_enabled =
false;
114 if (g_teredo_enabled) {
116 if (node && node->
val) {
117 DecodeTeredoConfigPorts(node->
val);
128 const uint8_t *pkt, uint16_t
len)
132 if (!g_teredo_enabled)
135 const uint8_t *start = pkt;
144 if (start[0] == 0x0) {
146 if (start[1] == 0x0) {
185 uint32_t blen =
len - (uint32_t)(start - pkt);
#define IPV6_GET_RAW_PLEN(ip6h)
void StatsIncr(ThreadVars *tv, uint16_t id)
Increments the local counter.
#define IPV6_GET_RAW_HLIM(ip6h)
#define IPV6_GET_RAW_NH(ip6h)
int ConfGetBool(const char *name, int *val)
Retrieve a configuration value as a boolean.
void DecodeTeredoConfig(void)
@ DECODE_TUNNEL_IPV6_TEREDO
ConfNode * ConfGetNode(const char *name)
Get a ConfNode by name.
#define IP_GET_RAW_VER(pkt)
#define PKT_SET_SRC(p, src_val)
int DetectPortParse(const DetectEngineCtx *de_ctx, DetectPort **head, const char *str)
Function for parsing port strings.
bool DecodeTeredoEnabledForPort(const uint16_t sp, const uint16_t dp)
Per thread variable structure.
#define SCLogWarning(...)
Macro used to log WARNING messages.
Port structure for detection engine.
void PacketEnqueueNoLock(PacketQueueNoLock *qnl, Packet *p)
#define TEREDO_UNSET_PORT
#define TEREDO_ORIG_INDICATION_LENGTH
Structure to hold thread specific data for all decode modules.
PacketQueueNoLock decode_pq
Packet * PacketTunnelPktSetup(ThreadVars *tv, DecodeThreadVars *dtv, Packet *parent, const uint8_t *pkt, uint32_t len, enum DecodeTunnelProto proto)
Setup a pseudo packet (tunnel)
void DetectPortCleanupList(const DetectEngineCtx *de_ctx, DetectPort *head)
Free a DetectPort list and each of its members.
#define DEBUG_VALIDATE_BUG_ON(exp)
int DecodeTeredo(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, const uint8_t *pkt, uint16_t len)
Function to decode Teredo packets.