aboutsummaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2013-01-27 00:56:10 -0500
committerDavid S. Miller <davem@davemloft.net>2013-01-27 00:56:10 -0500
commitb640bee6d9bb2e4ab803d1b1a119d271434ad960 (patch)
tree569900a59bbc4decf36dc48f51a0d67b5e9bac0d /include/net
parent93b9c1ddd3fb4a5b67d512e534b30070f9ecec28 (diff)
parent5f9f946b39bff31bc9a4a8be18cef3354d3382ae (diff)
Merge branch 'master' of git://1984.lsi.us.es/nf-next
Pablo Neira Ayuso says: ==================== This batch contains netfilter updates for you net-next tree, they are: * The new connlabel extension for x_tables, that allows us to attach labels to each conntrack flow. The kernel implementation uses a bitmask and there's a file in user-space that maps the bits with the corresponding string for each existing label. By now, you can attach up to 128 overlapping labels. From Florian Westphal. * A new round of improvements for the netns support for conntrack. Gao feng has moved many of the initialization code of each module of the netns init path. He also made several code refactoring, that code looks cleaner to me now. * Added documentation for all possible tweaks for nf_conntrack via sysctl, from Jiri Pirko. * Cisco 7941/7945 IP phone support for our SIP conntrack helper, from Kevin Cernekee. * Missing header file in the snmp helper, from Stephen Hemminger. * Finally, a couple of fixes to resolve minor issues with these changes, from myself. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net')
-rw-r--r--include/net/netfilter/nf_conntrack_acct.h6
-rw-r--r--include/net/netfilter/nf_conntrack_core.h15
-rw-r--r--include/net/netfilter/nf_conntrack_ecache.h19
-rw-r--r--include/net/netfilter/nf_conntrack_expect.h7
-rw-r--r--include/net/netfilter/nf_conntrack_extend.h4
-rw-r--r--include/net/netfilter/nf_conntrack_helper.h7
-rw-r--r--include/net/netfilter/nf_conntrack_l3proto.h11
-rw-r--r--include/net/netfilter/nf_conntrack_l4proto.h10
-rw-r--r--include/net/netfilter/nf_conntrack_labels.h58
-rw-r--r--include/net/netfilter/nf_conntrack_timeout.h8
-rw-r--r--include/net/netfilter/nf_conntrack_timestamp.h21
-rw-r--r--include/net/netns/conntrack.h4
12 files changed, 142 insertions, 28 deletions
diff --git a/include/net/netfilter/nf_conntrack_acct.h b/include/net/netfilter/nf_conntrack_acct.h
index 463ae8e16696..2bdb7a15fe06 100644
--- a/include/net/netfilter/nf_conntrack_acct.h
+++ b/include/net/netfilter/nf_conntrack_acct.h
@@ -57,7 +57,9 @@ static inline void nf_ct_set_acct(struct net *net, bool enable)
57 net->ct.sysctl_acct = enable; 57 net->ct.sysctl_acct = enable;
58} 58}
59 59
60extern int nf_conntrack_acct_init(struct net *net); 60extern int nf_conntrack_acct_pernet_init(struct net *net);
61extern void nf_conntrack_acct_fini(struct net *net); 61extern void nf_conntrack_acct_pernet_fini(struct net *net);
62 62
63extern int nf_conntrack_acct_init(void);
64extern void nf_conntrack_acct_fini(void);
63#endif /* _NF_CONNTRACK_ACCT_H */ 65#endif /* _NF_CONNTRACK_ACCT_H */
diff --git a/include/net/netfilter/nf_conntrack_core.h b/include/net/netfilter/nf_conntrack_core.h
index e98aeb3da033..930275fa2ea6 100644
--- a/include/net/netfilter/nf_conntrack_core.h
+++ b/include/net/netfilter/nf_conntrack_core.h
@@ -25,12 +25,19 @@ extern unsigned int nf_conntrack_in(struct net *net,
25 unsigned int hooknum, 25 unsigned int hooknum,
26 struct sk_buff *skb); 26 struct sk_buff *skb);
27 27
28extern int nf_conntrack_init(struct net *net); 28extern int nf_conntrack_init_net(struct net *net);
29extern void nf_conntrack_cleanup(struct net *net); 29extern void nf_conntrack_cleanup_net(struct net *net);
30 30
31extern int nf_conntrack_proto_init(struct net *net); 31extern int nf_conntrack_proto_pernet_init(struct net *net);
32extern void nf_conntrack_proto_fini(struct net *net); 32extern void nf_conntrack_proto_pernet_fini(struct net *net);
33 33
34extern int nf_conntrack_proto_init(void);
35extern void nf_conntrack_proto_fini(void);
36
37extern int nf_conntrack_init_start(void);
38extern void nf_conntrack_cleanup_start(void);
39
40extern void nf_conntrack_init_end(void);
34extern void nf_conntrack_cleanup_end(void); 41extern void nf_conntrack_cleanup_end(void);
35 42
36extern bool 43extern bool
diff --git a/include/net/netfilter/nf_conntrack_ecache.h b/include/net/netfilter/nf_conntrack_ecache.h
index 5654d292efd4..092dc651689f 100644
--- a/include/net/netfilter/nf_conntrack_ecache.h
+++ b/include/net/netfilter/nf_conntrack_ecache.h
@@ -207,9 +207,11 @@ nf_ct_expect_event(enum ip_conntrack_expect_events event,
207 nf_ct_expect_event_report(event, exp, 0, 0); 207 nf_ct_expect_event_report(event, exp, 0, 0);
208} 208}
209 209
210extern int nf_conntrack_ecache_init(struct net *net); 210extern int nf_conntrack_ecache_pernet_init(struct net *net);
211extern void nf_conntrack_ecache_fini(struct net *net); 211extern void nf_conntrack_ecache_pernet_fini(struct net *net);
212 212
213extern int nf_conntrack_ecache_init(void);
214extern void nf_conntrack_ecache_fini(void);
213#else /* CONFIG_NF_CONNTRACK_EVENTS */ 215#else /* CONFIG_NF_CONNTRACK_EVENTS */
214 216
215static inline void nf_conntrack_event_cache(enum ip_conntrack_events event, 217static inline void nf_conntrack_event_cache(enum ip_conntrack_events event,
@@ -232,12 +234,21 @@ static inline void nf_ct_expect_event_report(enum ip_conntrack_expect_events e,
232 u32 portid, 234 u32 portid,
233 int report) {} 235 int report) {}
234 236
235static inline int nf_conntrack_ecache_init(struct net *net) 237static inline int nf_conntrack_ecache_pernet_init(struct net *net)
236{ 238{
237 return 0; 239 return 0;
238} 240}
239 241
240static inline void nf_conntrack_ecache_fini(struct net *net) 242static inline void nf_conntrack_ecache_pernet_fini(struct net *net)
243{
244}
245
246static inline int nf_conntrack_ecache_init(void)
247{
248 return 0;
249}
250
251static inline void nf_conntrack_ecache_fini(void)
241{ 252{
242} 253}
243#endif /* CONFIG_NF_CONNTRACK_EVENTS */ 254#endif /* CONFIG_NF_CONNTRACK_EVENTS */
diff --git a/include/net/netfilter/nf_conntrack_expect.h b/include/net/netfilter/nf_conntrack_expect.h
index cc13f377a705..cbbae7621e22 100644
--- a/include/net/netfilter/nf_conntrack_expect.h
+++ b/include/net/netfilter/nf_conntrack_expect.h
@@ -69,8 +69,11 @@ struct nf_conntrack_expect_policy {
69 69
70#define NF_CT_EXPECT_CLASS_DEFAULT 0 70#define NF_CT_EXPECT_CLASS_DEFAULT 0
71 71
72int nf_conntrack_expect_init(struct net *net); 72int nf_conntrack_expect_pernet_init(struct net *net);
73void nf_conntrack_expect_fini(struct net *net); 73void nf_conntrack_expect_pernet_fini(struct net *net);
74
75int nf_conntrack_expect_init(void);
76void nf_conntrack_expect_fini(void);
74 77
75struct nf_conntrack_expect * 78struct nf_conntrack_expect *
76__nf_ct_expect_find(struct net *net, u16 zone, 79__nf_ct_expect_find(struct net *net, u16 zone,
diff --git a/include/net/netfilter/nf_conntrack_extend.h b/include/net/netfilter/nf_conntrack_extend.h
index 8b4d1fc29096..977bc8a46444 100644
--- a/include/net/netfilter/nf_conntrack_extend.h
+++ b/include/net/netfilter/nf_conntrack_extend.h
@@ -23,6 +23,9 @@ enum nf_ct_ext_id {
23#ifdef CONFIG_NF_CONNTRACK_TIMEOUT 23#ifdef CONFIG_NF_CONNTRACK_TIMEOUT
24 NF_CT_EXT_TIMEOUT, 24 NF_CT_EXT_TIMEOUT,
25#endif 25#endif
26#ifdef CONFIG_NF_CONNTRACK_LABELS
27 NF_CT_EXT_LABELS,
28#endif
26 NF_CT_EXT_NUM, 29 NF_CT_EXT_NUM,
27}; 30};
28 31
@@ -33,6 +36,7 @@ enum nf_ct_ext_id {
33#define NF_CT_EXT_ZONE_TYPE struct nf_conntrack_zone 36#define NF_CT_EXT_ZONE_TYPE struct nf_conntrack_zone
34#define NF_CT_EXT_TSTAMP_TYPE struct nf_conn_tstamp 37#define NF_CT_EXT_TSTAMP_TYPE struct nf_conn_tstamp
35#define NF_CT_EXT_TIMEOUT_TYPE struct nf_conn_timeout 38#define NF_CT_EXT_TIMEOUT_TYPE struct nf_conn_timeout
39#define NF_CT_EXT_LABELS_TYPE struct nf_conn_labels
36 40
37/* Extensions: optional stuff which isn't permanently in struct. */ 41/* Extensions: optional stuff which isn't permanently in struct. */
38struct nf_ct_ext { 42struct nf_ct_ext {
diff --git a/include/net/netfilter/nf_conntrack_helper.h b/include/net/netfilter/nf_conntrack_helper.h
index 9aad956d1008..ce27edf57570 100644
--- a/include/net/netfilter/nf_conntrack_helper.h
+++ b/include/net/netfilter/nf_conntrack_helper.h
@@ -82,8 +82,11 @@ static inline void *nfct_help_data(const struct nf_conn *ct)
82 return (void *)help->data; 82 return (void *)help->data;
83} 83}
84 84
85extern int nf_conntrack_helper_init(struct net *net); 85extern int nf_conntrack_helper_pernet_init(struct net *net);
86extern void nf_conntrack_helper_fini(struct net *net); 86extern void nf_conntrack_helper_pernet_fini(struct net *net);
87
88extern int nf_conntrack_helper_init(void);
89extern void nf_conntrack_helper_fini(void);
87 90
88extern int nf_conntrack_broadcast_help(struct sk_buff *skb, 91extern int nf_conntrack_broadcast_help(struct sk_buff *skb,
89 unsigned int protoff, 92 unsigned int protoff,
diff --git a/include/net/netfilter/nf_conntrack_l3proto.h b/include/net/netfilter/nf_conntrack_l3proto.h
index 6f7c13f4ac03..3bb89eac3fa1 100644
--- a/include/net/netfilter/nf_conntrack_l3proto.h
+++ b/include/net/netfilter/nf_conntrack_l3proto.h
@@ -76,11 +76,16 @@ struct nf_conntrack_l3proto {
76 76
77extern struct nf_conntrack_l3proto __rcu *nf_ct_l3protos[AF_MAX]; 77extern struct nf_conntrack_l3proto __rcu *nf_ct_l3protos[AF_MAX];
78 78
79/* Protocol registration. */ 79/* Protocol pernet registration. */
80extern int nf_conntrack_l3proto_register(struct net *net, 80extern int nf_ct_l3proto_pernet_register(struct net *net,
81 struct nf_conntrack_l3proto *proto); 81 struct nf_conntrack_l3proto *proto);
82extern void nf_conntrack_l3proto_unregister(struct net *net, 82extern void nf_ct_l3proto_pernet_unregister(struct net *net,
83 struct nf_conntrack_l3proto *proto); 83 struct nf_conntrack_l3proto *proto);
84
85/* Protocol global registration. */
86extern int nf_ct_l3proto_register(struct nf_conntrack_l3proto *proto);
87extern void nf_ct_l3proto_unregister(struct nf_conntrack_l3proto *proto);
88
84extern struct nf_conntrack_l3proto *nf_ct_l3proto_find_get(u_int16_t l3proto); 89extern struct nf_conntrack_l3proto *nf_ct_l3proto_find_get(u_int16_t l3proto);
85extern void nf_ct_l3proto_put(struct nf_conntrack_l3proto *p); 90extern void nf_ct_l3proto_put(struct nf_conntrack_l3proto *p);
86 91
diff --git a/include/net/netfilter/nf_conntrack_l4proto.h b/include/net/netfilter/nf_conntrack_l4proto.h
index c3be4aef6bf7..914d8d900798 100644
--- a/include/net/netfilter/nf_conntrack_l4proto.h
+++ b/include/net/netfilter/nf_conntrack_l4proto.h
@@ -121,12 +121,16 @@ extern struct nf_conntrack_l4proto *
121nf_ct_l4proto_find_get(u_int16_t l3proto, u_int8_t l4proto); 121nf_ct_l4proto_find_get(u_int16_t l3proto, u_int8_t l4proto);
122extern void nf_ct_l4proto_put(struct nf_conntrack_l4proto *p); 122extern void nf_ct_l4proto_put(struct nf_conntrack_l4proto *p);
123 123
124/* Protocol registration. */ 124/* Protocol pernet registration. */
125extern int nf_conntrack_l4proto_register(struct net *net, 125extern int nf_ct_l4proto_pernet_register(struct net *net,
126 struct nf_conntrack_l4proto *proto); 126 struct nf_conntrack_l4proto *proto);
127extern void nf_conntrack_l4proto_unregister(struct net *net, 127extern void nf_ct_l4proto_pernet_unregister(struct net *net,
128 struct nf_conntrack_l4proto *proto); 128 struct nf_conntrack_l4proto *proto);
129 129
130/* Protocol global registration. */
131extern int nf_ct_l4proto_register(struct nf_conntrack_l4proto *proto);
132extern void nf_ct_l4proto_unregister(struct nf_conntrack_l4proto *proto);
133
130static inline void nf_ct_kfree_compat_sysctl_table(struct nf_proto_net *pn) 134static inline void nf_ct_kfree_compat_sysctl_table(struct nf_proto_net *pn)
131{ 135{
132#if defined(CONFIG_SYSCTL) && defined(CONFIG_NF_CONNTRACK_PROC_COMPAT) 136#if defined(CONFIG_SYSCTL) && defined(CONFIG_NF_CONNTRACK_PROC_COMPAT)
diff --git a/include/net/netfilter/nf_conntrack_labels.h b/include/net/netfilter/nf_conntrack_labels.h
new file mode 100644
index 000000000000..c985695283b3
--- /dev/null
+++ b/include/net/netfilter/nf_conntrack_labels.h
@@ -0,0 +1,58 @@
1#include <linux/types.h>
2#include <net/net_namespace.h>
3#include <linux/netfilter/nf_conntrack_common.h>
4#include <linux/netfilter/nf_conntrack_tuple_common.h>
5#include <net/netfilter/nf_conntrack.h>
6#include <net/netfilter/nf_conntrack_extend.h>
7
8#include <uapi/linux/netfilter/xt_connlabel.h>
9
10struct nf_conn_labels {
11 u8 words;
12 unsigned long bits[];
13};
14
15static inline struct nf_conn_labels *nf_ct_labels_find(const struct nf_conn *ct)
16{
17#ifdef CONFIG_NF_CONNTRACK_LABELS
18 return nf_ct_ext_find(ct, NF_CT_EXT_LABELS);
19#else
20 return NULL;
21#endif
22}
23
24static inline struct nf_conn_labels *nf_ct_labels_ext_add(struct nf_conn *ct)
25{
26#ifdef CONFIG_NF_CONNTRACK_LABELS
27 struct nf_conn_labels *cl_ext;
28 struct net *net = nf_ct_net(ct);
29 u8 words;
30
31 words = ACCESS_ONCE(net->ct.label_words);
32 if (words == 0 || WARN_ON_ONCE(words > 8))
33 return NULL;
34
35 cl_ext = nf_ct_ext_add_length(ct, NF_CT_EXT_LABELS,
36 words * sizeof(long), GFP_ATOMIC);
37 if (cl_ext != NULL)
38 cl_ext->words = words;
39
40 return cl_ext;
41#else
42 return NULL;
43#endif
44}
45
46bool nf_connlabel_match(const struct nf_conn *ct, u16 bit);
47int nf_connlabel_set(struct nf_conn *ct, u16 bit);
48
49int nf_connlabels_replace(struct nf_conn *ct,
50 const u32 *data, const u32 *mask, unsigned int words);
51
52#ifdef CONFIG_NF_CONNTRACK_LABELS
53int nf_conntrack_labels_init(void);
54void nf_conntrack_labels_fini(void);
55#else
56static inline int nf_conntrack_labels_init(void) { return 0; }
57static inline void nf_conntrack_labels_fini(void) {}
58#endif
diff --git a/include/net/netfilter/nf_conntrack_timeout.h b/include/net/netfilter/nf_conntrack_timeout.h
index e41e472d08f2..d23aceb16d94 100644
--- a/include/net/netfilter/nf_conntrack_timeout.h
+++ b/include/net/netfilter/nf_conntrack_timeout.h
@@ -76,15 +76,15 @@ nf_ct_timeout_lookup(struct net *net, struct nf_conn *ct,
76} 76}
77 77
78#ifdef CONFIG_NF_CONNTRACK_TIMEOUT 78#ifdef CONFIG_NF_CONNTRACK_TIMEOUT
79extern int nf_conntrack_timeout_init(struct net *net); 79extern int nf_conntrack_timeout_init(void);
80extern void nf_conntrack_timeout_fini(struct net *net); 80extern void nf_conntrack_timeout_fini(void);
81#else 81#else
82static inline int nf_conntrack_timeout_init(struct net *net) 82static inline int nf_conntrack_timeout_init(void)
83{ 83{
84 return 0; 84 return 0;
85} 85}
86 86
87static inline void nf_conntrack_timeout_fini(struct net *net) 87static inline void nf_conntrack_timeout_fini(void)
88{ 88{
89 return; 89 return;
90} 90}
diff --git a/include/net/netfilter/nf_conntrack_timestamp.h b/include/net/netfilter/nf_conntrack_timestamp.h
index fc9c82b1f06b..b00461413efd 100644
--- a/include/net/netfilter/nf_conntrack_timestamp.h
+++ b/include/net/netfilter/nf_conntrack_timestamp.h
@@ -48,15 +48,28 @@ static inline void nf_ct_set_tstamp(struct net *net, bool enable)
48} 48}
49 49
50#ifdef CONFIG_NF_CONNTRACK_TIMESTAMP 50#ifdef CONFIG_NF_CONNTRACK_TIMESTAMP
51extern int nf_conntrack_tstamp_init(struct net *net); 51extern int nf_conntrack_tstamp_pernet_init(struct net *net);
52extern void nf_conntrack_tstamp_fini(struct net *net); 52extern void nf_conntrack_tstamp_pernet_fini(struct net *net);
53
54extern int nf_conntrack_tstamp_init(void);
55extern void nf_conntrack_tstamp_fini(void);
53#else 56#else
54static inline int nf_conntrack_tstamp_init(struct net *net) 57static inline int nf_conntrack_tstamp_pernet_init(struct net *net)
58{
59 return 0;
60}
61
62static inline void nf_conntrack_tstamp_pernet_fini(struct net *net)
63{
64 return;
65}
66
67static inline int nf_conntrack_tstamp_init(void)
55{ 68{
56 return 0; 69 return 0;
57} 70}
58 71
59static inline void nf_conntrack_tstamp_fini(struct net *net) 72static inline void nf_conntrack_tstamp_fini(void)
60{ 73{
61 return; 74 return;
62} 75}
diff --git a/include/net/netns/conntrack.h b/include/net/netns/conntrack.h
index 923cb20051ed..c9c0c538b68b 100644
--- a/include/net/netns/conntrack.h
+++ b/include/net/netns/conntrack.h
@@ -84,6 +84,10 @@ struct netns_ct {
84 int sysctl_auto_assign_helper; 84 int sysctl_auto_assign_helper;
85 bool auto_assign_helper_warned; 85 bool auto_assign_helper_warned;
86 struct nf_ip_net nf_ct_proto; 86 struct nf_ip_net nf_ct_proto;
87#if defined(CONFIG_NF_CONNTRACK_LABELS)
88 unsigned int labels_used;
89 u8 label_words;
90#endif
87#ifdef CONFIG_NF_NAT_NEEDED 91#ifdef CONFIG_NF_NAT_NEEDED
88 struct hlist_head *nat_bysource; 92 struct hlist_head *nat_bysource;
89 unsigned int nat_htable_size; 93 unsigned int nat_htable_size;