bugfixes for nf-next-2.6 (2.6.38-rc)
Subsystems (2)
Pablo Neira Ayuso
maintainercover bugfixes for nf-next-2.6 (2.6.38-rc)
Hi Patrick!
I've got a couple of patches for nf-next-2.6. The first fixes arptables that seems to be broken since quite some time due to a broken cleanup. The latter refers to the CT event filtering, I think it can be qualified as bugfix since the current filtering schema is not useful for conntrackd.
Please, apply!
---
Pablo Neira Ayuso (2):
netfilter: arpt_mangle: fix return values of checkentry
netfilter: ecache: always set events bits, filter them later
include/net/netfilter/nf_conntrack_ecache.h | 3 --- net/ipv4/netfilter/arpt_mangle.c | 6 +++--- net/netfilter/nf_conntrack_ecache.c | 3 +++ 3 files changed, 6 insertions(+), 6 deletions(-)
--
1+1=1
Pablo Neira Ayuso
maintainerPATCH 1/2 netfilter: arpt_mangle: fix return values of checkentry
In 135367b "netfilter: xtables: change xt_target.checkentry return type", the type returned by checkentry was changed from boolean to int, but the return values where not adjusted.
# arptables -I INPUT -i eth1 --h-length 6 --destination-mac 01:00:5e:00:01:01 -j mangle --mangle-mac-d 00:18:71:68:f2:34 arptables: Input/output error
This broke arptables with the mangle target since it returns true under success, which is interpreted by xtables as >0, thus returning EIO.
--- net/ipv4/netfilter/arpt_mangle.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
net/ipv4/netfilter/arpt_mangle.c +3 -3
@@ -60,12 +60,12 @@ static int checkentry(const struct xt_tgchk_param *par)if (mangle->flags & ~ARPT_MANGLE_MASK || !(mangle->flags &ARPT_MANGLE_MASK )) -return false; +return -EINVAL ;if (mangle->target !=NF_DROP && mangle->target !=NF_ACCEPT && mangle->target !=XT_CONTINUE ) -return false; -return true; +return -EINVAL ; +return 0 ; }static struct xt_target arpt_mangle_reg__read_mostly = {
Patrick McHardy
AppliedRe: [PATCH 1/2] netfilter: arpt_mangle: fix return values of checkentry
Am 01.02.2011 13:05, schrieb Pablo Neira Ayuso:
Quoted 10 lines
In 135367b "netfilter: xtables: change xt_target.checkentry return type", the type returned by checkentry was changed from boolean to int, but the return values where not adjusted.
# arptables -I INPUT -i eth1 --h-length 6 --destination-mac 01:00:5e:00:01:01 -j mangle --mangle-mac-d 00:18:71:68:f2:34 arptables: Input/output errorThis broke arptables with the mangle target since it returns true under success, which is interpreted by xtables as >0, thus returning EIO.
Applied, thanks Pablo. I'll also push this to -stable once it hits Linus' tree.
Pablo Neira Ayuso
maintainerPATCH 2/2 netfilter: ecache: always set events bits, filter them later
In reply to Pablo Neira AyusoFor the following rule:
iptables -I PREROUTING -t raw -j CT --ctevents assured
The event delivered looks like the following:
[UPDATE] tcp 6 src=192.168.0.2 dst=192.168.1.2 sport=37041 dport=80 src=192.168.1.2 dst=192.168.1.100 sport=80 dport=37041 [ASSURED]
Note that the TCP protocol state is not included. For that reason the CT event filtering is not very useful for conntrackd.
To resolve this issue, instead of conditionally setting the CT events bits based on the ctmask, we always set them and perform the filtering in the late stage, just before the delivery.
Thus, the event delivered looks like the following:
[UPDATE] tcp 6 432000 ESTABLISHED src=192.168.0.2 dst=192.168.1.2 sport=37041 dport=80 src=192.168.1.2 dst=192.168.1.100 sport=80 dport=37041 [ASSURED]
--- include/net/netfilter/nf_conntrack_ecache.h | 3 --- net/netfilter/nf_conntrack_ecache.c | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-)
include/net/netfilter/nf_conntrack_ecache.h +0 -3
@@ -77,9 +77,6 @@ nf_conntrack_event_cache(enum ip_conntrack_events event, struct nf_conn *ct)if (e ==NULL )return ; -if (!(e->ctmask & (1 << event))) -return ; -set_bit (event, &e->cache); }
net/netfilter/nf_conntrack_ecache.c +3 -0
@@ -63,6 +63,9 @@ void nf_ct_deliver_cached_events(struct nf_conn *ct)* this does not harm and it happens very rarely. */ unsigned long missed = e->missed; +if (!((events | missed) & e->ctmask)) + goto out_unlock; + ret = notify->fcn (events | missed, &item);if (unlikely (ret <0 || missed)) {spin_lock_bh (&ct->lock);
Re: [PATCH 2/2] netfilter: ecache: always set events bits, filter them later
Am 01.02.2011 13:05, schrieb Pablo Neira Ayuso:
Quoted 11 lines
For the following rule:
iptables -I PREROUTING -t raw -j CT --ctevents assured
The event delivered looks like the following:
[UPDATE] tcp 6 src=192.168.0.2 dst=192.168.1.2 sport=37041 dport=80 src=192.168.1.2 dst=192.168.1.100 sport=80 dport=37041 [ASSURED]
Note that the TCP protocol state is not included. For that reason the CT event filtering is not very useful for conntrackd.
Quoted 8 lines
To resolve this issue, instead of conditionally setting the CT events bits based on the ctmask, we always set them and perform the filtering in the late stage, just before the delivery.
Thus, the event delivered looks like the following:
[UPDATE] tcp 6 432000 ESTABLISHED src=192.168.0.2 dst=192.168.1.2 sport=37041 dport=80 src=192.168.1.2 dst=192.168.1.100 sport=80 dport=37041 [ASSURED]
Looks good to me, applied, thanks. Do you want me to push this one to -stable as well?
Am 01.02.2011 13:05, schrieb Pablo Neira Ayuso:
Quoted 7 lines
Hi Patrick!
I've got a couple of patches for nf-next-2.6. The first fixes arptables that seems to be broken since quite some time due to a broken cleanup. The latter refers to the CT event filtering, I think it can be qualified as bugfix since the current filtering schema is not useful for conntrackd.
The subject is contradictional, nf-next-2.6/net-next-2.6 will be merged once 2.6.38 is released, not for 2.6.38-rc. I suppose these fixes should go into nf-2.6.git for 2.6.38-rc?
Pablo Neira Ayuso
maintainerQuoted 9 lines · Patrick McHardy
Am 01.02.2011 13:05, schrieb Pablo Neira Ayuso:
Quoted 7 lines
Hi Patrick!
I've got a couple of patches for nf-next-2.6. The first fixes arptables that seems to be broken since quite some time due to a broken cleanup. The latter refers to the CT event filtering, I think it can be qualified as bugfix since the current filtering schema is not useful for conntrackd.
Quoted 3 lines
The subject is contradictional, nf-next-2.6/net-next-2.6 will be merged once 2.6.38 is released, not for 2.6.38-rc. I suppose these fixes should go into nf-2.6.git for 2.6.38-rc?
Indeed, I think this should go to nf-2.6.git for 2.6.38-rc. Sorry!