Skip to content

Commit

Permalink
decode/erspan: ERSPAN TypeI configurable
Browse files Browse the repository at this point in the history
For the backport, ERSPAN TypeI decode is

1. Disabled by default
2. Configurable: `decoder.erspan_typeI.enabled`
  • Loading branch information
jlucovsky committed Mar 5, 2020
1 parent e00de3d commit ae6beed
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/decode-erspan.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,26 @@
* \brief Functions to decode ERSPAN Type I and II packets
*/

bool g_erspan_typeI_enabled = false;

void DecodeERSPANConfig(void)
{
int enabled = 0;
if (ConfGetBool("decoder.erspan.typeI.enabled", &enabled) == 1) {
g_erspan_typeI_enabled = (enabled == 1);
}
SCLogDebug("ERSPAN Type I decode support %s", g_erspan_typeI_enabled ? "enabled" : "disabled");
}

/**
* \brief ERSPAN Type I
*/
int DecodeERSPANTypeI(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p,
const uint8_t *pkt, uint32_t len, PacketQueue *pq)
{
if (unlikely(!g_erspan_typeI_enabled))
return TM_ECODE_FAILED;

StatsIncr(tv, dtv->counter_erspan);

return DecodeEthernet(tv, dtv, p, pkt, len, pq);
Expand Down
1 change: 1 addition & 0 deletions src/decode-erspan.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,5 @@ typedef struct ErspanHdr_ {
uint32_t padding;
} __attribute__((__packed__)) ErspanHdr;

void DecodeERSPANConfig(void);
#endif /* __DECODE_ERSPAN_H__ */
1 change: 1 addition & 0 deletions src/decode.c
Original file line number Diff line number Diff line change
Expand Up @@ -732,6 +732,7 @@ void DecodeGlobalConfig(void)
{
DecodeTeredoConfig();
DecodeVXLANConfig();
DecodeERSPANConfig();
}

/**
Expand Down
4 changes: 4 additions & 0 deletions suricata.yaml.in
Original file line number Diff line number Diff line change
Expand Up @@ -1338,6 +1338,10 @@ decoder:
vxlan:
enabled: true
ports: $VXLAN_PORTS # syntax: '8472, 4789'
# ERSPAN Type I decode support
erspan:
typeI:
enabled: false


##
Expand Down

0 comments on commit ae6beed

Please sign in to comment.