netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/7] netfilter: netfilter update for -next
@ 2011-01-31 20:10 kaber
  2011-01-31 20:10 ` [PATCH 1/7] netfilter: ipvs: fix compiler warnings kaber
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: kaber @ 2011-01-31 20:10 UTC (permalink / raw)
  To: davem; +Cc: netfilter-devel, netdev

following is a small netfilter update for net-next, containing:

- compiler warning fixes for IPVS from Changli

- IPVS netns fixes from Simon and Hans Schillstrom

- a fix for connlimit destination address selection in NAT scenarios,
  from Jan

- minor iprange bugfixes and debugging improvements from Thomas Jacob

Please pull from:

git://git.kernel.org/pub/scm/linux/kernel/git/kaber/nf-next-2.6.git master

Thanks!

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/7] netfilter: ipvs: fix compiler warnings
  2011-01-31 20:10 [PATCH 0/7] netfilter: netfilter update for -next kaber
@ 2011-01-31 20:10 ` kaber
  2011-01-31 20:10 ` [PATCH 2/7] IPVS: Change sock_create_kernel() to __sock_create() kaber
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: kaber @ 2011-01-31 20:10 UTC (permalink / raw)
  To: davem; +Cc: netfilter-devel, netdev

From: Changli Gao <xiaosuo@gmail.com>

Fix compiler warnings when no transport protocol load balancing support
is configured.

[horms@verge.net.au: removed suprious __ip_vs_cleanup() clean-up hunk]
Signed-off-by: Changli Gao <xiaosuo@gmail.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
---
 net/netfilter/ipvs/ip_vs_ctl.c   |    4 ++++
 net/netfilter/ipvs/ip_vs_proto.c |    4 ++++
 2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c
index 09ca2ce..68b8033 100644
--- a/net/netfilter/ipvs/ip_vs_ctl.c
+++ b/net/netfilter/ipvs/ip_vs_ctl.c
@@ -2062,7 +2062,9 @@ static const struct file_operations ip_vs_stats_percpu_fops = {
  */
 static int ip_vs_set_timeout(struct net *net, struct ip_vs_timeout_user *u)
 {
+#if defined(CONFIG_IP_VS_PROTO_TCP) || defined(CONFIG_IP_VS_PROTO_UDP)
 	struct ip_vs_proto_data *pd;
+#endif
 
 	IP_VS_DBG(2, "Setting timeout tcp:%d tcpfin:%d udp:%d\n",
 		  u->tcp_timeout,
@@ -2405,7 +2407,9 @@ __ip_vs_get_dest_entries(struct net *net, const struct ip_vs_get_dests *get,
 static inline void
 __ip_vs_get_timeouts(struct net *net, struct ip_vs_timeout_user *u)
 {
+#if defined(CONFIG_IP_VS_PROTO_TCP) || defined(CONFIG_IP_VS_PROTO_UDP)
 	struct ip_vs_proto_data *pd;
+#endif
 
 #ifdef CONFIG_IP_VS_PROTO_TCP
 	pd = ip_vs_proto_data_get(net, IPPROTO_TCP);
diff --git a/net/netfilter/ipvs/ip_vs_proto.c b/net/netfilter/ipvs/ip_vs_proto.c
index 6ac986c..17484a4 100644
--- a/net/netfilter/ipvs/ip_vs_proto.c
+++ b/net/netfilter/ipvs/ip_vs_proto.c
@@ -60,6 +60,9 @@ static int __used __init register_ip_vs_protocol(struct ip_vs_protocol *pp)
 	return 0;
 }
 
+#if defined(CONFIG_IP_VS_PROTO_TCP) || defined(CONFIG_IP_VS_PROTO_UDP) || \
+    defined(CONFIG_IP_VS_PROTO_SCTP) || defined(CONFIG_IP_VS_PROTO_AH) || \
+    defined(CONFIG_IP_VS_PROTO_ESP)
 /*
  *	register an ipvs protocols netns related data
  */
@@ -85,6 +88,7 @@ register_ip_vs_proto_netns(struct net *net, struct ip_vs_protocol *pp)
 
 	return 0;
 }
+#endif
 
 /*
  *	unregister an ipvs protocol
-- 
1.7.2.3


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/7] IPVS: Change sock_create_kernel() to __sock_create()
  2011-01-31 20:10 [PATCH 0/7] netfilter: netfilter update for -next kaber
  2011-01-31 20:10 ` [PATCH 1/7] netfilter: ipvs: fix compiler warnings kaber
@ 2011-01-31 20:10 ` kaber
  2011-01-31 20:10 ` [PATCH 3/7] IPVS netns BUG, register sysctl for root ns kaber
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: kaber @ 2011-01-31 20:10 UTC (permalink / raw)
  To: davem; +Cc: netfilter-devel, netdev

From: Simon Horman <horms@verge.net.au>

The recent netns changes omitted to change
sock_create_kernel() to __sock_create() in ip_vs_sync.c

The effect of this is that the interface will be selected in the
root-namespace, from my point of view it's a major bug.

Reported-by: Hans Schillstrom <hans@schillstrom.com>
Acked-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Simon Horman <horms@verge.net.au>
---
 net/netfilter/ipvs/ip_vs_sync.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/netfilter/ipvs/ip_vs_sync.c b/net/netfilter/ipvs/ip_vs_sync.c
index d1adf98..d5a6e64 100644
--- a/net/netfilter/ipvs/ip_vs_sync.c
+++ b/net/netfilter/ipvs/ip_vs_sync.c
@@ -1305,7 +1305,7 @@ static struct socket *make_send_sock(struct net *net)
 	int result;
 
 	/* First create a socket */
-	result = sock_create_kern(PF_INET, SOCK_DGRAM, IPPROTO_UDP, &sock);
+	result = __sock_create(net, PF_INET, SOCK_DGRAM, IPPROTO_UDP, &sock, 1);
 	if (result < 0) {
 		pr_err("Error during creation of socket; terminating\n");
 		return ERR_PTR(result);
@@ -1351,7 +1351,7 @@ static struct socket *make_receive_sock(struct net *net)
 	int result;
 
 	/* First create a socket */
-	result = sock_create_kern(PF_INET, SOCK_DGRAM, IPPROTO_UDP, &sock);
+	result = __sock_create(net, PF_INET, SOCK_DGRAM, IPPROTO_UDP, &sock, 1);
 	if (result < 0) {
 		pr_err("Error during creation of socket; terminating\n");
 		return ERR_PTR(result);
-- 
1.7.2.3


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/7] IPVS netns BUG, register sysctl for root ns
  2011-01-31 20:10 [PATCH 0/7] netfilter: netfilter update for -next kaber
  2011-01-31 20:10 ` [PATCH 1/7] netfilter: ipvs: fix compiler warnings kaber
  2011-01-31 20:10 ` [PATCH 2/7] IPVS: Change sock_create_kernel() to __sock_create() kaber
@ 2011-01-31 20:10 ` kaber
  2011-01-31 20:10 ` [PATCH 4/7] netfilter: ipvs: fix compiler warnings kaber
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: kaber @ 2011-01-31 20:10 UTC (permalink / raw)
  To: davem; +Cc: netfilter-devel, netdev

From: Hans Schillstrom <hans.schillstrom@ericsson.com>

The newly created table was not used when register sysctl for a new namespace.
I.e. sysctl doesn't work for other than root namespace (init_net)

Signed-off-by: Hans Schillstrom <hans.schillstrom@ericsson.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
---
 net/netfilter/ipvs/ip_vs_ctl.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c
index 68b8033..98df59a 100644
--- a/net/netfilter/ipvs/ip_vs_ctl.c
+++ b/net/netfilter/ipvs/ip_vs_ctl.c
@@ -3556,7 +3556,7 @@ int __net_init __ip_vs_control_init(struct net *net)
 
 
 	ipvs->sysctl_hdr = register_net_sysctl_table(net, net_vs_ctl_path,
-						  vs_vars);
+						     tbl);
 	if (ipvs->sysctl_hdr == NULL)
 		goto err_reg;
 	ip_vs_new_estimator(net, ipvs->tot_stats);
-- 
1.7.2.3


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 4/7] netfilter: ipvs: fix compiler warnings
  2011-01-31 20:10 [PATCH 0/7] netfilter: netfilter update for -next kaber
                   ` (2 preceding siblings ...)
  2011-01-31 20:10 ` [PATCH 3/7] IPVS netns BUG, register sysctl for root ns kaber
@ 2011-01-31 20:10 ` kaber
  2011-01-31 20:10 ` [PATCH 5/7] netfilter: xt_connlimit: pick right dstaddr in NAT scenario kaber
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: kaber @ 2011-01-31 20:10 UTC (permalink / raw)
  To: davem; +Cc: netfilter-devel, netdev

From: Changli Gao <xiaosuo@gmail.com>

Fix compiler warnings when IP_VS_DBG() isn't defined.

Signed-off-by: Changli Gao <xiaosuo@gmail.com>
Acked-by: Hans Schillstrom <hans.schillstrom@ericsson.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
---
 net/netfilter/ipvs/ip_vs_core.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c
index f36a84f..d889f4f 100644
--- a/net/netfilter/ipvs/ip_vs_core.c
+++ b/net/netfilter/ipvs/ip_vs_core.c
@@ -1894,9 +1894,7 @@ static int __net_init __ip_vs_init(struct net *net)
 
 static void __net_exit __ip_vs_cleanup(struct net *net)
 {
-	struct netns_ipvs *ipvs = net_ipvs(net);
-
-	IP_VS_DBG(10, "ipvs netns %d released\n", ipvs->gen);
+	IP_VS_DBG(10, "ipvs netns %d released\n", net_ipvs(net)->gen);
 }
 
 static struct pernet_operations ipvs_core_ops = {
-- 
1.7.2.3


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 5/7] netfilter: xt_connlimit: pick right dstaddr in NAT scenario
  2011-01-31 20:10 [PATCH 0/7] netfilter: netfilter update for -next kaber
                   ` (3 preceding siblings ...)
  2011-01-31 20:10 ` [PATCH 4/7] netfilter: ipvs: fix compiler warnings kaber
@ 2011-01-31 20:10 ` kaber
  2011-01-31 20:10 ` [PATCH 6/7] netfilter: xt_iprange: typo in IPv4 match debug print code kaber
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: kaber @ 2011-01-31 20:10 UTC (permalink / raw)
  To: davem; +Cc: netfilter-devel, netdev

From: Jan Engelhardt <jengelh@medozas.de>

xt_connlimit normally records the "original" tuples in a hashlist
(such as "1.2.3.4 -> 5.6.7.8"), and looks in this list for iph->daddr
when counting.

When the user however uses DNAT in PREROUTING, looking for
iph->daddr -- which is now 192.168.9.10 -- will not match. Thus in
daddr mode, we need to record the reverse direction tuple
("192.168.9.10 -> 1.2.3.4") instead. In the reverse tuple, the dst
addr is on the src side, which is convenient, as count_them still uses
&conn->tuple.src.u3.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
---
 net/netfilter/xt_connlimit.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/net/netfilter/xt_connlimit.c b/net/netfilter/xt_connlimit.c
index 7fd3fd5..e029c48 100644
--- a/net/netfilter/xt_connlimit.c
+++ b/net/netfilter/xt_connlimit.c
@@ -185,11 +185,15 @@ connlimit_mt(const struct sk_buff *skb, struct xt_action_param *par)
 	int connections;
 
 	ct = nf_ct_get(skb, &ctinfo);
-	if (ct != NULL)
-		tuple_ptr = &ct->tuplehash[0].tuple;
-	else if (!nf_ct_get_tuplepr(skb, skb_network_offset(skb),
-				    par->family, &tuple))
+	if (ct != NULL) {
+		if (info->flags & XT_CONNLIMIT_DADDR)
+			tuple_ptr = &ct->tuplehash[IP_CT_DIR_REPLY].tuple;
+		else
+			tuple_ptr = &ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple;
+	} else if (!nf_ct_get_tuplepr(skb, skb_network_offset(skb),
+				    par->family, &tuple)) {
 		goto hotdrop;
+	}
 
 	if (par->family == NFPROTO_IPV6) {
 		const struct ipv6hdr *iph = ipv6_hdr(skb);
-- 
1.7.2.3


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 6/7] netfilter: xt_iprange: typo in IPv4 match debug print code
  2011-01-31 20:10 [PATCH 0/7] netfilter: netfilter update for -next kaber
                   ` (4 preceding siblings ...)
  2011-01-31 20:10 ` [PATCH 5/7] netfilter: xt_connlimit: pick right dstaddr in NAT scenario kaber
@ 2011-01-31 20:10 ` kaber
  2011-01-31 20:10 ` [PATCH 7/7] netfilter: xt_iprange: add IPv6 " kaber
  2011-01-31 20:32 ` [PATCH 0/7] netfilter: netfilter update for -next David Miller
  7 siblings, 0 replies; 9+ messages in thread
From: kaber @ 2011-01-31 20:10 UTC (permalink / raw)
  To: davem; +Cc: netfilter-devel, netdev

From: Thomas Jacob <jacob@internet24.de>

Signed-off-by: Thomas Jacob <jacob@internet24.de>
Signed-off-by: Patrick McHardy <kaber@trash.net>
---
 net/netfilter/xt_iprange.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/net/netfilter/xt_iprange.c b/net/netfilter/xt_iprange.c
index 88f7c35..77b9ebc 100644
--- a/net/netfilter/xt_iprange.c
+++ b/net/netfilter/xt_iprange.c
@@ -31,7 +31,7 @@ iprange_mt4(const struct sk_buff *skb, struct xt_action_param *par)
 			pr_debug("src IP %pI4 NOT in range %s%pI4-%pI4\n",
 			         &iph->saddr,
 			         (info->flags & IPRANGE_SRC_INV) ? "(INV) " : "",
-			         &info->src_max.ip,
+			         &info->src_min.ip,
 			         &info->src_max.ip);
 			return false;
 		}
-- 
1.7.2.3


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 7/7] netfilter: xt_iprange: add IPv6 match debug print code
  2011-01-31 20:10 [PATCH 0/7] netfilter: netfilter update for -next kaber
                   ` (5 preceding siblings ...)
  2011-01-31 20:10 ` [PATCH 6/7] netfilter: xt_iprange: typo in IPv4 match debug print code kaber
@ 2011-01-31 20:10 ` kaber
  2011-01-31 20:32 ` [PATCH 0/7] netfilter: netfilter update for -next David Miller
  7 siblings, 0 replies; 9+ messages in thread
From: kaber @ 2011-01-31 20:10 UTC (permalink / raw)
  To: davem; +Cc: netfilter-devel, netdev

From: Thomas Jacob <jacob@internet24.de>

Signed-off-by: Thomas Jacob <jacob@internet24.de>
Signed-off-by: Patrick McHardy <kaber@trash.net>
---
 net/netfilter/xt_iprange.c |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/net/netfilter/xt_iprange.c b/net/netfilter/xt_iprange.c
index 77b9ebc..d3eb5ed 100644
--- a/net/netfilter/xt_iprange.c
+++ b/net/netfilter/xt_iprange.c
@@ -78,15 +78,27 @@ iprange_mt6(const struct sk_buff *skb, struct xt_action_param *par)
 		m  = iprange_ipv6_sub(&iph->saddr, &info->src_min.in6) < 0;
 		m |= iprange_ipv6_sub(&iph->saddr, &info->src_max.in6) > 0;
 		m ^= !!(info->flags & IPRANGE_SRC_INV);
-		if (m)
+		if (m) {
+			pr_debug("src IP %pI6 NOT in range %s%pI6-%pI6\n",
+				 &iph->saddr,
+				 (info->flags & IPRANGE_SRC_INV) ? "(INV) " : "",
+				 &info->src_min.in6,
+				 &info->src_max.in6);
 			return false;
+		}
 	}
 	if (info->flags & IPRANGE_DST) {
 		m  = iprange_ipv6_sub(&iph->daddr, &info->dst_min.in6) < 0;
 		m |= iprange_ipv6_sub(&iph->daddr, &info->dst_max.in6) > 0;
 		m ^= !!(info->flags & IPRANGE_DST_INV);
-		if (m)
+		if (m) {
+			pr_debug("dst IP %pI6 NOT in range %s%pI6-%pI6\n",
+				 &iph->daddr,
+				 (info->flags & IPRANGE_DST_INV) ? "(INV) " : "",
+				 &info->dst_min.in6,
+				 &info->dst_max.in6);
 			return false;
+		}
 	}
 	return true;
 }
-- 
1.7.2.3


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 0/7] netfilter: netfilter update for -next
  2011-01-31 20:10 [PATCH 0/7] netfilter: netfilter update for -next kaber
                   ` (6 preceding siblings ...)
  2011-01-31 20:10 ` [PATCH 7/7] netfilter: xt_iprange: add IPv6 " kaber
@ 2011-01-31 20:32 ` David Miller
  7 siblings, 0 replies; 9+ messages in thread
From: David Miller @ 2011-01-31 20:32 UTC (permalink / raw)
  To: kaber; +Cc: netfilter-devel, netdev

From: kaber@trash.net
Date: Mon, 31 Jan 2011 21:10:13 +0100

> following is a small netfilter update for net-next, containing:
> 
> - compiler warning fixes for IPVS from Changli
> 
> - IPVS netns fixes from Simon and Hans Schillstrom
> 
> - a fix for connlimit destination address selection in NAT scenarios,
>   from Jan
> 
> - minor iprange bugfixes and debugging improvements from Thomas Jacob
> 
> Please pull from:
> 
> git://git.kernel.org/pub/scm/linux/kernel/git/kaber/nf-next-2.6.git master

Pulled, thanks Patrick.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2011-01-31 20:31 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-31 20:10 [PATCH 0/7] netfilter: netfilter update for -next kaber
2011-01-31 20:10 ` [PATCH 1/7] netfilter: ipvs: fix compiler warnings kaber
2011-01-31 20:10 ` [PATCH 2/7] IPVS: Change sock_create_kernel() to __sock_create() kaber
2011-01-31 20:10 ` [PATCH 3/7] IPVS netns BUG, register sysctl for root ns kaber
2011-01-31 20:10 ` [PATCH 4/7] netfilter: ipvs: fix compiler warnings kaber
2011-01-31 20:10 ` [PATCH 5/7] netfilter: xt_connlimit: pick right dstaddr in NAT scenario kaber
2011-01-31 20:10 ` [PATCH 6/7] netfilter: xt_iprange: typo in IPv4 match debug print code kaber
2011-01-31 20:10 ` [PATCH 7/7] netfilter: xt_iprange: add IPv6 " kaber
2011-01-31 20:32 ` [PATCH 0/7] netfilter: netfilter update for -next 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).