suricata
detect-engine-address-ipv6.c File Reference
#include "suricata-common.h"
#include "decode.h"
#include "detect.h"
#include "flow-var.h"
#include "util-cidr.h"
#include "util-unittest.h"
#include "detect-engine-address.h"
#include "detect-engine-address-ipv6.h"
#include "detect-engine-siggroup.h"
#include "detect-engine-port.h"
#include "util-debug.h"
Include dependency graph for detect-engine-address-ipv6.c:

Go to the source code of this file.

Functions

int AddressIPv6Lt (Address *a, Address *b)
 Compares 2 ipv6 addresses and returns if the first address(a) is less than the second address(b) or not. More...
 
int AddressIPv6LtU32 (uint32_t *a, uint32_t *b)
 
int AddressIPv6Gt (Address *a, Address *b)
 Compares 2 ipv6 addresses and returns if the first address(a) is greater than the second address(b) or not. More...
 
int AddressIPv6GtU32 (uint32_t *a, uint32_t *b)
 
int AddressIPv6Eq (Address *a, Address *b)
 Compares 2 ipv6 addresses and returns if the addresses are equal or not. More...
 
int AddressIPv6EqU32 (uint32_t *a, uint32_t *b)
 
int AddressIPv6Le (Address *a, Address *b)
 Compares 2 ipv6 addresses and returns if the first address(a) is less than or equal to the second address(b) or not. More...
 
int AddressIPv6LeU32 (uint32_t *a, uint32_t *b)
 
int AddressIPv6Ge (Address *a, Address *b)
 Compares 2 ipv6 addresses and returns if the first address(a) is greater than or equal to the second address(b) or not. More...
 
int AddressIPv6GeU32 (uint32_t *a, uint32_t *b)
 
int DetectAddressCmpIPv6 (DetectAddress *a, DetectAddress *b)
 Compares 2 addresses(address ranges) and returns the relationship between the 2 addresses. More...
 
int DetectAddressCutIPv6 (DetectEngineCtx *de_ctx, DetectAddress *a, DetectAddress *b, DetectAddress **c)
 
int DetectAddressCutNotIPv6 (DetectAddress *a, DetectAddress **b)
 Cuts and returns an address range, which is the complement of the address range that is supplied as the argument. More...
 
void DetectAddressIPv6Tests (void)
 

Detailed Description

Author
Victor Julien victo.nosp@m.r@in.nosp@m.linia.nosp@m.c.ne.nosp@m.t

IPV6 Address part of the detection engine.

Definition in file detect-engine-address-ipv6.c.

Function Documentation

◆ AddressIPv6Eq()

int AddressIPv6Eq ( Address a,
Address b 
)

Compares 2 ipv6 addresses and returns if the addresses are equal or not.

Parameters
aThe first ipv6 address to be compared.
bThe second ipv6 address to be compared.
Return values
1If a == b.
0Otherwise.

Definition at line 128 of file detect-engine-address-ipv6.c.

Referenced by AddressIPv6Ge(), AddressIPv6Le(), and DetectAddressCmpIPv6().

Here is the caller graph for this function:

◆ AddressIPv6EqU32()

int AddressIPv6EqU32 ( uint32_t *  a,
uint32_t *  b 
)

Definition at line 140 of file detect-engine-address-ipv6.c.

Referenced by AddressIPv6GeU32(), and AddressIPv6LeU32().

Here is the caller graph for this function:

◆ AddressIPv6Ge()

int AddressIPv6Ge ( Address a,
Address b 
)

Compares 2 ipv6 addresses and returns if the first address(a) is greater than or equal to the second address(b) or not.

Parameters
aThe first ipv6 address to be compared.
bThe second ipv6 address to be compared.
Return values
1If a >= b.
0Otherwise, i.e. a < b.

Definition at line 194 of file detect-engine-address-ipv6.c.

References AddressIPv6Eq(), and AddressIPv6Gt().

Referenced by DetectAddressCmpIPv6().

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

◆ AddressIPv6GeU32()

int AddressIPv6GeU32 ( uint32_t *  a,
uint32_t *  b 
)

Definition at line 205 of file detect-engine-address-ipv6.c.

References AddressIPv6EqU32(), and AddressIPv6GtU32().

Here is the call graph for this function:

◆ AddressIPv6Gt()

int AddressIPv6Gt ( Address a,
Address b 
)

Compares 2 ipv6 addresses and returns if the first address(a) is greater than the second address(b) or not.

Parameters
aThe first ipv6 address to be compared.
bThe second ipv6 address to be compared.
Return values
1If a > b.
0Otherwise, i.e. a <= b.

Definition at line 90 of file detect-engine-address-ipv6.c.

References SCNtohl.

Referenced by AddressIPv6Ge(), and DetectAddressCmpIPv6().

Here is the caller graph for this function:

◆ AddressIPv6GtU32()

int AddressIPv6GtU32 ( uint32_t *  a,
uint32_t *  b 
)

Definition at line 104 of file detect-engine-address-ipv6.c.

References SCNtohl.

Referenced by AddressIPv6GeU32().

Here is the caller graph for this function:

◆ AddressIPv6Le()

int AddressIPv6Le ( Address a,
Address b 
)

Compares 2 ipv6 addresses and returns if the first address(a) is less than or equal to the second address(b) or not.

Parameters
aThe first ipv6 address to be compared.
bThe second ipv6 address to be compared.
Return values
1If a <= b.
0Otherwise, i.e. a > b.

Definition at line 162 of file detect-engine-address-ipv6.c.

References AddressIPv6Eq(), and AddressIPv6Lt().

Referenced by DetectAddressCmpIPv6().

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

◆ AddressIPv6LeU32()

int AddressIPv6LeU32 ( uint32_t *  a,
uint32_t *  b 
)

Definition at line 173 of file detect-engine-address-ipv6.c.

References AddressIPv6EqU32(), and AddressIPv6LtU32().

Here is the call graph for this function:

◆ AddressIPv6Lt()

int AddressIPv6Lt ( Address a,
Address b 
)

Compares 2 ipv6 addresses and returns if the first address(a) is less than the second address(b) or not.

Parameters
aThe first ipv6 address to be compared.
bThe second ipv6 address to be compared.
Return values
1If a < b.
0Otherwise, i.e. a >= b.

Definition at line 52 of file detect-engine-address-ipv6.c.

References SCNtohl.

Referenced by AddressIPv6Le(), and DetectAddressCmpIPv6().

Here is the caller graph for this function:

◆ AddressIPv6LtU32()

int AddressIPv6LtU32 ( uint32_t *  a,
uint32_t *  b 
)

Definition at line 66 of file detect-engine-address-ipv6.c.

References SCNtohl.

Referenced by AddressIPv6LeU32().

Here is the caller graph for this function:

◆ DetectAddressCmpIPv6()

int DetectAddressCmpIPv6 ( DetectAddress a,
DetectAddress b 
)

Compares 2 addresses(address ranges) and returns the relationship between the 2 addresses.

Parameters
aPointer to the first address instance to be compared.
bPointer to the second address instance to be compared.
Return values
ADDRESS_EQIf the 2 address ranges a and b, are equal.
ADDRESS_ESb encapsulates a. b_ip1[...a_ip1...a_ip2...]b_ip2.
ADDRESS_EBa encapsulates b. a_ip1[...b_ip1....b_ip2...]a_ip2.
ADDRESS_LEa_ip1(...b_ip1==a_ip2...)b_ip2
ADDRESS_LTa_ip1(...b_ip1...a_ip2...)b_ip2
ADDRESS_GEb_ip1(...a_ip1==b_ip2...)a_ip2
ADDRESS_GTa_ip1 > b_ip2, i.e. the address range for 'a' starts only after the end of the address range for 'b'

Definition at line 232 of file detect-engine-address-ipv6.c.

References ADDRESS_EB, ADDRESS_EQ, ADDRESS_ER, ADDRESS_ES, ADDRESS_GE, ADDRESS_GT, ADDRESS_LE, ADDRESS_LT, AddressIPv6Eq(), AddressIPv6Ge(), AddressIPv6Gt(), AddressIPv6Le(), AddressIPv6Lt(), DetectAddress_::ip, DetectAddress_::ip2, and SCLogDebug.

Referenced by DetectAddressCmp(), and DetectAddressCutIPv6().

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

◆ DetectAddressCutIPv6()

int DetectAddressCutIPv6 ( DetectEngineCtx de_ctx,
DetectAddress a,
DetectAddress b,
DetectAddress **  c 
)

Definition at line 359 of file detect-engine-address-ipv6.c.

References ADDRESS_EB, ADDRESS_ES, ADDRESS_GE, ADDRESS_LE, DetectAddressCmpIPv6(), DetectAddress_::ip, DetectAddress_::ip2, and SCNtohl.

Here is the call graph for this function:

◆ DetectAddressCutNotIPv6()

int DetectAddressCutNotIPv6 ( DetectAddress a,
DetectAddress **  b 
)

Cuts and returns an address range, which is the complement of the address range that is supplied as the argument.

For example:

If a = ::-2000::, then a = 2000::1-FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF and b = NULL If a = 2000::1-FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF, then a = ::-2000:: and b = NULL If a = 2000::1-20FF::2, then a = ::-2000:: and b = 20FF::3-FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF

Parameters
aPointer to an address range (DetectAddress) instance whose complement has to be returned in a and b.
bPointer to DetectAddress pointer, that will be supplied back with a new DetectAddress instance, if the complement demands so.
Return values
0On success.
-1On failure.

Definition at line 710 of file detect-engine-address-ipv6.c.

References DetectAddress_::ip, DetectAddress_::ip2, and SCNtohl.

◆ DetectAddressIPv6Tests()

void DetectAddressIPv6Tests ( void  )

Definition at line 1880 of file detect-engine-address-ipv6.c.

References UtRegisterTest().

Here is the call graph for this function: