Contributors: 19
| Author |
Tokens |
Token Proportion |
Commits |
Commit Proportion |
| Pablo Neira Ayuso |
178 |
27.64% |
12 |
22.22% |
| Patrick McHardy |
111 |
17.24% |
18 |
33.33% |
| Yasuyuki Kozakai |
96 |
14.91% |
1 |
1.85% |
| Martin Josefsson |
71 |
11.02% |
1 |
1.85% |
| Florian Westphal |
47 |
7.30% |
3 |
5.56% |
| Alexey Dobriyan |
44 |
6.83% |
2 |
3.70% |
| Linus Torvalds (pre-git) |
19 |
2.95% |
2 |
3.70% |
| xiao ruizhu |
17 |
2.64% |
1 |
1.85% |
| Daniel Borkmann |
16 |
2.48% |
1 |
1.85% |
| Rusty Russell |
13 |
2.02% |
2 |
3.70% |
| Gao Feng |
12 |
1.86% |
2 |
3.70% |
| Elena Reshetova |
4 |
0.62% |
1 |
1.85% |
| Romain Bellan |
4 |
0.62% |
1 |
1.85% |
| Xin Long |
3 |
0.47% |
1 |
1.85% |
| Jan Engelhardt |
3 |
0.47% |
2 |
3.70% |
| Felix Fietkau |
3 |
0.47% |
1 |
1.85% |
| Jozsef Kadlecsik |
1 |
0.16% |
1 |
1.85% |
| Greg Kroah-Hartman |
1 |
0.16% |
1 |
1.85% |
| Harald Welte |
1 |
0.16% |
1 |
1.85% |
| Total |
644 |
|
54 |
|
/* SPDX-License-Identifier: GPL-2.0 */
/*
* connection tracking expectations.
*/
#ifndef _NF_CONNTRACK_EXPECT_H
#define _NF_CONNTRACK_EXPECT_H
#include <linux/refcount.h>
#include <net/netfilter/nf_conntrack.h>
#include <net/netfilter/nf_conntrack_zones.h>
extern unsigned int nf_ct_expect_hsize;
extern unsigned int nf_ct_expect_max;
extern struct hlist_head *nf_ct_expect_hash;
struct nf_conntrack_expect {
/* Conntrack expectation list member */
struct hlist_node lnode;
/* Hash member */
struct hlist_node hnode;
/* Network namespace */
possible_net_t net;
/* We expect this tuple, with the following mask */
struct nf_conntrack_tuple master_tuple;
struct nf_conntrack_tuple tuple;
struct nf_conntrack_tuple_mask mask;
#ifdef CONFIG_NF_CONNTRACK_ZONES
struct nf_conntrack_zone zone;
#endif
/* Usage count. */
refcount_t use;
/* Flags */
unsigned int flags;
/* Expectation class */
unsigned int class;
/* Function to call after setup and insertion */
void (*expectfn)(struct nf_conn *new,
struct nf_conntrack_expect *this);
/* Helper that created this expectation */
struct nf_conntrack_helper __rcu *helper;
/* Helper to assign to new connection */
struct nf_conntrack_helper __rcu *assign_helper;
/* The conntrack of the master connection */
struct nf_conn *master;
/* jiffies32 when this expectation expires */
u32 timeout;
#if IS_ENABLED(CONFIG_NF_NAT)
union nf_inet_addr saved_addr;
/* This is the original per-proto part, used to map the
* expected connection the way the recipient expects. */
union nf_conntrack_man_proto saved_proto;
/* Direction relative to the master connection. */
enum ip_conntrack_dir dir;
#endif
struct rcu_head rcu;
};
static inline bool nf_ct_exp_is_expired(const struct nf_conntrack_expect *exp)
{
if (READ_ONCE(exp->flags) & NF_CT_EXPECT_DEAD)
return true;
return (__s32)(READ_ONCE(exp->timeout) - nfct_time_stamp) <= 0;
}
static inline struct net *nf_ct_exp_net(struct nf_conntrack_expect *exp)
{
return read_pnet(&exp->net);
}
static inline bool nf_ct_exp_zone_equal_any(const struct nf_conntrack_expect *a,
const struct nf_conntrack_zone *b)
{
#ifdef CONFIG_NF_CONNTRACK_ZONES
return a->zone.id == b->id;
#else
return true;
#endif
}
#define NF_CT_EXP_POLICY_NAME_LEN 16
struct nf_conntrack_expect_policy {
unsigned int max_expected;
unsigned int timeout;
char name[NF_CT_EXP_POLICY_NAME_LEN];
};
#define NF_CT_EXPECT_CLASS_DEFAULT 0
#define NF_CT_EXPECT_MAX_CNT 255
/* Allow to reuse expectations with the same tuples from different master
* conntracks.
*/
#define NF_CT_EXP_F_SKIP_MASTER 0x1
int nf_conntrack_expect_pernet_init(struct net *net);
void nf_conntrack_expect_pernet_fini(struct net *net);
int nf_conntrack_expect_init(void);
void nf_conntrack_expect_fini(void);
struct nf_conntrack_expect *
__nf_ct_expect_find(struct net *net,
const struct nf_conntrack_zone *zone,
const struct nf_conntrack_tuple *tuple);
struct nf_conntrack_expect *
nf_ct_expect_find_get(struct net *net,
const struct nf_conntrack_zone *zone,
const struct nf_conntrack_tuple *tuple);
struct nf_conntrack_expect *
nf_ct_find_expectation(struct net *net,
const struct nf_conntrack_zone *zone,
const struct nf_conntrack_tuple *tuple, bool unlink);
void nf_ct_unlink_expect_report(struct nf_conntrack_expect *exp,
u32 portid, int report);
static inline void nf_ct_unlink_expect(struct nf_conntrack_expect *exp)
{
nf_ct_unlink_expect_report(exp, 0, 0);
}
void nf_ct_remove_expectations(struct nf_conn *ct);
void nf_ct_unexpect_related(struct nf_conntrack_expect *exp);
void nf_ct_expect_iterate_destroy(bool (*iter)(struct nf_conntrack_expect *e, void *data), void *data);
void nf_ct_expect_iterate_net(struct net *net,
bool (*iter)(struct nf_conntrack_expect *e, void *data),
void *data, u32 portid, int report);
/* Allocate space for an expectation: this is mandatory before calling
nf_ct_expect_related. You will have to call put afterwards. */
struct nf_conntrack_expect *nf_ct_expect_alloc(struct nf_conn *me);
void nf_ct_expect_init(struct nf_conntrack_expect *, unsigned int, u_int8_t,
const union nf_inet_addr *,
const union nf_inet_addr *,
u_int8_t, const __be16 *, const __be16 *);
void nf_ct_expect_put(struct nf_conntrack_expect *exp);
int nf_ct_expect_related_report(struct nf_conntrack_expect *expect,
u32 portid, int report, unsigned int flags);
static inline int nf_ct_expect_related(struct nf_conntrack_expect *expect,
unsigned int flags)
{
return nf_ct_expect_related_report(expect, 0, 0, flags);
}
int nf_ct_expect_related_pair(struct nf_conntrack_expect *expect[],
unsigned int flag);
struct nf_conn_help;
void nf_ct_expectation_gc(struct nf_conn_help *master_help);
#endif /*_NF_CONNTRACK_EXPECT_H*/