* [GIT PULL nf-next] IPVS for v3.11
@ 2013-05-22 5:56 Simon Horman
2013-05-22 5:56 ` [PATCH 1/2] ipvs: change type of netns_ipvs->sysctl_sync_qlen_max Simon Horman
2013-05-22 5:56 ` [PATCH 2/2] ipvs: Fix reuse connection if real server is dead Simon Horman
0 siblings, 2 replies; 7+ messages in thread
From: Simon Horman @ 2013-05-22 5:56 UTC (permalink / raw)
To: Pablo Neira Ayuso
Cc: lvs-devel, netdev, netfilter-devel, Wensong Zhang,
Julian Anastasov
Hi Pablo,
The following changes since commit eee1d5a14780b9391ec51f3feaf4cffb521ddbb1:
sctp: Correct type and usage of sctp_end_cksum() (2013-04-29 20:09:08 +0200)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/horms/ipvs-next.git tags/ipvs-for-v3.11
for you to fetch changes up to fc889767fc2e51e43787408e3ff9fb34e5312c74:
ipvs: Fix reuse connection if real server is dead (2013-05-22 14:43:11 +0900)
----------------------------------------------------------------
Two enhancements to IPVS for v3.11
* Correct connection reuse for TCP and SCTP
* Tidy up type of sysctl_sync_qlen_max member of struct netns_ipvs
----------------------------------------------------------------
Grzegorz Lyczba (1):
ipvs: Fix reuse connection if real server is dead
Zhang Yanfei (1):
ipvs: change type of netns_ipvs->sysctl_sync_qlen_max
include/net/ip_vs.h | 8 ++++----
net/netfilter/ipvs/ip_vs_core.c | 36 ++++++++++++++++++++++++++++++++++++
net/netfilter/ipvs/ip_vs_ctl.c | 4 ++--
3 files changed, 42 insertions(+), 6 deletions(-)
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/2] ipvs: change type of netns_ipvs->sysctl_sync_qlen_max
2013-05-22 5:56 [GIT PULL nf-next] IPVS for v3.11 Simon Horman
@ 2013-05-22 5:56 ` Simon Horman
2013-05-22 5:56 ` [PATCH 2/2] ipvs: Fix reuse connection if real server is dead Simon Horman
1 sibling, 0 replies; 7+ messages in thread
From: Simon Horman @ 2013-05-22 5:56 UTC (permalink / raw)
To: Pablo Neira Ayuso
Cc: lvs-devel, netdev, netfilter-devel, Wensong Zhang,
Julian Anastasov, Zhang Yanfei, David Miller, Andrew Morton,
Simon Horman
From: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
This member of struct netns_ipvs is calculated from nr_free_buffer_pages
so change its type to unsigned long in case of overflow. Also, type of
its related proc var sync_qlen_max and the return type of function
sysctl_sync_qlen_max() should be changed to unsigned long, too.
Besides, the type of ipvs_master_sync_state->sync_queue_len should be
changed to unsigned long accordingly.
Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
Cc: Julian Anastasov <ja@ssi.bg>
Cc: David Miller <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Simon Horman <horms@verge.net.au>
---
include/net/ip_vs.h | 8 ++++----
net/netfilter/ipvs/ip_vs_ctl.c | 4 ++--
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index 4c062cc..4405886 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -905,7 +905,7 @@ struct ip_vs_app {
struct ipvs_master_sync_state {
struct list_head sync_queue;
struct ip_vs_sync_buff *sync_buff;
- int sync_queue_len;
+ unsigned long sync_queue_len;
unsigned int sync_queue_delay;
struct task_struct *master_thread;
struct delayed_work master_wakeup_work;
@@ -998,7 +998,7 @@ struct netns_ipvs {
int sysctl_snat_reroute;
int sysctl_sync_ver;
int sysctl_sync_ports;
- int sysctl_sync_qlen_max;
+ unsigned long sysctl_sync_qlen_max;
int sysctl_sync_sock_size;
int sysctl_cache_bypass;
int sysctl_expire_nodest_conn;
@@ -1085,7 +1085,7 @@ static inline int sysctl_sync_ports(struct netns_ipvs *ipvs)
return ACCESS_ONCE(ipvs->sysctl_sync_ports);
}
-static inline int sysctl_sync_qlen_max(struct netns_ipvs *ipvs)
+static inline unsigned long sysctl_sync_qlen_max(struct netns_ipvs *ipvs)
{
return ipvs->sysctl_sync_qlen_max;
}
@@ -1138,7 +1138,7 @@ static inline int sysctl_sync_ports(struct netns_ipvs *ipvs)
return 1;
}
-static inline int sysctl_sync_qlen_max(struct netns_ipvs *ipvs)
+static inline unsigned long sysctl_sync_qlen_max(struct netns_ipvs *ipvs)
{
return IPVS_SYNC_QLEN_MAX;
}
diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c
index 5b142fb..7014649 100644
--- a/net/netfilter/ipvs/ip_vs_ctl.c
+++ b/net/netfilter/ipvs/ip_vs_ctl.c
@@ -1716,9 +1716,9 @@ static struct ctl_table vs_vars[] = {
},
{
.procname = "sync_qlen_max",
- .maxlen = sizeof(int),
+ .maxlen = sizeof(unsigned long),
.mode = 0644,
- .proc_handler = proc_dointvec,
+ .proc_handler = proc_doulongvec_minmax,
},
{
.procname = "sync_sock_size",
--
1.8.2.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/2] ipvs: Fix reuse connection if real server is dead
2013-05-22 5:56 [GIT PULL nf-next] IPVS for v3.11 Simon Horman
2013-05-22 5:56 ` [PATCH 1/2] ipvs: change type of netns_ipvs->sysctl_sync_qlen_max Simon Horman
@ 2013-05-22 5:56 ` Simon Horman
2013-05-22 7:06 ` Julian Anastasov
` (2 more replies)
1 sibling, 3 replies; 7+ messages in thread
From: Simon Horman @ 2013-05-22 5:56 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>
Signed-off-by: Simon Horman <horms@verge.net.au>
---
net/netfilter/ipvs/ip_vs_core.c | 36 ++++++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)
diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c
index 085b588..7967d12 100644
--- a/net/netfilter/ipvs/ip_vs_core.c
+++ b/net/netfilter/ipvs/ip_vs_core.c
@@ -1001,6 +1001,33 @@ 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 +1639,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.8.2.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] ipvs: Fix reuse connection if real server is dead
2013-05-22 5:56 ` [PATCH 2/2] ipvs: Fix reuse connection if real server is dead Simon Horman
@ 2013-05-22 7:06 ` Julian Anastasov
2013-05-22 18:11 ` Sergei Shtylyov
2013-05-23 11:34 ` Pablo Neira Ayuso
2 siblings, 0 replies; 7+ messages in thread
From: Julian Anastasov @ 2013-05-22 7:06 UTC (permalink / raw)
To: Simon Horman
Cc: Pablo Neira Ayuso, lvs-devel, netdev, netfilter-devel,
Wensong Zhang, Grzegorz Lyczba
Hello,
On Wed, 22 May 2013, Simon Horman wrote:
> 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>
Above line should have a ':' after 'Acked-by'.
You can also add my ack for both patches:
Acked-by: Julian Anastasov <ja@ssi.bg>
> Signed-off-by: Simon Horman <horms@verge.net.au>
> ---
> net/netfilter/ipvs/ip_vs_core.c | 36 ++++++++++++++++++++++++++++++++++++
> 1 file changed, 36 insertions(+)
>
> diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c
> index 085b588..7967d12 100644
> --- a/net/netfilter/ipvs/ip_vs_core.c
> +++ b/net/netfilter/ipvs/ip_vs_core.c
> @@ -1001,6 +1001,33 @@ 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 +1639,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.8.2.1
Regards
--
Julian Anastasov <ja@ssi.bg>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] ipvs: Fix reuse connection if real server is dead
2013-05-22 5:56 ` [PATCH 2/2] ipvs: Fix reuse connection if real server is dead Simon Horman
2013-05-22 7:06 ` Julian Anastasov
@ 2013-05-22 18:11 ` Sergei Shtylyov
2013-05-23 11:34 ` Pablo Neira Ayuso
2 siblings, 0 replies; 7+ messages in thread
From: Sergei Shtylyov @ 2013-05-22 18:11 UTC (permalink / raw)
To: Simon Horman
Cc: Pablo Neira Ayuso, lvs-devel, netdev, netfilter-devel,
Wensong Zhang, Julian Anastasov, Grzegorz Lyczba
Hello.
On 22-05-2013 9:56, Simon Horman wrote:
> 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>
Missing :.
> Signed-off-by: Simon Horman <horms@verge.net.au>
> ---
> net/netfilter/ipvs/ip_vs_core.c | 36 ++++++++++++++++++++++++++++++++++++
> 1 file changed, 36 insertions(+)
> diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c
> index 085b588..7967d12 100644
> --- a/net/netfilter/ipvs/ip_vs_core.c
> +++ b/net/netfilter/ipvs/ip_vs_core.c
> @@ -1001,6 +1001,33 @@ 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);
This line should be aligned under the next character after (.
> + if (sch == NULL)
> + return false;
> + return (sch->type == SCTP_CID_INIT);
() not needed.
> + }
> + default:
> + return false;
> + }
> +}
> +
> +
Too many empty lines?
WBR, Sergei
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] ipvs: Fix reuse connection if real server is dead
2013-05-22 5:56 ` [PATCH 2/2] ipvs: Fix reuse connection if real server is dead Simon Horman
2013-05-22 7:06 ` Julian Anastasov
2013-05-22 18:11 ` Sergei Shtylyov
@ 2013-05-23 11:34 ` Pablo Neira Ayuso
2013-05-24 3:01 ` Simon Horman
2 siblings, 1 reply; 7+ messages in thread
From: Pablo Neira Ayuso @ 2013-05-23 11:34 UTC (permalink / raw)
To: Simon Horman
Cc: lvs-devel, netdev, netfilter-devel, Wensong Zhang,
Julian Anastasov, Grzegorz Lyczba
Hi Simon,
On Wed, May 22, 2013 at 02:56:49PM +0900, Simon Horman wrote:
> From: Grzegorz Lyczba <grzegorz.lyczba@gmail.com>
>
> Expire cached connection for new TCP/SCTP connection if real server is down
We can get this fix into 3.10-rc.
Please, address the comestic cleanups proposed by Sergei and resubmit
against the nf tree.
Thanks.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] ipvs: Fix reuse connection if real server is dead
2013-05-23 11:34 ` Pablo Neira Ayuso
@ 2013-05-24 3:01 ` Simon Horman
0 siblings, 0 replies; 7+ messages in thread
From: Simon Horman @ 2013-05-24 3:01 UTC (permalink / raw)
To: Pablo Neira Ayuso
Cc: lvs-devel, netdev, netfilter-devel, Wensong Zhang,
Julian Anastasov, Grzegorz Lyczba
On Thu, May 23, 2013 at 01:34:35PM +0200, Pablo Neira Ayuso wrote:
> Hi Simon,
>
> On Wed, May 22, 2013 at 02:56:49PM +0900, Simon Horman wrote:
> > From: Grzegorz Lyczba <grzegorz.lyczba@gmail.com>
> >
> > Expire cached connection for new TCP/SCTP connection if real server is down
>
> We can get this fix into 3.10-rc.
>
> Please, address the comestic cleanups proposed by Sergei and resubmit
> against the nf tree.
Sure, will do.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2013-05-24 3:01 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-22 5:56 [GIT PULL nf-next] IPVS for v3.11 Simon Horman
2013-05-22 5:56 ` [PATCH 1/2] ipvs: change type of netns_ipvs->sysctl_sync_qlen_max Simon Horman
2013-05-22 5:56 ` [PATCH 2/2] ipvs: Fix reuse connection if real server is dead Simon Horman
2013-05-22 7:06 ` Julian Anastasov
2013-05-22 18:11 ` Sergei Shtylyov
2013-05-23 11:34 ` Pablo Neira Ayuso
2013-05-24 3:01 ` 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).