Electroneum
Toggle main menu visibility
Loading...
Searching...
No Matches
nftnlrdr_misc.h
Go to the documentation of this file.
1
/*
2
* MiniUPnP project
3
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
4
* (c) 2015 Tomofumi Hayashi
5
*
6
* This software is subject to the conditions detailed
7
* in the LICENCE file provided within the distribution.
8
*/
9
#include <sys/queue.h>
10
11
#define NFT_TABLE_NAT "nat"
12
#define NFT_TABLE_FILTER "filter"
13
14
enum
rule_reg_type
{
15
RULE_REG_NONE
,
16
RULE_REG_IIF
,
17
RULE_REG_OIF
,
18
RULE_REG_IP_SRC_ADDR
,
19
RULE_REG_IP_DEST_ADDR
,
20
RULE_REG_IP_SD_ADDR
,
/* source & dest */
21
RULE_REG_IP_PROTO
,
22
RULE_REG_TCP_DPORT
,
23
RULE_REG_TCP_SD_PORT
,
/* source & dest */
24
RULE_REG_IMM_VAL
,
25
RULE_REG_MAX
,
26
};
27
28
enum
rule_type
{
29
RULE_NONE
,
30
RULE_NAT
,
31
RULE_SNAT
,
32
RULE_FILTER
,
33
RULE_COUNTER
,
34
};
35
36
typedef
struct
rule_
{
37
LIST_ENTRY
(
rule_t
) entry;
38
char
*
table
;
39
char
*
chain
;
40
uint64_t
handle
;
41
enum
rule_type
type
;
42
uint32_t
nat_type
;
43
uint32_t
filter_action
;
44
uint32_t
family
;
45
uint32_t
ingress_ifidx
;
46
uint32_t
egress_ifidx
;
47
in_addr_t
eaddr
;
48
in_addr_t
iaddr
;
49
in_addr_t
rhost
;
50
uint16_t
eport
;
51
uint16_t
iport
;
52
uint16_t
rport
;
53
uint8_t
proto
;
54
enum
rule_reg_type
reg1_type
;
55
enum
rule_reg_type
reg2_type
;
56
uint32_t
reg1_val
;
57
uint32_t
reg2_val
;
58
uint64_t
packets
;
59
uint64_t
bytes
;
60
char
*
desc
;
61
}
rule_t
;
62
63
LIST_HEAD
(rule_list,
rule_
);
64
extern
struct
rule_list
head
;
65
extern
rule_t
**
peer_cache
;
66
extern
rule_t
**
redirect_cache
;
67
68
int
69
nft_send_request
(
struct
nft_rule * rule,
uint16_t
cmd);
70
struct
nft_rule *
71
rule_set_dnat
(
uint8_t
family,
const
char
* ifname,
uint8_t
proto,
72
in_addr_t rhost,
unsigned
short
eport,
73
in_addr_t ihost,
uint32_t
iport,
74
const
char
*descr,
75
const
char
*handle);
76
struct
nft_rule *
77
rule_set_snat
(
uint8_t
family,
uint8_t
proto,
78
in_addr_t rhost,
unsigned
short
rport,
79
in_addr_t ehost,
unsigned
short
eport,
80
in_addr_t ihost,
unsigned
short
iport,
81
const
char
*descr,
82
const
char
*handle);
83
struct
nft_rule *
84
rule_set_filter
(
uint8_t
family,
const
char
* ifname,
uint8_t
proto,
85
in_addr_t rhost, in_addr_t iaddr,
unsigned
short
eport,
86
unsigned
short
iport,
const
char
* descr,
const
char
*handle);
87
struct
nft_rule *
88
rule_del_handle
(
rule_t
*r);
89
void
90
reflesh_nft_cache
(
uint32_t
family);
91
void
print_rule
(
rule_t
*r);
rule_del_handle
struct nft_rule * rule_del_handle(rule_t *r)
rule_set_snat
struct nft_rule * rule_set_snat(uint8_t family, uint8_t proto, in_addr_t rhost, unsigned short rport, in_addr_t ehost, unsigned short eport, in_addr_t ihost, unsigned short iport, const char *descr, const char *handle)
rule_set_dnat
struct nft_rule * rule_set_dnat(uint8_t family, const char *ifname, uint8_t proto, in_addr_t rhost, unsigned short eport, in_addr_t ihost, uint32_t iport, const char *descr, const char *handle)
LIST_HEAD
LIST_HEAD(rule_list, rule_)
rule_t
struct rule_ rule_t
print_rule
void print_rule(rule_t *r)
reflesh_nft_cache
void reflesh_nft_cache(uint32_t family)
redirect_cache
rule_t ** redirect_cache
peer_cache
rule_t ** peer_cache
rule_set_filter
struct nft_rule * rule_set_filter(uint8_t family, const char *ifname, uint8_t proto, in_addr_t rhost, in_addr_t iaddr, unsigned short eport, unsigned short iport, const char *descr, const char *handle)
rule_type
rule_type
Definition
nftnlrdr_misc.h:28
RULE_FILTER
@ RULE_FILTER
Definition
nftnlrdr_misc.h:32
RULE_SNAT
@ RULE_SNAT
Definition
nftnlrdr_misc.h:31
RULE_NAT
@ RULE_NAT
Definition
nftnlrdr_misc.h:30
RULE_NONE
@ RULE_NONE
Definition
nftnlrdr_misc.h:29
RULE_COUNTER
@ RULE_COUNTER
Definition
nftnlrdr_misc.h:33
nft_send_request
int nft_send_request(struct nft_rule *rule, uint16_t cmd)
head
struct rule_list head
rule_reg_type
rule_reg_type
Definition
nftnlrdr_misc.h:14
RULE_REG_TCP_SD_PORT
@ RULE_REG_TCP_SD_PORT
Definition
nftnlrdr_misc.h:23
RULE_REG_IP_SRC_ADDR
@ RULE_REG_IP_SRC_ADDR
Definition
nftnlrdr_misc.h:18
RULE_REG_IP_PROTO
@ RULE_REG_IP_PROTO
Definition
nftnlrdr_misc.h:21
RULE_REG_IMM_VAL
@ RULE_REG_IMM_VAL
Definition
nftnlrdr_misc.h:24
RULE_REG_NONE
@ RULE_REG_NONE
Definition
nftnlrdr_misc.h:15
RULE_REG_IP_SD_ADDR
@ RULE_REG_IP_SD_ADDR
Definition
nftnlrdr_misc.h:20
RULE_REG_TCP_DPORT
@ RULE_REG_TCP_DPORT
Definition
nftnlrdr_misc.h:22
RULE_REG_OIF
@ RULE_REG_OIF
Definition
nftnlrdr_misc.h:17
RULE_REG_IIF
@ RULE_REG_IIF
Definition
nftnlrdr_misc.h:16
RULE_REG_IP_DEST_ADDR
@ RULE_REG_IP_DEST_ADDR
Definition
nftnlrdr_misc.h:19
RULE_REG_MAX
@ RULE_REG_MAX
Definition
nftnlrdr_misc.h:25
uint16_t
unsigned short uint16_t
Definition
stdint.h:125
uint32_t
unsigned int uint32_t
Definition
stdint.h:126
uint8_t
unsigned char uint8_t
Definition
stdint.h:124
uint64_t
unsigned __int64 uint64_t
Definition
stdint.h:136
rule_
Definition
nftnlrdr_misc.h:36
rule_::reg1_val
uint32_t reg1_val
Definition
nftnlrdr_misc.h:56
rule_::proto
uint8_t proto
Definition
nftnlrdr_misc.h:53
rule_::handle
uint64_t handle
Definition
nftnlrdr_misc.h:40
rule_::egress_ifidx
uint32_t egress_ifidx
Definition
nftnlrdr_misc.h:46
rule_::iport
uint16_t iport
Definition
nftnlrdr_misc.h:51
rule_::table
char * table
Definition
nftnlrdr_misc.h:38
rule_::eport
uint16_t eport
Definition
nftnlrdr_misc.h:50
rule_::nat_type
uint32_t nat_type
Definition
nftnlrdr_misc.h:42
rule_::ingress_ifidx
uint32_t ingress_ifidx
Definition
nftnlrdr_misc.h:45
rule_::family
uint32_t family
Definition
nftnlrdr_misc.h:44
rule_::desc
char * desc
Definition
nftnlrdr_misc.h:60
rule_::rport
uint16_t rport
Definition
nftnlrdr_misc.h:52
rule_::type
enum rule_type type
Definition
nftnlrdr_misc.h:41
rule_::iaddr
in_addr_t iaddr
Definition
nftnlrdr_misc.h:48
rule_::packets
uint64_t packets
Definition
nftnlrdr_misc.h:58
rule_::chain
char * chain
Definition
nftnlrdr_misc.h:39
rule_::rhost
in_addr_t rhost
Definition
nftnlrdr_misc.h:49
rule_::reg1_type
enum rule_reg_type reg1_type
Definition
nftnlrdr_misc.h:54
rule_::LIST_ENTRY
LIST_ENTRY(rule_t) entry
rule_::filter_action
uint32_t filter_action
Definition
nftnlrdr_misc.h:43
rule_::reg2_val
uint32_t reg2_val
Definition
nftnlrdr_misc.h:57
rule_::reg2_type
enum rule_reg_type reg2_type
Definition
nftnlrdr_misc.h:55
rule_::eaddr
in_addr_t eaddr
Definition
nftnlrdr_misc.h:47
rule_::bytes
uint64_t bytes
Definition
nftnlrdr_misc.h:59
external
miniupnp
miniupnpd
netfilter_nft
nftnlrdr_misc.h
Generated on
for Electroneum by
1.17.0