suricata
decode-ipv6.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  IPV6Hdr_
 
struct  IPV6Vars_
 get the highest proto/next header field we know More...
 
struct  IPV6FragHdr_
 
struct  IPV6AuthHdr_
 
struct  IPV6EspHdr_
 
struct  IPV6RouteHdr_
 
struct  IPV6OptHAO_
 
struct  IPV6OptRA_
 
struct  IPV6OptJumbo_
 
struct  IPV6HopOptsHdr_
 
struct  IPV6DstOptsHdr_
 
struct  IPV6GenOptHdr_
 
struct  IPV6ExtHdrs_
 

Macros

#define IPV6_HEADER_LEN   40
 
#define IPV6_MAXPACKET   65535 /* maximum packet size */
 
#define IPV6_MAX_OPT   40
 
#define s_ip6_src   ip6_hdrun2.ip6_un2.ip6_src
 
#define s_ip6_dst   ip6_hdrun2.ip6_un2.ip6_dst
 
#define s_ip6_addrs   ip6_hdrun2.ip6_addrs
 
#define s_ip6_vfc   ip6_hdrun.ip6_un2_vfc
 
#define s_ip6_flow   ip6_hdrun.ip6_un1.ip6_un1_flow
 
#define s_ip6_plen   ip6_hdrun.ip6_un1.ip6_un1_plen
 
#define s_ip6_nxt   ip6_hdrun.ip6_un1.ip6_un1_nxt
 
#define s_ip6_hlim   ip6_hdrun.ip6_un1.ip6_un1_hlim
 
#define IPV6_GET_RAW_VER(ip6h)   (((ip6h)->s_ip6_vfc & 0xf0) >> 4)
 
#define IPV6_GET_RAW_CLASS(ip6h)   ((SCNtohl((ip6h)->s_ip6_flow) & 0x0FF00000) >> 20)
 
#define IPV6_GET_RAW_FLOW(ip6h)   (SCNtohl((ip6h)->s_ip6_flow) & 0x000FFFFF)
 
#define IPV6_GET_RAW_NH(ip6h)   ((ip6h)->s_ip6_nxt)
 
#define IPV6_GET_RAW_PLEN(ip6h)   (SCNtohs((ip6h)->s_ip6_plen))
 
#define IPV6_GET_RAW_HLIM(ip6h)   ((ip6h)->s_ip6_hlim)
 
#define IPV6_SET_RAW_VER(ip6h, value)   ((ip6h)->s_ip6_vfc = (((ip6h)->s_ip6_vfc & 0x0f) | (value << 4)))
 
#define IPV6_SET_RAW_NH(ip6h, value)   ((ip6h)->s_ip6_nxt = (value))
 
#define IPV6_SET_L4PROTO(p, proto)   (p)->ip6vars.l4proto = (proto)
 
#define IPV6_SET_EXTHDRS_LEN(p, len)   (p)->ip6vars.exthdrs_len = (len)
 
#define IPV6_GET_VER(p)   IPV6_GET_RAW_VER((p)->ip6h)
 
#define IPV6_GET_CLASS(p)   IPV6_GET_RAW_CLASS((p)->ip6h)
 
#define IPV6_GET_FLOW(p)   IPV6_GET_RAW_FLOW((p)->ip6h)
 
#define IPV6_GET_NH(p)   (IPV6_GET_RAW_NH((p)->ip6h))
 
#define IPV6_GET_PLEN(p)   IPV6_GET_RAW_PLEN((p)->ip6h)
 
#define IPV6_GET_HLIM(p)   (IPV6_GET_RAW_HLIM((p)->ip6h))
 
#define IPV6_GET_L4PROTO(p)   ((p)->ip6vars.l4proto)
 
#define IPV6_GET_EXTHDRS_LEN(p)   ((p)->ip6vars.exthdrs_len)
 
#define CLEAR_IPV6_PACKET(p)
 
#define IPV6_EXTHDR_GET_FH_NH(p)   (p)->ip6eh.fh_nh
 
#define IPV6_EXTHDR_GET_FH_OFFSET(p)   (p)->ip6eh.fh_offset
 
#define IPV6_EXTHDR_GET_FH_FLAG(p)   (p)->ip6eh.fh_more_frags_set
 
#define IPV6_EXTHDR_GET_FH_ID(p)   (p)->ip6eh.fh_id
 
#define IPV6OPT_PAD1   0x00
 
#define IPV6OPT_PADN   0x01
 
#define IPV6OPT_RA   0x05
 
#define IPV6OPT_JUMBO   0xC2
 
#define IPV6OPT_HAO   0xC9
 
#define IPV6_EXTHDR_SET_FH(p)   (p)->ip6eh.fh_set = true
 
#define IPV6_EXTHDR_ISSET_FH(p)   (p)->ip6eh.fh_set
 
#define IPV6_EXTHDR_SET_RH(p)   (p)->ip6eh.rh_set = true
 
#define IPV6_EXTHDR_ISSET_RH(p)   (p)->ip6eh.rh_set
 

Typedefs

typedef struct IPV6Hdr_ IPV6Hdr
 
typedef struct IPV6Vars_ IPV6Vars
 get the highest proto/next header field we know More...
 
typedef struct IPV6OptHAO_ IPV6OptHAO
 
typedef struct IPV6OptRA_ IPV6OptRA
 
typedef struct IPV6OptJumbo_ IPV6OptJumbo
 
typedef struct IPV6GenOptHdr_ IPV6GenOptHdr
 
typedef struct IPV6ExtHdrs_ IPV6ExtHdrs
 

Functions

struct IPV6FragHdr_ __attribute__ ((__packed__)) IPV6FragHdr
 DNP3 link header. More...
 
void DecodeIPV6RegisterTests (void)
 this function registers unit tests for IPV6 decoder More...
 

Variables

uint8_t ip6fh_nxt
 
uint8_t ip6fh_reserved
 
uint16_t ip6fh_offlg
 
uint32_t ip6fh_ident
 
uint8_t ip6ah_nxt
 
uint8_t ip6ah_len
 
uint16_t ip6ah_reserved
 
uint32_t ip6ah_spi
 
uint32_t ip6ah_seq
 
uint32_t ip6esph_spi
 
uint32_t ip6esph_seq
 
uint8_t ip6rh_nxt
 
uint8_t ip6rh_len
 
uint8_t ip6rh_type
 
uint8_t ip6rh_segsleft
 
uint8_t ip6hh_nxt
 
uint8_t ip6hh_len
 
uint8_t ip6dh_nxt
 
uint8_t ip6dh_len
 

Detailed Description

Macro Definition Documentation

◆ CLEAR_IPV6_PACKET

#define CLEAR_IPV6_PACKET (   p)
Value:
do { \
(p)->ip6h = NULL; \
(p)->ip6vars.l4proto = 0; \
(p)->ip6vars.exthdrs_len = 0; \
memset(&(p)->ip6eh, 0x00, sizeof((p)->ip6eh)); \
} while (0)

Definition at line 112 of file decode-ipv6.h.

◆ IPV6_EXTHDR_GET_FH_FLAG

#define IPV6_EXTHDR_GET_FH_FLAG (   p)    (p)->ip6eh.fh_more_frags_set

Definition at line 130 of file decode-ipv6.h.

◆ IPV6_EXTHDR_GET_FH_ID

#define IPV6_EXTHDR_GET_FH_ID (   p)    (p)->ip6eh.fh_id

Definition at line 131 of file decode-ipv6.h.

◆ IPV6_EXTHDR_GET_FH_NH

#define IPV6_EXTHDR_GET_FH_NH (   p)    (p)->ip6eh.fh_nh

Definition at line 128 of file decode-ipv6.h.

◆ IPV6_EXTHDR_GET_FH_OFFSET

#define IPV6_EXTHDR_GET_FH_OFFSET (   p)    (p)->ip6eh.fh_offset

Definition at line 129 of file decode-ipv6.h.

◆ IPV6_EXTHDR_ISSET_FH

#define IPV6_EXTHDR_ISSET_FH (   p)    (p)->ip6eh.fh_set

Definition at line 240 of file decode-ipv6.h.

◆ IPV6_EXTHDR_ISSET_RH

#define IPV6_EXTHDR_ISSET_RH (   p)    (p)->ip6eh.rh_set

Definition at line 242 of file decode-ipv6.h.

◆ IPV6_EXTHDR_SET_FH

#define IPV6_EXTHDR_SET_FH (   p)    (p)->ip6eh.fh_set = true

Definition at line 239 of file decode-ipv6.h.

◆ IPV6_EXTHDR_SET_RH

#define IPV6_EXTHDR_SET_RH (   p)    (p)->ip6eh.rh_set = true

Definition at line 241 of file decode-ipv6.h.

◆ IPV6_GET_CLASS

#define IPV6_GET_CLASS (   p)    IPV6_GET_RAW_CLASS((p)->ip6h)

Definition at line 83 of file decode-ipv6.h.

◆ IPV6_GET_EXTHDRS_LEN

#define IPV6_GET_EXTHDRS_LEN (   p)    ((p)->ip6vars.exthdrs_len)

Definition at line 96 of file decode-ipv6.h.

◆ IPV6_GET_FLOW

#define IPV6_GET_FLOW (   p)    IPV6_GET_RAW_FLOW((p)->ip6h)

Definition at line 85 of file decode-ipv6.h.

◆ IPV6_GET_HLIM

#define IPV6_GET_HLIM (   p)    (IPV6_GET_RAW_HLIM((p)->ip6h))

Definition at line 91 of file decode-ipv6.h.

◆ IPV6_GET_L4PROTO

#define IPV6_GET_L4PROTO (   p)    ((p)->ip6vars.l4proto)

Definition at line 94 of file decode-ipv6.h.

◆ IPV6_GET_NH

#define IPV6_GET_NH (   p)    (IPV6_GET_RAW_NH((p)->ip6h))

Definition at line 87 of file decode-ipv6.h.

◆ IPV6_GET_PLEN

#define IPV6_GET_PLEN (   p)    IPV6_GET_RAW_PLEN((p)->ip6h)

Definition at line 89 of file decode-ipv6.h.

◆ IPV6_GET_RAW_CLASS

#define IPV6_GET_RAW_CLASS (   ip6h)    ((SCNtohl((ip6h)->s_ip6_flow) & 0x0FF00000) >> 20)

Definition at line 64 of file decode-ipv6.h.

◆ IPV6_GET_RAW_FLOW

#define IPV6_GET_RAW_FLOW (   ip6h)    (SCNtohl((ip6h)->s_ip6_flow) & 0x000FFFFF)

Definition at line 65 of file decode-ipv6.h.

◆ IPV6_GET_RAW_HLIM

#define IPV6_GET_RAW_HLIM (   ip6h)    ((ip6h)->s_ip6_hlim)

Definition at line 68 of file decode-ipv6.h.

◆ IPV6_GET_RAW_NH

#define IPV6_GET_RAW_NH (   ip6h)    ((ip6h)->s_ip6_nxt)

Definition at line 66 of file decode-ipv6.h.

◆ IPV6_GET_RAW_PLEN

#define IPV6_GET_RAW_PLEN (   ip6h)    (SCNtohs((ip6h)->s_ip6_plen))

Definition at line 67 of file decode-ipv6.h.

◆ IPV6_GET_RAW_VER

#define IPV6_GET_RAW_VER (   ip6h)    (((ip6h)->s_ip6_vfc & 0xf0) >> 4)

Definition at line 63 of file decode-ipv6.h.

◆ IPV6_GET_VER

#define IPV6_GET_VER (   p)    IPV6_GET_RAW_VER((p)->ip6h)

Definition at line 81 of file decode-ipv6.h.

◆ IPV6_HEADER_LEN

#define IPV6_HEADER_LEN   40

Definition at line 28 of file decode-ipv6.h.

◆ IPV6_MAX_OPT

#define IPV6_MAX_OPT   40

Definition at line 30 of file decode-ipv6.h.

◆ IPV6_MAXPACKET

#define IPV6_MAXPACKET   65535 /* maximum packet size */

Definition at line 29 of file decode-ipv6.h.

◆ IPV6_SET_EXTHDRS_LEN

#define IPV6_SET_EXTHDRS_LEN (   p,
  len 
)    (p)->ip6vars.exthdrs_len = (len)

Definition at line 74 of file decode-ipv6.h.

◆ IPV6_SET_L4PROTO

#define IPV6_SET_L4PROTO (   p,
  proto 
)    (p)->ip6vars.l4proto = (proto)

Definition at line 73 of file decode-ipv6.h.

◆ IPV6_SET_RAW_NH

#define IPV6_SET_RAW_NH (   ip6h,
  value 
)    ((ip6h)->s_ip6_nxt = (value))

Definition at line 71 of file decode-ipv6.h.

◆ IPV6_SET_RAW_VER

#define IPV6_SET_RAW_VER (   ip6h,
  value 
)    ((ip6h)->s_ip6_vfc = (((ip6h)->s_ip6_vfc & 0x0f) | (value << 4)))

Definition at line 70 of file decode-ipv6.h.

◆ IPV6OPT_HAO

#define IPV6OPT_HAO   0xC9

Definition at line 167 of file decode-ipv6.h.

◆ IPV6OPT_JUMBO

#define IPV6OPT_JUMBO   0xC2

Definition at line 166 of file decode-ipv6.h.

◆ IPV6OPT_PAD1

#define IPV6OPT_PAD1   0x00

Definition at line 163 of file decode-ipv6.h.

◆ IPV6OPT_PADN

#define IPV6OPT_PADN   0x01

Definition at line 164 of file decode-ipv6.h.

◆ IPV6OPT_RA

#define IPV6OPT_RA   0x05

Definition at line 165 of file decode-ipv6.h.

◆ s_ip6_addrs

#define s_ip6_addrs   ip6_hdrun2.ip6_addrs

Definition at line 55 of file decode-ipv6.h.

◆ s_ip6_dst

#define s_ip6_dst   ip6_hdrun2.ip6_un2.ip6_dst

Definition at line 54 of file decode-ipv6.h.

◆ s_ip6_flow

#define s_ip6_flow   ip6_hdrun.ip6_un1.ip6_un1_flow

Definition at line 58 of file decode-ipv6.h.

◆ s_ip6_hlim

#define s_ip6_hlim   ip6_hdrun.ip6_un1.ip6_un1_hlim

Definition at line 61 of file decode-ipv6.h.

◆ s_ip6_nxt

#define s_ip6_nxt   ip6_hdrun.ip6_un1.ip6_un1_nxt

Definition at line 60 of file decode-ipv6.h.

◆ s_ip6_plen

#define s_ip6_plen   ip6_hdrun.ip6_un1.ip6_un1_plen

Definition at line 59 of file decode-ipv6.h.

◆ s_ip6_src

#define s_ip6_src   ip6_hdrun2.ip6_un2.ip6_src

Definition at line 53 of file decode-ipv6.h.

◆ s_ip6_vfc

#define s_ip6_vfc   ip6_hdrun.ip6_un2_vfc

Definition at line 57 of file decode-ipv6.h.

Typedef Documentation

◆ IPV6ExtHdrs

typedef struct IPV6ExtHdrs_ IPV6ExtHdrs

◆ IPV6GenOptHdr

typedef struct IPV6GenOptHdr_ IPV6GenOptHdr

◆ IPV6Hdr

typedef struct IPV6Hdr_ IPV6Hdr

◆ IPV6OptHAO

typedef struct IPV6OptHAO_ IPV6OptHAO

◆ IPV6OptJumbo

typedef struct IPV6OptJumbo_ IPV6OptJumbo

◆ IPV6OptRA

typedef struct IPV6OptRA_ IPV6OptRA

◆ IPV6Vars

typedef struct IPV6Vars_ IPV6Vars

get the highest proto/next header field we know

Function Documentation

◆ DecodeIPV6RegisterTests()

void DecodeIPV6RegisterTests ( void  )

this function registers unit tests for IPV6 decoder

Definition at line 901 of file decode-ipv6.c.

References UtRegisterTest().

Here is the call graph for this function:

Variable Documentation

◆ ip6ah_len

uint8_t ip6ah_len

Definition at line 1 of file decode-ipv6.h.

◆ ip6ah_nxt

uint8_t ip6ah_nxt

Definition at line 0 of file decode-ipv6.h.

◆ ip6ah_reserved

uint16_t ip6ah_reserved

Definition at line 3 of file decode-ipv6.h.

◆ ip6ah_seq

uint32_t ip6ah_seq

Definition at line 5 of file decode-ipv6.h.

◆ ip6ah_spi

uint32_t ip6ah_spi

Definition at line 4 of file decode-ipv6.h.

◆ ip6dh_len

uint8_t ip6dh_len

Definition at line 1 of file decode-ipv6.h.

◆ ip6dh_nxt

uint8_t ip6dh_nxt

Definition at line 0 of file decode-ipv6.h.

◆ ip6esph_seq

uint32_t ip6esph_seq

Definition at line 1 of file decode-ipv6.h.

◆ ip6esph_spi

uint32_t ip6esph_spi

Definition at line 0 of file decode-ipv6.h.

◆ ip6fh_ident

uint32_t ip6fh_ident

Definition at line 3 of file decode-ipv6.h.

◆ ip6fh_nxt

uint8_t ip6fh_nxt

Definition at line 0 of file decode-ipv6.h.

◆ ip6fh_offlg

uint16_t ip6fh_offlg

Definition at line 2 of file decode-ipv6.h.

◆ ip6fh_reserved

uint8_t ip6fh_reserved

Definition at line 1 of file decode-ipv6.h.

◆ ip6hh_len

uint8_t ip6hh_len

Definition at line 1 of file decode-ipv6.h.

◆ ip6hh_nxt

uint8_t ip6hh_nxt

Definition at line 0 of file decode-ipv6.h.

◆ ip6rh_len

uint8_t ip6rh_len

Definition at line 1 of file decode-ipv6.h.

◆ ip6rh_nxt

uint8_t ip6rh_nxt

Definition at line 0 of file decode-ipv6.h.

◆ ip6rh_segsleft

uint8_t ip6rh_segsleft

Definition at line 4 of file decode-ipv6.h.

◆ ip6rh_type

uint8_t ip6rh_type

Definition at line 3 of file decode-ipv6.h.