netfilter fixes
Subsystems (3)
cover netfilter fixes
Hi Dave,
following are four netfilter fixes for 2.6.34, fixing:
- a regression in the recent match, introduced during 2.6.33
- a crash after a failed memory allocation in xt_hashlimit seq_file handling
- an incorrect hook priority of the IPv6 raw table
- a missing 'break' in the IPv6 xt_hashlimit netmask calculation
include/linux/netfilter_ipv6.h | 1 + net/ipv6/netfilter/ip6table_raw.c | 2 +- net/netfilter/xt_hashlimit.c | 4 +++- net/netfilter/xt_recent.c | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-)
Please apply or pull from:
git://git.kernel.org/pub/scm/linux/kernel/git/kaber/nf-2.6.git master
Thanks!
PS: this is my first "live" attempt at using git-send-email, so appologies in advance in case I made any mistakes.
PATCH 1/4 netfilter: xt_recent: fix regression in rules using a zero hit_count
From: Patrick McHardy <[email protected]>
Commit 8ccb92ad (netfilter: xt_recent: fix false match) fixed supposedly false matches in rules using a zero hit_count. As it turns out there is nothing false about these matches and people are actually using entries with a hit_count of zero to make rules dependant on addresses inserted manually through /proc.
Since this slipped past the eyes of three reviewers, instead of reverting the commit in question, this patch explicitly checks for a hit_count of zero to make the intentions more clear.
--- net/netfilter/xt_recent.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
net/netfilter/xt_recent.c +1 -1
@@ -267,7 +267,7 @@ recent_mt(const struct sk_buff *skb, const struct xt_match_param *par)for (i =0 ; i < e->nstamps; i++) {if (info->seconds &&time_after (time, e->stamps[i]))continue ; -if (info->hit_count && ++hits >= info->hit_count) { +if (!info->hit_count || ++hits >= info->hit_count) { ret = !ret;break ; }
Signature · 1 line
1.6.5.7
PATCH 2/4 netfilter: xt_hashlimit: dl_seq_stop() fix
From: Eric Dumazet <[email protected]>
If dl_seq_start() memory allocation fails, we crash later in dl_seq_stop(), trying to kfree(ERR_PTR(-ENOMEM))
--- net/netfilter/xt_hashlimit.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
net/netfilter/xt_hashlimit.c +2 -1
@@ -879,7 +879,8 @@ static void dl_seq_stop(struct seq_file *s, void *v)struct xt_hashlimit_htable *htable = s->private;unsigned int *bucket = (unsigned int *)v; -kfree (bucket); +if (!IS_ERR (bucket)) +kfree (bucket);spin_unlock_bh (&htable->lock); }
Signature · 1 line
1.6.5.7
PATCH 3/4 netfilter: ip6table_raw: fix table priority
From: Jozsef Kadlecsik <[email protected]>
The order of the IPv6 raw table is currently reversed, that makes impossible to use the NOTRACK target in IPv6: for example if someone enters
ip6tables -t raw -A PREROUTING -p tcp --dport 80 -j NOTRACK
and if we receive fragmented packets then the first fragment will be untracked and thus skip nf_ct_frag6_gather (and conntrack), while all subsequent fragments enter nf_ct_frag6_gather and reassembly will never successfully be finished.
--- include/linux/netfilter_ipv6.h | 1 + net/ipv6/netfilter/ip6table_raw.c | 2 +- 2 files changed, 2 insertions(+), 1 deletions(-)
include/linux/netfilter_ipv6.h +1 -0
@@ -59,6 +59,7 @@enum nf_ip6_hook_priorities {NF_IP6_PRI_FIRST =INT_MIN ,NF_IP6_PRI_CONNTRACK_DEFRAG =-400 , +NF_IP6_PRI_RAW =-300 ,NF_IP6_PRI_SELINUX_FIRST =-225 ,NF_IP6_PRI_CONNTRACK =-200 ,NF_IP6_PRI_MANGLE =-150 ,
net/ipv6/netfilter/ip6table_raw.c +1 -1
@@ -13,7 +13,7 @@ static const struct xt_table packet_raw = { .valid_hooks = RAW_VALID_HOOKS, .me = THIS_MODULE, .af = NFPROTO_IPV6, - .priority = NF_IP6_PRI_FIRST, + .priority = NF_IP6_PRI_RAW, };/* The work comes in here from netfilter.c. */
Signature · 1 line
1.6.5.7
PATCH 4/4 netfilter: xt_hashlimit: IPV6 bugfix
From: Eric Dumazet <[email protected]>
A missing break statement in hashlimit_ipv6_mask(), and masks between /64 and /95 are not working at all...
--- net/netfilter/xt_hashlimit.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
net/netfilter/xt_hashlimit.c +1 -0
@@ -493,6 +493,7 @@ static void hashlimit_ipv6_mask(__be32 *i, unsigned int p) case 64 ... 95: i[2 ] =maskl (i[2 ], p -64 ); i[3 ] =0 ; +break ; case 96 ... 127: i[3 ] =maskl (i[3 ], p -96 );break ;
Signature · 1 line
1.6.5.7
PATCH 1/1 netfilter: CLUSTERIP: clusterip_seq_stop() fix
In reply to [email protected]If clusterip_seq_start() memory allocation fails, we crash later in clusterip_seq_start(), trying to kfree(ERR_PTR(-ENOMEM))
---
net/ipv4/netfilter/ipt_CLUSTERIP.c +2 -1
@@ -600,7 +600,8 @@ static void *clusterip_seq_next(struct seq_file *s, void *v, loff_t *pos)static void clusterip_seq_stop (struct seq_file *s,void *v) { -kfree (v); +if (!IS_ERR (v)) +kfree (v); }static int clusterip_seq_show (struct seq_file *s,void *v)
Patrick McHardy
AppliedRe: [PATCH] netfilter: CLUSTERIP: clusterip_seq_stop() fix
Quoted 2 lines · Eric Dumazet
If
clusterip_seq_start()memory allocation fails, we crash later inclusterip_seq_start(), trying to kfree(ERR_PTR(-ENOMEM))
Applied, thanks Eric.
David Miller
maintainerFrom: [email protected]
Date: Thu, 25 Mar 2010 18:54:42 +0100
Quoted 3 lines
Please apply or pull from:
git://git.kernel.org/pub/scm/linux/kernel/git/kaber/nf-2.6.gitmaster
Pulled, thanks a lot Patrick.