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 | |
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>
-rw-r--r-- | include/net/ip_vs.h | 2 | ||||
-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 |
4 files changed, 11 insertions, 5 deletions
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h index 873d5be7926c..e5a7b9aaf552 100644 --- a/include/net/ip_vs.h +++ b/include/net/ip_vs.h | |||
@@ -1207,7 +1207,7 @@ extern void ip_vs_control_cleanup(void); | |||
1207 | extern struct ip_vs_dest * | 1207 | extern struct ip_vs_dest * |
1208 | ip_vs_find_dest(struct net *net, int af, const union nf_inet_addr *daddr, | 1208 | ip_vs_find_dest(struct net *net, int af, const union nf_inet_addr *daddr, |
1209 | __be16 dport, const union nf_inet_addr *vaddr, __be16 vport, | 1209 | __be16 dport, const union nf_inet_addr *vaddr, __be16 vport, |
1210 | __u16 protocol, __u32 fwmark); | 1210 | __u16 protocol, __u32 fwmark, __u32 flags); |
1211 | extern struct ip_vs_dest *ip_vs_try_bind_dest(struct ip_vs_conn *cp); | 1211 | extern struct ip_vs_dest *ip_vs_try_bind_dest(struct ip_vs_conn *cp); |
1212 | 1212 | ||
1213 | 1213 | ||
diff --git a/net/netfilter/ipvs/ip_vs_conn.c b/net/netfilter/ipvs/ip_vs_conn.c index 12571fb2881c..29fa5badde75 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 008bf97cc91a..e1a66cf37f9a 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 3cdd479f9b5d..2b6678c0ce14 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) { |