suricata
decode-icmpv6.h File Reference
#include "decode-tcp.h"
#include "decode-udp.h"
#include "decode-ipv6.h"
Include dependency graph for decode-icmpv6.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ICMPV6Info_
 
struct  ICMPV6Hdr_
 
struct  ICMPV6Vars_
 

Macros

#define ICMPV6_HEADER_LEN   8
 
#define ICMPV6_HEADER_PKT_OFFSET   8
 
#define ICMP6_DST_UNREACH   1
 
#define ICMP6_PACKET_TOO_BIG   2
 
#define ICMP6_TIME_EXCEEDED   3
 
#define ICMP6_PARAM_PROB   4
 
#define ICMP6_ECHO_REQUEST   128
 
#define ICMP6_ECHO_REPLY   129
 
#define MLD_LISTENER_QUERY   130
 
#define MLD_LISTENER_REPORT   131
 
#define MLD_LISTENER_REDUCTION   132
 
#define ND_ROUTER_SOLICIT   133
 
#define ND_ROUTER_ADVERT   134
 
#define ND_NEIGHBOR_SOLICIT   135
 
#define ND_NEIGHBOR_ADVERT   136
 
#define ND_REDIRECT   137
 
#define ICMP6_RR   138
 
#define ICMP6_NI_QUERY   139
 
#define ICMP6_NI_REPLY   140
 
#define ND_INVERSE_SOLICIT   141
 
#define ND_INVERSE_ADVERT   142
 
#define MLD_V2_LIST_REPORT   143
 
#define HOME_AGENT_AD_REQUEST   144
 
#define HOME_AGENT_AD_REPLY   145
 
#define MOBILE_PREFIX_SOLICIT   146
 
#define MOBILE_PREFIX_ADVERT   147
 
#define CERT_PATH_SOLICIT   148
 
#define CERT_PATH_ADVERT   149
 
#define ICMP6_MOBILE_EXPERIMENTAL   150
 
#define MC_ROUTER_ADVERT   151
 
#define MC_ROUTER_SOLICIT   152
 
#define MC_ROUTER_TERMINATE   153
 
#define FMIPV6_MSG   154
 
#define RPL_CONTROL_MSG   155
 
#define LOCATOR_UDATE_MSG   156
 
#define DUPL_ADDR_REQUEST   157
 
#define DUPL_ADDR_CONFIRM   158
 
#define MPL_CONTROL_MSG   159
 
#define ICMP6_DST_UNREACH_NOROUTE   0 /* no route to destination */
 
#define ICMP6_DST_UNREACH_ADMIN   1 /* communication with destination */
 
#define ICMP6_DST_UNREACH_BEYONDSCOPE   2 /* beyond scope of source address */
 
#define ICMP6_DST_UNREACH_ADDR   3 /* address unreachable */
 
#define ICMP6_DST_UNREACH_NOPORT   4 /* bad port */
 
#define ICMP6_DST_UNREACH_FAILEDPOLICY   5 /* Source address failed ingress/egress policy */
 
#define ICMP6_DST_UNREACH_REJECTROUTE   6 /* Reject route to destination */
 
#define ICMP6_TIME_EXCEED_TRANSIT   0 /* Hop Limit == 0 in transit */
 
#define ICMP6_TIME_EXCEED_REASSEMBLY   1 /* Reassembly time out */
 
#define ICMP6_PARAMPROB_HEADER   0 /* erroneous header field */
 
#define ICMP6_PARAMPROB_NEXTHEADER   1 /* unrecognized Next Header */
 
#define ICMP6_PARAMPROB_OPTION   2 /* unrecognized IPv6 option */
 
#define ICMPV6_GET_TYPE(p)   (p)->icmpv6h->type
 
#define ICMPV6_GET_CODE(p)   (p)->icmpv6h->code
 
#define ICMPV6_GET_RAW_CSUM(p)   SCNtohs((p)->icmpv6h->csum)
 
#define ICMPV6_GET_CSUM(p)   (p)->icmpv6h->csum
 
#define ICMPV6_GET_ID(p)   (p)->icmpv6vars.id
 
#define ICMPV6_GET_SEQ(p)   (p)->icmpv6vars.seq
 
#define ICMPV6_GET_UNUSED(p)   (p)->icmpv6h->icmpv6b.icmpv6e.unused
 
#define ICMPV6_GET_ERROR_PTR(p)   (p)->icmpv6h->icmpv6b.icmpv6e.error_ptr
 
#define ICMPV6_HAS_MTU(p)   ((p)->icmpv6h->type == ICMP6_PACKET_TOO_BIG)
 
#define ICMPV6_GET_MTU(p)   SCNtohl((p)->icmpv6h->icmpv6b.icmpv6e.mtu)
 
#define ICMPV6_GET_EMB_PROTO(p)   (p)->icmpv6vars.emb_ip6_proto_next
 
#define ICMPV6_GET_EMB_IPV6(p)   (p)->icmpv6vars.emb_ipv6h
 
#define ICMPV6_GET_EMB_TCP(p)   (p)->icmpv6vars.emb_tcph
 
#define ICMPV6_GET_EMB_UDP(p)   (p)->icmpv6vars.emb_udph
 
#define ICMPV6_GET_EMB_icmpv6h(p)   (p)->icmpv6vars.emb_icmpv6h
 
#define CLEAR_ICMPV6_PACKET(p)
 

Typedefs

typedef struct ICMPV6Info_ ICMPV6Info
 
typedef struct ICMPV6Hdr_ ICMPV6Hdr
 
typedef struct ICMPV6Vars_ ICMPV6Vars
 

Functions

void DecodeICMPV6RegisterTests (void)
 Registers ICMPV6 unit tests. More...
 
int ICMPv6GetCounterpart (uint8_t type)
 

Detailed Description

Macro Definition Documentation

◆ CERT_PATH_ADVERT

#define CERT_PATH_ADVERT   149

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

◆ CERT_PATH_SOLICIT

#define CERT_PATH_SOLICIT   148

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

◆ CLEAR_ICMPV6_PACKET

#define CLEAR_ICMPV6_PACKET (   p)
Value:
do { \
PACKET_CLEAR_L4VARS((p)); \
(p)->icmpv6h = NULL; \
} while (0)

Definition at line 186 of file decode-icmpv6.h.

◆ DUPL_ADDR_CONFIRM

#define DUPL_ADDR_CONFIRM   158

Definition at line 76 of file decode-icmpv6.h.

◆ DUPL_ADDR_REQUEST

#define DUPL_ADDR_REQUEST   157

Definition at line 75 of file decode-icmpv6.h.

◆ FMIPV6_MSG

#define FMIPV6_MSG   154

Definition at line 72 of file decode-icmpv6.h.

◆ HOME_AGENT_AD_REPLY

#define HOME_AGENT_AD_REPLY   145

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

◆ HOME_AGENT_AD_REQUEST

#define HOME_AGENT_AD_REQUEST   144

Definition at line 62 of file decode-icmpv6.h.

◆ ICMP6_DST_UNREACH

#define ICMP6_DST_UNREACH   1

ICMPV6 Message Types: Error Messages: (type <128)

Definition at line 37 of file decode-icmpv6.h.

◆ ICMP6_DST_UNREACH_ADDR

#define ICMP6_DST_UNREACH_ADDR   3 /* address unreachable */

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

◆ ICMP6_DST_UNREACH_ADMIN

#define ICMP6_DST_UNREACH_ADMIN   1 /* communication with destination */

Definition at line 82 of file decode-icmpv6.h.

◆ ICMP6_DST_UNREACH_BEYONDSCOPE

#define ICMP6_DST_UNREACH_BEYONDSCOPE   2 /* beyond scope of source address */

Definition at line 84 of file decode-icmpv6.h.

◆ ICMP6_DST_UNREACH_FAILEDPOLICY

#define ICMP6_DST_UNREACH_FAILEDPOLICY   5 /* Source address failed ingress/egress policy */

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

◆ ICMP6_DST_UNREACH_NOPORT

#define ICMP6_DST_UNREACH_NOPORT   4 /* bad port */

Definition at line 86 of file decode-icmpv6.h.

◆ ICMP6_DST_UNREACH_NOROUTE

#define ICMP6_DST_UNREACH_NOROUTE   0 /* no route to destination */

Destination Unreachable Message (type=1) Code:

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

◆ ICMP6_DST_UNREACH_REJECTROUTE

#define ICMP6_DST_UNREACH_REJECTROUTE   6 /* Reject route to destination */

Definition at line 88 of file decode-icmpv6.h.

◆ ICMP6_ECHO_REPLY

#define ICMP6_ECHO_REPLY   129

Definition at line 44 of file decode-icmpv6.h.

◆ ICMP6_ECHO_REQUEST

#define ICMP6_ECHO_REQUEST   128

Informational Messages (type>=128)

Definition at line 43 of file decode-icmpv6.h.

◆ ICMP6_MOBILE_EXPERIMENTAL

#define ICMP6_MOBILE_EXPERIMENTAL   150

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

◆ ICMP6_NI_QUERY

#define ICMP6_NI_QUERY   139

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

◆ ICMP6_NI_REPLY

#define ICMP6_NI_REPLY   140

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

◆ ICMP6_PACKET_TOO_BIG

#define ICMP6_PACKET_TOO_BIG   2

Definition at line 38 of file decode-icmpv6.h.

◆ ICMP6_PARAM_PROB

#define ICMP6_PARAM_PROB   4

Definition at line 40 of file decode-icmpv6.h.

◆ ICMP6_PARAMPROB_HEADER

#define ICMP6_PARAMPROB_HEADER   0 /* erroneous header field */

Parameter Problem Message (type=4) Code:

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

◆ ICMP6_PARAMPROB_NEXTHEADER

#define ICMP6_PARAMPROB_NEXTHEADER   1 /* unrecognized Next Header */

Definition at line 97 of file decode-icmpv6.h.

◆ ICMP6_PARAMPROB_OPTION

#define ICMP6_PARAMPROB_OPTION   2 /* unrecognized IPv6 option */

Definition at line 98 of file decode-icmpv6.h.

◆ ICMP6_RR

#define ICMP6_RR   138

Definition at line 56 of file decode-icmpv6.h.

◆ ICMP6_TIME_EXCEED_REASSEMBLY

#define ICMP6_TIME_EXCEED_REASSEMBLY   1 /* Reassembly time out */

Definition at line 93 of file decode-icmpv6.h.

◆ ICMP6_TIME_EXCEED_TRANSIT

#define ICMP6_TIME_EXCEED_TRANSIT   0 /* Hop Limit == 0 in transit */

Time Exceeded Message (type=3) Code:

Definition at line 92 of file decode-icmpv6.h.

◆ ICMP6_TIME_EXCEEDED

#define ICMP6_TIME_EXCEEDED   3

Definition at line 39 of file decode-icmpv6.h.

◆ ICMPV6_GET_CODE

#define ICMPV6_GET_CODE (   p)    (p)->icmpv6h->code

macro for icmpv6 "code" access

Definition at line 104 of file decode-icmpv6.h.

◆ ICMPV6_GET_CSUM

#define ICMPV6_GET_CSUM (   p)    (p)->icmpv6h->csum

Definition at line 107 of file decode-icmpv6.h.

◆ ICMPV6_GET_EMB_icmpv6h

#define ICMPV6_GET_EMB_icmpv6h (   p)    (p)->icmpv6vars.emb_icmpv6h

macro for icmpv6 embedded "icmpv6h" header access

Definition at line 135 of file decode-icmpv6.h.

◆ ICMPV6_GET_EMB_IPV6

#define ICMPV6_GET_EMB_IPV6 (   p)    (p)->icmpv6vars.emb_ipv6h

macro for icmpv6 embedded "ipv6h" header access

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

◆ ICMPV6_GET_EMB_PROTO

#define ICMPV6_GET_EMB_PROTO (   p)    (p)->icmpv6vars.emb_ip6_proto_next

macro for icmpv6 embedded "protocol" access

Definition at line 127 of file decode-icmpv6.h.

◆ ICMPV6_GET_EMB_TCP

#define ICMPV6_GET_EMB_TCP (   p)    (p)->icmpv6vars.emb_tcph

macro for icmpv6 embedded "tcph" header access

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

◆ ICMPV6_GET_EMB_UDP

#define ICMPV6_GET_EMB_UDP (   p)    (p)->icmpv6vars.emb_udph

macro for icmpv6 embedded "udph" header access

Definition at line 133 of file decode-icmpv6.h.

◆ ICMPV6_GET_ERROR_PTR

#define ICMPV6_GET_ERROR_PTR (   p)    (p)->icmpv6h->icmpv6b.icmpv6e.error_ptr

macro for icmpv6 "error_ptr" access

Definition at line 119 of file decode-icmpv6.h.

◆ ICMPV6_GET_ID

#define ICMPV6_GET_ID (   p)    (p)->icmpv6vars.id

If message is informational macro for icmpv6 "id" access

Definition at line 111 of file decode-icmpv6.h.

◆ ICMPV6_GET_MTU

#define ICMPV6_GET_MTU (   p)    SCNtohl((p)->icmpv6h->icmpv6b.icmpv6e.mtu)

macro for icmpv6 "mtu" access

Definition at line 124 of file decode-icmpv6.h.

◆ ICMPV6_GET_RAW_CSUM

#define ICMPV6_GET_RAW_CSUM (   p)    SCNtohs((p)->icmpv6h->csum)

macro for icmpv6 "csum" access

Definition at line 106 of file decode-icmpv6.h.

◆ ICMPV6_GET_SEQ

#define ICMPV6_GET_SEQ (   p)    (p)->icmpv6vars.seq

macro for icmpv6 "seq" access

Definition at line 113 of file decode-icmpv6.h.

◆ ICMPV6_GET_TYPE

#define ICMPV6_GET_TYPE (   p)    (p)->icmpv6h->type

macro for icmpv6 "type" access

Definition at line 102 of file decode-icmpv6.h.

◆ ICMPV6_GET_UNUSED

#define ICMPV6_GET_UNUSED (   p)    (p)->icmpv6h->icmpv6b.icmpv6e.unused

If message is Error macro for icmpv6 "unused" access

Definition at line 117 of file decode-icmpv6.h.

◆ ICMPV6_HAS_MTU

#define ICMPV6_HAS_MTU (   p)    ((p)->icmpv6h->type == ICMP6_PACKET_TOO_BIG)

macro for icmpv6 "mtu" accessibility

Definition at line 122 of file decode-icmpv6.h.

◆ ICMPV6_HEADER_LEN

#define ICMPV6_HEADER_LEN   8

Definition at line 32 of file decode-icmpv6.h.

◆ ICMPV6_HEADER_PKT_OFFSET

#define ICMPV6_HEADER_PKT_OFFSET   8

Definition at line 33 of file decode-icmpv6.h.

◆ LOCATOR_UDATE_MSG

#define LOCATOR_UDATE_MSG   156

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

◆ MC_ROUTER_ADVERT

#define MC_ROUTER_ADVERT   151

Definition at line 69 of file decode-icmpv6.h.

◆ MC_ROUTER_SOLICIT

#define MC_ROUTER_SOLICIT   152

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

◆ MC_ROUTER_TERMINATE

#define MC_ROUTER_TERMINATE   153

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

◆ MLD_LISTENER_QUERY

#define MLD_LISTENER_QUERY   130

Definition at line 46 of file decode-icmpv6.h.

◆ MLD_LISTENER_REDUCTION

#define MLD_LISTENER_REDUCTION   132

Definition at line 48 of file decode-icmpv6.h.

◆ MLD_LISTENER_REPORT

#define MLD_LISTENER_REPORT   131

Definition at line 47 of file decode-icmpv6.h.

◆ MLD_V2_LIST_REPORT

#define MLD_V2_LIST_REPORT   143

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

◆ MOBILE_PREFIX_ADVERT

#define MOBILE_PREFIX_ADVERT   147

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

◆ MOBILE_PREFIX_SOLICIT

#define MOBILE_PREFIX_SOLICIT   146

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

◆ MPL_CONTROL_MSG

#define MPL_CONTROL_MSG   159

Definition at line 77 of file decode-icmpv6.h.

◆ ND_INVERSE_ADVERT

#define ND_INVERSE_ADVERT   142

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

◆ ND_INVERSE_SOLICIT

#define ND_INVERSE_SOLICIT   141

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

◆ ND_NEIGHBOR_ADVERT

#define ND_NEIGHBOR_ADVERT   136

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

◆ ND_NEIGHBOR_SOLICIT

#define ND_NEIGHBOR_SOLICIT   135

Definition at line 52 of file decode-icmpv6.h.

◆ ND_REDIRECT

#define ND_REDIRECT   137

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

◆ ND_ROUTER_ADVERT

#define ND_ROUTER_ADVERT   134

Definition at line 51 of file decode-icmpv6.h.

◆ ND_ROUTER_SOLICIT

#define ND_ROUTER_SOLICIT   133

Definition at line 50 of file decode-icmpv6.h.

◆ RPL_CONTROL_MSG

#define RPL_CONTROL_MSG   155

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

Typedef Documentation

◆ ICMPV6Hdr

typedef struct ICMPV6Hdr_ ICMPV6Hdr

ICMPv6 header structure

◆ ICMPV6Info

typedef struct ICMPV6Info_ ICMPV6Info

◆ ICMPV6Vars

typedef struct ICMPV6Vars_ ICMPV6Vars

Data available from the decoded packet

Function Documentation

◆ DecodeICMPV6RegisterTests()

void DecodeICMPV6RegisterTests ( void  )

Registers ICMPV6 unit tests.

Todo:
More ICMPv6 tests

Definition at line 1552 of file decode-icmpv6.c.

References UtRegisterTest().

Here is the call graph for this function:

◆ ICMPv6GetCounterpart()