aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6
diff options
context:
space:
mode:
authorGao feng <gaofeng@cn.fujitsu.com>2013-03-24 19:50:40 -0400
committerPablo Neira Ayuso <pablo@netfilter.org>2013-04-05 14:12:54 -0400
commit30e0c6a6bee24db0166b7ca709277cd693e179f2 (patch)
tree264a13fcbf0d76de9e1b3f076ac7f8b045c6c5d5 /net/ipv6
parentf3c1a44a2208d14b061ad665d9549c9b321f38e5 (diff)
netfilter: nf_log: prepare net namespace support for loggers
This patch adds netns support to nf_log and it prepares netns support for existing loggers. It is composed of four major changes. 1) nf_log_register has been split to two functions: nf_log_register and nf_log_set. The new nf_log_register is used to globally register the nf_logger and nf_log_set is used for enabling pernet support from nf_loggers. Per netns is not yet complete after this patch, it comes in separate follow up patches. 2) Add net as a parameter of nf_log_bind_pf. Per netns is not yet complete after this patch, it only allows to bind the nf_logger to the protocol family from init_net and it skips other cases. 3) Adapt all nf_log_packet callers to pass netns as parameter. After this patch, this function only works for init_net. 4) Make the sysctl net/netfilter/nf_log pernet. Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'net/ipv6')
-rw-r--r--net/ipv6/netfilter/ip6_tables.c3
-rw-r--r--net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c7
2 files changed, 6 insertions, 4 deletions
diff --git a/net/ipv6/netfilter/ip6_tables.c b/net/ipv6/netfilter/ip6_tables.c
index 341b54ade72c..8861b1ef420e 100644
--- a/net/ipv6/netfilter/ip6_tables.c
+++ b/net/ipv6/netfilter/ip6_tables.c
@@ -284,6 +284,7 @@ static void trace_packet(const struct sk_buff *skb,
284 const char *hookname, *chainname, *comment; 284 const char *hookname, *chainname, *comment;
285 const struct ip6t_entry *iter; 285 const struct ip6t_entry *iter;
286 unsigned int rulenum = 0; 286 unsigned int rulenum = 0;
287 struct net *net = dev_net(in ? in : out);
287 288
288 table_base = private->entries[smp_processor_id()]; 289 table_base = private->entries[smp_processor_id()];
289 root = get_entry(table_base, private->hook_entry[hook]); 290 root = get_entry(table_base, private->hook_entry[hook]);
@@ -296,7 +297,7 @@ static void trace_packet(const struct sk_buff *skb,
296 &chainname, &comment, &rulenum) != 0) 297 &chainname, &comment, &rulenum) != 0)
297 break; 298 break;
298 299
299 nf_log_packet(AF_INET6, hook, skb, in, out, &trace_loginfo, 300 nf_log_packet(net, AF_INET6, hook, skb, in, out, &trace_loginfo,
300 "TRACE: %s:%s:%s:%u ", 301 "TRACE: %s:%s:%s:%u ",
301 tablename, chainname, comment, rulenum); 302 tablename, chainname, comment, rulenum);
302} 303}
diff --git a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
index 24df3dde0076..b3807c5cb888 100644
--- a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
+++ b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
@@ -131,7 +131,8 @@ static bool icmpv6_new(struct nf_conn *ct, const struct sk_buff *skb,
131 type + 128); 131 type + 128);
132 nf_ct_dump_tuple_ipv6(&ct->tuplehash[0].tuple); 132 nf_ct_dump_tuple_ipv6(&ct->tuplehash[0].tuple);
133 if (LOG_INVALID(nf_ct_net(ct), IPPROTO_ICMPV6)) 133 if (LOG_INVALID(nf_ct_net(ct), IPPROTO_ICMPV6))
134 nf_log_packet(PF_INET6, 0, skb, NULL, NULL, NULL, 134 nf_log_packet(nf_ct_net(ct), PF_INET6, 0, skb, NULL,
135 NULL, NULL,
135 "nf_ct_icmpv6: invalid new with type %d ", 136 "nf_ct_icmpv6: invalid new with type %d ",
136 type + 128); 137 type + 128);
137 return false; 138 return false;
@@ -203,7 +204,7 @@ icmpv6_error(struct net *net, struct nf_conn *tmpl,
203 icmp6h = skb_header_pointer(skb, dataoff, sizeof(_ih), &_ih); 204 icmp6h = skb_header_pointer(skb, dataoff, sizeof(_ih), &_ih);
204 if (icmp6h == NULL) { 205 if (icmp6h == NULL) {
205 if (LOG_INVALID(net, IPPROTO_ICMPV6)) 206 if (LOG_INVALID(net, IPPROTO_ICMPV6))
206 nf_log_packet(PF_INET6, 0, skb, NULL, NULL, NULL, 207 nf_log_packet(net, PF_INET6, 0, skb, NULL, NULL, NULL,
207 "nf_ct_icmpv6: short packet "); 208 "nf_ct_icmpv6: short packet ");
208 return -NF_ACCEPT; 209 return -NF_ACCEPT;
209 } 210 }
@@ -211,7 +212,7 @@ icmpv6_error(struct net *net, struct nf_conn *tmpl,
211 if (net->ct.sysctl_checksum && hooknum == NF_INET_PRE_ROUTING && 212 if (net->ct.sysctl_checksum && hooknum == NF_INET_PRE_ROUTING &&
212 nf_ip6_checksum(skb, hooknum, dataoff, IPPROTO_ICMPV6)) { 213 nf_ip6_checksum(skb, hooknum, dataoff, IPPROTO_ICMPV6)) {
213 if (LOG_INVALID(net, IPPROTO_ICMPV6)) 214 if (LOG_INVALID(net, IPPROTO_ICMPV6))
214 nf_log_packet(PF_INET6, 0, skb, NULL, NULL, NULL, 215 nf_log_packet(net, PF_INET6, 0, skb, NULL, NULL, NULL,
215 "nf_ct_icmpv6: ICMPv6 checksum failed "); 216 "nf_ct_icmpv6: ICMPv6 checksum failed ");
216 return -NF_ACCEPT; 217 return -NF_ACCEPT;
217 } 218 }