Merge branch 'davem-next' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik...
[deliverable/linux.git] / net / ipv4 / ipvs / ip_vs_proto_tcp.c
1 /*
2 * ip_vs_proto_tcp.c: TCP load balancing support for IPVS
3 *
4 * Authors: Wensong Zhang <wensong@linuxvirtualserver.org>
5 * Julian Anastasov <ja@ssi.bg>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version.
11 *
12 * Changes:
13 *
14 */
15
16 #include <linux/kernel.h>
17 #include <linux/ip.h>
18 #include <linux/tcp.h> /* for tcphdr */
19 #include <net/ip.h>
20 #include <net/tcp.h> /* for csum_tcpudp_magic */
21 #include <linux/netfilter.h>
22 #include <linux/netfilter_ipv4.h>
23
24 #include <net/ip_vs.h>
25
26
27 static struct ip_vs_conn *
28 tcp_conn_in_get(const struct sk_buff *skb, struct ip_vs_protocol *pp,
29 const struct iphdr *iph, unsigned int proto_off, int inverse)
30 {
31 __be16 _ports[2], *pptr;
32
33 pptr = skb_header_pointer(skb, proto_off, sizeof(_ports), _ports);
34 if (pptr == NULL)
35 return NULL;
36
37 if (likely(!inverse)) {
38 return ip_vs_conn_in_get(iph->protocol,
39 iph->saddr, pptr[0],
40 iph->daddr, pptr[1]);
41 } else {
42 return ip_vs_conn_in_get(iph->protocol,
43 iph->daddr, pptr[1],
44 iph->saddr, pptr[0]);
45 }
46 }
47
48 static struct ip_vs_conn *
49 tcp_conn_out_get(const struct sk_buff *skb, struct ip_vs_protocol *pp,
50 const struct iphdr *iph, unsigned int proto_off, int inverse)
51 {
52 __be16 _ports[2], *pptr;
53
54 pptr = skb_header_pointer(skb, proto_off, sizeof(_ports), _ports);
55 if (pptr == NULL)
56 return NULL;
57
58 if (likely(!inverse)) {
59 return ip_vs_conn_out_get(iph->protocol,
60 iph->saddr, pptr[0],
61 iph->daddr, pptr[1]);
62 } else {
63 return ip_vs_conn_out_get(iph->protocol,
64 iph->daddr, pptr[1],
65 iph->saddr, pptr[0]);
66 }
67 }
68
69
70 static int
71 tcp_conn_schedule(struct sk_buff *skb,
72 struct ip_vs_protocol *pp,
73 int *verdict, struct ip_vs_conn **cpp)
74 {
75 struct ip_vs_service *svc;
76 struct tcphdr _tcph, *th;
77
78 th = skb_header_pointer(skb, ip_hdrlen(skb), sizeof(_tcph), &_tcph);
79 if (th == NULL) {
80 *verdict = NF_DROP;
81 return 0;
82 }
83
84 if (th->syn &&
85 (svc = ip_vs_service_get(skb->mark, ip_hdr(skb)->protocol,
86 ip_hdr(skb)->daddr, th->dest))) {
87 if (ip_vs_todrop()) {
88 /*
89 * It seems that we are very loaded.
90 * We have to drop this packet :(
91 */
92 ip_vs_service_put(svc);
93 *verdict = NF_DROP;
94 return 0;
95 }
96
97 /*
98 * Let the virtual server select a real server for the
99 * incoming connection, and create a connection entry.
100 */
101 *cpp = ip_vs_schedule(svc, skb);
102 if (!*cpp) {
103 *verdict = ip_vs_leave(svc, skb, pp);
104 return 0;
105 }
106 ip_vs_service_put(svc);
107 }
108 return 1;
109 }
110
111
112 static inline void
113 tcp_fast_csum_update(struct tcphdr *tcph, __be32 oldip, __be32 newip,
114 __be16 oldport, __be16 newport)
115 {
116 tcph->check =
117 csum_fold(ip_vs_check_diff4(oldip, newip,
118 ip_vs_check_diff2(oldport, newport,
119 ~csum_unfold(tcph->check))));
120 }
121
122
123 static int
124 tcp_snat_handler(struct sk_buff *skb,
125 struct ip_vs_protocol *pp, struct ip_vs_conn *cp)
126 {
127 struct tcphdr *tcph;
128 const unsigned int tcphoff = ip_hdrlen(skb);
129
130 /* csum_check requires unshared skb */
131 if (!skb_make_writable(skb, tcphoff+sizeof(*tcph)))
132 return 0;
133
134 if (unlikely(cp->app != NULL)) {
135 /* Some checks before mangling */
136 if (pp->csum_check && !pp->csum_check(skb, pp))
137 return 0;
138
139 /* Call application helper if needed */
140 if (!ip_vs_app_pkt_out(cp, skb))
141 return 0;
142 }
143
144 tcph = (void *)ip_hdr(skb) + tcphoff;
145 tcph->source = cp->vport;
146
147 /* Adjust TCP checksums */
148 if (!cp->app) {
149 /* Only port and addr are changed, do fast csum update */
150 tcp_fast_csum_update(tcph, cp->daddr, cp->vaddr,
151 cp->dport, cp->vport);
152 if (skb->ip_summed == CHECKSUM_COMPLETE)
153 skb->ip_summed = CHECKSUM_NONE;
154 } else {
155 /* full checksum calculation */
156 tcph->check = 0;
157 skb->csum = skb_checksum(skb, tcphoff, skb->len - tcphoff, 0);
158 tcph->check = csum_tcpudp_magic(cp->vaddr, cp->caddr,
159 skb->len - tcphoff,
160 cp->protocol, skb->csum);
161 IP_VS_DBG(11, "O-pkt: %s O-csum=%d (+%zd)\n",
162 pp->name, tcph->check,
163 (char*)&(tcph->check) - (char*)tcph);
164 }
165 return 1;
166 }
167
168
169 static int
170 tcp_dnat_handler(struct sk_buff *skb,
171 struct ip_vs_protocol *pp, struct ip_vs_conn *cp)
172 {
173 struct tcphdr *tcph;
174 const unsigned int tcphoff = ip_hdrlen(skb);
175
176 /* csum_check requires unshared skb */
177 if (!skb_make_writable(skb, tcphoff+sizeof(*tcph)))
178 return 0;
179
180 if (unlikely(cp->app != NULL)) {
181 /* Some checks before mangling */
182 if (pp->csum_check && !pp->csum_check(skb, pp))
183 return 0;
184
185 /*
186 * Attempt ip_vs_app call.
187 * It will fix ip_vs_conn and iph ack_seq stuff
188 */
189 if (!ip_vs_app_pkt_in(cp, skb))
190 return 0;
191 }
192
193 tcph = (void *)ip_hdr(skb) + tcphoff;
194 tcph->dest = cp->dport;
195
196 /*
197 * Adjust TCP checksums
198 */
199 if (!cp->app) {
200 /* Only port and addr are changed, do fast csum update */
201 tcp_fast_csum_update(tcph, cp->vaddr, cp->daddr,
202 cp->vport, cp->dport);
203 if (skb->ip_summed == CHECKSUM_COMPLETE)
204 skb->ip_summed = CHECKSUM_NONE;
205 } else {
206 /* full checksum calculation */
207 tcph->check = 0;
208 skb->csum = skb_checksum(skb, tcphoff, skb->len - tcphoff, 0);
209 tcph->check = csum_tcpudp_magic(cp->caddr, cp->daddr,
210 skb->len - tcphoff,
211 cp->protocol, skb->csum);
212 skb->ip_summed = CHECKSUM_UNNECESSARY;
213 }
214 return 1;
215 }
216
217
218 static int
219 tcp_csum_check(struct sk_buff *skb, struct ip_vs_protocol *pp)
220 {
221 const unsigned int tcphoff = ip_hdrlen(skb);
222
223 switch (skb->ip_summed) {
224 case CHECKSUM_NONE:
225 skb->csum = skb_checksum(skb, tcphoff, skb->len - tcphoff, 0);
226 case CHECKSUM_COMPLETE:
227 if (csum_tcpudp_magic(ip_hdr(skb)->saddr, ip_hdr(skb)->daddr,
228 skb->len - tcphoff,
229 ip_hdr(skb)->protocol, skb->csum)) {
230 IP_VS_DBG_RL_PKT(0, pp, skb, 0,
231 "Failed checksum for");
232 return 0;
233 }
234 break;
235 default:
236 /* No need to checksum. */
237 break;
238 }
239
240 return 1;
241 }
242
243
244 #define TCP_DIR_INPUT 0
245 #define TCP_DIR_OUTPUT 4
246 #define TCP_DIR_INPUT_ONLY 8
247
248 static const int tcp_state_off[IP_VS_DIR_LAST] = {
249 [IP_VS_DIR_INPUT] = TCP_DIR_INPUT,
250 [IP_VS_DIR_OUTPUT] = TCP_DIR_OUTPUT,
251 [IP_VS_DIR_INPUT_ONLY] = TCP_DIR_INPUT_ONLY,
252 };
253
254 /*
255 * Timeout table[state]
256 */
257 static int tcp_timeouts[IP_VS_TCP_S_LAST+1] = {
258 [IP_VS_TCP_S_NONE] = 2*HZ,
259 [IP_VS_TCP_S_ESTABLISHED] = 15*60*HZ,
260 [IP_VS_TCP_S_SYN_SENT] = 2*60*HZ,
261 [IP_VS_TCP_S_SYN_RECV] = 1*60*HZ,
262 [IP_VS_TCP_S_FIN_WAIT] = 2*60*HZ,
263 [IP_VS_TCP_S_TIME_WAIT] = 2*60*HZ,
264 [IP_VS_TCP_S_CLOSE] = 10*HZ,
265 [IP_VS_TCP_S_CLOSE_WAIT] = 60*HZ,
266 [IP_VS_TCP_S_LAST_ACK] = 30*HZ,
267 [IP_VS_TCP_S_LISTEN] = 2*60*HZ,
268 [IP_VS_TCP_S_SYNACK] = 120*HZ,
269 [IP_VS_TCP_S_LAST] = 2*HZ,
270 };
271
272 static char * tcp_state_name_table[IP_VS_TCP_S_LAST+1] = {
273 [IP_VS_TCP_S_NONE] = "NONE",
274 [IP_VS_TCP_S_ESTABLISHED] = "ESTABLISHED",
275 [IP_VS_TCP_S_SYN_SENT] = "SYN_SENT",
276 [IP_VS_TCP_S_SYN_RECV] = "SYN_RECV",
277 [IP_VS_TCP_S_FIN_WAIT] = "FIN_WAIT",
278 [IP_VS_TCP_S_TIME_WAIT] = "TIME_WAIT",
279 [IP_VS_TCP_S_CLOSE] = "CLOSE",
280 [IP_VS_TCP_S_CLOSE_WAIT] = "CLOSE_WAIT",
281 [IP_VS_TCP_S_LAST_ACK] = "LAST_ACK",
282 [IP_VS_TCP_S_LISTEN] = "LISTEN",
283 [IP_VS_TCP_S_SYNACK] = "SYNACK",
284 [IP_VS_TCP_S_LAST] = "BUG!",
285 };
286
287 #define sNO IP_VS_TCP_S_NONE
288 #define sES IP_VS_TCP_S_ESTABLISHED
289 #define sSS IP_VS_TCP_S_SYN_SENT
290 #define sSR IP_VS_TCP_S_SYN_RECV
291 #define sFW IP_VS_TCP_S_FIN_WAIT
292 #define sTW IP_VS_TCP_S_TIME_WAIT
293 #define sCL IP_VS_TCP_S_CLOSE
294 #define sCW IP_VS_TCP_S_CLOSE_WAIT
295 #define sLA IP_VS_TCP_S_LAST_ACK
296 #define sLI IP_VS_TCP_S_LISTEN
297 #define sSA IP_VS_TCP_S_SYNACK
298
299 struct tcp_states_t {
300 int next_state[IP_VS_TCP_S_LAST];
301 };
302
303 static const char * tcp_state_name(int state)
304 {
305 if (state >= IP_VS_TCP_S_LAST)
306 return "ERR!";
307 return tcp_state_name_table[state] ? tcp_state_name_table[state] : "?";
308 }
309
310 static struct tcp_states_t tcp_states [] = {
311 /* INPUT */
312 /* sNO, sES, sSS, sSR, sFW, sTW, sCL, sCW, sLA, sLI, sSA */
313 /*syn*/ {{sSR, sES, sES, sSR, sSR, sSR, sSR, sSR, sSR, sSR, sSR }},
314 /*fin*/ {{sCL, sCW, sSS, sTW, sTW, sTW, sCL, sCW, sLA, sLI, sTW }},
315 /*ack*/ {{sCL, sES, sSS, sES, sFW, sTW, sCL, sCW, sCL, sLI, sES }},
316 /*rst*/ {{sCL, sCL, sCL, sSR, sCL, sCL, sCL, sCL, sLA, sLI, sSR }},
317
318 /* OUTPUT */
319 /* sNO, sES, sSS, sSR, sFW, sTW, sCL, sCW, sLA, sLI, sSA */
320 /*syn*/ {{sSS, sES, sSS, sSR, sSS, sSS, sSS, sSS, sSS, sLI, sSR }},
321 /*fin*/ {{sTW, sFW, sSS, sTW, sFW, sTW, sCL, sTW, sLA, sLI, sTW }},
322 /*ack*/ {{sES, sES, sSS, sES, sFW, sTW, sCL, sCW, sLA, sES, sES }},
323 /*rst*/ {{sCL, sCL, sSS, sCL, sCL, sTW, sCL, sCL, sCL, sCL, sCL }},
324
325 /* INPUT-ONLY */
326 /* sNO, sES, sSS, sSR, sFW, sTW, sCL, sCW, sLA, sLI, sSA */
327 /*syn*/ {{sSR, sES, sES, sSR, sSR, sSR, sSR, sSR, sSR, sSR, sSR }},
328 /*fin*/ {{sCL, sFW, sSS, sTW, sFW, sTW, sCL, sCW, sLA, sLI, sTW }},
329 /*ack*/ {{sCL, sES, sSS, sES, sFW, sTW, sCL, sCW, sCL, sLI, sES }},
330 /*rst*/ {{sCL, sCL, sCL, sSR, sCL, sCL, sCL, sCL, sLA, sLI, sCL }},
331 };
332
333 static struct tcp_states_t tcp_states_dos [] = {
334 /* INPUT */
335 /* sNO, sES, sSS, sSR, sFW, sTW, sCL, sCW, sLA, sLI, sSA */
336 /*syn*/ {{sSR, sES, sES, sSR, sSR, sSR, sSR, sSR, sSR, sSR, sSA }},
337 /*fin*/ {{sCL, sCW, sSS, sTW, sTW, sTW, sCL, sCW, sLA, sLI, sSA }},
338 /*ack*/ {{sCL, sES, sSS, sSR, sFW, sTW, sCL, sCW, sCL, sLI, sSA }},
339 /*rst*/ {{sCL, sCL, sCL, sSR, sCL, sCL, sCL, sCL, sLA, sLI, sCL }},
340
341 /* OUTPUT */
342 /* sNO, sES, sSS, sSR, sFW, sTW, sCL, sCW, sLA, sLI, sSA */
343 /*syn*/ {{sSS, sES, sSS, sSA, sSS, sSS, sSS, sSS, sSS, sLI, sSA }},
344 /*fin*/ {{sTW, sFW, sSS, sTW, sFW, sTW, sCL, sTW, sLA, sLI, sTW }},
345 /*ack*/ {{sES, sES, sSS, sES, sFW, sTW, sCL, sCW, sLA, sES, sES }},
346 /*rst*/ {{sCL, sCL, sSS, sCL, sCL, sTW, sCL, sCL, sCL, sCL, sCL }},
347
348 /* INPUT-ONLY */
349 /* sNO, sES, sSS, sSR, sFW, sTW, sCL, sCW, sLA, sLI, sSA */
350 /*syn*/ {{sSA, sES, sES, sSR, sSA, sSA, sSA, sSA, sSA, sSA, sSA }},
351 /*fin*/ {{sCL, sFW, sSS, sTW, sFW, sTW, sCL, sCW, sLA, sLI, sTW }},
352 /*ack*/ {{sCL, sES, sSS, sES, sFW, sTW, sCL, sCW, sCL, sLI, sES }},
353 /*rst*/ {{sCL, sCL, sCL, sSR, sCL, sCL, sCL, sCL, sLA, sLI, sCL }},
354 };
355
356 static struct tcp_states_t *tcp_state_table = tcp_states;
357
358
359 static void tcp_timeout_change(struct ip_vs_protocol *pp, int flags)
360 {
361 int on = (flags & 1); /* secure_tcp */
362
363 /*
364 ** FIXME: change secure_tcp to independent sysctl var
365 ** or make it per-service or per-app because it is valid
366 ** for most if not for all of the applications. Something
367 ** like "capabilities" (flags) for each object.
368 */
369 tcp_state_table = (on? tcp_states_dos : tcp_states);
370 }
371
372 static int
373 tcp_set_state_timeout(struct ip_vs_protocol *pp, char *sname, int to)
374 {
375 return ip_vs_set_state_timeout(pp->timeout_table, IP_VS_TCP_S_LAST,
376 tcp_state_name_table, sname, to);
377 }
378
379 static inline int tcp_state_idx(struct tcphdr *th)
380 {
381 if (th->rst)
382 return 3;
383 if (th->syn)
384 return 0;
385 if (th->fin)
386 return 1;
387 if (th->ack)
388 return 2;
389 return -1;
390 }
391
392 static inline void
393 set_tcp_state(struct ip_vs_protocol *pp, struct ip_vs_conn *cp,
394 int direction, struct tcphdr *th)
395 {
396 int state_idx;
397 int new_state = IP_VS_TCP_S_CLOSE;
398 int state_off = tcp_state_off[direction];
399
400 /*
401 * Update state offset to INPUT_ONLY if necessary
402 * or delete NO_OUTPUT flag if output packet detected
403 */
404 if (cp->flags & IP_VS_CONN_F_NOOUTPUT) {
405 if (state_off == TCP_DIR_OUTPUT)
406 cp->flags &= ~IP_VS_CONN_F_NOOUTPUT;
407 else
408 state_off = TCP_DIR_INPUT_ONLY;
409 }
410
411 if ((state_idx = tcp_state_idx(th)) < 0) {
412 IP_VS_DBG(8, "tcp_state_idx=%d!!!\n", state_idx);
413 goto tcp_state_out;
414 }
415
416 new_state = tcp_state_table[state_off+state_idx].next_state[cp->state];
417
418 tcp_state_out:
419 if (new_state != cp->state) {
420 struct ip_vs_dest *dest = cp->dest;
421
422 IP_VS_DBG(8, "%s %s [%c%c%c%c] %u.%u.%u.%u:%d->"
423 "%u.%u.%u.%u:%d state: %s->%s conn->refcnt:%d\n",
424 pp->name,
425 (state_off==TCP_DIR_OUTPUT)?"output ":"input ",
426 th->syn? 'S' : '.',
427 th->fin? 'F' : '.',
428 th->ack? 'A' : '.',
429 th->rst? 'R' : '.',
430 NIPQUAD(cp->daddr), ntohs(cp->dport),
431 NIPQUAD(cp->caddr), ntohs(cp->cport),
432 tcp_state_name(cp->state),
433 tcp_state_name(new_state),
434 atomic_read(&cp->refcnt));
435 if (dest) {
436 if (!(cp->flags & IP_VS_CONN_F_INACTIVE) &&
437 (new_state != IP_VS_TCP_S_ESTABLISHED)) {
438 atomic_dec(&dest->activeconns);
439 atomic_inc(&dest->inactconns);
440 cp->flags |= IP_VS_CONN_F_INACTIVE;
441 } else if ((cp->flags & IP_VS_CONN_F_INACTIVE) &&
442 (new_state == IP_VS_TCP_S_ESTABLISHED)) {
443 atomic_inc(&dest->activeconns);
444 atomic_dec(&dest->inactconns);
445 cp->flags &= ~IP_VS_CONN_F_INACTIVE;
446 }
447 }
448 }
449
450 cp->timeout = pp->timeout_table[cp->state = new_state];
451 }
452
453
454 /*
455 * Handle state transitions
456 */
457 static int
458 tcp_state_transition(struct ip_vs_conn *cp, int direction,
459 const struct sk_buff *skb,
460 struct ip_vs_protocol *pp)
461 {
462 struct tcphdr _tcph, *th;
463
464 th = skb_header_pointer(skb, ip_hdrlen(skb), sizeof(_tcph), &_tcph);
465 if (th == NULL)
466 return 0;
467
468 spin_lock(&cp->lock);
469 set_tcp_state(pp, cp, direction, th);
470 spin_unlock(&cp->lock);
471
472 return 1;
473 }
474
475
476 /*
477 * Hash table for TCP application incarnations
478 */
479 #define TCP_APP_TAB_BITS 4
480 #define TCP_APP_TAB_SIZE (1 << TCP_APP_TAB_BITS)
481 #define TCP_APP_TAB_MASK (TCP_APP_TAB_SIZE - 1)
482
483 static struct list_head tcp_apps[TCP_APP_TAB_SIZE];
484 static DEFINE_SPINLOCK(tcp_app_lock);
485
486 static inline __u16 tcp_app_hashkey(__be16 port)
487 {
488 return (((__force u16)port >> TCP_APP_TAB_BITS) ^ (__force u16)port)
489 & TCP_APP_TAB_MASK;
490 }
491
492
493 static int tcp_register_app(struct ip_vs_app *inc)
494 {
495 struct ip_vs_app *i;
496 __u16 hash;
497 __be16 port = inc->port;
498 int ret = 0;
499
500 hash = tcp_app_hashkey(port);
501
502 spin_lock_bh(&tcp_app_lock);
503 list_for_each_entry(i, &tcp_apps[hash], p_list) {
504 if (i->port == port) {
505 ret = -EEXIST;
506 goto out;
507 }
508 }
509 list_add(&inc->p_list, &tcp_apps[hash]);
510 atomic_inc(&ip_vs_protocol_tcp.appcnt);
511
512 out:
513 spin_unlock_bh(&tcp_app_lock);
514 return ret;
515 }
516
517
518 static void
519 tcp_unregister_app(struct ip_vs_app *inc)
520 {
521 spin_lock_bh(&tcp_app_lock);
522 atomic_dec(&ip_vs_protocol_tcp.appcnt);
523 list_del(&inc->p_list);
524 spin_unlock_bh(&tcp_app_lock);
525 }
526
527
528 static int
529 tcp_app_conn_bind(struct ip_vs_conn *cp)
530 {
531 int hash;
532 struct ip_vs_app *inc;
533 int result = 0;
534
535 /* Default binding: bind app only for NAT */
536 if (IP_VS_FWD_METHOD(cp) != IP_VS_CONN_F_MASQ)
537 return 0;
538
539 /* Lookup application incarnations and bind the right one */
540 hash = tcp_app_hashkey(cp->vport);
541
542 spin_lock(&tcp_app_lock);
543 list_for_each_entry(inc, &tcp_apps[hash], p_list) {
544 if (inc->port == cp->vport) {
545 if (unlikely(!ip_vs_app_inc_get(inc)))
546 break;
547 spin_unlock(&tcp_app_lock);
548
549 IP_VS_DBG(9, "%s: Binding conn %u.%u.%u.%u:%u->"
550 "%u.%u.%u.%u:%u to app %s on port %u\n",
551 __func__,
552 NIPQUAD(cp->caddr), ntohs(cp->cport),
553 NIPQUAD(cp->vaddr), ntohs(cp->vport),
554 inc->name, ntohs(inc->port));
555 cp->app = inc;
556 if (inc->init_conn)
557 result = inc->init_conn(inc, cp);
558 goto out;
559 }
560 }
561 spin_unlock(&tcp_app_lock);
562
563 out:
564 return result;
565 }
566
567
568 /*
569 * Set LISTEN timeout. (ip_vs_conn_put will setup timer)
570 */
571 void ip_vs_tcp_conn_listen(struct ip_vs_conn *cp)
572 {
573 spin_lock(&cp->lock);
574 cp->state = IP_VS_TCP_S_LISTEN;
575 cp->timeout = ip_vs_protocol_tcp.timeout_table[IP_VS_TCP_S_LISTEN];
576 spin_unlock(&cp->lock);
577 }
578
579
580 static void ip_vs_tcp_init(struct ip_vs_protocol *pp)
581 {
582 IP_VS_INIT_HASH_TABLE(tcp_apps);
583 pp->timeout_table = tcp_timeouts;
584 }
585
586
587 static void ip_vs_tcp_exit(struct ip_vs_protocol *pp)
588 {
589 }
590
591
592 struct ip_vs_protocol ip_vs_protocol_tcp = {
593 .name = "TCP",
594 .protocol = IPPROTO_TCP,
595 .num_states = IP_VS_TCP_S_LAST,
596 .dont_defrag = 0,
597 .appcnt = ATOMIC_INIT(0),
598 .init = ip_vs_tcp_init,
599 .exit = ip_vs_tcp_exit,
600 .register_app = tcp_register_app,
601 .unregister_app = tcp_unregister_app,
602 .conn_schedule = tcp_conn_schedule,
603 .conn_in_get = tcp_conn_in_get,
604 .conn_out_get = tcp_conn_out_get,
605 .snat_handler = tcp_snat_handler,
606 .dnat_handler = tcp_dnat_handler,
607 .csum_check = tcp_csum_check,
608 .state_name = tcp_state_name,
609 .state_transition = tcp_state_transition,
610 .app_conn_bind = tcp_app_conn_bind,
611 .debug_packet = ip_vs_tcpudp_debug_packet,
612 .timeout_change = tcp_timeout_change,
613 .set_state_timeout = tcp_set_state_timeout,
614 };
This page took 0.069824 seconds and 5 git commands to generate.