* netfilter 00/04: netfilter fixes
@ 2009-05-05 16:47 Patrick McHardy
2009-05-05 16:47 ` netfilter 01/04: add missing linux/types.h include to xt_LED.h Patrick McHardy
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Patrick McHardy @ 2009-05-05 16:47 UTC (permalink / raw)
To: davem; +Cc: netdev, Patrick McHardy, netfilter-devel
Hi Dave,
the following patches fix a couple of netfilter bugs:
- missing inclusion of linux/types.h in xt_LED.h
- an incorrect length check in the ipv6header match, causing
mismatches on packets ending with NEXTHDR_NONE
- an incorrect check in the new cluster match, causing rules using
32 nodes to fail loading
- incorrect ctnetlink event types for user-generated events
Please apply or pull from:
git://git.kernel.org/pub/scm/linux/kernel/git/kaber/nf-2.6.git
Thanks!
include/linux/netfilter/xt_LED.h | 2 ++
include/linux/netfilter/xt_cluster.h | 2 ++
net/ipv6/netfilter/ip6t_ipv6header.c | 6 +++---
net/netfilter/xt_cluster.c | 8 +++++++-
4 files changed, 14 insertions(+), 4 deletions(-)
Christoph Paasch (1):
netfilter: ip6t_ipv6header: fix match on packets ending with NEXTHDR_NONE
Pablo Neira Ayuso (1):
netfilter: xt_cluster: fix use of cluster match with 32 nodes
Patrick McHardy (1):
netfilter: add missing linux/types.h include to xt_LED.h
^ permalink raw reply [flat|nested] 6+ messages in thread
* netfilter 01/04: add missing linux/types.h include to xt_LED.h
2009-05-05 16:47 netfilter 00/04: netfilter fixes Patrick McHardy
@ 2009-05-05 16:47 ` Patrick McHardy
2009-05-05 16:47 ` netfilter 02/04: ip6t_ipv6header: fix match on packets ending with NEXTHDR_NONE Patrick McHardy
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Patrick McHardy @ 2009-05-05 16:47 UTC (permalink / raw)
To: davem; +Cc: netdev, Patrick McHardy, netfilter-devel
commit a7ca7fccacc029958fd09985e7f3529b90ec791d
Author: Patrick McHardy <kaber@trash.net>
Date: Tue May 5 14:31:12 2009 +0200
netfilter: add missing linux/types.h include to xt_LED.h
Pointed out by Dave Miller:
CHECK include/linux/netfilter (57 files)
/home/davem/src/GIT/net-2.6/usr/include/linux/netfilter/xt_LED.h:6: found __[us]{8,16,32,64} type without #include <linux/types.h>
Signed-off-by: Patrick McHardy <kaber@trash.net>
diff --git a/include/linux/netfilter/xt_LED.h b/include/linux/netfilter/xt_LED.h
index 4c91a0d..f5509e7 100644
--- a/include/linux/netfilter/xt_LED.h
+++ b/include/linux/netfilter/xt_LED.h
@@ -1,6 +1,8 @@
#ifndef _XT_LED_H
#define _XT_LED_H
+#include <linux/types.h>
+
struct xt_led_info {
char id[27]; /* Unique ID for this trigger in the LED class */
__u8 always_blink; /* Blink even if the LED is already on */
^ permalink raw reply related [flat|nested] 6+ messages in thread
* netfilter 02/04: ip6t_ipv6header: fix match on packets ending with NEXTHDR_NONE
2009-05-05 16:47 netfilter 00/04: netfilter fixes Patrick McHardy
2009-05-05 16:47 ` netfilter 01/04: add missing linux/types.h include to xt_LED.h Patrick McHardy
@ 2009-05-05 16:47 ` Patrick McHardy
2009-05-05 16:47 ` netfilter 03/04: xt_cluster: fix use of cluster match with 32 nodes Patrick McHardy
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Patrick McHardy @ 2009-05-05 16:47 UTC (permalink / raw)
To: davem; +Cc: netdev, Patrick McHardy, netfilter-devel
commit b98b4947cb79d670fceca0e951c092eea93e9baa
Author: Christoph Paasch <christoph.paasch@gmail.com>
Date: Tue May 5 15:32:16 2009 +0200
netfilter: ip6t_ipv6header: fix match on packets ending with NEXTHDR_NONE
As packets ending with NEXTHDR_NONE don't have a last extension header,
the check for the length needs to be after the check for NEXTHDR_NONE.
Signed-off-by: Christoph Paasch <christoph.paasch@gmail.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
diff --git a/net/ipv6/netfilter/ip6t_ipv6header.c b/net/ipv6/netfilter/ip6t_ipv6header.c
index 14e6724..91490ad 100644
--- a/net/ipv6/netfilter/ip6t_ipv6header.c
+++ b/net/ipv6/netfilter/ip6t_ipv6header.c
@@ -50,14 +50,14 @@ ipv6header_mt6(const struct sk_buff *skb, const struct xt_match_param *par)
struct ipv6_opt_hdr _hdr;
int hdrlen;
- /* Is there enough space for the next ext header? */
- if (len < (int)sizeof(struct ipv6_opt_hdr))
- return false;
/* No more exthdr -> evaluate */
if (nexthdr == NEXTHDR_NONE) {
temp |= MASK_NONE;
break;
}
+ /* Is there enough space for the next ext header? */
+ if (len < (int)sizeof(struct ipv6_opt_hdr))
+ return false;
/* ESP -> evaluate */
if (nexthdr == NEXTHDR_ESP) {
temp |= MASK_ESP;
^ permalink raw reply related [flat|nested] 6+ messages in thread
* netfilter 03/04: xt_cluster: fix use of cluster match with 32 nodes
2009-05-05 16:47 netfilter 00/04: netfilter fixes Patrick McHardy
2009-05-05 16:47 ` netfilter 01/04: add missing linux/types.h include to xt_LED.h Patrick McHardy
2009-05-05 16:47 ` netfilter 02/04: ip6t_ipv6header: fix match on packets ending with NEXTHDR_NONE Patrick McHardy
@ 2009-05-05 16:47 ` Patrick McHardy
2009-05-05 16:47 ` netfilter 04/04: ctnetlink: fix wrong message type in user updates Patrick McHardy
2009-05-05 19:02 ` netfilter 00/04: netfilter fixes David Miller
4 siblings, 0 replies; 6+ messages in thread
From: Patrick McHardy @ 2009-05-05 16:47 UTC (permalink / raw)
To: davem; +Cc: netdev, Patrick McHardy, netfilter-devel
commit 280f37afa2c270ff029cb420b34396aa002909c3
Author: Pablo Neira Ayuso <pablo@netfilter.org>
Date: Tue May 5 17:46:07 2009 +0200
netfilter: xt_cluster: fix use of cluster match with 32 nodes
This patch fixes a problem when you use 32 nodes in the cluster
match:
% iptables -I PREROUTING -t mangle -i eth0 -m cluster \
--cluster-total-nodes 32 --cluster-local-node 32 \
--cluster-hash-seed 0xdeadbeef -j MARK --set-mark 0xffff
iptables: Invalid argument. Run `dmesg' for more information.
% dmesg | tail -1
xt_cluster: this node mask cannot be higher than the total number of nodes
The problem is related to this checking:
if (info->node_mask >= (1 << info->total_nodes)) {
printk(KERN_ERR "xt_cluster: this node mask cannot be "
"higher than the total number of nodes\n");
return false;
}
(1 << 32) is 1. Thus, the checking fails.
BTW, I said this before but I insist: I have only tested the cluster
match with 2 nodes getting ~45% extra performance in an active-active setup.
The maximum limit of 32 nodes is still completely arbitrary. I'd really
appreciate if people that have more nodes in their setups let me know.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Patrick McHardy <kaber@trash.net>
diff --git a/include/linux/netfilter/xt_cluster.h b/include/linux/netfilter/xt_cluster.h
index 5e0a0d0..8866826 100644
--- a/include/linux/netfilter/xt_cluster.h
+++ b/include/linux/netfilter/xt_cluster.h
@@ -12,4 +12,6 @@ struct xt_cluster_match_info {
u_int32_t flags;
};
+#define XT_CLUSTER_NODES_MAX 32
+
#endif /* _XT_CLUSTER_MATCH_H */
diff --git a/net/netfilter/xt_cluster.c b/net/netfilter/xt_cluster.c
index 6c48476..69a639f 100644
--- a/net/netfilter/xt_cluster.c
+++ b/net/netfilter/xt_cluster.c
@@ -135,7 +135,13 @@ static bool xt_cluster_mt_checkentry(const struct xt_mtchk_param *par)
{
struct xt_cluster_match_info *info = par->matchinfo;
- if (info->node_mask >= (1 << info->total_nodes)) {
+ if (info->total_nodes > XT_CLUSTER_NODES_MAX) {
+ printk(KERN_ERR "xt_cluster: you have exceeded the maximum "
+ "number of cluster nodes (%u > %u)\n",
+ info->total_nodes, XT_CLUSTER_NODES_MAX);
+ return false;
+ }
+ if (info->node_mask >= (1ULL << info->total_nodes)) {
printk(KERN_ERR "xt_cluster: this node mask cannot be "
"higher than the total number of nodes\n");
return false;
^ permalink raw reply related [flat|nested] 6+ messages in thread
* netfilter 04/04: ctnetlink: fix wrong message type in user updates
2009-05-05 16:47 netfilter 00/04: netfilter fixes Patrick McHardy
` (2 preceding siblings ...)
2009-05-05 16:47 ` netfilter 03/04: xt_cluster: fix use of cluster match with 32 nodes Patrick McHardy
@ 2009-05-05 16:47 ` Patrick McHardy
2009-05-05 19:02 ` netfilter 00/04: netfilter fixes David Miller
4 siblings, 0 replies; 6+ messages in thread
From: Patrick McHardy @ 2009-05-05 16:47 UTC (permalink / raw)
To: davem; +Cc: netdev, Patrick McHardy, netfilter-devel
commit fecc1133b66af6e0cd49115a248f34bbb01f180a
Author: Pablo Neira Ayuso <pablo@netfilter.org>
Date: Tue May 5 17:48:26 2009 +0200
netfilter: ctnetlink: fix wrong message type in user updates
This patch fixes the wrong message type that are triggered by
user updates, the following commands:
(term1)# conntrack -I -p tcp -s 1.1.1.1 -d 2.2.2.2 -t 10 --sport 10 --dport 20 --state LISTEN
(term1)# conntrack -U -p tcp -s 1.1.1.1 -d 2.2.2.2 -t 10 --sport 10 --dport 20 --state SYN_SENT
(term1)# conntrack -U -p tcp -s 1.1.1.1 -d 2.2.2.2 -t 10 --sport 10 --dport 20 --state SYN_RECV
only trigger event message of type NEW, when only the first is NEW
while others should be UPDATE.
(term2)# conntrack -E
[NEW] tcp 6 10 LISTEN src=1.1.1.1 dst=2.2.2.2 sport=10 dport=20 [UNREPLIED] src=2.2.2.2 dst=1.1.1.1 sport=20 dport=10 mark=0
[NEW] tcp 6 10 SYN_SENT src=1.1.1.1 dst=2.2.2.2 sport=10 dport=20 [UNREPLIED] src=2.2.2.2 dst=1.1.1.1 sport=20 dport=10 mark=0
[NEW] tcp 6 10 SYN_RECV src=1.1.1.1 dst=2.2.2.2 sport=10 dport=20 [UNREPLIED] src=2.2.2.2 dst=1.1.1.1 sport=20 dport=10 mark=0
This patch also removes IPCT_REFRESH from the bitmask since it is
not of any use.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Patrick McHardy <kaber@trash.net>
diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c
index 0ea36e0..fd77619 100644
--- a/net/netfilter/nf_conntrack_netlink.c
+++ b/net/netfilter/nf_conntrack_netlink.c
@@ -1186,28 +1186,6 @@ ctnetlink_change_conntrack(struct nf_conn *ct, struct nlattr *cda[])
return 0;
}
-static inline void
-ctnetlink_event_report(struct nf_conn *ct, u32 pid, int report)
-{
- unsigned int events = 0;
-
- if (test_bit(IPS_EXPECTED_BIT, &ct->status))
- events |= IPCT_RELATED;
- else
- events |= IPCT_NEW;
-
- nf_conntrack_event_report(IPCT_STATUS |
- IPCT_HELPER |
- IPCT_REFRESH |
- IPCT_PROTOINFO |
- IPCT_NATSEQADJ |
- IPCT_MARK |
- events,
- ct,
- pid,
- report);
-}
-
static struct nf_conn *
ctnetlink_create_conntrack(struct nlattr *cda[],
struct nf_conntrack_tuple *otuple,
@@ -1373,6 +1351,7 @@ ctnetlink_new_conntrack(struct sock *ctnl, struct sk_buff *skb,
err = -ENOENT;
if (nlh->nlmsg_flags & NLM_F_CREATE) {
struct nf_conn *ct;
+ enum ip_conntrack_events events;
ct = ctnetlink_create_conntrack(cda, &otuple,
&rtuple, u3);
@@ -1383,9 +1362,18 @@ ctnetlink_new_conntrack(struct sock *ctnl, struct sk_buff *skb,
err = 0;
nf_conntrack_get(&ct->ct_general);
spin_unlock_bh(&nf_conntrack_lock);
- ctnetlink_event_report(ct,
- NETLINK_CB(skb).pid,
- nlmsg_report(nlh));
+ if (test_bit(IPS_EXPECTED_BIT, &ct->status))
+ events = IPCT_RELATED;
+ else
+ events = IPCT_NEW;
+
+ nf_conntrack_event_report(IPCT_STATUS |
+ IPCT_HELPER |
+ IPCT_PROTOINFO |
+ IPCT_NATSEQADJ |
+ IPCT_MARK | events,
+ ct, NETLINK_CB(skb).pid,
+ nlmsg_report(nlh));
nf_ct_put(ct);
} else
spin_unlock_bh(&nf_conntrack_lock);
@@ -1404,9 +1392,13 @@ ctnetlink_new_conntrack(struct sock *ctnl, struct sk_buff *skb,
if (err == 0) {
nf_conntrack_get(&ct->ct_general);
spin_unlock_bh(&nf_conntrack_lock);
- ctnetlink_event_report(ct,
- NETLINK_CB(skb).pid,
- nlmsg_report(nlh));
+ nf_conntrack_event_report(IPCT_STATUS |
+ IPCT_HELPER |
+ IPCT_PROTOINFO |
+ IPCT_NATSEQADJ |
+ IPCT_MARK,
+ ct, NETLINK_CB(skb).pid,
+ nlmsg_report(nlh));
nf_ct_put(ct);
} else
spin_unlock_bh(&nf_conntrack_lock);
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: netfilter 00/04: netfilter fixes
2009-05-05 16:47 netfilter 00/04: netfilter fixes Patrick McHardy
` (3 preceding siblings ...)
2009-05-05 16:47 ` netfilter 04/04: ctnetlink: fix wrong message type in user updates Patrick McHardy
@ 2009-05-05 19:02 ` David Miller
4 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2009-05-05 19:02 UTC (permalink / raw)
To: kaber; +Cc: netdev, netfilter-devel
From: Patrick McHardy <kaber@trash.net>
Date: Tue, 5 May 2009 18:47:42 +0200 (MEST)
> the following patches fix a couple of netfilter bugs:
...
> Please apply or pull from:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/kaber/nf-2.6.git
Pulled, thanks a lot Patrick!
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2009-05-05 19:02 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-05 16:47 netfilter 00/04: netfilter fixes Patrick McHardy
2009-05-05 16:47 ` netfilter 01/04: add missing linux/types.h include to xt_LED.h Patrick McHardy
2009-05-05 16:47 ` netfilter 02/04: ip6t_ipv6header: fix match on packets ending with NEXTHDR_NONE Patrick McHardy
2009-05-05 16:47 ` netfilter 03/04: xt_cluster: fix use of cluster match with 32 nodes Patrick McHardy
2009-05-05 16:47 ` netfilter 04/04: ctnetlink: fix wrong message type in user updates Patrick McHardy
2009-05-05 19:02 ` netfilter 00/04: netfilter fixes David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox