summaryrefslogtreecommitdiff
path: root/include/netlink.h
blob: 6d28ac62b3fff3b1d8ebda8313d2c0ed19ec332f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#ifndef _NETLINK_H_
#define _NETLINK_H_

#include <libnetfilter_conntrack/libnetfilter_conntrack.h>

struct nf_conntrack;
struct nfct_handle;

int ignore_conntrack(struct nf_conntrack *ct);

int nl_init_event_handler(void);

int nl_init_dump_handler(void);

int nl_init_request_handler(void);

int nl_init_overrun_handler(void);

int nl_overrun_request_resync(void);

void nl_resize_socket_buffer(struct nfct_handle *h);

int nl_dump_conntrack_table(void);

int nl_exist_conntrack(struct nf_conntrack *ct);

int nl_get_conntrack(struct nf_conntrack *ct);

int nl_create_conntrack(struct nf_conntrack *ct);

int nl_update_conntrack(struct nf_conntrack *ct);

int nl_destroy_conntrack(struct nf_conntrack *ct);

static inline int ct_is_related(const struct nf_conntrack *ct)
{
	return (nfct_attr_is_set(ct, ATTR_MASTER_L3PROTO) &&
		nfct_attr_is_set(ct, ATTR_MASTER_L4PROTO) &&
		((nfct_attr_is_set(ct, ATTR_MASTER_IPV4_SRC) &&
		  nfct_attr_is_set(ct, ATTR_MASTER_IPV4_DST)) ||
		 (nfct_attr_is_set(ct, ATTR_MASTER_IPV6_SRC) &&
		  nfct_attr_is_set(ct, ATTR_MASTER_IPV6_DST))) &&
		nfct_attr_is_set(ct, ATTR_MASTER_PORT_SRC) &&
		nfct_attr_is_set(ct, ATTR_MASTER_PORT_DST));
}

#endif