* [GIT PULL nf] IPVS fixes for v3.10
@ 2013-05-25 23:16 Simon Horman
2013-05-25 23:16 ` [PATCH] ipvs: Fix reuse connection if real server is dead Simon Horman
0 siblings, 1 reply; 4+ messages in thread
From: Simon Horman @ 2013-05-25 23:16 UTC (permalink / raw)
To: Pablo Neira Ayuso
Cc: lvs-devel, netdev, netfilter-devel, Wensong Zhang,
Julian Anastasov
Hi Pablo,
The following changes since commit 4f36ea6eed2081340c7a7aa98c73187ecfccebff:
netfilter: ipt_ULOG: fix non-null terminated string in the nf_log path (2013-05-23 14:25:40 +0200)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/horms/ipvs.git tags/ipvs-fixes-for-v3.10
for you to fetch changes up to 1fb4f80a593231770eae3192e4a52fa7631bd897:
ipvs: Fix reuse connection if real server is dead (2013-05-26 08:10:47 +0900)
----------------------------------------------------------------
IPVS fixes for v3.10
Correct connection reuse for TCP and SCTP
----------------------------------------------------------------
Grzegorz Lyczba (1):
ipvs: Fix reuse connection if real server is dead
net/netfilter/ipvs/ip_vs_core.c | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] ipvs: Fix reuse connection if real server is dead
2013-05-25 23:16 [GIT PULL nf] IPVS fixes for v3.10 Simon Horman
@ 2013-05-25 23:16 ` Simon Horman
2013-05-27 11:49 ` Pablo Neira Ayuso
0 siblings, 1 reply; 4+ messages in thread
From: Simon Horman @ 2013-05-25 23:16 UTC (permalink / raw)
To: Pablo Neira Ayuso
Cc: lvs-devel, netdev, netfilter-devel, Wensong Zhang,
Julian Anastasov, Grzegorz Lyczba, Simon Horman
From: Grzegorz Lyczba <grzegorz.lyczba@gmail.com>
Expire cached connection for new TCP/SCTP connection if real server is down
Signed-off-by: Grzegorz Lyczba <grzegorz.lyczba@gmail.com>
Acked-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_core.c | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c
index 085b588..05565d2 100644
--- a/net/netfilter/ipvs/ip_vs_core.c
+++ b/net/netfilter/ipvs/ip_vs_core.c
@@ -1001,6 +1001,32 @@ static inline int is_tcp_reset(const struct sk_buff *skb, int nh_len)
return th->rst;
}
+static inline bool is_new_conn(const struct sk_buff *skb,
+ struct ip_vs_iphdr *iph)
+{
+ switch (iph->protocol) {
+ case IPPROTO_TCP: {
+ struct tcphdr _tcph, *th;
+
+ th = skb_header_pointer(skb, iph->len, sizeof(_tcph), &_tcph);
+ if (th == NULL)
+ return false;
+ return th->syn;
+ }
+ case IPPROTO_SCTP: {
+ sctp_chunkhdr_t *sch, schunk;
+
+ sch = skb_header_pointer(skb, iph->len + sizeof(sctp_sctphdr_t),
+ sizeof(schunk), &schunk);
+ if (sch == NULL)
+ return false;
+ return sch->type == SCTP_CID_INIT;
+ }
+ default:
+ return false;
+ }
+}
+
/* Handle response packets: rewrite addresses and send away...
*/
static unsigned int
@@ -1612,6 +1638,15 @@ ip_vs_in(unsigned int hooknum, struct sk_buff *skb, int af)
* Check if the packet belongs to an existing connection entry
*/
cp = pp->conn_in_get(af, skb, &iph, 0);
+
+ if (unlikely(sysctl_expire_nodest_conn(ipvs)) && cp && cp->dest &&
+ unlikely(!atomic_read(&cp->dest->weight)) && !iph.fragoffs &&
+ is_new_conn(skb, &iph)) {
+ ip_vs_conn_expire_now(cp);
+ __ip_vs_conn_put(cp);
+ cp = NULL;
+ }
+
if (unlikely(!cp) && !iph.fragoffs) {
/* No (second) fragments need to enter here, as nf_defrag_ipv6
* replayed fragment zero will already have created the cp
--
1.7.10.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] ipvs: Fix reuse connection if real server is dead
2013-05-25 23:16 ` [PATCH] ipvs: Fix reuse connection if real server is dead Simon Horman
@ 2013-05-27 11:49 ` Pablo Neira Ayuso
2013-05-27 23:48 ` Simon Horman
0 siblings, 1 reply; 4+ messages in thread
From: Pablo Neira Ayuso @ 2013-05-27 11:49 UTC (permalink / raw)
To: Simon Horman
Cc: lvs-devel, netdev, netfilter-devel, Wensong Zhang,
Julian Anastasov, Grzegorz Lyczba
On Sun, May 26, 2013 at 08:16:39AM +0900, Simon Horman wrote:
> From: Grzegorz Lyczba <grzegorz.lyczba@gmail.com>
>
> Expire cached connection for new TCP/SCTP connection if real server is down
Applied, thanks Simon.
I have mangled the description to insist on the fact that newly
(reused) connections break as they will be directed to the dead
server.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ipvs: Fix reuse connection if real server is dead
2013-05-27 11:49 ` Pablo Neira Ayuso
@ 2013-05-27 23:48 ` Simon Horman
0 siblings, 0 replies; 4+ messages in thread
From: Simon Horman @ 2013-05-27 23:48 UTC (permalink / raw)
To: Pablo Neira Ayuso
Cc: lvs-devel, netdev, netfilter-devel, Wensong Zhang,
Julian Anastasov, Grzegorz Lyczba
On Mon, May 27, 2013 at 01:49:11PM +0200, Pablo Neira Ayuso wrote:
> On Sun, May 26, 2013 at 08:16:39AM +0900, Simon Horman wrote:
> > From: Grzegorz Lyczba <grzegorz.lyczba@gmail.com>
> >
> > Expire cached connection for new TCP/SCTP connection if real server is down
>
> Applied, thanks Simon.
>
> I have mangled the description to insist on the fact that newly
> (reused) connections break as they will be directed to the dead
> server.
Thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-05-27 23:48 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-25 23:16 [GIT PULL nf] IPVS fixes for v3.10 Simon Horman
2013-05-25 23:16 ` [PATCH] ipvs: Fix reuse connection if real server is dead Simon Horman
2013-05-27 11:49 ` Pablo Neira Ayuso
2013-05-27 23:48 ` Simon Horman
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).