-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
yaml --- r: 290819 b: refs/heads/master c: dd70507 h: refs/heads/master i: 290817: f9ff241 290815: ef80cab v: v3
- Loading branch information
Pablo Neira Ayuso
committed
Mar 7, 2012
1 parent
68227d3
commit d2707cf
Showing
8 changed files
with
161 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
--- | ||
refs/heads/master: 50978462300f74dc48aea4a38471cb69bdf741a5 | ||
refs/heads/master: dd705072412225a97784fe38feee2ebf8d14814d |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
#ifndef _NF_CONNTRACK_TIMEOUT_H | ||
#define _NF_CONNTRACK_TIMEOUT_H | ||
|
||
#include <net/net_namespace.h> | ||
#include <linux/netfilter/nf_conntrack_common.h> | ||
#include <linux/netfilter/nf_conntrack_tuple_common.h> | ||
#include <net/netfilter/nf_conntrack.h> | ||
#include <net/netfilter/nf_conntrack_extend.h> | ||
|
||
#define CTNL_TIMEOUT_NAME_MAX 32 | ||
|
||
struct ctnl_timeout { | ||
struct list_head head; | ||
struct rcu_head rcu_head; | ||
atomic_t refcnt; | ||
char name[CTNL_TIMEOUT_NAME_MAX]; | ||
__u16 l3num; | ||
__u8 l4num; | ||
char data[0]; | ||
}; | ||
|
||
struct nf_conn_timeout { | ||
struct ctnl_timeout *timeout; | ||
}; | ||
|
||
#define NF_CT_TIMEOUT_EXT_DATA(__t) (unsigned int *) &((__t)->timeout->data) | ||
|
||
static inline | ||
struct nf_conn_timeout *nf_ct_timeout_find(const struct nf_conn *ct) | ||
{ | ||
#ifdef CONFIG_NF_CONNTRACK_TIMEOUT | ||
return nf_ct_ext_find(ct, NF_CT_EXT_TIMEOUT); | ||
#else | ||
return NULL; | ||
#endif | ||
} | ||
|
||
static inline | ||
struct nf_conn_timeout *nf_ct_timeout_ext_add(struct nf_conn *ct, | ||
struct ctnl_timeout *timeout, | ||
gfp_t gfp) | ||
{ | ||
#ifdef CONFIG_NF_CONNTRACK_TIMEOUT | ||
struct nf_conn_timeout *timeout_ext; | ||
|
||
timeout_ext = nf_ct_ext_add(ct, NF_CT_EXT_TIMEOUT, gfp); | ||
if (timeout_ext == NULL) | ||
return NULL; | ||
|
||
timeout_ext->timeout = timeout; | ||
|
||
return timeout_ext; | ||
#else | ||
return NULL; | ||
#endif | ||
}; | ||
|
||
#ifdef CONFIG_NF_CONNTRACK_TIMEOUT | ||
extern int nf_conntrack_timeout_init(struct net *net); | ||
extern void nf_conntrack_timeout_fini(struct net *net); | ||
#else | ||
static inline int nf_conntrack_timeout_init(struct net *net) | ||
{ | ||
return 0; | ||
} | ||
|
||
static inline void nf_conntrack_timeout_fini(struct net *net) | ||
{ | ||
return; | ||
} | ||
#endif /* CONFIG_NF_CONNTRACK_TIMEOUT */ | ||
|
||
#ifdef CONFIG_NF_CONNTRACK_TIMEOUT | ||
extern struct ctnl_timeout *(*nf_ct_timeout_find_get_hook)(const char *name); | ||
extern void (*nf_ct_timeout_put_hook)(struct ctnl_timeout *timeout); | ||
#endif | ||
|
||
#endif /* _NF_CONNTRACK_TIMEOUT_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
* (C) 2012 by Pablo Neira Ayuso <pablo@netfilter.org> | ||
* (C) 2012 by Vyatta Inc. <http://www.vyatta.com> | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License version 2 as | ||
* published by the Free Software Foundation (or any later at your option). | ||
*/ | ||
|
||
#include <linux/types.h> | ||
#include <linux/netfilter.h> | ||
#include <linux/skbuff.h> | ||
#include <linux/vmalloc.h> | ||
#include <linux/stddef.h> | ||
#include <linux/err.h> | ||
#include <linux/percpu.h> | ||
#include <linux/kernel.h> | ||
#include <linux/netdevice.h> | ||
#include <linux/slab.h> | ||
#include <linux/export.h> | ||
|
||
#include <net/netfilter/nf_conntrack.h> | ||
#include <net/netfilter/nf_conntrack_core.h> | ||
#include <net/netfilter/nf_conntrack_extend.h> | ||
#include <net/netfilter/nf_conntrack_timeout.h> | ||
|
||
struct ctnl_timeout * | ||
(*nf_ct_timeout_find_get_hook)(const char *name) __read_mostly; | ||
EXPORT_SYMBOL_GPL(nf_ct_timeout_find_get_hook); | ||
|
||
void (*nf_ct_timeout_put_hook)(struct ctnl_timeout *timeout) __read_mostly; | ||
EXPORT_SYMBOL_GPL(nf_ct_timeout_put_hook); | ||
|
||
static struct nf_ct_ext_type timeout_extend __read_mostly = { | ||
.len = sizeof(struct nf_conn_timeout), | ||
.align = __alignof__(struct nf_conn_timeout), | ||
.id = NF_CT_EXT_TIMEOUT, | ||
}; | ||
|
||
int nf_conntrack_timeout_init(struct net *net) | ||
{ | ||
int ret = 0; | ||
|
||
if (net_eq(net, &init_net)) { | ||
ret = nf_ct_extend_register(&timeout_extend); | ||
if (ret < 0) { | ||
printk(KERN_ERR "nf_ct_timeout: Unable to register " | ||
"timeout extension.\n"); | ||
return ret; | ||
} | ||
} | ||
|
||
return 0; | ||
} | ||
|
||
void nf_conntrack_timeout_fini(struct net *net) | ||
{ | ||
if (net_eq(net, &init_net)) | ||
nf_ct_extend_unregister(&timeout_extend); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters