suricata
decode-geneve.c File Reference
#include "suricata-common.h"
#include "decode.h"
#include "decode-geneve.h"
#include "decode-events.h"
#include "detect.h"
#include "detect-engine-port.h"
#include "flow.h"
#include "util-validate.h"
#include "util-unittest.h"
#include "util-debug.h"
#include "pkt-var.h"
#include "util-profiling.h"
#include "host.h"
Include dependency graph for decode-geneve.c:

Go to the source code of this file.

Data Structures

struct  GeneveOption_
 
struct  GeneveHeader_
 

Macros

#define VALID_GENEVE_VERSIONS
 
#define GENEVE_VERSION(hdr_ptr)   (hdr_ptr->ver_plus_len >> 6)
 
#define GENEVE_RESERVED_FLAGS(hdr_ptr)   (hdr_ptr->flags & 0x3F)
 
#define GENEVE_MIN_HEADER_LEN   sizeof(GeneveHeader)
 
#define GENEVE_TOTAL_OPT_LEN(hdr_ptr)   ((uint8_t)((hdr_ptr->ver_plus_len & 0x3F) << 2))
 
#define GENEVE_TOTAL_HEADER_LEN(hdr_ptr)   (GENEVE_MIN_HEADER_LEN + GENEVE_TOTAL_OPT_LEN(hdr_ptr))
 
#define GENEVE_MIN_SINGLE_OPT_LEN   sizeof(GeneveOption)
 
#define GENEVE_SINGLE_OPT_LEN(option_ptr)   ((uint8_t)((option_ptr->flags_plus_len & 0x1F) << 2))
 
#define GENEVE_SINGLE_OPT_TOTAL_LEN(option_ptr)   (GENEVE_MIN_SINGLE_OPT_LEN + GENEVE_SINGLE_OPT_LEN(option_ptr))
 
#define GENEVE_MAX_PORTS   4
 
#define GENEVE_UNSET_PORT   -1
 
#define GENEVE_DEFAULT_PORT   6081
 
#define GENEVE_DEFAULT_PORT_S   "6081"
 

Typedefs

typedef struct GeneveOption_ GeneveOption
 
typedef struct GeneveHeader_ GeneveHeader
 

Functions

bool DecodeGeneveEnabledForPort (const uint16_t sp, const uint16_t dp)
 
void DecodeGeneveConfig (void)
 
int DecodeGeneve (ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, const uint8_t *pkt, uint32_t len)
 
void DecodeGeneveRegisterTests (void)
 

Detailed Description

Author
Ali Jad Khalil jadkh.nosp@m.al@a.nosp@m.mazon.nosp@m..com

Geneve tunneling scheme decoder.

This implementation is based on the following specification doc: https://tools.ietf.org/html/draft-ietf-nvo3-geneve-16#section-3

Definition in file decode-geneve.c.

Macro Definition Documentation

◆ GENEVE_DEFAULT_PORT

#define GENEVE_DEFAULT_PORT   6081

Definition at line 66 of file decode-geneve.c.

◆ GENEVE_DEFAULT_PORT_S

#define GENEVE_DEFAULT_PORT_S   "6081"

Definition at line 67 of file decode-geneve.c.

◆ GENEVE_MAX_PORTS

#define GENEVE_MAX_PORTS   4

Definition at line 64 of file decode-geneve.c.

◆ GENEVE_MIN_HEADER_LEN

#define GENEVE_MIN_HEADER_LEN   sizeof(GeneveHeader)

Definition at line 55 of file decode-geneve.c.

◆ GENEVE_MIN_SINGLE_OPT_LEN

#define GENEVE_MIN_SINGLE_OPT_LEN   sizeof(GeneveOption)

Definition at line 59 of file decode-geneve.c.

◆ GENEVE_RESERVED_FLAGS

#define GENEVE_RESERVED_FLAGS (   hdr_ptr)    (hdr_ptr->flags & 0x3F)

Definition at line 53 of file decode-geneve.c.

◆ GENEVE_SINGLE_OPT_LEN

#define GENEVE_SINGLE_OPT_LEN (   option_ptr)    ((uint8_t)((option_ptr->flags_plus_len & 0x1F) << 2))

Definition at line 60 of file decode-geneve.c.

◆ GENEVE_SINGLE_OPT_TOTAL_LEN

#define GENEVE_SINGLE_OPT_TOTAL_LEN (   option_ptr)    (GENEVE_MIN_SINGLE_OPT_LEN + GENEVE_SINGLE_OPT_LEN(option_ptr))

Definition at line 61 of file decode-geneve.c.

◆ GENEVE_TOTAL_HEADER_LEN

#define GENEVE_TOTAL_HEADER_LEN (   hdr_ptr)    (GENEVE_MIN_HEADER_LEN + GENEVE_TOTAL_OPT_LEN(hdr_ptr))

Definition at line 57 of file decode-geneve.c.

◆ GENEVE_TOTAL_OPT_LEN

#define GENEVE_TOTAL_OPT_LEN (   hdr_ptr)    ((uint8_t)((hdr_ptr->ver_plus_len & 0x3F) << 2))

Definition at line 56 of file decode-geneve.c.

◆ GENEVE_UNSET_PORT

#define GENEVE_UNSET_PORT   -1

Definition at line 65 of file decode-geneve.c.

◆ GENEVE_VERSION

#define GENEVE_VERSION (   hdr_ptr)    (hdr_ptr->ver_plus_len >> 6)

Definition at line 52 of file decode-geneve.c.

◆ VALID_GENEVE_VERSIONS

#define VALID_GENEVE_VERSIONS
Value:
{ \
0 \
}

Definition at line 48 of file decode-geneve.c.

Typedef Documentation

◆ GeneveHeader

typedef struct GeneveHeader_ GeneveHeader

◆ GeneveOption

typedef struct GeneveOption_ GeneveOption

Function Documentation

◆ DecodeGeneve()

int DecodeGeneve ( ThreadVars tv,
DecodeThreadVars dtv,
Packet p,
const uint8_t *  pkt,
uint32_t  len 
)
Parameters
pktpayload data directly above UDP header
lenlength in bytes of pkt

Definition at line 185 of file decode-geneve.c.

References DEBUG_VALIDATE_BUG_ON, DECODE_TUNNEL_UNSET, eth_type, and unlikely.

◆ DecodeGeneveConfig()

void DecodeGeneveConfig ( void  )

Definition at line 128 of file decode-geneve.c.

References ConfGetBool().

Referenced by DecodeGlobalConfig().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DecodeGeneveEnabledForPort()

bool DecodeGeneveEnabledForPort ( const uint16_t  sp,
const uint16_t  dp 
)

Definition at line 91 of file decode-geneve.c.

References SCLogDebug.

◆ DecodeGeneveRegisterTests()

void DecodeGeneveRegisterTests ( void  )

Definition at line 490 of file decode-geneve.c.

References UtRegisterTest().

Here is the call graph for this function: