diff options
author | Julian Anastasov <ja@ssi.bg> | 2011-12-30 00:19:02 -0500 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2011-12-31 10:06:29 -0500 |
commit | 52793dbe3d60bd73bbebe28b2bfc9f6b4b920d4c (patch) | |
tree | 845ae88e96de3b28884bab1e868e00ba4687fd02 /net | |
parent | fe3c8cc9226c7487c053edad9229dc85e93534d7 (diff) |
ipvs: try also real server with port 0 in backup server
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>
Diffstat (limited to 'net')
-rw-r--r-- | net/netfilter/ipvs/ip_vs_conn.c | 2 | ||||
-rw-r--r-- | net/netfilter/ipvs/ip_vs_ctl.c | 10 | ||||
-rw-r--r-- | net/netfilter/ipvs/ip_vs_sync.c | 2 |
3 files changed, 10 insertions, 4 deletions
diff --git a/net/netfilter/ipvs/ip_vs_conn.c b/net/netfilter/ipvs/ip_vs_conn.c index 12571fb2881..29fa5badde7 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) | |||
616 | if ((cp) && (!cp->dest)) { | 616 | if ((cp) && (!cp->dest)) { |
617 | dest = ip_vs_find_dest(ip_vs_conn_net(cp), cp->af, &cp->daddr, | 617 | dest = ip_vs_find_dest(ip_vs_conn_net(cp), cp->af, &cp->daddr, |
618 | cp->dport, &cp->vaddr, cp->vport, | 618 | cp->dport, &cp->vaddr, cp->vport, |
619 | cp->protocol, cp->fwmark); | 619 | cp->protocol, cp->fwmark, cp->flags); |
620 | ip_vs_bind_dest(cp, dest); | 620 | ip_vs_bind_dest(cp, dest); |
621 | return dest; | 621 | return dest; |
622 | } else | 622 | } else |
diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c index 008bf97cc91..e1a66cf37f9 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, | |||
619 | const union nf_inet_addr *daddr, | 619 | const union nf_inet_addr *daddr, |
620 | __be16 dport, | 620 | __be16 dport, |
621 | const union nf_inet_addr *vaddr, | 621 | const union nf_inet_addr *vaddr, |
622 | __be16 vport, __u16 protocol, __u32 fwmark) | 622 | __be16 vport, __u16 protocol, __u32 fwmark, |
623 | __u32 flags) | ||
623 | { | 624 | { |
624 | struct ip_vs_dest *dest; | 625 | struct ip_vs_dest *dest; |
625 | struct ip_vs_service *svc; | 626 | struct ip_vs_service *svc; |
627 | __be16 port = dport; | ||
626 | 628 | ||
627 | svc = ip_vs_service_get(net, af, fwmark, protocol, vaddr, vport); | 629 | svc = ip_vs_service_get(net, af, fwmark, protocol, vaddr, vport); |
628 | if (!svc) | 630 | if (!svc) |
629 | return NULL; | 631 | return NULL; |
630 | dest = ip_vs_lookup_dest(svc, daddr, dport); | 632 | if (fwmark && (flags & IP_VS_CONN_F_FWD_MASK) != IP_VS_CONN_F_MASQ) |
633 | port = 0; | ||
634 | dest = ip_vs_lookup_dest(svc, daddr, port); | ||
635 | if (!dest) | ||
636 | dest = ip_vs_lookup_dest(svc, daddr, port ^ dport); | ||
631 | if (dest) | 637 | if (dest) |
632 | atomic_inc(&dest->refcnt); | 638 | atomic_inc(&dest->refcnt); |
633 | ip_vs_service_put(svc); | 639 | ip_vs_service_put(svc); |
diff --git a/net/netfilter/ipvs/ip_vs_sync.c b/net/netfilter/ipvs/ip_vs_sync.c index 3cdd479f9b5..2b6678c0ce1 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, | |||
740 | * but still handled. | 740 | * but still handled. |
741 | */ | 741 | */ |
742 | dest = ip_vs_find_dest(net, type, daddr, dport, param->vaddr, | 742 | dest = ip_vs_find_dest(net, type, daddr, dport, param->vaddr, |
743 | param->vport, protocol, fwmark); | 743 | param->vport, protocol, fwmark, flags); |
744 | 744 | ||
745 | /* Set the approprite ativity flag */ | 745 | /* Set the approprite ativity flag */ |
746 | if (protocol == IPPROTO_TCP) { | 746 | if (protocol == IPPROTO_TCP) { |