* [PATCH 0/2] more Netfilter fixes for 3.2-rc7
@ 2011-12-31 16:22 pablo
2011-12-31 16:22 ` [PATCH 1/2] ipvs: try also real server with port 0 in backup server pablo
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: pablo @ 2011-12-31 16:22 UTC (permalink / raw)
To: netfilter-devel; +Cc: davem, netdev
From: Pablo Neira Ayuso <pablo@netfilter.org>
Hi Dave,
The following patches are a couple of late fixes for Netfilter,
one for IPVS and another for ctnetlink.
You can pull them from:
git://1984.lsi.us.es/net nf
Julian Anastasov (1):
ipvs: try also real server with port 0 in backup server
Xi Wang (1):
netfilter: ctnetlink: fix timeout calculation
include/net/ip_vs.h | 2 +-
net/netfilter/ipvs/ip_vs_conn.c | 2 +-
net/netfilter/ipvs/ip_vs_ctl.c | 10 ++++++++--
net/netfilter/ipvs/ip_vs_sync.c | 2 +-
net/netfilter/nf_conntrack_netlink.c | 4 ++--
5 files changed, 13 insertions(+), 7 deletions(-)
--
1.7.7.3
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] ipvs: try also real server with port 0 in backup server
2011-12-31 16:22 [PATCH 0/2] more Netfilter fixes for 3.2-rc7 pablo
@ 2011-12-31 16:22 ` pablo
2011-12-31 16:22 ` [PATCH 2/2] netfilter: ctnetlink: fix timeout calculation pablo
2011-12-31 17:46 ` [PATCH 0/2] more Netfilter fixes for 3.2-rc7 David Miller
2 siblings, 0 replies; 4+ messages in thread
From: pablo @ 2011-12-31 16:22 UTC (permalink / raw)
To: netfilter-devel; +Cc: davem, netdev
From: Julian Anastasov <ja@ssi.bg>
We should not forget to try for real server with port 0
in the backup server when processing the sync message. We should
do it in all cases because the backup server can use different
forwarding method.
Signed-off-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
include/net/ip_vs.h | 2 +-
net/netfilter/ipvs/ip_vs_conn.c | 2 +-
net/netfilter/ipvs/ip_vs_ctl.c | 10 ++++++++--
net/netfilter/ipvs/ip_vs_sync.c | 2 +-
4 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index 873d5be..e5a7b9a 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -1207,7 +1207,7 @@ extern void ip_vs_control_cleanup(void);
extern struct ip_vs_dest *
ip_vs_find_dest(struct net *net, int af, const union nf_inet_addr *daddr,
__be16 dport, const union nf_inet_addr *vaddr, __be16 vport,
- __u16 protocol, __u32 fwmark);
+ __u16 protocol, __u32 fwmark, __u32 flags);
extern struct ip_vs_dest *ip_vs_try_bind_dest(struct ip_vs_conn *cp);
diff --git a/net/netfilter/ipvs/ip_vs_conn.c b/net/netfilter/ipvs/ip_vs_conn.c
index 12571fb..29fa5ba 100644
--- a/net/netfilter/ipvs/ip_vs_conn.c
+++ b/net/netfilter/ipvs/ip_vs_conn.c
@@ -616,7 +616,7 @@ struct ip_vs_dest *ip_vs_try_bind_dest(struct ip_vs_conn *cp)
if ((cp) && (!cp->dest)) {
dest = ip_vs_find_dest(ip_vs_conn_net(cp), cp->af, &cp->daddr,
cp->dport, &cp->vaddr, cp->vport,
- cp->protocol, cp->fwmark);
+ cp->protocol, cp->fwmark, cp->flags);
ip_vs_bind_dest(cp, dest);
return dest;
} else
diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c
index 008bf97..e1a66cf 100644
--- a/net/netfilter/ipvs/ip_vs_ctl.c
+++ b/net/netfilter/ipvs/ip_vs_ctl.c
@@ -619,15 +619,21 @@ struct ip_vs_dest *ip_vs_find_dest(struct net *net, int af,
const union nf_inet_addr *daddr,
__be16 dport,
const union nf_inet_addr *vaddr,
- __be16 vport, __u16 protocol, __u32 fwmark)
+ __be16 vport, __u16 protocol, __u32 fwmark,
+ __u32 flags)
{
struct ip_vs_dest *dest;
struct ip_vs_service *svc;
+ __be16 port = dport;
svc = ip_vs_service_get(net, af, fwmark, protocol, vaddr, vport);
if (!svc)
return NULL;
- dest = ip_vs_lookup_dest(svc, daddr, dport);
+ if (fwmark && (flags & IP_VS_CONN_F_FWD_MASK) != IP_VS_CONN_F_MASQ)
+ port = 0;
+ dest = ip_vs_lookup_dest(svc, daddr, port);
+ if (!dest)
+ dest = ip_vs_lookup_dest(svc, daddr, port ^ dport);
if (dest)
atomic_inc(&dest->refcnt);
ip_vs_service_put(svc);
diff --git a/net/netfilter/ipvs/ip_vs_sync.c b/net/netfilter/ipvs/ip_vs_sync.c
index 3cdd479..2b6678c0 100644
--- a/net/netfilter/ipvs/ip_vs_sync.c
+++ b/net/netfilter/ipvs/ip_vs_sync.c
@@ -740,7 +740,7 @@ static void ip_vs_proc_conn(struct net *net, struct ip_vs_conn_param *param,
* but still handled.
*/
dest = ip_vs_find_dest(net, type, daddr, dport, param->vaddr,
- param->vport, protocol, fwmark);
+ param->vport, protocol, fwmark, flags);
/* Set the approprite ativity flag */
if (protocol == IPPROTO_TCP) {
--
1.7.7.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] netfilter: ctnetlink: fix timeout calculation
2011-12-31 16:22 [PATCH 0/2] more Netfilter fixes for 3.2-rc7 pablo
2011-12-31 16:22 ` [PATCH 1/2] ipvs: try also real server with port 0 in backup server pablo
@ 2011-12-31 16:22 ` pablo
2011-12-31 17:46 ` [PATCH 0/2] more Netfilter fixes for 3.2-rc7 David Miller
2 siblings, 0 replies; 4+ messages in thread
From: pablo @ 2011-12-31 16:22 UTC (permalink / raw)
To: netfilter-devel; +Cc: davem, netdev
From: Xi Wang <xi.wang@gmail.com>
The sanity check (timeout < 0) never works; the dividend is unsigned
and so is the division, which should have been a signed division.
long timeout = (ct->timeout.expires - jiffies) / HZ;
if (timeout < 0)
timeout = 0;
This patch converts the time values to signed for the division.
Signed-off-by: Xi Wang <xi.wang@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
net/netfilter/nf_conntrack_netlink.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c
index b697777..257e772 100644
--- a/net/netfilter/nf_conntrack_netlink.c
+++ b/net/netfilter/nf_conntrack_netlink.c
@@ -135,7 +135,7 @@ nla_put_failure:
static inline int
ctnetlink_dump_timeout(struct sk_buff *skb, const struct nf_conn *ct)
{
- long timeout = (ct->timeout.expires - jiffies) / HZ;
+ long timeout = ((long)ct->timeout.expires - (long)jiffies) / HZ;
if (timeout < 0)
timeout = 0;
@@ -1641,7 +1641,7 @@ ctnetlink_exp_dump_expect(struct sk_buff *skb,
const struct nf_conntrack_expect *exp)
{
struct nf_conn *master = exp->master;
- long timeout = (exp->timeout.expires - jiffies) / HZ;
+ long timeout = ((long)exp->timeout.expires - (long)jiffies) / HZ;
struct nf_conn_help *help;
if (timeout < 0)
--
1.7.7.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 0/2] more Netfilter fixes for 3.2-rc7
2011-12-31 16:22 [PATCH 0/2] more Netfilter fixes for 3.2-rc7 pablo
2011-12-31 16:22 ` [PATCH 1/2] ipvs: try also real server with port 0 in backup server pablo
2011-12-31 16:22 ` [PATCH 2/2] netfilter: ctnetlink: fix timeout calculation pablo
@ 2011-12-31 17:46 ` David Miller
2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2011-12-31 17:46 UTC (permalink / raw)
To: pablo; +Cc: netfilter-devel, netdev
From: pablo@netfilter.org
Date: Sat, 31 Dec 2011 17:22:45 +0100
> The following patches are a couple of late fixes for Netfilter,
> one for IPVS and another for ctnetlink.
>
> You can pull them from:
>
> git://1984.lsi.us.es/net nf
Pulled, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-12-31 17:47 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-31 16:22 [PATCH 0/2] more Netfilter fixes for 3.2-rc7 pablo
2011-12-31 16:22 ` [PATCH 1/2] ipvs: try also real server with port 0 in backup server pablo
2011-12-31 16:22 ` [PATCH 2/2] netfilter: ctnetlink: fix timeout calculation pablo
2011-12-31 17:46 ` [PATCH 0/2] more Netfilter fixes for 3.2-rc7 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).