mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-24 13:44:26 -04:00
netfilter: cttimeout: decouple timeout policy from nfnetlink_cttimeout object
The timeout policy is currently embedded into the nfnetlink_cttimeout object, move the policy into an independent object. This allows us to reuse part of the existing conntrack timeout extension from nf_tables without adding dependencies with the nfnetlink_cttimeout object layout. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
This commit is contained in:
parent
4e665afbd7
commit
6c1fd7dc48
4 changed files with 39 additions and 30 deletions
|
|
@ -11,24 +11,28 @@
|
|||
|
||||
#define CTNL_TIMEOUT_NAME_MAX 32
|
||||
|
||||
struct ctnl_timeout {
|
||||
struct list_head head;
|
||||
struct rcu_head rcu_head;
|
||||
refcount_t refcnt;
|
||||
char name[CTNL_TIMEOUT_NAME_MAX];
|
||||
struct nf_ct_timeout {
|
||||
__u16 l3num;
|
||||
const struct nf_conntrack_l4proto *l4proto;
|
||||
char data[0];
|
||||
};
|
||||
|
||||
struct ctnl_timeout {
|
||||
struct list_head head;
|
||||
struct rcu_head rcu_head;
|
||||
refcount_t refcnt;
|
||||
char name[CTNL_TIMEOUT_NAME_MAX];
|
||||
struct nf_ct_timeout timeout;
|
||||
};
|
||||
|
||||
struct nf_conn_timeout {
|
||||
struct ctnl_timeout __rcu *timeout;
|
||||
struct nf_ct_timeout __rcu *timeout;
|
||||
};
|
||||
|
||||
static inline unsigned int *
|
||||
nf_ct_timeout_data(struct nf_conn_timeout *t)
|
||||
{
|
||||
struct ctnl_timeout *timeout;
|
||||
struct nf_ct_timeout *timeout;
|
||||
|
||||
timeout = rcu_dereference(t->timeout);
|
||||
if (timeout == NULL)
|
||||
|
|
@ -49,7 +53,7 @@ struct nf_conn_timeout *nf_ct_timeout_find(const struct nf_conn *ct)
|
|||
|
||||
static inline
|
||||
struct nf_conn_timeout *nf_ct_timeout_ext_add(struct nf_conn *ct,
|
||||
struct ctnl_timeout *timeout,
|
||||
struct nf_ct_timeout *timeout,
|
||||
gfp_t gfp)
|
||||
{
|
||||
#ifdef CONFIG_NF_CONNTRACK_TIMEOUT
|
||||
|
|
@ -83,7 +87,7 @@ static inline unsigned int *nf_ct_timeout_lookup(const struct nf_conn *ct)
|
|||
#ifdef CONFIG_NF_CONNTRACK_TIMEOUT
|
||||
int nf_conntrack_timeout_init(void);
|
||||
void nf_conntrack_timeout_fini(void);
|
||||
void nf_ct_untimeout(struct net *net, struct ctnl_timeout *timeout);
|
||||
void nf_ct_untimeout(struct net *net, struct nf_ct_timeout *timeout);
|
||||
#else
|
||||
static inline int nf_conntrack_timeout_init(void)
|
||||
{
|
||||
|
|
@ -97,8 +101,8 @@ static inline void nf_conntrack_timeout_fini(void)
|
|||
#endif /* CONFIG_NF_CONNTRACK_TIMEOUT */
|
||||
|
||||
#ifdef CONFIG_NF_CONNTRACK_TIMEOUT
|
||||
extern struct ctnl_timeout *(*nf_ct_timeout_find_get_hook)(struct net *net, const char *name);
|
||||
extern void (*nf_ct_timeout_put_hook)(struct ctnl_timeout *timeout);
|
||||
extern struct nf_ct_timeout *(*nf_ct_timeout_find_get_hook)(struct net *net, const char *name);
|
||||
extern void (*nf_ct_timeout_put_hook)(struct nf_ct_timeout *timeout);
|
||||
#endif
|
||||
|
||||
#endif /* _NF_CONNTRACK_TIMEOUT_H */
|
||||
|
|
|
|||
Loading…
Reference in a new issue