* [PATCH 0/4] netfilter updates for net tree
@ 2012-01-17 11:04 pablo
2012-01-17 15:03 ` David Miller
0 siblings, 1 reply; 8+ messages in thread
From: pablo @ 2012-01-17 11:04 UTC (permalink / raw)
To: netfilter-devel; +Cc: davem, netdev
From: Pablo Neira Ayuso <pablo@netfilter.org>
Hi Dave,
The following patches contains updates for your current net tree:
* A couple for bugfixes for ipset from Jozsef.
* Revert the user-space expectation helper support from myself.
I decided to do this because I found problems specifically
regarding NAT setups. I didn't throw the towel though. I'm
working one new infrastructure. My plan is to submit it for
net-next once it's open and it passes developers scrutiny
(still work in progress):
http://1984.lsi.us.es/git/net-next/commit/?h=cthelper&id=4e690f548859eec5a3dad151dec9c12bac17c014
* Fix one compilation warning if ip6tables is disabled in
xt_hashlimit.
You can pull these changes from:
git://1984.lsi.us.es/net nf
Thanks.
Jozsef Kadlecsik (2):
netfilter: ipset: autoload set type modules safely
netfilter: ipset: dumping error triggered removing references twice
Pablo Neira Ayuso (1):
netfilter: revert user-space expectation helper support
Stephen Rothwell (1):
netfilter: xt_hashlimit: fix unused variable warning if IPv6 disabled
include/linux/netfilter/nf_conntrack_common.h | 4 ---
include/linux/netfilter/xt_CT.h | 3 +-
net/netfilter/ipset/ip_set_core.c | 37 ++++++++++++++++++-------
net/netfilter/nf_conntrack_helper.c | 12 --------
net/netfilter/nf_conntrack_netlink.c | 4 ---
net/netfilter/xt_CT.c | 8 ++---
net/netfilter/xt_hashlimit.c | 5 +++-
7 files changed, 35 insertions(+), 38 deletions(-)
--
1.7.7.3
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 0/4] netfilter updates for net tree
2012-01-17 11:04 pablo
@ 2012-01-17 15:03 ` David Miller
0 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2012-01-17 15:03 UTC (permalink / raw)
To: pablo; +Cc: netfilter-devel, netdev
From: pablo@netfilter.org
Date: Tue, 17 Jan 2012 12:04:45 +0100
> You can pull these changes from:
>
> git://1984.lsi.us.es/net nf
>
> Thanks.
>
> Jozsef Kadlecsik (2):
> netfilter: ipset: autoload set type modules safely
> netfilter: ipset: dumping error triggered removing references twice
>
> Pablo Neira Ayuso (1):
> netfilter: revert user-space expectation helper support
>
> Stephen Rothwell (1):
> netfilter: xt_hashlimit: fix unused variable warning if IPv6 disabled
Pulled, thanks!
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 0/4] netfilter updates for net tree
@ 2012-02-23 0:02 pablo
2012-02-23 0:02 ` [PATCH 1/4] ipvs: fix matching of fwmark templates during scheduling pablo
` (4 more replies)
0 siblings, 5 replies; 8+ messages in thread
From: pablo @ 2012-02-23 0:02 UTC (permalink / raw)
To: netfilter-devel; +Cc: netdev, davem
From: Pablo Neira Ayuso <pablo@netfilter.org>
Hi David,
The following are four fixes for your net tree:
* One fix for NFQUEUE if used in bridge mode when GRO/GSO skbs
are enqueued from Florian Westphal.
* One fix from Joerg Willmann to fix wrong alignment in ebtables
on PPC.
* One fix for soft lockup for ctnetlink from Jozsef Kadlecsik.
* One fix for IPVS from Simon Horman.
Please, pull these changes from:
git://1984.lsi.us.es/net nf
Thanks!
Florian Westphal (1):
netfilter: nf_queue: fix queueing of bridged gro skbs
Joerg Willmann (1):
netfilter: ebtables: fix alignment problem in ppc
Jozsef Kadlecsik (1):
netfilter: ctnetlink: fix soft lockup when netlink adds new entries
Simon Horman (1):
ipvs: fix matching of fwmark templates during scheduling
include/linux/netfilter_bridge/ebtables.h | 4 +-
net/netfilter/ipvs/ip_vs_core.c | 2 +-
net/netfilter/nf_conntrack_netlink.c | 43 +++++++++++------------------
net/netfilter/nf_queue.c | 40 +++++++++++++++++++++-----
4 files changed, 51 insertions(+), 38 deletions(-)
--
1.7.7.3
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/4] ipvs: fix matching of fwmark templates during scheduling
2012-02-23 0:02 [PATCH 0/4] netfilter updates for net tree pablo
@ 2012-02-23 0:02 ` pablo
2012-02-23 0:02 ` [PATCH 2/4] netfilter: nf_queue: fix queueing of bridged gro skbs pablo
` (3 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: pablo @ 2012-02-23 0:02 UTC (permalink / raw)
To: netfilter-devel; +Cc: netdev, davem
From: Simon Horman <horms@verge.net.au>
Commit f11017ec2d1859c661f4e2b12c4a8d250e1f47cf (2.6.37)
moved the fwmark variable in subcontext that is invalidated before
reaching the ip_vs_ct_in_get call. As vaddr is provided as pointer
in the param structure make sure the fwmark variable is in
same context. As the fwmark templates can not be matched,
more and more template connections are created and the
controlled connections can not go to single real server.
Signed-off-by: Julian Anastasov <ja@ssi.bg>
Cc: stable@vger.kernel.org
Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
net/netfilter/ipvs/ip_vs_core.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c
index 611c335..2555816 100644
--- a/net/netfilter/ipvs/ip_vs_core.c
+++ b/net/netfilter/ipvs/ip_vs_core.c
@@ -232,6 +232,7 @@ ip_vs_sched_persist(struct ip_vs_service *svc,
__be16 dport = 0; /* destination port to forward */
unsigned int flags;
struct ip_vs_conn_param param;
+ const union nf_inet_addr fwmark = { .ip = htonl(svc->fwmark) };
union nf_inet_addr snet; /* source network of the client,
after masking */
@@ -267,7 +268,6 @@ ip_vs_sched_persist(struct ip_vs_service *svc,
{
int protocol = iph.protocol;
const union nf_inet_addr *vaddr = &iph.daddr;
- const union nf_inet_addr fwmark = { .ip = htonl(svc->fwmark) };
__be16 vport = 0;
if (dst_port == svc->port) {
--
1.7.7.3
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/4] netfilter: nf_queue: fix queueing of bridged gro skbs
2012-02-23 0:02 [PATCH 0/4] netfilter updates for net tree pablo
2012-02-23 0:02 ` [PATCH 1/4] ipvs: fix matching of fwmark templates during scheduling pablo
@ 2012-02-23 0:02 ` pablo
2012-02-23 0:02 ` [PATCH 3/4] netfilter: ebtables: fix alignment problem in ppc pablo
` (2 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: pablo @ 2012-02-23 0:02 UTC (permalink / raw)
To: netfilter-devel; +Cc: netdev, davem
From: Florian Westphal <fw@strlen.de>
When trying to nf_queue GRO/GSO skbs, nf_queue uses skb_gso_segment
to split the skb.
However, if nf_queue is called via bridge netfilter, the mac header
won't be preserved -- packets will thus contain a bogus mac header.
Fix this by setting skb->data to the mac header when skb->nf_bridge
is set and restoring skb->data afterwards for all segments.
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
net/netfilter/nf_queue.c | 40 ++++++++++++++++++++++++++++++++--------
1 files changed, 32 insertions(+), 8 deletions(-)
diff --git a/net/netfilter/nf_queue.c b/net/netfilter/nf_queue.c
index b3a7db6..ce60cf0 100644
--- a/net/netfilter/nf_queue.c
+++ b/net/netfilter/nf_queue.c
@@ -203,6 +203,27 @@ err:
return status;
}
+#ifdef CONFIG_BRIDGE_NETFILTER
+/* When called from bridge netfilter, skb->data must point to MAC header
+ * before calling skb_gso_segment(). Else, original MAC header is lost
+ * and segmented skbs will be sent to wrong destination.
+ */
+static void nf_bridge_adjust_skb_data(struct sk_buff *skb)
+{
+ if (skb->nf_bridge)
+ __skb_push(skb, skb->network_header - skb->mac_header);
+}
+
+static void nf_bridge_adjust_segmented_data(struct sk_buff *skb)
+{
+ if (skb->nf_bridge)
+ __skb_pull(skb, skb->network_header - skb->mac_header);
+}
+#else
+#define nf_bridge_adjust_skb_data(s) do {} while (0)
+#define nf_bridge_adjust_segmented_data(s) do {} while (0)
+#endif
+
int nf_queue(struct sk_buff *skb,
struct list_head *elem,
u_int8_t pf, unsigned int hook,
@@ -212,7 +233,7 @@ int nf_queue(struct sk_buff *skb,
unsigned int queuenum)
{
struct sk_buff *segs;
- int err;
+ int err = -EINVAL;
unsigned int queued;
if (!skb_is_gso(skb))
@@ -228,23 +249,25 @@ int nf_queue(struct sk_buff *skb,
break;
}
+ nf_bridge_adjust_skb_data(skb);
segs = skb_gso_segment(skb, 0);
/* Does not use PTR_ERR to limit the number of error codes that can be
* returned by nf_queue. For instance, callers rely on -ECANCELED to mean
* 'ignore this hook'.
*/
if (IS_ERR(segs))
- return -EINVAL;
-
+ goto out_err;
queued = 0;
err = 0;
do {
struct sk_buff *nskb = segs->next;
segs->next = NULL;
- if (err == 0)
+ if (err == 0) {
+ nf_bridge_adjust_segmented_data(segs);
err = __nf_queue(segs, elem, pf, hook, indev,
outdev, okfn, queuenum);
+ }
if (err == 0)
queued++;
else
@@ -252,11 +275,12 @@ int nf_queue(struct sk_buff *skb,
segs = nskb;
} while (segs);
- /* also free orig skb if only some segments were queued */
- if (unlikely(err && queued))
- err = 0;
- if (err == 0)
+ if (queued) {
kfree_skb(skb);
+ return 0;
+ }
+ out_err:
+ nf_bridge_adjust_segmented_data(skb);
return err;
}
--
1.7.7.3
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 3/4] netfilter: ebtables: fix alignment problem in ppc
2012-02-23 0:02 [PATCH 0/4] netfilter updates for net tree pablo
2012-02-23 0:02 ` [PATCH 1/4] ipvs: fix matching of fwmark templates during scheduling pablo
2012-02-23 0:02 ` [PATCH 2/4] netfilter: nf_queue: fix queueing of bridged gro skbs pablo
@ 2012-02-23 0:02 ` pablo
2012-02-23 0:02 ` [PATCH 4/4] netfilter: ctnetlink: fix soft lockup when netlink adds new entries pablo
2012-02-23 5:20 ` [PATCH 0/4] netfilter updates for net tree David Miller
4 siblings, 0 replies; 8+ messages in thread
From: pablo @ 2012-02-23 0:02 UTC (permalink / raw)
To: netfilter-devel; +Cc: netdev, davem
From: Joerg Willmann <joe@clnt.de>
ebt_among extension of ebtables uses __alignof__(_xt_align) while the
corresponding kernel module uses __alignof__(ebt_replace) to determine
the alignment in EBT_ALIGN().
These are the results of these values on different platforms:
x86 x86_64 ppc
__alignof__(_xt_align) 4 8 8
__alignof__(ebt_replace) 4 8 4
ebtables fails to add rules which use the among extension.
I'm using kernel 2.6.33 and ebtables 2.0.10-4
According to Bart De Schuymer, userspace alignment was changed to
_xt_align to fix an alignment issue on a userspace32-kernel64 system
(he thinks it was for an ARM device). So userspace must be right.
The kernel alignment macro needs to change so it also uses _xt_align
instead of ebt_replace. The userspace changes date back from
June 29, 2009.
Signed-off-by: Joerg Willmann <joe@clnt.de>
Signed-off by: Bart De Schuymer <bdschuym@pandora.be>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
include/linux/netfilter_bridge/ebtables.h | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/linux/netfilter_bridge/ebtables.h b/include/linux/netfilter_bridge/ebtables.h
index 8797ed1..4dd5bd6 100644
--- a/include/linux/netfilter_bridge/ebtables.h
+++ b/include/linux/netfilter_bridge/ebtables.h
@@ -285,8 +285,8 @@ struct ebt_table {
struct module *me;
};
-#define EBT_ALIGN(s) (((s) + (__alignof__(struct ebt_replace)-1)) & \
- ~(__alignof__(struct ebt_replace)-1))
+#define EBT_ALIGN(s) (((s) + (__alignof__(struct _xt_align)-1)) & \
+ ~(__alignof__(struct _xt_align)-1))
extern struct ebt_table *ebt_register_table(struct net *net,
const struct ebt_table *table);
extern void ebt_unregister_table(struct net *net, struct ebt_table *table);
--
1.7.7.3
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 4/4] netfilter: ctnetlink: fix soft lockup when netlink adds new entries
2012-02-23 0:02 [PATCH 0/4] netfilter updates for net tree pablo
` (2 preceding siblings ...)
2012-02-23 0:02 ` [PATCH 3/4] netfilter: ebtables: fix alignment problem in ppc pablo
@ 2012-02-23 0:02 ` pablo
2012-02-23 5:20 ` [PATCH 0/4] netfilter updates for net tree David Miller
4 siblings, 0 replies; 8+ messages in thread
From: pablo @ 2012-02-23 0:02 UTC (permalink / raw)
To: netfilter-devel; +Cc: netdev, davem
From: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Marcell Zambo and Janos Farago noticed and reported that when
new conntrack entries are added via netlink and the conntrack table
gets full, soft lockup happens. This is because the nf_conntrack_lock
is held while nf_conntrack_alloc is called, which is in turn wants
to lock nf_conntrack_lock while evicting entries from the full table.
The patch fixes the soft lockup with limiting the holding of the
nf_conntrack_lock to the minimum, where it's absolutely required.
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
net/netfilter/nf_conntrack_netlink.c | 43 ++++++++++++---------------------
1 files changed, 16 insertions(+), 27 deletions(-)
diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c
index 9307b03..cc70517 100644
--- a/net/netfilter/nf_conntrack_netlink.c
+++ b/net/netfilter/nf_conntrack_netlink.c
@@ -1367,15 +1367,12 @@ ctnetlink_create_conntrack(struct net *net, u16 zone,
nf_ct_protonum(ct));
if (helper == NULL) {
rcu_read_unlock();
- spin_unlock_bh(&nf_conntrack_lock);
#ifdef CONFIG_MODULES
if (request_module("nfct-helper-%s", helpname) < 0) {
- spin_lock_bh(&nf_conntrack_lock);
err = -EOPNOTSUPP;
goto err1;
}
- spin_lock_bh(&nf_conntrack_lock);
rcu_read_lock();
helper = __nf_conntrack_helper_find(helpname,
nf_ct_l3num(ct),
@@ -1469,7 +1466,10 @@ ctnetlink_create_conntrack(struct net *net, u16 zone,
tstamp->start = ktime_to_ns(ktime_get_real());
add_timer(&ct->timeout);
+ spin_lock_bh(&nf_conntrack_lock);
nf_conntrack_hash_insert(ct);
+ nf_conntrack_get(&ct->ct_general);
+ spin_unlock_bh(&nf_conntrack_lock);
rcu_read_unlock();
return ct;
@@ -1490,6 +1490,7 @@ ctnetlink_new_conntrack(struct sock *ctnl, struct sk_buff *skb,
struct nf_conntrack_tuple otuple, rtuple;
struct nf_conntrack_tuple_hash *h = NULL;
struct nfgenmsg *nfmsg = nlmsg_data(nlh);
+ struct nf_conn *ct;
u_int8_t u3 = nfmsg->nfgen_family;
u16 zone;
int err;
@@ -1512,25 +1513,22 @@ ctnetlink_new_conntrack(struct sock *ctnl, struct sk_buff *skb,
spin_lock_bh(&nf_conntrack_lock);
if (cda[CTA_TUPLE_ORIG])
- h = __nf_conntrack_find(net, zone, &otuple);
+ h = nf_conntrack_find_get(net, zone, &otuple);
else if (cda[CTA_TUPLE_REPLY])
- h = __nf_conntrack_find(net, zone, &rtuple);
+ h = nf_conntrack_find_get(net, zone, &rtuple);
+ spin_unlock_bh(&nf_conntrack_lock);
if (h == NULL) {
err = -ENOENT;
if (nlh->nlmsg_flags & NLM_F_CREATE) {
- struct nf_conn *ct;
enum ip_conntrack_events events;
ct = ctnetlink_create_conntrack(net, zone, cda, &otuple,
&rtuple, u3);
- if (IS_ERR(ct)) {
- err = PTR_ERR(ct);
- goto out_unlock;
- }
+ if (IS_ERR(ct))
+ return PTR_ERR(ct);
+
err = 0;
- nf_conntrack_get(&ct->ct_general);
- spin_unlock_bh(&nf_conntrack_lock);
if (test_bit(IPS_EXPECTED_BIT, &ct->status))
events = IPCT_RELATED;
else
@@ -1545,23 +1543,19 @@ ctnetlink_new_conntrack(struct sock *ctnl, struct sk_buff *skb,
ct, NETLINK_CB(skb).pid,
nlmsg_report(nlh));
nf_ct_put(ct);
- } else
- spin_unlock_bh(&nf_conntrack_lock);
+ }
return err;
}
/* implicit 'else' */
- /* We manipulate the conntrack inside the global conntrack table lock,
- * so there's no need to increase the refcount */
err = -EEXIST;
+ ct = nf_ct_tuplehash_to_ctrack(h);
if (!(nlh->nlmsg_flags & NLM_F_EXCL)) {
- struct nf_conn *ct = nf_ct_tuplehash_to_ctrack(h);
-
+ spin_lock_bh(&nf_conntrack_lock);
err = ctnetlink_change_conntrack(ct, cda);
+ spin_unlock_bh(&nf_conntrack_lock);
if (err == 0) {
- nf_conntrack_get(&ct->ct_general);
- spin_unlock_bh(&nf_conntrack_lock);
nf_conntrack_eventmask_report((1 << IPCT_REPLY) |
(1 << IPCT_ASSURED) |
(1 << IPCT_HELPER) |
@@ -1570,15 +1564,10 @@ ctnetlink_new_conntrack(struct sock *ctnl, struct sk_buff *skb,
(1 << IPCT_MARK),
ct, NETLINK_CB(skb).pid,
nlmsg_report(nlh));
- nf_ct_put(ct);
- } else
- spin_unlock_bh(&nf_conntrack_lock);
-
- return err;
+ }
}
-out_unlock:
- spin_unlock_bh(&nf_conntrack_lock);
+ nf_ct_put(ct);
return err;
}
--
1.7.7.3
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 0/4] netfilter updates for net tree
2012-02-23 0:02 [PATCH 0/4] netfilter updates for net tree pablo
` (3 preceding siblings ...)
2012-02-23 0:02 ` [PATCH 4/4] netfilter: ctnetlink: fix soft lockup when netlink adds new entries pablo
@ 2012-02-23 5:20 ` David Miller
4 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2012-02-23 5:20 UTC (permalink / raw)
To: pablo; +Cc: netfilter-devel, netdev
From: pablo@netfilter.org
Date: Thu, 23 Feb 2012 01:02:22 +0100
> The following are four fixes for your net tree:
>
> * One fix for NFQUEUE if used in bridge mode when GRO/GSO skbs
> are enqueued from Florian Westphal.
>
> * One fix from Joerg Willmann to fix wrong alignment in ebtables
> on PPC.
>
> * One fix for soft lockup for ctnetlink from Jozsef Kadlecsik.
>
> * One fix for IPVS from Simon Horman.
>
> Please, pull these changes from:
>
> git://1984.lsi.us.es/net nf
Pulled, thanks Pablo.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2012-02-23 5:20 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-23 0:02 [PATCH 0/4] netfilter updates for net tree pablo
2012-02-23 0:02 ` [PATCH 1/4] ipvs: fix matching of fwmark templates during scheduling pablo
2012-02-23 0:02 ` [PATCH 2/4] netfilter: nf_queue: fix queueing of bridged gro skbs pablo
2012-02-23 0:02 ` [PATCH 3/4] netfilter: ebtables: fix alignment problem in ppc pablo
2012-02-23 0:02 ` [PATCH 4/4] netfilter: ctnetlink: fix soft lockup when netlink adds new entries pablo
2012-02-23 5:20 ` [PATCH 0/4] netfilter updates for net tree David Miller
-- strict thread matches above, loose matches on Subject: below --
2012-01-17 11:04 pablo
2012-01-17 15:03 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).