2005-04-17 00:20:36 +02:00
|
|
|
/*
|
|
|
|
* ip_vs_proto_tcp.c: TCP load balancing support for IPVS
|
|
|
|
*
|
|
|
|
* Authors: Wensong Zhang <wensong@linuxvirtualserver.org>
|
|
|
|
* Julian Anastasov <ja@ssi.bg>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version
|
|
|
|
* 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
2011-01-03 14:44:47 +01:00
|
|
|
* Changes: Hans Schillstrom <hans.schillstrom@ericsson.com>
|
2005-04-17 00:20:36 +02:00
|
|
|
*
|
2011-01-03 14:44:47 +01:00
|
|
|
* Network name space (netns) aware.
|
|
|
|
* Global data moved to netns i.e struct netns_ipvs
|
|
|
|
* tcp_timeouts table has copy per netns in a hash table per
|
|
|
|
* protocol ip_vs_proto_data and is handled by netns
|
2005-04-17 00:20:36 +02:00
|
|
|
*/
|
|
|
|
|
2009-07-30 23:29:44 +02:00
|
|
|
#define KMSG_COMPONENT "IPVS"
|
|
|
|
#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
|
|
|
|
|
2005-04-17 00:20:36 +02:00
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/ip.h>
|
|
|
|
#include <linux/tcp.h> /* for tcphdr */
|
|
|
|
#include <net/ip.h>
|
|
|
|
#include <net/tcp.h> /* for csum_tcpudp_magic */
|
2008-09-13 08:23:50 +02:00
|
|
|
#include <net/ip6_checksum.h>
|
2007-10-14 09:39:33 +02:00
|
|
|
#include <linux/netfilter.h>
|
2005-04-17 00:20:36 +02:00
|
|
|
#include <linux/netfilter_ipv4.h>
|
|
|
|
|
|
|
|
#include <net/ip_vs.h>
|
|
|
|
|
|
|
|
static int
|
2011-01-03 14:44:51 +01:00
|
|
|
tcp_conn_schedule(int af, struct sk_buff *skb, struct ip_vs_proto_data *pd,
|
2005-04-17 00:20:36 +02:00
|
|
|
int *verdict, struct ip_vs_conn **cpp)
|
|
|
|
{
|
2011-01-03 14:44:43 +01:00
|
|
|
struct net *net;
|
2005-04-17 00:20:36 +02:00
|
|
|
struct ip_vs_service *svc;
|
|
|
|
struct tcphdr _tcph, *th;
|
2008-09-02 15:55:38 +02:00
|
|
|
struct ip_vs_iphdr iph;
|
2005-04-17 00:20:36 +02:00
|
|
|
|
2008-09-02 15:55:40 +02:00
|
|
|
ip_vs_fill_iphdr(af, skb_network_header(skb), &iph);
|
2008-09-02 15:55:38 +02:00
|
|
|
|
|
|
|
th = skb_header_pointer(skb, iph.len, sizeof(_tcph), &_tcph);
|
2005-04-17 00:20:36 +02:00
|
|
|
if (th == NULL) {
|
|
|
|
*verdict = NF_DROP;
|
|
|
|
return 0;
|
|
|
|
}
|
2011-01-03 14:44:43 +01:00
|
|
|
net = skb_net(skb);
|
2010-10-17 15:24:37 +02:00
|
|
|
/* No !th->ack check to allow scheduling on SYN+ACK for Active FTP */
|
2005-04-17 00:20:36 +02:00
|
|
|
if (th->syn &&
|
2011-01-03 14:44:43 +01:00
|
|
|
(svc = ip_vs_service_get(net, af, skb->mark, iph.protocol,
|
|
|
|
&iph.daddr, th->dest))) {
|
2010-10-17 15:24:37 +02:00
|
|
|
int ignored;
|
|
|
|
|
2011-01-03 14:44:58 +01:00
|
|
|
if (ip_vs_todrop(net_ipvs(net))) {
|
2005-04-17 00:20:36 +02:00
|
|
|
/*
|
|
|
|
* It seems that we are very loaded.
|
|
|
|
* We have to drop this packet :(
|
|
|
|
*/
|
|
|
|
ip_vs_service_put(svc);
|
|
|
|
*verdict = NF_DROP;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Let the virtual server select a real server for the
|
|
|
|
* incoming connection, and create a connection entry.
|
|
|
|
*/
|
2011-01-03 14:44:51 +01:00
|
|
|
*cpp = ip_vs_schedule(svc, skb, pd, &ignored);
|
2010-11-19 14:25:10 +01:00
|
|
|
if (!*cpp && ignored <= 0) {
|
|
|
|
if (!ignored)
|
2011-01-03 14:44:51 +01:00
|
|
|
*verdict = ip_vs_leave(svc, skb, pd);
|
2010-11-19 14:25:10 +01:00
|
|
|
else {
|
|
|
|
ip_vs_service_put(svc);
|
|
|
|
*verdict = NF_DROP;
|
|
|
|
}
|
2005-04-17 00:20:36 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
ip_vs_service_put(svc);
|
|
|
|
}
|
2010-11-19 14:25:10 +01:00
|
|
|
/* NF_ACCEPT */
|
2005-04-17 00:20:36 +02:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static inline void
|
2008-09-02 15:55:42 +02:00
|
|
|
tcp_fast_csum_update(int af, struct tcphdr *tcph,
|
|
|
|
const union nf_inet_addr *oldip,
|
|
|
|
const union nf_inet_addr *newip,
|
2006-09-28 23:29:52 +02:00
|
|
|
__be16 oldport, __be16 newport)
|
2005-04-17 00:20:36 +02:00
|
|
|
{
|
2008-09-02 15:55:42 +02:00
|
|
|
#ifdef CONFIG_IP_VS_IPV6
|
|
|
|
if (af == AF_INET6)
|
|
|
|
tcph->check =
|
|
|
|
csum_fold(ip_vs_check_diff16(oldip->ip6, newip->ip6,
|
|
|
|
ip_vs_check_diff2(oldport, newport,
|
|
|
|
~csum_unfold(tcph->check))));
|
|
|
|
else
|
|
|
|
#endif
|
2005-04-17 00:20:36 +02:00
|
|
|
tcph->check =
|
2008-09-02 15:55:42 +02:00
|
|
|
csum_fold(ip_vs_check_diff4(oldip->ip, newip->ip,
|
2006-11-16 11:41:18 +01:00
|
|
|
ip_vs_check_diff2(oldport, newport,
|
|
|
|
~csum_unfold(tcph->check))));
|
2005-04-17 00:20:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-09-08 04:04:21 +02:00
|
|
|
static inline void
|
|
|
|
tcp_partial_csum_update(int af, struct tcphdr *tcph,
|
|
|
|
const union nf_inet_addr *oldip,
|
|
|
|
const union nf_inet_addr *newip,
|
|
|
|
__be16 oldlen, __be16 newlen)
|
|
|
|
{
|
|
|
|
#ifdef CONFIG_IP_VS_IPV6
|
|
|
|
if (af == AF_INET6)
|
|
|
|
tcph->check =
|
2010-10-17 15:14:31 +02:00
|
|
|
~csum_fold(ip_vs_check_diff16(oldip->ip6, newip->ip6,
|
2008-09-08 04:04:21 +02:00
|
|
|
ip_vs_check_diff2(oldlen, newlen,
|
2010-10-17 15:14:31 +02:00
|
|
|
csum_unfold(tcph->check))));
|
2008-09-08 04:04:21 +02:00
|
|
|
else
|
|
|
|
#endif
|
|
|
|
tcph->check =
|
2010-10-17 15:14:31 +02:00
|
|
|
~csum_fold(ip_vs_check_diff4(oldip->ip, newip->ip,
|
2008-09-08 04:04:21 +02:00
|
|
|
ip_vs_check_diff2(oldlen, newlen,
|
2010-10-17 15:14:31 +02:00
|
|
|
csum_unfold(tcph->check))));
|
2008-09-08 04:04:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-17 00:20:36 +02:00
|
|
|
static int
|
2007-10-15 09:53:15 +02:00
|
|
|
tcp_snat_handler(struct sk_buff *skb,
|
2005-04-17 00:20:36 +02:00
|
|
|
struct ip_vs_protocol *pp, struct ip_vs_conn *cp)
|
|
|
|
{
|
|
|
|
struct tcphdr *tcph;
|
2008-09-02 15:55:42 +02:00
|
|
|
unsigned int tcphoff;
|
2008-09-08 04:04:21 +02:00
|
|
|
int oldlen;
|
2010-10-17 15:17:20 +02:00
|
|
|
int payload_csum = 0;
|
2008-09-02 15:55:42 +02:00
|
|
|
|
|
|
|
#ifdef CONFIG_IP_VS_IPV6
|
|
|
|
if (cp->af == AF_INET6)
|
|
|
|
tcphoff = sizeof(struct ipv6hdr);
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
tcphoff = ip_hdrlen(skb);
|
2008-09-08 04:04:21 +02:00
|
|
|
oldlen = skb->len - tcphoff;
|
2005-04-17 00:20:36 +02:00
|
|
|
|
|
|
|
/* csum_check requires unshared skb */
|
2007-10-15 09:53:15 +02:00
|
|
|
if (!skb_make_writable(skb, tcphoff+sizeof(*tcph)))
|
2005-04-17 00:20:36 +02:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
if (unlikely(cp->app != NULL)) {
|
2010-10-17 15:17:20 +02:00
|
|
|
int ret;
|
|
|
|
|
2005-04-17 00:20:36 +02:00
|
|
|
/* Some checks before mangling */
|
2008-09-02 15:55:42 +02:00
|
|
|
if (pp->csum_check && !pp->csum_check(cp->af, skb, pp))
|
2005-04-17 00:20:36 +02:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
/* Call application helper if needed */
|
2010-10-17 15:17:20 +02:00
|
|
|
if (!(ret = ip_vs_app_pkt_out(cp, skb)))
|
2005-04-17 00:20:36 +02:00
|
|
|
return 0;
|
2010-10-17 15:17:20 +02:00
|
|
|
/* ret=2: csum update is needed after payload mangling */
|
|
|
|
if (ret == 1)
|
|
|
|
oldlen = skb->len - tcphoff;
|
|
|
|
else
|
|
|
|
payload_csum = 1;
|
2005-04-17 00:20:36 +02:00
|
|
|
}
|
|
|
|
|
2008-09-02 15:55:42 +02:00
|
|
|
tcph = (void *)skb_network_header(skb) + tcphoff;
|
2005-04-17 00:20:36 +02:00
|
|
|
tcph->source = cp->vport;
|
|
|
|
|
|
|
|
/* Adjust TCP checksums */
|
2008-09-08 04:04:21 +02:00
|
|
|
if (skb->ip_summed == CHECKSUM_PARTIAL) {
|
|
|
|
tcp_partial_csum_update(cp->af, tcph, &cp->daddr, &cp->vaddr,
|
2008-11-07 08:09:56 +01:00
|
|
|
htons(oldlen),
|
|
|
|
htons(skb->len - tcphoff));
|
2010-10-17 15:17:20 +02:00
|
|
|
} else if (!payload_csum) {
|
2005-04-17 00:20:36 +02:00
|
|
|
/* Only port and addr are changed, do fast csum update */
|
2008-09-02 15:55:42 +02:00
|
|
|
tcp_fast_csum_update(cp->af, tcph, &cp->daddr, &cp->vaddr,
|
2005-04-17 00:20:36 +02:00
|
|
|
cp->dport, cp->vport);
|
2007-10-15 09:53:15 +02:00
|
|
|
if (skb->ip_summed == CHECKSUM_COMPLETE)
|
2010-10-17 15:17:20 +02:00
|
|
|
skb->ip_summed = (cp->app && pp->csum_check) ?
|
|
|
|
CHECKSUM_UNNECESSARY : CHECKSUM_NONE;
|
2005-04-17 00:20:36 +02:00
|
|
|
} else {
|
|
|
|
/* full checksum calculation */
|
|
|
|
tcph->check = 0;
|
2007-10-15 09:53:15 +02:00
|
|
|
skb->csum = skb_checksum(skb, tcphoff, skb->len - tcphoff, 0);
|
2008-09-02 15:55:42 +02:00
|
|
|
#ifdef CONFIG_IP_VS_IPV6
|
|
|
|
if (cp->af == AF_INET6)
|
|
|
|
tcph->check = csum_ipv6_magic(&cp->vaddr.in6,
|
|
|
|
&cp->caddr.in6,
|
|
|
|
skb->len - tcphoff,
|
|
|
|
cp->protocol, skb->csum);
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
tcph->check = csum_tcpudp_magic(cp->vaddr.ip,
|
|
|
|
cp->caddr.ip,
|
|
|
|
skb->len - tcphoff,
|
|
|
|
cp->protocol,
|
|
|
|
skb->csum);
|
2010-10-17 15:17:20 +02:00
|
|
|
skb->ip_summed = CHECKSUM_UNNECESSARY;
|
2008-09-02 15:55:42 +02:00
|
|
|
|
2005-04-17 00:20:36 +02:00
|
|
|
IP_VS_DBG(11, "O-pkt: %s O-csum=%d (+%zd)\n",
|
|
|
|
pp->name, tcph->check,
|
|
|
|
(char*)&(tcph->check) - (char*)tcph);
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
2007-10-15 09:53:15 +02:00
|
|
|
tcp_dnat_handler(struct sk_buff *skb,
|
2005-04-17 00:20:36 +02:00
|
|
|
struct ip_vs_protocol *pp, struct ip_vs_conn *cp)
|
|
|
|
{
|
|
|
|
struct tcphdr *tcph;
|
2008-09-02 15:55:42 +02:00
|
|
|
unsigned int tcphoff;
|
2008-09-08 04:04:21 +02:00
|
|
|
int oldlen;
|
2010-10-17 15:17:20 +02:00
|
|
|
int payload_csum = 0;
|
2008-09-02 15:55:42 +02:00
|
|
|
|
|
|
|
#ifdef CONFIG_IP_VS_IPV6
|
|
|
|
if (cp->af == AF_INET6)
|
|
|
|
tcphoff = sizeof(struct ipv6hdr);
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
tcphoff = ip_hdrlen(skb);
|
2008-09-08 04:04:21 +02:00
|
|
|
oldlen = skb->len - tcphoff;
|
2005-04-17 00:20:36 +02:00
|
|
|
|
|
|
|
/* csum_check requires unshared skb */
|
2007-10-15 09:53:15 +02:00
|
|
|
if (!skb_make_writable(skb, tcphoff+sizeof(*tcph)))
|
2005-04-17 00:20:36 +02:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
if (unlikely(cp->app != NULL)) {
|
2010-10-17 15:17:20 +02:00
|
|
|
int ret;
|
|
|
|
|
2005-04-17 00:20:36 +02:00
|
|
|
/* Some checks before mangling */
|
2008-09-02 15:55:42 +02:00
|
|
|
if (pp->csum_check && !pp->csum_check(cp->af, skb, pp))
|
2005-04-17 00:20:36 +02:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Attempt ip_vs_app call.
|
|
|
|
* It will fix ip_vs_conn and iph ack_seq stuff
|
|
|
|
*/
|
2010-10-17 15:17:20 +02:00
|
|
|
if (!(ret = ip_vs_app_pkt_in(cp, skb)))
|
2005-04-17 00:20:36 +02:00
|
|
|
return 0;
|
2010-10-17 15:17:20 +02:00
|
|
|
/* ret=2: csum update is needed after payload mangling */
|
|
|
|
if (ret == 1)
|
|
|
|
oldlen = skb->len - tcphoff;
|
|
|
|
else
|
|
|
|
payload_csum = 1;
|
2005-04-17 00:20:36 +02:00
|
|
|
}
|
|
|
|
|
2008-09-02 15:55:42 +02:00
|
|
|
tcph = (void *)skb_network_header(skb) + tcphoff;
|
2005-04-17 00:20:36 +02:00
|
|
|
tcph->dest = cp->dport;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Adjust TCP checksums
|
|
|
|
*/
|
2008-09-08 04:04:21 +02:00
|
|
|
if (skb->ip_summed == CHECKSUM_PARTIAL) {
|
2010-10-17 15:14:31 +02:00
|
|
|
tcp_partial_csum_update(cp->af, tcph, &cp->vaddr, &cp->daddr,
|
2008-11-07 08:09:56 +01:00
|
|
|
htons(oldlen),
|
|
|
|
htons(skb->len - tcphoff));
|
2010-10-17 15:17:20 +02:00
|
|
|
} else if (!payload_csum) {
|
2005-04-17 00:20:36 +02:00
|
|
|
/* Only port and addr are changed, do fast csum update */
|
2008-09-02 15:55:42 +02:00
|
|
|
tcp_fast_csum_update(cp->af, tcph, &cp->vaddr, &cp->daddr,
|
2005-04-17 00:20:36 +02:00
|
|
|
cp->vport, cp->dport);
|
2007-10-15 09:53:15 +02:00
|
|
|
if (skb->ip_summed == CHECKSUM_COMPLETE)
|
2010-10-17 15:17:20 +02:00
|
|
|
skb->ip_summed = (cp->app && pp->csum_check) ?
|
|
|
|
CHECKSUM_UNNECESSARY : CHECKSUM_NONE;
|
2005-04-17 00:20:36 +02:00
|
|
|
} else {
|
|
|
|
/* full checksum calculation */
|
|
|
|
tcph->check = 0;
|
2007-10-15 09:53:15 +02:00
|
|
|
skb->csum = skb_checksum(skb, tcphoff, skb->len - tcphoff, 0);
|
2008-09-02 15:55:42 +02:00
|
|
|
#ifdef CONFIG_IP_VS_IPV6
|
|
|
|
if (cp->af == AF_INET6)
|
|
|
|
tcph->check = csum_ipv6_magic(&cp->caddr.in6,
|
|
|
|
&cp->daddr.in6,
|
|
|
|
skb->len - tcphoff,
|
|
|
|
cp->protocol, skb->csum);
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
tcph->check = csum_tcpudp_magic(cp->caddr.ip,
|
|
|
|
cp->daddr.ip,
|
|
|
|
skb->len - tcphoff,
|
|
|
|
cp->protocol,
|
|
|
|
skb->csum);
|
2007-10-15 09:53:15 +02:00
|
|
|
skb->ip_summed = CHECKSUM_UNNECESSARY;
|
2005-04-17 00:20:36 +02:00
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
2008-09-02 15:55:40 +02:00
|
|
|
tcp_csum_check(int af, struct sk_buff *skb, struct ip_vs_protocol *pp)
|
2005-04-17 00:20:36 +02:00
|
|
|
{
|
2008-09-02 15:55:40 +02:00
|
|
|
unsigned int tcphoff;
|
|
|
|
|
|
|
|
#ifdef CONFIG_IP_VS_IPV6
|
|
|
|
if (af == AF_INET6)
|
|
|
|
tcphoff = sizeof(struct ipv6hdr);
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
tcphoff = ip_hdrlen(skb);
|
2005-04-17 00:20:36 +02:00
|
|
|
|
|
|
|
switch (skb->ip_summed) {
|
|
|
|
case CHECKSUM_NONE:
|
|
|
|
skb->csum = skb_checksum(skb, tcphoff, skb->len - tcphoff, 0);
|
2006-08-30 01:44:56 +02:00
|
|
|
case CHECKSUM_COMPLETE:
|
2008-09-02 15:55:40 +02:00
|
|
|
#ifdef CONFIG_IP_VS_IPV6
|
|
|
|
if (af == AF_INET6) {
|
|
|
|
if (csum_ipv6_magic(&ipv6_hdr(skb)->saddr,
|
|
|
|
&ipv6_hdr(skb)->daddr,
|
|
|
|
skb->len - tcphoff,
|
|
|
|
ipv6_hdr(skb)->nexthdr,
|
|
|
|
skb->csum)) {
|
2010-10-17 15:46:17 +02:00
|
|
|
IP_VS_DBG_RL_PKT(0, af, pp, skb, 0,
|
2008-09-02 15:55:40 +02:00
|
|
|
"Failed checksum for");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
} else
|
|
|
|
#endif
|
|
|
|
if (csum_tcpudp_magic(ip_hdr(skb)->saddr,
|
|
|
|
ip_hdr(skb)->daddr,
|
|
|
|
skb->len - tcphoff,
|
|
|
|
ip_hdr(skb)->protocol,
|
|
|
|
skb->csum)) {
|
2010-10-17 15:46:17 +02:00
|
|
|
IP_VS_DBG_RL_PKT(0, af, pp, skb, 0,
|
2008-09-02 15:55:40 +02:00
|
|
|
"Failed checksum for");
|
|
|
|
return 0;
|
|
|
|
}
|
2005-04-17 00:20:36 +02:00
|
|
|
break;
|
|
|
|
default:
|
2006-08-30 01:44:56 +02:00
|
|
|
/* No need to checksum. */
|
2005-04-17 00:20:36 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#define TCP_DIR_INPUT 0
|
|
|
|
#define TCP_DIR_OUTPUT 4
|
|
|
|
#define TCP_DIR_INPUT_ONLY 8
|
|
|
|
|
2005-11-30 01:21:38 +01:00
|
|
|
static const int tcp_state_off[IP_VS_DIR_LAST] = {
|
2005-04-17 00:20:36 +02:00
|
|
|
[IP_VS_DIR_INPUT] = TCP_DIR_INPUT,
|
|
|
|
[IP_VS_DIR_OUTPUT] = TCP_DIR_OUTPUT,
|
|
|
|
[IP_VS_DIR_INPUT_ONLY] = TCP_DIR_INPUT_ONLY,
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Timeout table[state]
|
|
|
|
*/
|
2011-01-03 14:44:47 +01:00
|
|
|
static const int tcp_timeouts[IP_VS_TCP_S_LAST+1] = {
|
2005-04-17 00:20:36 +02:00
|
|
|
[IP_VS_TCP_S_NONE] = 2*HZ,
|
|
|
|
[IP_VS_TCP_S_ESTABLISHED] = 15*60*HZ,
|
|
|
|
[IP_VS_TCP_S_SYN_SENT] = 2*60*HZ,
|
|
|
|
[IP_VS_TCP_S_SYN_RECV] = 1*60*HZ,
|
|
|
|
[IP_VS_TCP_S_FIN_WAIT] = 2*60*HZ,
|
|
|
|
[IP_VS_TCP_S_TIME_WAIT] = 2*60*HZ,
|
|
|
|
[IP_VS_TCP_S_CLOSE] = 10*HZ,
|
|
|
|
[IP_VS_TCP_S_CLOSE_WAIT] = 60*HZ,
|
|
|
|
[IP_VS_TCP_S_LAST_ACK] = 30*HZ,
|
|
|
|
[IP_VS_TCP_S_LISTEN] = 2*60*HZ,
|
|
|
|
[IP_VS_TCP_S_SYNACK] = 120*HZ,
|
|
|
|
[IP_VS_TCP_S_LAST] = 2*HZ,
|
|
|
|
};
|
|
|
|
|
2009-08-05 19:42:58 +02:00
|
|
|
static const char *const tcp_state_name_table[IP_VS_TCP_S_LAST+1] = {
|
2005-04-17 00:20:36 +02:00
|
|
|
[IP_VS_TCP_S_NONE] = "NONE",
|
|
|
|
[IP_VS_TCP_S_ESTABLISHED] = "ESTABLISHED",
|
|
|
|
[IP_VS_TCP_S_SYN_SENT] = "SYN_SENT",
|
|
|
|
[IP_VS_TCP_S_SYN_RECV] = "SYN_RECV",
|
|
|
|
[IP_VS_TCP_S_FIN_WAIT] = "FIN_WAIT",
|
|
|
|
[IP_VS_TCP_S_TIME_WAIT] = "TIME_WAIT",
|
|
|
|
[IP_VS_TCP_S_CLOSE] = "CLOSE",
|
|
|
|
[IP_VS_TCP_S_CLOSE_WAIT] = "CLOSE_WAIT",
|
|
|
|
[IP_VS_TCP_S_LAST_ACK] = "LAST_ACK",
|
|
|
|
[IP_VS_TCP_S_LISTEN] = "LISTEN",
|
|
|
|
[IP_VS_TCP_S_SYNACK] = "SYNACK",
|
|
|
|
[IP_VS_TCP_S_LAST] = "BUG!",
|
|
|
|
};
|
|
|
|
|
|
|
|
#define sNO IP_VS_TCP_S_NONE
|
|
|
|
#define sES IP_VS_TCP_S_ESTABLISHED
|
|
|
|
#define sSS IP_VS_TCP_S_SYN_SENT
|
|
|
|
#define sSR IP_VS_TCP_S_SYN_RECV
|
|
|
|
#define sFW IP_VS_TCP_S_FIN_WAIT
|
|
|
|
#define sTW IP_VS_TCP_S_TIME_WAIT
|
|
|
|
#define sCL IP_VS_TCP_S_CLOSE
|
|
|
|
#define sCW IP_VS_TCP_S_CLOSE_WAIT
|
|
|
|
#define sLA IP_VS_TCP_S_LAST_ACK
|
|
|
|
#define sLI IP_VS_TCP_S_LISTEN
|
|
|
|
#define sSA IP_VS_TCP_S_SYNACK
|
|
|
|
|
|
|
|
struct tcp_states_t {
|
|
|
|
int next_state[IP_VS_TCP_S_LAST];
|
|
|
|
};
|
|
|
|
|
|
|
|
static const char * tcp_state_name(int state)
|
|
|
|
{
|
|
|
|
if (state >= IP_VS_TCP_S_LAST)
|
|
|
|
return "ERR!";
|
|
|
|
return tcp_state_name_table[state] ? tcp_state_name_table[state] : "?";
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct tcp_states_t tcp_states [] = {
|
|
|
|
/* INPUT */
|
|
|
|
/* sNO, sES, sSS, sSR, sFW, sTW, sCL, sCW, sLA, sLI, sSA */
|
|
|
|
/*syn*/ {{sSR, sES, sES, sSR, sSR, sSR, sSR, sSR, sSR, sSR, sSR }},
|
|
|
|
/*fin*/ {{sCL, sCW, sSS, sTW, sTW, sTW, sCL, sCW, sLA, sLI, sTW }},
|
|
|
|
/*ack*/ {{sCL, sES, sSS, sES, sFW, sTW, sCL, sCW, sCL, sLI, sES }},
|
|
|
|
/*rst*/ {{sCL, sCL, sCL, sSR, sCL, sCL, sCL, sCL, sLA, sLI, sSR }},
|
|
|
|
|
|
|
|
/* OUTPUT */
|
|
|
|
/* sNO, sES, sSS, sSR, sFW, sTW, sCL, sCW, sLA, sLI, sSA */
|
|
|
|
/*syn*/ {{sSS, sES, sSS, sSR, sSS, sSS, sSS, sSS, sSS, sLI, sSR }},
|
|
|
|
/*fin*/ {{sTW, sFW, sSS, sTW, sFW, sTW, sCL, sTW, sLA, sLI, sTW }},
|
|
|
|
/*ack*/ {{sES, sES, sSS, sES, sFW, sTW, sCL, sCW, sLA, sES, sES }},
|
|
|
|
/*rst*/ {{sCL, sCL, sSS, sCL, sCL, sTW, sCL, sCL, sCL, sCL, sCL }},
|
|
|
|
|
|
|
|
/* INPUT-ONLY */
|
|
|
|
/* sNO, sES, sSS, sSR, sFW, sTW, sCL, sCW, sLA, sLI, sSA */
|
|
|
|
/*syn*/ {{sSR, sES, sES, sSR, sSR, sSR, sSR, sSR, sSR, sSR, sSR }},
|
|
|
|
/*fin*/ {{sCL, sFW, sSS, sTW, sFW, sTW, sCL, sCW, sLA, sLI, sTW }},
|
|
|
|
/*ack*/ {{sCL, sES, sSS, sES, sFW, sTW, sCL, sCW, sCL, sLI, sES }},
|
|
|
|
/*rst*/ {{sCL, sCL, sCL, sSR, sCL, sCL, sCL, sCL, sLA, sLI, sCL }},
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct tcp_states_t tcp_states_dos [] = {
|
|
|
|
/* INPUT */
|
|
|
|
/* sNO, sES, sSS, sSR, sFW, sTW, sCL, sCW, sLA, sLI, sSA */
|
|
|
|
/*syn*/ {{sSR, sES, sES, sSR, sSR, sSR, sSR, sSR, sSR, sSR, sSA }},
|
|
|
|
/*fin*/ {{sCL, sCW, sSS, sTW, sTW, sTW, sCL, sCW, sLA, sLI, sSA }},
|
|
|
|
/*ack*/ {{sCL, sES, sSS, sSR, sFW, sTW, sCL, sCW, sCL, sLI, sSA }},
|
|
|
|
/*rst*/ {{sCL, sCL, sCL, sSR, sCL, sCL, sCL, sCL, sLA, sLI, sCL }},
|
|
|
|
|
|
|
|
/* OUTPUT */
|
|
|
|
/* sNO, sES, sSS, sSR, sFW, sTW, sCL, sCW, sLA, sLI, sSA */
|
|
|
|
/*syn*/ {{sSS, sES, sSS, sSA, sSS, sSS, sSS, sSS, sSS, sLI, sSA }},
|
|
|
|
/*fin*/ {{sTW, sFW, sSS, sTW, sFW, sTW, sCL, sTW, sLA, sLI, sTW }},
|
|
|
|
/*ack*/ {{sES, sES, sSS, sES, sFW, sTW, sCL, sCW, sLA, sES, sES }},
|
|
|
|
/*rst*/ {{sCL, sCL, sSS, sCL, sCL, sTW, sCL, sCL, sCL, sCL, sCL }},
|
|
|
|
|
|
|
|
/* INPUT-ONLY */
|
|
|
|
/* sNO, sES, sSS, sSR, sFW, sTW, sCL, sCW, sLA, sLI, sSA */
|
|
|
|
/*syn*/ {{sSA, sES, sES, sSR, sSA, sSA, sSA, sSA, sSA, sSA, sSA }},
|
|
|
|
/*fin*/ {{sCL, sFW, sSS, sTW, sFW, sTW, sCL, sCW, sLA, sLI, sTW }},
|
|
|
|
/*ack*/ {{sCL, sES, sSS, sES, sFW, sTW, sCL, sCW, sCL, sLI, sES }},
|
|
|
|
/*rst*/ {{sCL, sCL, sCL, sSR, sCL, sCL, sCL, sCL, sLA, sLI, sCL }},
|
|
|
|
};
|
|
|
|
|
2011-01-03 14:44:51 +01:00
|
|
|
static void tcp_timeout_change(struct ip_vs_proto_data *pd, int flags)
|
2005-04-17 00:20:36 +02:00
|
|
|
{
|
|
|
|
int on = (flags & 1); /* secure_tcp */
|
|
|
|
|
|
|
|
/*
|
|
|
|
** FIXME: change secure_tcp to independent sysctl var
|
|
|
|
** or make it per-service or per-app because it is valid
|
|
|
|
** for most if not for all of the applications. Something
|
|
|
|
** like "capabilities" (flags) for each object.
|
|
|
|
*/
|
2011-01-03 14:44:51 +01:00
|
|
|
pd->tcp_state_table = (on ? tcp_states_dos : tcp_states);
|
2005-04-17 00:20:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline int tcp_state_idx(struct tcphdr *th)
|
|
|
|
{
|
|
|
|
if (th->rst)
|
|
|
|
return 3;
|
|
|
|
if (th->syn)
|
|
|
|
return 0;
|
|
|
|
if (th->fin)
|
|
|
|
return 1;
|
|
|
|
if (th->ack)
|
|
|
|
return 2;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
2011-01-03 14:44:51 +01:00
|
|
|
set_tcp_state(struct ip_vs_proto_data *pd, struct ip_vs_conn *cp,
|
2005-04-17 00:20:36 +02:00
|
|
|
int direction, struct tcphdr *th)
|
|
|
|
{
|
|
|
|
int state_idx;
|
|
|
|
int new_state = IP_VS_TCP_S_CLOSE;
|
|
|
|
int state_off = tcp_state_off[direction];
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Update state offset to INPUT_ONLY if necessary
|
|
|
|
* or delete NO_OUTPUT flag if output packet detected
|
|
|
|
*/
|
|
|
|
if (cp->flags & IP_VS_CONN_F_NOOUTPUT) {
|
|
|
|
if (state_off == TCP_DIR_OUTPUT)
|
|
|
|
cp->flags &= ~IP_VS_CONN_F_NOOUTPUT;
|
|
|
|
else
|
|
|
|
state_off = TCP_DIR_INPUT_ONLY;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((state_idx = tcp_state_idx(th)) < 0) {
|
|
|
|
IP_VS_DBG(8, "tcp_state_idx=%d!!!\n", state_idx);
|
|
|
|
goto tcp_state_out;
|
|
|
|
}
|
|
|
|
|
2011-01-03 14:44:51 +01:00
|
|
|
new_state =
|
|
|
|
pd->tcp_state_table[state_off+state_idx].next_state[cp->state];
|
2005-04-17 00:20:36 +02:00
|
|
|
|
|
|
|
tcp_state_out:
|
|
|
|
if (new_state != cp->state) {
|
|
|
|
struct ip_vs_dest *dest = cp->dest;
|
|
|
|
|
2008-09-02 15:55:53 +02:00
|
|
|
IP_VS_DBG_BUF(8, "%s %s [%c%c%c%c] %s:%d->"
|
|
|
|
"%s:%d state: %s->%s conn->refcnt:%d\n",
|
2011-01-03 14:44:51 +01:00
|
|
|
pd->pp->name,
|
2008-09-02 15:55:53 +02:00
|
|
|
((state_off == TCP_DIR_OUTPUT) ?
|
|
|
|
"output " : "input "),
|
|
|
|
th->syn ? 'S' : '.',
|
|
|
|
th->fin ? 'F' : '.',
|
|
|
|
th->ack ? 'A' : '.',
|
|
|
|
th->rst ? 'R' : '.',
|
|
|
|
IP_VS_DBG_ADDR(cp->af, &cp->daddr),
|
|
|
|
ntohs(cp->dport),
|
|
|
|
IP_VS_DBG_ADDR(cp->af, &cp->caddr),
|
|
|
|
ntohs(cp->cport),
|
|
|
|
tcp_state_name(cp->state),
|
|
|
|
tcp_state_name(new_state),
|
|
|
|
atomic_read(&cp->refcnt));
|
|
|
|
|
2005-04-17 00:20:36 +02:00
|
|
|
if (dest) {
|
|
|
|
if (!(cp->flags & IP_VS_CONN_F_INACTIVE) &&
|
|
|
|
(new_state != IP_VS_TCP_S_ESTABLISHED)) {
|
|
|
|
atomic_dec(&dest->activeconns);
|
|
|
|
atomic_inc(&dest->inactconns);
|
|
|
|
cp->flags |= IP_VS_CONN_F_INACTIVE;
|
|
|
|
} else if ((cp->flags & IP_VS_CONN_F_INACTIVE) &&
|
|
|
|
(new_state == IP_VS_TCP_S_ESTABLISHED)) {
|
|
|
|
atomic_inc(&dest->activeconns);
|
|
|
|
atomic_dec(&dest->inactconns);
|
|
|
|
cp->flags &= ~IP_VS_CONN_F_INACTIVE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-01-03 14:44:47 +01:00
|
|
|
if (likely(pd))
|
|
|
|
cp->timeout = pd->timeout_table[cp->state = new_state];
|
|
|
|
else /* What to do ? */
|
|
|
|
cp->timeout = tcp_timeouts[cp->state = new_state];
|
2005-04-17 00:20:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Handle state transitions
|
|
|
|
*/
|
2011-09-16 07:11:49 +02:00
|
|
|
static void
|
2005-04-17 00:20:36 +02:00
|
|
|
tcp_state_transition(struct ip_vs_conn *cp, int direction,
|
|
|
|
const struct sk_buff *skb,
|
2011-01-03 14:44:51 +01:00
|
|
|
struct ip_vs_proto_data *pd)
|
2005-04-17 00:20:36 +02:00
|
|
|
{
|
|
|
|
struct tcphdr _tcph, *th;
|
|
|
|
|
2008-09-02 15:55:42 +02:00
|
|
|
#ifdef CONFIG_IP_VS_IPV6
|
|
|
|
int ihl = cp->af == AF_INET ? ip_hdrlen(skb) : sizeof(struct ipv6hdr);
|
|
|
|
#else
|
|
|
|
int ihl = ip_hdrlen(skb);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
th = skb_header_pointer(skb, ihl, sizeof(_tcph), &_tcph);
|
2005-04-17 00:20:36 +02:00
|
|
|
if (th == NULL)
|
2011-09-16 07:11:49 +02:00
|
|
|
return;
|
2005-04-17 00:20:36 +02:00
|
|
|
|
|
|
|
spin_lock(&cp->lock);
|
2011-01-03 14:44:51 +01:00
|
|
|
set_tcp_state(pd, cp, direction, th);
|
2005-04-17 00:20:36 +02:00
|
|
|
spin_unlock(&cp->lock);
|
|
|
|
}
|
|
|
|
|
2006-11-15 06:13:28 +01:00
|
|
|
static inline __u16 tcp_app_hashkey(__be16 port)
|
2005-04-17 00:20:36 +02:00
|
|
|
{
|
2006-11-15 06:13:28 +01:00
|
|
|
return (((__force u16)port >> TCP_APP_TAB_BITS) ^ (__force u16)port)
|
|
|
|
& TCP_APP_TAB_MASK;
|
2005-04-17 00:20:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-01-03 14:44:53 +01:00
|
|
|
static int tcp_register_app(struct net *net, struct ip_vs_app *inc)
|
2005-04-17 00:20:36 +02:00
|
|
|
{
|
|
|
|
struct ip_vs_app *i;
|
2006-11-15 06:13:28 +01:00
|
|
|
__u16 hash;
|
|
|
|
__be16 port = inc->port;
|
2005-04-17 00:20:36 +02:00
|
|
|
int ret = 0;
|
2011-01-03 14:44:53 +01:00
|
|
|
struct netns_ipvs *ipvs = net_ipvs(net);
|
|
|
|
struct ip_vs_proto_data *pd = ip_vs_proto_data_get(net, IPPROTO_TCP);
|
2005-04-17 00:20:36 +02:00
|
|
|
|
|
|
|
hash = tcp_app_hashkey(port);
|
|
|
|
|
2011-01-03 14:44:47 +01:00
|
|
|
spin_lock_bh(&ipvs->tcp_app_lock);
|
|
|
|
list_for_each_entry(i, &ipvs->tcp_apps[hash], p_list) {
|
2005-04-17 00:20:36 +02:00
|
|
|
if (i->port == port) {
|
|
|
|
ret = -EEXIST;
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
}
|
2011-01-03 14:44:47 +01:00
|
|
|
list_add(&inc->p_list, &ipvs->tcp_apps[hash]);
|
2011-01-03 14:44:52 +01:00
|
|
|
atomic_inc(&pd->appcnt);
|
2005-04-17 00:20:36 +02:00
|
|
|
|
|
|
|
out:
|
2011-01-03 14:44:47 +01:00
|
|
|
spin_unlock_bh(&ipvs->tcp_app_lock);
|
2005-04-17 00:20:36 +02:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
2011-01-03 14:44:53 +01:00
|
|
|
tcp_unregister_app(struct net *net, struct ip_vs_app *inc)
|
2005-04-17 00:20:36 +02:00
|
|
|
{
|
2011-01-03 14:44:53 +01:00
|
|
|
struct netns_ipvs *ipvs = net_ipvs(net);
|
|
|
|
struct ip_vs_proto_data *pd = ip_vs_proto_data_get(net, IPPROTO_TCP);
|
2011-01-03 14:44:47 +01:00
|
|
|
|
|
|
|
spin_lock_bh(&ipvs->tcp_app_lock);
|
2011-01-03 14:44:52 +01:00
|
|
|
atomic_dec(&pd->appcnt);
|
2005-04-17 00:20:36 +02:00
|
|
|
list_del(&inc->p_list);
|
2011-01-03 14:44:47 +01:00
|
|
|
spin_unlock_bh(&ipvs->tcp_app_lock);
|
2005-04-17 00:20:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
tcp_app_conn_bind(struct ip_vs_conn *cp)
|
|
|
|
{
|
2011-01-03 14:44:57 +01:00
|
|
|
struct netns_ipvs *ipvs = net_ipvs(ip_vs_conn_net(cp));
|
2005-04-17 00:20:36 +02:00
|
|
|
int hash;
|
|
|
|
struct ip_vs_app *inc;
|
|
|
|
int result = 0;
|
|
|
|
|
|
|
|
/* Default binding: bind app only for NAT */
|
|
|
|
if (IP_VS_FWD_METHOD(cp) != IP_VS_CONN_F_MASQ)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
/* Lookup application incarnations and bind the right one */
|
|
|
|
hash = tcp_app_hashkey(cp->vport);
|
|
|
|
|
2011-01-03 14:44:47 +01:00
|
|
|
spin_lock(&ipvs->tcp_app_lock);
|
|
|
|
list_for_each_entry(inc, &ipvs->tcp_apps[hash], p_list) {
|
2005-04-17 00:20:36 +02:00
|
|
|
if (inc->port == cp->vport) {
|
|
|
|
if (unlikely(!ip_vs_app_inc_get(inc)))
|
|
|
|
break;
|
2011-01-03 14:44:47 +01:00
|
|
|
spin_unlock(&ipvs->tcp_app_lock);
|
2005-04-17 00:20:36 +02:00
|
|
|
|
2009-08-02 13:05:41 +02:00
|
|
|
IP_VS_DBG_BUF(9, "%s(): Binding conn %s:%u->"
|
2008-09-02 15:55:53 +02:00
|
|
|
"%s:%u to app %s on port %u\n",
|
|
|
|
__func__,
|
|
|
|
IP_VS_DBG_ADDR(cp->af, &cp->caddr),
|
|
|
|
ntohs(cp->cport),
|
|
|
|
IP_VS_DBG_ADDR(cp->af, &cp->vaddr),
|
|
|
|
ntohs(cp->vport),
|
|
|
|
inc->name, ntohs(inc->port));
|
|
|
|
|
2005-04-17 00:20:36 +02:00
|
|
|
cp->app = inc;
|
|
|
|
if (inc->init_conn)
|
|
|
|
result = inc->init_conn(inc, cp);
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
}
|
2011-01-03 14:44:47 +01:00
|
|
|
spin_unlock(&ipvs->tcp_app_lock);
|
2005-04-17 00:20:36 +02:00
|
|
|
|
|
|
|
out:
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Set LISTEN timeout. (ip_vs_conn_put will setup timer)
|
|
|
|
*/
|
2011-01-03 14:44:47 +01:00
|
|
|
void ip_vs_tcp_conn_listen(struct net *net, struct ip_vs_conn *cp)
|
2005-04-17 00:20:36 +02:00
|
|
|
{
|
2011-01-03 14:44:47 +01:00
|
|
|
struct ip_vs_proto_data *pd = ip_vs_proto_data_get(net, IPPROTO_TCP);
|
|
|
|
|
2005-04-17 00:20:36 +02:00
|
|
|
spin_lock(&cp->lock);
|
|
|
|
cp->state = IP_VS_TCP_S_LISTEN;
|
2011-01-03 14:44:47 +01:00
|
|
|
cp->timeout = (pd ? pd->timeout_table[IP_VS_TCP_S_LISTEN]
|
|
|
|
: tcp_timeouts[IP_VS_TCP_S_LISTEN]);
|
2005-04-17 00:20:36 +02:00
|
|
|
spin_unlock(&cp->lock);
|
|
|
|
}
|
|
|
|
|
2011-01-03 14:44:47 +01:00
|
|
|
/* ---------------------------------------------
|
|
|
|
* timeouts is netns related now.
|
|
|
|
* ---------------------------------------------
|
|
|
|
*/
|
2012-04-26 09:45:35 +02:00
|
|
|
static int __ip_vs_tcp_init(struct net *net, struct ip_vs_proto_data *pd)
|
2005-04-17 00:20:36 +02:00
|
|
|
{
|
2011-01-03 14:44:47 +01:00
|
|
|
struct netns_ipvs *ipvs = net_ipvs(net);
|
2005-04-17 00:20:36 +02:00
|
|
|
|
2011-01-03 14:44:47 +01:00
|
|
|
ip_vs_init_hash_table(ipvs->tcp_apps, TCP_APP_TAB_SIZE);
|
|
|
|
spin_lock_init(&ipvs->tcp_app_lock);
|
|
|
|
pd->timeout_table = ip_vs_create_timeout_table((int *)tcp_timeouts,
|
|
|
|
sizeof(tcp_timeouts));
|
2012-04-26 09:45:35 +02:00
|
|
|
if (!pd->timeout_table)
|
|
|
|
return -ENOMEM;
|
2011-01-03 14:44:51 +01:00
|
|
|
pd->tcp_state_table = tcp_states;
|
2012-04-26 09:45:35 +02:00
|
|
|
return 0;
|
2011-01-03 14:44:47 +01:00
|
|
|
}
|
2005-04-17 00:20:36 +02:00
|
|
|
|
2011-01-03 14:44:47 +01:00
|
|
|
static void __ip_vs_tcp_exit(struct net *net, struct ip_vs_proto_data *pd)
|
2005-04-17 00:20:36 +02:00
|
|
|
{
|
2011-01-03 14:44:47 +01:00
|
|
|
kfree(pd->timeout_table);
|
2005-04-17 00:20:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
struct ip_vs_protocol ip_vs_protocol_tcp = {
|
|
|
|
.name = "TCP",
|
|
|
|
.protocol = IPPROTO_TCP,
|
2008-04-29 12:21:23 +02:00
|
|
|
.num_states = IP_VS_TCP_S_LAST,
|
2005-04-17 00:20:36 +02:00
|
|
|
.dont_defrag = 0,
|
2011-01-03 14:44:47 +01:00
|
|
|
.init = NULL,
|
|
|
|
.exit = NULL,
|
|
|
|
.init_netns = __ip_vs_tcp_init,
|
|
|
|
.exit_netns = __ip_vs_tcp_exit,
|
2005-04-17 00:20:36 +02:00
|
|
|
.register_app = tcp_register_app,
|
|
|
|
.unregister_app = tcp_unregister_app,
|
|
|
|
.conn_schedule = tcp_conn_schedule,
|
2010-08-02 17:12:44 +02:00
|
|
|
.conn_in_get = ip_vs_conn_in_get_proto,
|
|
|
|
.conn_out_get = ip_vs_conn_out_get_proto,
|
2005-04-17 00:20:36 +02:00
|
|
|
.snat_handler = tcp_snat_handler,
|
|
|
|
.dnat_handler = tcp_dnat_handler,
|
|
|
|
.csum_check = tcp_csum_check,
|
|
|
|
.state_name = tcp_state_name,
|
|
|
|
.state_transition = tcp_state_transition,
|
|
|
|
.app_conn_bind = tcp_app_conn_bind,
|
|
|
|
.debug_packet = ip_vs_tcpudp_debug_packet,
|
|
|
|
.timeout_change = tcp_timeout_change,
|
|
|
|
};
|