netfilter: netfilter update
Subsystems (6)
cover netfilter: netfilter update
Hi Dave,
following is a small netfilter update for net-next, containing:
- a patch to support user-defined SNAT rules in the nat/INPUT chain, from myself
- one-packet scheduling for IPVS from Nick Chalk
- missing kdev_t.h inclusion in xt_IDLETIMER from Randy Dunlap
- the removal of CONFIG_NF_CT_ACCT, originally scheduled for 2.6.29, from Tim Gardner
- a patch to support MAC header decoding in the netfilter LOG targets, from myself
- a patch for per bridge device controls for iptables invocation, from myself
Please apply or pull from:
git://git.kernel.org/pub/scm/linux/kernel/git/kaber/nf-next-2.6.git master
Thanks!
Arnd Hannemann (1):
netfilter: fix simple typo in KConfig for netfiltert xt_TEE
Nick Chalk (1):
IPVS: one-packet scheduling
Patrick McHardy (4):
netfilter: nf_nat: support user-specified SNAT rules in LOCAL_IN
netfilter: ipt_LOG/ip6t_LOG: remove comparison within loop
netfilter: ipt_LOG/ip6t_LOG: add option to print decoded MAC header
bridge: add per bridge device controls for invoking iptables
Randy Dunlap (1):
netfilter: xt_IDLETIMER needs kdev_t.h
Tim Gardner (2):
netfilter: xt_connbytes: Force CT accounting to be enabled
netfilter: complete the deprecation of CONFIG_NF_CT_ACCT
PATCH 1/9 netfilter: nf_nat: support user-specified SNAT rules in LOCAL_IN
From: Patrick McHardy <[email protected]>
2.6.34 introduced 'conntrack zones' to deal with cases where packets from multiple identical networks are handled by conntrack/NAT. Packets are looped through veth devices, during which they are NATed to private addresses, after which they can continue normally through the stack and possibly have NAT rules applied a second time.
This works well, but is needlessly complicated for cases where only a single SNAT/DNAT mapping needs to be applied to these packets. In that case, all that needs to be done is to assign each network to a seperate zone and perform NAT as usual. However this doesn't work for packets destined for the machine performing NAT itself since its corrently not possible to configure SNAT mappings for the LOCAL_IN chain.
This patch adds a new INPUT chain to the NAT table and changes the targets performing SNAT to be usable in that chain.
Example usage with two identical networks (192.168.0.0/24) on eth0/eth1:
iptables -t raw -A PREROUTING -i eth0 -j CT --zone 1 iptables -t raw -A PREROUTING -i eth0 -j MARK --set-mark 1 iptables -t raw -A PREROUTING -i eth1 -j CT --zone 2 iptabels -t raw -A PREROUTING -i eth1 -j MARK --set-mark 2
iptables -t nat -A INPUT -m mark --mark 1 -j NETMAP --to 10.0.0.0/24
iptables -t nat -A POSTROUTING -m mark --mark 1 -j NETMAP --to 10.0.0.0/24
iptables -t nat -A INPUT -m mark --mark 2 -j NETMAP --to 10.0.1.0/24
iptables -t nat -A POSTROUTING -m mark --mark 2 -j NETMAP --to 10.0.1.0/24
iptables -t raw -A PREROUTING -d 10.0.0.0/24 -j CT --zone 1
iptables -t raw -A OUTPUT -d 10.0.0.0/24 -j CT --zone 1
iptables -t raw -A PREROUTING -d 10.0.1.0/24 -j CT --zone 2
iptables -t raw -A OUTPUT -d 10.0.1.0/24 -j CT --zone 2
iptables -t nat -A PREROUTING -d 10.0.0.0/24 -j NETMAP --to 192.168.0.0/24
iptables -t nat -A OUTPUT -d 10.0.0.0/24 -j NETMAP --to 192.168.0.0/24
iptables -t nat -A PREROUTING -d 10.0.1.0/24 -j NETMAP --to 192.168.0.0/24
iptables -t nat -A OUTPUT -d 10.0.1.0/24 -j NETMAP --to 192.168.0.0/24
--- include/net/netfilter/nf_nat_rule.h | 2 -- net/ipv4/netfilter/ipt_NETMAP.c | 6 ++++-- net/ipv4/netfilter/nf_nat_rule.c | 10 ++++++---- net/ipv4/netfilter/nf_nat_standalone.c | 8 +------- 4 files changed, 11 insertions(+), 15 deletions(-)
include/net/netfilter/nf_nat_rule.h +0 -2
@@ -12,6 +12,4 @@ extern int nf_nat_rule_find(struct sk_buff *skb,const struct net_device *out, struct nf_conn *ct); -extern unsigned int -alloc_null_binding (struct nf_conn *ct,unsigned int hooknum);#endif /* _NF_NAT_RULE_H */
net/ipv4/netfilter/ipt_NETMAP.c +4 -2
@@ -48,7 +48,8 @@ netmap_tg(struct sk_buff *skb, const struct xt_action_param *par)NF_CT_ASSERT (par->hooknum ==NF_INET_PRE_ROUTING || par->hooknum ==NF_INET_POST_ROUTING || - par->hooknum ==NF_INET_LOCAL_OUT ); + par->hooknum ==NF_INET_LOCAL_OUT || + par->hooknum ==NF_INET_LOCAL_IN ); ct =nf_ct_get (skb, &ctinfo); netmask = ~(mr->range[0 ].min_ip ^ mr->range[0 ].max_ip);
@@ -77,7 +78,8 @@ static struct xt_target netmap_tg_reg __read_mostly = { .table = "nat", .hooks = (1 <<NF_INET_PRE_ROUTING ) | (1 <<NF_INET_POST_ROUTING ) | - (1 << NF_INET_LOCAL_OUT), + (1 <<NF_INET_LOCAL_OUT ) | + (1 << NF_INET_LOCAL_IN), .checkentry = netmap_tg_check, .me =THIS_MODULE };
net/ipv4/netfilter/nf_nat_rule.c +6 -4
@@ -28,7 +28,8 @@#define NAT_VALID_HOOKS ((1 << NF_INET_PRE_ROUTING) | \ (1 << NF_INET_POST_ROUTING) | \ - (1 << NF_INET_LOCAL_OUT)) + (1 << NF_INET_LOCAL_OUT) | \ + (1 << NF_INET_LOCAL_IN))static const struct xt_table nat_table = { .name ="nat" ,
@@ -45,7 +46,8 @@ ipt_snat_target(struct sk_buff *skb, const struct xt_action_param *par)enum ip_conntrack_info ctinfo;const struct nf_nat_multi_range_compat *mr = par->targinfo; -NF_CT_ASSERT (par->hooknum ==NF_INET_POST_ROUTING ); +NF_CT_ASSERT (par->hooknum ==NF_INET_POST_ROUTING || + par->hooknum ==NF_INET_LOCAL_IN ); ct =nf_ct_get (skb, &ctinfo);
@@ -99,7 +101,7 @@ static int ipt_dnat_checkentry(const struct xt_tgchk_param *par)return 0 ; } -unsigned int +static unsigned int alloc_null_binding (struct nf_conn *ct,unsigned int hooknum) {/* Force range to this IP; let proto decide mapping for
@@ -141,7 +143,7 @@ static struct xt_target ipt_snat_reg __read_mostly = { .target = ipt_snat_target, .targetsize = sizeof(struct nf_nat_multi_range_compat), .table = "nat", - .hooks = 1 << NF_INET_POST_ROUTING, + .hooks = (1 << NF_INET_POST_ROUTING) | (1 << NF_INET_LOCAL_IN), .checkentry = ipt_snat_checkentry, .family = AF_INET, };
net/ipv4/netfilter/nf_nat_standalone.c +1 -7
@@ -131,13 +131,7 @@ nf_nat_fn(unsigned int hooknum,if (!nf_nat_initialized (ct, maniptype)) {unsigned int ret; -if (hooknum ==NF_INET_LOCAL_IN ) -/* LOCAL_IN hook doesn't have a chain! */ - ret =alloc_null_binding (ct, hooknum); -else - ret =nf_nat_rule_find (skb, hooknum, in, out, - ct); - + ret =nf_nat_rule_find (skb, hooknum, in, out, ct);if (ret !=NF_ACCEPT )return ret; }else
Signature · 1 line
1.7.0.4
Re: [PATCH 1/9] netfilter: nf_nat: support user-specified SNAT rules in LOCAL_IN
Quoted 9 lines · On Friday 2010-07-02 11:52, [email protected] wrote:
2.6.34 introduced 'conntrack zones' to deal with cases where packets from multiple identical networks are handled by conntrack/NAT. Packets are looped through veth devices, during which they are NATed to private addresses, after which they can continue normally through the stack and possibly have NAT rules applied a second time.
This works well, but is needlessly complicated for cases where only a single SNAT/DNAT mapping needs to be applied to these packets.
I still have not grasped why SNAT is needed in the INPUT path. For the tunnel scenario that you wanted to build I could not find a reason to do SNAT in that place - since the non-encapsulated packets don't go through INPUT anyway.
Re: [PATCH 1/9] netfilter: nf_nat: support user-specified SNAT rules in LOCAL_IN
Quoted 10 lines · Jan Engelhardt
Quoted 8 lines · On Friday 2010-07-02 11:52, [email protected] wrote:
2.6.34 introduced 'conntrack zones' to deal with cases where packets
from multiple identical networks are handled by conntrack/NAT. Packets
are looped through veth devices, during which they are NATed to private addresses, after which they can continue normally through the stack and possibly have NAT rules applied a second time.
Quoted 9 lines
Quoted 3 lines
This works well, but is needlessly complicated for cases where only a single SNAT/DNAT mapping needs to be applied to these packets.
I still have not grasped why SNAT is needed in the INPUT path. For the tunnel scenario that you wanted to build I could not find a reason to do SNAT in that place - since the non-encapsulated packets don't go through INPUT anyway.
Sure they do, if they are destined for the host itself. I'm not sure what's so hard to understand about this patch, you have f.i. multiple tunnels using the same remote network, on INPUT and POSTROUTING you SNAT them to seperate networks based on criteria like the network device or the IPsec tunnel to be able to distinguish them.
Re: [PATCH 1/9] netfilter: nf_nat: support user-specified SNAT rules in LOCAL_IN
Quoted 11 lines · Patrick McHardy
Quoted 5 lines
I still have not grasped why SNAT is needed in the INPUT path. For the tunnel scenario that you wanted to build I could not find a reason to do SNAT in that place - since the non-encapsulated packets don't go through INPUT anyway.
Sure they do, if they are destined for the host itself. I'm not sure what's so hard to understand about this patch, you have f.i. multiple tunnels using the same remote network, on INPUT and POSTROUTING you SNAT them to seperate networks based on criteria like the network device or the IPsec tunnel to be able to distinguish them.
But they are already distinguishable by the ctmark that is applied to these connections to do routing of the reply, are they not?
Re: [PATCH 1/9] netfilter: nf_nat: support user-specified SNAT rules in LOCAL_IN
Quoted 14 lines · Jan Engelhardt
Quoted 11 lines · Patrick McHardy
Quoted 5 lines
I still have not grasped why SNAT is needed in the INPUT path. For the tunnel scenario that you wanted to build I could not find a reason to do SNAT in that place - since the non-encapsulated packets don't go through INPUT anyway.
Sure they do, if they are destined for the host itself. I'm not sure what's so hard to understand about this patch, you have f.i. multiple tunnels using the same remote network, on INPUT and POSTROUTING you SNAT them to seperate networks based on criteria like the network device or the IPsec tunnel to be able to distinguish them.
Quoted 3 lines
But they are already distinguishable by the ctmark that is applied to these connections to do routing of the reply, are they not?
Its not (only) about routing, you simply can't have two connections using the same identity.
Re: [PATCH 1/9] netfilter: nf_nat: support user-specified SNAT rules in LOCAL_IN
Quoted 7 lines · Patrick McHardy
Quoted 7 lines
Quoted 6 lines
Sure they do, if they are destined for the host itself. I'm not sure what's so hard to understand about this patch, you have f.i. multiple tunnels using the same remote network, on INPUT and POSTROUTING you SNAT them to seperate networks based on criteria like the network device or the IPsec tunnel to be able to distinguish them.
Quoted 6 lines
Quoted 3 lines
But they are already distinguishable by the ctmark that is applied to these connections to do routing of the reply, are they not?
Its not (only) about routing, you simply can't have two connections using the same identity.
Which is why the zone thing is added.
Ah, but I now see that you need to select a zone for it first.. touché.
Still this SNAT-on-INPUT leaves a second taste. Adding another address to the tunnel master and using DNAT-on-PREROUTING for local deliveries would have also made the connections unambiguous.
Re: [PATCH 1/9] netfilter: nf_nat: support user-specified SNAT rules in LOCAL_IN
Quoted 13 lines · Jan Engelhardt
Quoted 11 lines · Patrick McHardy
Quoted 11 lines
Quoted 7 lines
Sure they do, if they are destined for the host itself. I'm not sure what's so hard to understand about this patch, you have f.i. multiple tunnels using the same remote network, on INPUT and POSTROUTING you SNAT them to seperate networks based on criteria like the network device or the IPsec tunnel to be able to distinguish them.
But they are already distinguishable by the ctmark that is applied to these connections to do routing of the reply, are they not?
Quoted 6 lines
Quoted 3 lines
Its not (only) about routing, you simply can't have two connections using the same identity.
Which is why the zone thing is added.
I'm not talking about conntrack at all. A connection needs a unique identity. Just look at the socket lookup code.
Quoted 3 lines
Ah, but I now see that you need to select a zone for it first.. touché.
Still this SNAT-on-INPUT leaves a second taste. Adding another address to the tunnel master and using DNAT-on-PREROUTING for local deliveries would have also made the connections unambiguous
PATCH 2/9 IPVS: one-packet scheduling
In reply to [email protected]From: Nick Chalk <[email protected]>
Allow one-packet scheduling for UDP connections. When the fwmark-based or normal virtual service is marked with '-o' or '--ops' options all connections are created only to schedule one packet. Useful to schedule UDP packets from same client port to different real servers. Recommended with RR or WRR schedulers (the connections are not visible with ipvsadm -L).
--- include/linux/ip_vs.h | 2 ++ net/netfilter/ipvs/ip_vs_conn.c | 10 +++++++--- net/netfilter/ipvs/ip_vs_core.c | 20 ++++++++++++++++---- net/netfilter/ipvs/ip_vs_ctl.c | 10 ++++++---- 4 files changed, 31 insertions(+), 11 deletions(-)
include/linux/ip_vs.h +2 -0
@@ -19,6 +19,7 @@*/ #define IP_VS_SVC_F_PERSISTENT 0x0001/* persistent port */ #define IP_VS_SVC_F_HASHED 0x0002/* hashed entry */ +#define IP_VS_SVC_F_ONEPACKET 0x0004/* one-packet scheduling */ /* * Destination Server Flags
@@ -85,6 +86,7 @@#define IP_VS_CONN_F_SEQ_MASK 0x0600/* in/out sequence mask */ #define IP_VS_CONN_F_NO_CPORT 0x0800/* no client port set yet */ #define IP_VS_CONN_F_TEMPLATE 0x1000/* template, not connection */ +#define IP_VS_CONN_F_ONE_PACKET 0x2000/* forward only one packet */ #define IP_VS_SCHEDNAME_MAXLEN 16#define IP_VS_IFNAME_MAXLEN 16
net/netfilter/ipvs/ip_vs_conn.c +7 -3
@@ -158,6 +158,9 @@ static inline int ip_vs_conn_hash(struct ip_vs_conn *cp)unsigned hash;int ret; +if (cp->flags &IP_VS_CONN_F_ONE_PACKET ) +return 0 ; +/* Hash by protocol, client address and port */ hash =ip_vs_conn_hashkey (cp->af, cp->protocol, &cp->caddr, cp->cport);
@@ -355,8 +358,9 @@ struct ip_vs_conn *ip_vs_conn_out_get*/ void ip_vs_conn_put (struct ip_vs_conn *cp) { -/* reset it expire in its timeout */ -mod_timer (&cp->timer, jiffies+cp->timeout); +unsigned long t = (cp->flags &IP_VS_CONN_F_ONE_PACKET ) ? +0 : cp->timeout; +mod_timer (&cp->timer, jiffies+t);__ip_vs_conn_put (cp); }
@@ -649,7 +653,7 @@ static void ip_vs_conn_expire(unsigned long data)/* * unhash it if it is hashed in the conn table */ -if (!ip_vs_conn_unhash (cp)) +if (!ip_vs_conn_unhash (cp) && !(cp->flags &IP_VS_CONN_F_ONE_PACKET )) goto expire_later;/*
net/netfilter/ipvs/ip_vs_core.c +16 -4
@@ -194,6 +194,7 @@ ip_vs_sched_persist(struct ip_vs_service *svc,struct ip_vs_dest *dest;struct ip_vs_conn *ct;__be16 dport;/* destination port to forward */ +__be16 flags;union nf_inet_addr snet;/* source network of the client, after masking */
@@ -340,6 +341,10 @@ ip_vs_sched_persist(struct ip_vs_service *svc, dport = ports[1 ]; } + flags = (svc->flags &IP_VS_SVC_F_ONEPACKET + && iph.protocol ==IPPROTO_UDP )? +IP_VS_CONN_F_ONE_PACKET :0 ; +/* * Create a new connection according to the template */
@@ -347,7 +352,7 @@ ip_vs_sched_persist(struct ip_vs_service *svc, &iph.saddr, ports[0 ], &iph.daddr, ports[1 ], &dest->addr, dport, -0 , + flags, dest);if (cp ==NULL ) {ip_vs_conn_put (ct);
@@ -377,7 +382,7 @@ ip_vs_schedule(struct ip_vs_service *svc, const struct sk_buff *skb)struct ip_vs_conn *cp =NULL ;struct ip_vs_iphdr iph;struct ip_vs_dest *dest; -__be16 _ports[2 ], *pptr; +__be16 _ports[2 ], *pptr, flags;ip_vs_fill_iphdr (svc->af,skb_network_header (skb), &iph); pptr =skb_header_pointer (skb, iph.len,sizeof (_ports), _ports);
@@ -407,6 +412,10 @@ ip_vs_schedule(struct ip_vs_service *svc, const struct sk_buff *skb)return NULL ; } + flags = (svc->flags &IP_VS_SVC_F_ONEPACKET + && iph.protocol ==IPPROTO_UDP )? +IP_VS_CONN_F_ONE_PACKET :0 ; +/* * Create a connection entry. */
@@ -414,7 +423,7 @@ ip_vs_schedule(struct ip_vs_service *svc, const struct sk_buff *skb) &iph.saddr, pptr[0 ], &iph.daddr, pptr[1 ], &dest->addr, dest->port ? dest->port : pptr[1 ], -0 , + flags, dest);if (cp ==NULL )return NULL ;
@@ -464,6 +473,9 @@ int ip_vs_leave(struct ip_vs_service *svc, struct sk_buff *skb,if (sysctl_ip_vs_cache_bypass && svc->fwmark && unicast) {int ret, cs;struct ip_vs_conn *cp; +__u16 flags = (svc->flags &IP_VS_SVC_F_ONEPACKET && + iph.protocol ==IPPROTO_UDP )? +IP_VS_CONN_F_ONE_PACKET :0 ;union nf_inet_addr daddr = { .all = {0 ,0 ,0 ,0 } };ip_vs_service_put (svc);
@@ -474,7 +486,7 @@ int ip_vs_leave(struct ip_vs_service *svc, struct sk_buff *skb, &iph.saddr, pptr[0 ], &iph.daddr, pptr[1 ], &daddr,0 , -IP_VS_CONN_F_BYPASS , +IP_VS_CONN_F_BYPASS | flags, NULL);if (cp ==NULL )return NF_DROP ;
net/netfilter/ipvs/ip_vs_ctl.c +6 -4
@@ -1864,14 +1864,16 @@ static int ip_vs_info_seq_show(struct seq_file *seq, void *v) svc->scheduler->name); else#endif -seq_printf (seq,"%s %08X:%04X %s " , +seq_printf (seq,"%s %08X:%04X %s %s " ,ip_vs_proto_name (svc->protocol),ntohl (svc->addr.ip),ntohs (svc->port), - svc->scheduler->name); + svc->scheduler->name, + (svc->flags &IP_VS_SVC_F_ONEPACKET )?"ops " :"" ); }else { -seq_printf (seq,"FWM %08X %s " , - svc->fwmark, svc->scheduler->name); +seq_printf (seq,"FWM %08X %s %s" , + svc->fwmark, svc->scheduler->name, + (svc->flags &IP_VS_SVC_F_ONEPACKET )?"ops " :"" ); }if (svc->flags &IP_VS_SVC_F_PERSISTENT )
Signature · 1 line
1.7.0.4
PATCH 3/9 netfilter: xt_IDLETIMER needs kdev_t.h
In reply to [email protected]From: Randy Dunlap <[email protected]>
Add header file to fix build error:net/netfilter/xt_IDLETIMER.c:276: error: implicit declaration of function 'MKDEV'
--- net/netfilter/xt_IDLETIMER.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
net/netfilter/xt_IDLETIMER.c +1 -0
@@ -36,6 +36,7 @@#include <linux/netfilter.h> #include <linux/netfilter/x_tables.h> #include <linux/netfilter/xt_IDLETIMER.h> +#include <linux/kdev_t.h> #include <linux/kobject.h> #include <linux/workqueue.h> #include <linux/sysfs.h>
Signature · 1 line
1.7.0.4
PATCH 4/9 netfilter: fix simple typo in KConfig for netfiltert xt_TEE
In reply to [email protected]From: Arnd Hannemann <[email protected]>
Destination was spelled wrong in KConfig.
--- net/netfilter/Kconfig | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
net/netfilter/Kconfig +1 -1
@@ -515,7 +515,7 @@ config NETFILTER_XT_TARGET_RATEEST To compile it as a module, choose M here. If unsure, say N. config NETFILTER_XT_TARGET_TEE - tristate '"TEE" - packet cloning to alternate destiantion' + tristate '"TEE" - packet cloning to alternate destination' depends on NETFILTER_ADVANCED depends on (IPV6 || IPV6=n) depends on !NF_CONNTRACK || NF_CONNTRACK
Signature · 1 line
1.7.0.4
PATCH 5/9 netfilter: xt_connbytes: Force CT accounting to be enabled
In reply to [email protected]From: Tim Gardner <[email protected]>
Check at rule install time that CT accounting is enabled. Force it to be enabled if not while also emitting a warning since this is not the default state.
This is in preparation for deprecating CONFIG_NF_CT_ACCT upon which CONFIG_NETFILTER_XT_MATCH_CONNBYTES depended being set.
Added 2 CT accounting support functions:
nf_ct_acct_enabled() - Get CT accounting state.nf_ct_set_acct() - Enable/disable CT accountuing.
--- include/net/netfilter/nf_conntrack_acct.h | 12 ++++++++++++ net/netfilter/xt_connbytes.c | 10 ++++++++++ 2 files changed, 22 insertions(+), 0 deletions(-)
include/net/netfilter/nf_conntrack_acct.h +12 -0
@@ -45,6 +45,18 @@ struct nf_conn_counter *nf_ct_acct_ext_add(struct nf_conn *ct, gfp_t gfp)extern unsigned int seq_print_acct (struct seq_file *s,const struct nf_conn *ct,int dir); +/* Check if connection tracking accounting is enabled */ +static inline bool nf_ct_acct_enabled (struct net *net) +{ +return net->ct.sysctl_acct !=0 ; +} + +/* Enable/disable connection tracking accounting */ +static inline void nf_ct_set_acct (struct net *net,bool enable) +{ + net->ct.sysctl_acct = enable; +} +extern int nf_conntrack_acct_init (struct net *net);extern void nf_conntrack_acct_fini (struct net *net);
net/netfilter/xt_connbytes.c +10 -0
@@ -112,6 +112,16 @@ static int connbytes_mt_check(const struct xt_mtchk_param *par)if (ret <0 )pr_info ("cannot load conntrack support for proto=%u\n" , par->family); + +/* +* This filter cannot function correctly unless connection tracking +* accounting is enabled, so complain in the hope that someone notices. +*/ +if (!nf_ct_acct_enabled (par->net)) { +pr_warning ("Forcing CT accounting to be enabled\n" ); +nf_ct_set_acct (par->net, true); + } +return ret; }
Signature · 1 line
1.7.0.4
PATCH 6/9 netfilter: complete the deprecation of CONFIG_NF_CT_ACCT
In reply to [email protected]From: Tim Gardner <[email protected]>
CONFIG_NF_CT_ACCT has been deprecated for awhile and was originally scheduled for removal by 2.6.29.
Removing support for this config option also stops this deprecation warning message in the kernel log.
[ 61.669627] nf_conntrack version 0.5.0 (16384 buckets, 65536 max) [ 61.669850] CONFIG_NF_CT_ACCT is deprecated and will be removed soon. Please use [ 61.669852] nf_conntrack.acct=1 kernel parameter, acct=1 nf_conntrack module option or [ 61.669853] sysctl net.netfilter.nf_conntrack_acct=1 to enable it.
--- Documentation/feature-removal-schedule.txt | 9 --------- Documentation/kernel-parameters.txt | 3 +-- net/netfilter/Kconfig | 22 ---------------------- net/netfilter/nf_conntrack_acct.c | 14 +------------- 4 files changed, 2 insertions(+), 46 deletions(-)
Documentation/feature-removal-schedule.txt +0 -9
@@ -303,15 +303,6 @@ Who: Johannes Berg <[email protected]> --------------------------- -What: CONFIG_NF_CT_ACCT -When: 2.6.29 -Why: Accounting can now be enabled/disabled without kernel recompilation. - Currently used only to set a default value for a feature that is also - controlled by a kernel/module/sysfs/sysctl parameter. -Who: Krzysztof Piotr Oledzki <[email protected]> - ---------------------------- - What: sysfs ui for changing p4-clockmod parameters When: September 2009 Why: See commits 129f8ae9b1b5be94517da76009ea956e89104ce8 and
Documentation/kernel-parameters.txt +1 -2
@@ -1597,8 +1597,7 @@ and is between 256 and 4096 characters. It is defined in the file [NETFILTER] Enable connection tracking flow accounting 0 to disable accounting 1 to enable accounting - Default value depends on CONFIG_NF_CT_ACCT that is - going to be removed in 2.6.29. + Default value is 0. nfsaddrs= [NFS] See Documentation/filesystems/nfs/nfsroot.txt.
net/netfilter/Kconfig +0 -22
@@ -40,27 +40,6 @@ config NF_CONNTRACK if NF_CONNTRACK -config NF_CT_ACCT - bool "Connection tracking flow accounting" - depends on NETFILTER_ADVANCED - help - If this option is enabled, the connection tracking code will - keep per-flow packet and byte counters. - - Those counters can be used for flow-based accounting or the - `connbytes' match. - - Please note that currently this option only sets a default state. - You may change it at boot time with nf_conntrack.acct=0/1 kernel - parameter or by loading the nf_conntrack module with acct=0/1. - - You may also disable/enable it on a running system with: - sysctl net.netfilter.nf_conntrack_acct=0/1 - - This option will be removed in 2.6.29. - - If unsure, say `N'. - config NF_CONNTRACK_MARK bool 'Connection mark tracking support' depends on NETFILTER_ADVANCED
@@ -630,7 +609,6 @@ config NETFILTER_XT_MATCH_CONNBYTES tristate '"connbytes" per-connection counter match support' depends on NF_CONNTRACK depends on NETFILTER_ADVANCED - select NF_CT_ACCT help This option adds a `connbytes' match, which allows you to match the number of bytes and/or packets for each direction within a connection.
net/netfilter/nf_conntrack_acct.c +1 -13
@@ -17,13 +17,7 @@#include <net/netfilter/nf_conntrack_extend.h> #include <net/netfilter/nf_conntrack_acct.h> -#ifdef CONFIG_NF_CT_ACCT -#define NF_CT_ACCT_DEFAULT 1 -#else -#define NF_CT_ACCT_DEFAULT 0 -#endif - -static int nf_ct_acct__read_mostly =NF_CT_ACCT_DEFAULT ; +static int nf_ct_acct__read_mostly ;module_param_named (acct, nf_ct_acct, bool,0644 );MODULE_PARM_DESC (acct,"Enable connection tracking flow accounting." );
@@ -114,12 +108,6 @@ int nf_conntrack_acct_init(struct net *net) net->ct.sysctl_acct = nf_ct_acct;if (net_eq (net, &init_net)) { -#ifdef CONFIG_NF_CT_ACCT -printk (KERN_WARNING "CONFIG_NF_CT_ACCT is deprecated and will be removed soon. Please use\n" ); -printk (KERN_WARNING "nf_conntrack.acct=1 kernel parameter, acct=1 nf_conntrack module option or\n" ); -printk (KERN_WARNING "sysctl net.netfilter.nf_conntrack_acct=1 to enable it.\n" ); -#endif - ret =nf_ct_extend_register (&acct_extend);if (ret <0 ) {printk (KERN_ERR "nf_conntrack_acct: Unable to register extension\n" );
Signature · 1 line
1.7.0.4
PATCH 7/9 netfilter: ipt_LOG/ip6t_LOG: remove comparison within loop
In reply to [email protected]From: Patrick McHardy <[email protected]>
Remove the comparison within the loop to print the macheader by prepending the colon to all but the first printk.
Based on suggestion by Jan Engelhardt <[email protected]>.
--- net/ipv4/netfilter/ipt_LOG.c | 12 ++++++------ net/ipv6/netfilter/ip6t_LOG.c | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-)
net/ipv4/netfilter/ipt_LOG.c +6 -6
@@ -411,12 +411,12 @@ ipt_log_packet(u_int8_t pf, skb->mac_header != skb->network_header) {int i;const unsigned char *p =skb_mac_header (skb); -for (i =0 ; i < skb->dev->hard_header_len; i++,p++) -printk ("%02x%c" , *p, - i==skb->dev->hard_header_len -1 - ?' ' :':' ); - } else - printk(" "); + +printk ("%02x" , *p++); +for (i =1 ; i < skb->dev->hard_header_len; i++, p++) +printk (":%02x" , *p); + } +printk (" " ); }dump_packet (loginfo, skb,0 );
net/ipv6/netfilter/ip6t_LOG.c +3 -3
@@ -414,9 +414,9 @@ ip6t_log_packet(u_int8_t pf, p =NULL ;if (p !=NULL ) { -for (i =0 ; i < len; i++) -printk ("%02x%s" , p[i], - i == len -1 ?"" :":" ); +printk ("%02x" , *p++); +for (i =1 ; i < len; i++) +printk (":%02x" , p[i]); }printk (" " );
Signature · 1 line
1.7.0.4
PATCH 8/9 netfilter: ipt_LOG/ip6t_LOG: add option to print decoded MAC header
In reply to [email protected]From: Patrick McHardy <[email protected]>
The LOG targets print the entire MAC header as one long string, which is not readable very well:
IN=eth0 OUT= MAC=00:15:f2:24:91:f8:00:1b:24:dc:61:e6:08:00 ...
Add an option to decode known header formats (currently just ARPHRD_ETHER devices) in their individual fields:
IN=eth0 OUT= MACSRC=00:1b:24:dc:61:e6 MACDST=00:15:f2:24:91:f8 MACPROTO=0800 ... IN=eth0 OUT= MACSRC=00:1b:24:dc:61:e6 MACDST=00:15:f2:24:91:f8 MACPROTO=86dd ...
The option needs to be explicitly enabled by userspace to avoid breaking existing parsers.
--- include/linux/netfilter_ipv4/ipt_LOG.h | 3 +- include/linux/netfilter_ipv6/ip6t_LOG.h | 3 +- net/ipv4/netfilter/ipt_LOG.c | 54 +++++++++++++++----- net/ipv6/netfilter/ip6t_LOG.c | 81 ++++++++++++++++++++----------- 4 files changed, 97 insertions(+), 44 deletions(-)
include/linux/netfilter_ipv4/ipt_LOG.h +2 -1
@@ -7,7 +7,8 @@#define IPT_LOG_IPOPT 0x04/* Log IP options */ #define IPT_LOG_UID 0x08/* Log UID owning local socket */ #define IPT_LOG_NFLOG 0x10/* Unsupported, don't reuse */ -#define IPT_LOG_MASK 0x1f +#define IPT_LOG_MACDECODE 0x20/* Decode MAC header */ +#define IPT_LOG_MASK 0x2fstruct ipt_log_info {unsigned char level;
include/linux/netfilter_ipv6/ip6t_LOG.h +2 -1
@@ -7,7 +7,8 @@#define IP6T_LOG_IPOPT 0x04/* Log IP options */ #define IP6T_LOG_UID 0x08/* Log UID owning local socket */ #define IP6T_LOG_NFLOG 0x10/* Unsupported, don't use */ -#define IP6T_LOG_MASK 0x1f +#define IP6T_LOG_MACDECODE 0x20/* Decode MAC header */ +#define IP6T_LOG_MASK 0x2fstruct ip6t_log_info {unsigned char level;
net/ipv4/netfilter/ipt_LOG.c +40 -14
72 lines not on this page · raw message
net/ipv6/netfilter/ip6t_LOG.c +53 -28
94 lines not on this page · raw message
Signature · 1 line
1.7.0.4
PATCH 9/9 bridge: add per bridge device controls for invoking iptables
In reply to [email protected]From: Patrick McHardy <[email protected]>
Support more fine grained control of bridge netfilter iptables invocation by adding seperate brnf_call_*tables parameters for each device using the sysfs interface. Packets are passed to layer 3 netfilter when either the global parameter or the per bridge parameter is enabled.
--- net/bridge/br_netfilter.c | 31 ++++++++++++++----- net/bridge/br_private.h | 3 ++ net/bridge/br_sysfs_br.c | 72 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 97 insertions(+), 9 deletions(-)
net/bridge/br_netfilter.c +22 -9
@@ -55,6 +55,9 @@ static int brnf_call_arptables __read_mostly = 1;static int brnf_filter_vlan_tagged__read_mostly =0 ;static int brnf_filter_pppoe_tagged__read_mostly =0 ;#else +#define brnf_call_iptables 1 +#define brnf_call_ip6tables 1 +#define brnf_call_arptables 1#define brnf_filter_vlan_tagged 0#define brnf_filter_pppoe_tagged 0#endif
@@ -543,25 +546,30 @@ static unsigned int br_nf_pre_routing(unsigned int hook, struct sk_buff *skb,const struct net_device *out, int (*okfn)(struct sk_buff *)) { + struct net_bridge_port *p; +struct net_bridge *br;struct iphdr *iph;__u32 len =nf_bridge_encap_header_len (skb);if (unlikely (!pskb_may_pull (skb, len))) goto out; + p =rcu_dereference (in->br_port); +if (p ==NULL ) + goto out; + br = p->br; +if (skb->protocol ==htons (ETH_P_IPV6 ) ||IS_VLAN_IPV6 (skb) ||IS_PPPOE_IPV6 (skb)) { -#ifdef CONFIG_SYSCTL -if (!brnf_call_ip6tables) +if (!brnf_call_ip6tables && !br->nf_call_ip6tables)return NF_ACCEPT ; -#endif +nf_bridge_pull_encap_header_rcsum (skb);return br_nf_pre_routing_ipv6 (hook, skb, in, out, okfn); } -#ifdef CONFIG_SYSCTL -if (!brnf_call_iptables) + +if (!brnf_call_iptables && !br->nf_call_iptables)return NF_ACCEPT ; -#endif if (skb->protocol !=htons (ETH_P_IP ) && !IS_VLAN_IP (skb) && !IS_PPPOE_IP (skb))
@@ -714,12 +722,17 @@ static unsigned int br_nf_forward_arp(unsigned int hook, struct sk_buff *skb,const struct net_device *out, int (*okfn)(struct sk_buff *)) { + struct net_bridge_port *p; +struct net_bridge *br;struct net_device **d = (struct net_device **)(skb->cb); -#ifdef CONFIG_SYSCTL -if (!brnf_call_arptables) + p =rcu_dereference (out->br_port); +if (p ==NULL ) +return NF_ACCEPT ; + br = p->br; + +if (!brnf_call_arptables && !br->nf_call_arptables)return NF_ACCEPT ; -#endif if (skb->protocol !=htons (ETH_P_ARP )) {if (!IS_VLAN_ARP (skb))
net/bridge/br_private.h +3 -0
@@ -164,6 +164,9 @@ struct net_bridgeunsigned long feature_mask;#ifdef CONFIG_BRIDGE_NETFILTER struct rtable fake_rtable; +bool nf_call_iptables; +bool nf_call_ip6tables; +bool nf_call_arptables;#endif unsigned long flags;#define BR_SET_MAC_ADDR 0x00000001
net/bridge/br_sysfs_br.c +72 -0
84 lines not on this page · raw message
Signature · 1 line
1.7.0.4
David Miller
maintainerFrom: [email protected]
Date: Fri, 2 Jul 2010 11:52:13 +0200
Quoted 3 lines
Please apply or pull from:
git://git.kernel.org/pub/scm/linux/kernel/git/kaber/nf-next-2.6.gitmaster
Looks good, pulled, thanks Patrick.
David Miller
maintainerFrom: David Miller <[email protected]>
Date: Fri, 02 Jul 2010 22:04:08 -0700 (PDT)
Quoted 8 lines
From: [email protected]
Date: Fri, 2 Jul 2010 11:52:13 +0200Quoted 3 lines
Please apply or pull from:
git://git.kernel.org/pub/scm/linux/kernel/git/kaber/nf-next-2.6.gitmasterLooks good, pulled, thanks Patrick.
The br_netfilter changes don't build against net-next-2.6:
net/bridge/br_netfilter.c: In function 'br_nf_pre_routing':net/bridge/br_netfilter.c:558:6: error: 'const struct net_device' has no member named 'br_port' net/bridge/br_netfilter.c:558:6: warning: type defaults to 'int' in declaration of '_________p1' net/bridge/br_netfilter.c:558:6: error: 'const struct net_device' has no member named 'br_port' net/bridge/br_netfilter.c:558:6: error: 'const struct net_device' has no member named 'br_port' net/bridge/br_netfilter.c:558:2: warning: type defaults to 'int' in type name net/bridge/br_netfilter.c:558:4: warning: assignment makes pointer from integer without a cast net/bridge/br_netfilter.c: In function 'br_nf_forward_arp':net/bridge/br_netfilter.c:730:6: error: 'const struct net_device' has no member named 'br_port' net/bridge/br_netfilter.c:730:6: warning: type defaults to 'int' in declaration of '_________p1'
The br_port accessors got changed in net-next-2.6, so you have to do it using br_port_get_rcu(netdev) et al.
I'll fix this up in the merge commit when I pull.
Quoted 28 lines · David Miller
From: David Miller <[email protected]>
Date: Fri, 02 Jul 2010 22:04:08 -0700 (PDT)Quoted 10 lines
From: [email protected]
Date: Fri, 2 Jul 2010 11:52:13 +0200Quoted 4 lines
Please apply or pull from:
git://git.kernel.org/pub/scm/linux/kernel/git/kaber/nf-next-2.6.gitmasterLooks good, pulled, thanks Patrick.
The
br_netfilterchanges don't build against net-next-2.6:
net/bridge/br_netfilter.c: In function 'br_nf_pre_routing':net/bridge/br_netfilter.c:558:6: error: 'const structnet_device' has no member named 'br_port'net/bridge/br_netfilter.c:558:6: warning: type defaults to 'int' in declaration of '_________p1'net/bridge/br_netfilter.c:558:6: error: 'const structnet_device' has no member named 'br_port'net/bridge/br_netfilter.c:558:6: error: 'const structnet_device' has no member named 'br_port'net/bridge/br_netfilter.c:558:2: warning: type defaults to 'int' in type namenet/bridge/br_netfilter.c:558:4: warning: assignment makes pointer from integer without a castnet/bridge/br_netfilter.c: In function 'br_nf_forward_arp':net/bridge/br_netfilter.c:730:6: error: 'const structnet_device' has no member named 'br_port'net/bridge/br_netfilter.c:730:6: warning: type defaults to 'int' in declaration of '_________p1'
Quoted 3 lines
The
br_portaccessors got changed in net-next-2.6, so you have to do it usingbr_port_get_rcu(netdev)et al.
Sorry, I added that patch to my tree after testing based on a merge with net-next and forgot to retest.
Quoted 2 lines
I'll fix this up in the merge commit when I pull.
Thanks!