diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv4/Kconfig | 2 | ||||
-rw-r--r-- | net/ipv4/Makefile | 1 | ||||
-rw-r--r-- | net/netfilter/Kconfig | 2 | ||||
-rw-r--r-- | net/netfilter/Makefile | 3 | ||||
-rw-r--r-- | net/netfilter/ipvs/Kconfig (renamed from net/ipv4/ipvs/Kconfig) | 0 | ||||
-rw-r--r-- | net/netfilter/ipvs/Makefile (renamed from net/ipv4/ipvs/Makefile) | 0 | ||||
-rw-r--r-- | net/netfilter/ipvs/ip_vs_app.c (renamed from net/ipv4/ipvs/ip_vs_app.c) | 0 | ||||
-rw-r--r-- | net/netfilter/ipvs/ip_vs_conn.c (renamed from net/ipv4/ipvs/ip_vs_conn.c) | 0 | ||||
-rw-r--r-- | net/netfilter/ipvs/ip_vs_core.c (renamed from net/ipv4/ipvs/ip_vs_core.c) | 0 | ||||
-rw-r--r-- | net/netfilter/ipvs/ip_vs_ctl.c (renamed from net/ipv4/ipvs/ip_vs_ctl.c) | 2 | ||||
-rw-r--r-- | net/netfilter/ipvs/ip_vs_dh.c | 261 | ||||
-rw-r--r-- | net/netfilter/ipvs/ip_vs_est.c (renamed from net/ipv4/ipvs/ip_vs_est.c) | 0 | ||||
-rw-r--r-- | net/netfilter/ipvs/ip_vs_ftp.c (renamed from net/ipv4/ipvs/ip_vs_ftp.c) | 0 | ||||
-rw-r--r-- | net/netfilter/ipvs/ip_vs_lblc.c (renamed from net/ipv4/ipvs/ip_vs_lblc.c) | 0 | ||||
-rw-r--r-- | net/netfilter/ipvs/ip_vs_lblcr.c (renamed from net/ipv4/ipvs/ip_vs_lblcr.c) | 0 | ||||
-rw-r--r-- | net/netfilter/ipvs/ip_vs_lc.c (renamed from net/ipv4/ipvs/ip_vs_lc.c) | 0 | ||||
-rw-r--r-- | net/netfilter/ipvs/ip_vs_nq.c (renamed from net/ipv4/ipvs/ip_vs_nq.c) | 0 | ||||
-rw-r--r-- | net/netfilter/ipvs/ip_vs_proto.c (renamed from net/ipv4/ipvs/ip_vs_proto.c) | 0 | ||||
-rw-r--r-- | net/netfilter/ipvs/ip_vs_proto_ah_esp.c (renamed from net/ipv4/ipvs/ip_vs_proto_ah_esp.c) | 0 | ||||
-rw-r--r-- | net/netfilter/ipvs/ip_vs_proto_tcp.c (renamed from net/ipv4/ipvs/ip_vs_proto_tcp.c) | 0 | ||||
-rw-r--r-- | net/netfilter/ipvs/ip_vs_proto_udp.c (renamed from net/ipv4/ipvs/ip_vs_proto_udp.c) | 0 | ||||
-rw-r--r-- | net/netfilter/ipvs/ip_vs_rr.c (renamed from net/ipv4/ipvs/ip_vs_rr.c) | 0 | ||||
-rw-r--r-- | net/netfilter/ipvs/ip_vs_sched.c (renamed from net/ipv4/ipvs/ip_vs_sched.c) | 0 | ||||
-rw-r--r-- | net/netfilter/ipvs/ip_vs_sed.c (renamed from net/ipv4/ipvs/ip_vs_sed.c) | 0 | ||||
-rw-r--r-- | net/netfilter/ipvs/ip_vs_sh.c (renamed from net/ipv4/ipvs/ip_vs_sh.c) | 0 | ||||
-rw-r--r-- | net/netfilter/ipvs/ip_vs_sync.c (renamed from net/ipv4/ipvs/ip_vs_sync.c) | 6 | ||||
-rw-r--r-- | net/netfilter/ipvs/ip_vs_wlc.c (renamed from net/ipv4/ipvs/ip_vs_wlc.c) | 0 | ||||
-rw-r--r-- | net/netfilter/ipvs/ip_vs_wrr.c (renamed from net/ipv4/ipvs/ip_vs_wrr.c) | 0 | ||||
-rw-r--r-- | net/netfilter/ipvs/ip_vs_xmit.c (renamed from net/ipv4/ipvs/ip_vs_xmit.c) | 0 |
29 files changed, 272 insertions, 5 deletions
diff --git a/net/ipv4/Kconfig b/net/ipv4/Kconfig index 591ea23639ca..691268f3a359 100644 --- a/net/ipv4/Kconfig +++ b/net/ipv4/Kconfig | |||
@@ -630,5 +630,3 @@ config TCP_MD5SIG | |||
630 | 630 | ||
631 | If unsure, say N. | 631 | If unsure, say N. |
632 | 632 | ||
633 | source "net/ipv4/ipvs/Kconfig" | ||
634 | |||
diff --git a/net/ipv4/Makefile b/net/ipv4/Makefile index ad40ef3f9ebc..80ff87ce43aa 100644 --- a/net/ipv4/Makefile +++ b/net/ipv4/Makefile | |||
@@ -33,7 +33,6 @@ obj-$(CONFIG_INET_XFRM_MODE_TRANSPORT) += xfrm4_mode_transport.o | |||
33 | obj-$(CONFIG_INET_XFRM_MODE_TUNNEL) += xfrm4_mode_tunnel.o | 33 | obj-$(CONFIG_INET_XFRM_MODE_TUNNEL) += xfrm4_mode_tunnel.o |
34 | obj-$(CONFIG_IP_PNP) += ipconfig.o | 34 | obj-$(CONFIG_IP_PNP) += ipconfig.o |
35 | obj-$(CONFIG_NETFILTER) += netfilter.o netfilter/ | 35 | obj-$(CONFIG_NETFILTER) += netfilter.o netfilter/ |
36 | obj-$(CONFIG_IP_VS) += ipvs/ | ||
37 | obj-$(CONFIG_INET_DIAG) += inet_diag.o | 36 | obj-$(CONFIG_INET_DIAG) += inet_diag.o |
38 | obj-$(CONFIG_INET_TCP_DIAG) += tcp_diag.o | 37 | obj-$(CONFIG_INET_TCP_DIAG) += tcp_diag.o |
39 | obj-$(CONFIG_NET_TCPPROBE) += tcp_probe.o | 38 | obj-$(CONFIG_NET_TCPPROBE) += tcp_probe.o |
diff --git a/net/netfilter/Kconfig b/net/netfilter/Kconfig index ee898e74808d..73f9378e1bfe 100644 --- a/net/netfilter/Kconfig +++ b/net/netfilter/Kconfig | |||
@@ -838,3 +838,5 @@ config NETFILTER_XT_MATCH_HASHLIMIT | |||
838 | 838 | ||
839 | endmenu | 839 | endmenu |
840 | 840 | ||
841 | source "net/netfilter/ipvs/Kconfig" | ||
842 | |||
diff --git a/net/netfilter/Makefile b/net/netfilter/Makefile index 3bd2cc556aea..cf75055be830 100644 --- a/net/netfilter/Makefile +++ b/net/netfilter/Makefile | |||
@@ -83,3 +83,6 @@ obj-$(CONFIG_NETFILTER_XT_MATCH_STRING) += xt_string.o | |||
83 | obj-$(CONFIG_NETFILTER_XT_MATCH_TCPMSS) += xt_tcpmss.o | 83 | obj-$(CONFIG_NETFILTER_XT_MATCH_TCPMSS) += xt_tcpmss.o |
84 | obj-$(CONFIG_NETFILTER_XT_MATCH_TIME) += xt_time.o | 84 | obj-$(CONFIG_NETFILTER_XT_MATCH_TIME) += xt_time.o |
85 | obj-$(CONFIG_NETFILTER_XT_MATCH_U32) += xt_u32.o | 85 | obj-$(CONFIG_NETFILTER_XT_MATCH_U32) += xt_u32.o |
86 | |||
87 | # IPVS | ||
88 | obj-$(CONFIG_IP_VS) += ipvs/ | ||
diff --git a/net/ipv4/ipvs/Kconfig b/net/netfilter/ipvs/Kconfig index de6004de80bc..de6004de80bc 100644 --- a/net/ipv4/ipvs/Kconfig +++ b/net/netfilter/ipvs/Kconfig | |||
diff --git a/net/ipv4/ipvs/Makefile b/net/netfilter/ipvs/Makefile index 73a46fe1fe4c..73a46fe1fe4c 100644 --- a/net/ipv4/ipvs/Makefile +++ b/net/netfilter/ipvs/Makefile | |||
diff --git a/net/ipv4/ipvs/ip_vs_app.c b/net/netfilter/ipvs/ip_vs_app.c index 201b8ea3020d..201b8ea3020d 100644 --- a/net/ipv4/ipvs/ip_vs_app.c +++ b/net/netfilter/ipvs/ip_vs_app.c | |||
diff --git a/net/ipv4/ipvs/ip_vs_conn.c b/net/netfilter/ipvs/ip_vs_conn.c index 9a24332fbed8..9a24332fbed8 100644 --- a/net/ipv4/ipvs/ip_vs_conn.c +++ b/net/netfilter/ipvs/ip_vs_conn.c | |||
diff --git a/net/ipv4/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c index 958abf3e5f8c..958abf3e5f8c 100644 --- a/net/ipv4/ipvs/ip_vs_core.c +++ b/net/netfilter/ipvs/ip_vs_core.c | |||
diff --git a/net/ipv4/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c index 771551d8fba9..0302cf3e5039 100644 --- a/net/ipv4/ipvs/ip_vs_ctl.c +++ b/net/netfilter/ipvs/ip_vs_ctl.c | |||
@@ -1330,7 +1330,9 @@ ip_vs_edit_service(struct ip_vs_service *svc, struct ip_vs_service_user_kern *u) | |||
1330 | 1330 | ||
1331 | out_unlock: | 1331 | out_unlock: |
1332 | write_unlock_bh(&__ip_vs_svc_lock); | 1332 | write_unlock_bh(&__ip_vs_svc_lock); |
1333 | #ifdef CONFIG_IP_VS_IPV6 | ||
1333 | out: | 1334 | out: |
1335 | #endif | ||
1334 | 1336 | ||
1335 | if (old_sched) | 1337 | if (old_sched) |
1336 | ip_vs_scheduler_put(old_sched); | 1338 | ip_vs_scheduler_put(old_sched); |
diff --git a/net/netfilter/ipvs/ip_vs_dh.c b/net/netfilter/ipvs/ip_vs_dh.c new file mode 100644 index 000000000000..a16943fd72f1 --- /dev/null +++ b/net/netfilter/ipvs/ip_vs_dh.c | |||
@@ -0,0 +1,261 @@ | |||
1 | /* | ||
2 | * IPVS: Destination Hashing scheduling module | ||
3 | * | ||
4 | * Authors: Wensong Zhang <wensong@gnuchina.org> | ||
5 | * | ||
6 | * Inspired by the consistent hashing scheduler patch from | ||
7 | * Thomas Proell <proellt@gmx.de> | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or | ||
10 | * modify it under the terms of the GNU General Public License | ||
11 | * as published by the Free Software Foundation; either version | ||
12 | * 2 of the License, or (at your option) any later version. | ||
13 | * | ||
14 | * Changes: | ||
15 | * | ||
16 | */ | ||
17 | |||
18 | /* | ||
19 | * The dh algorithm is to select server by the hash key of destination IP | ||
20 | * address. The pseudo code is as follows: | ||
21 | * | ||
22 | * n <- servernode[dest_ip]; | ||
23 | * if (n is dead) OR | ||
24 | * (n is overloaded) OR (n.weight <= 0) then | ||
25 | * return NULL; | ||
26 | * | ||
27 | * return n; | ||
28 | * | ||
29 | * Notes that servernode is a 256-bucket hash table that maps the hash | ||
30 | * index derived from packet destination IP address to the current server | ||
31 | * array. If the dh scheduler is used in cache cluster, it is good to | ||
32 | * combine it with cache_bypass feature. When the statically assigned | ||
33 | * server is dead or overloaded, the load balancer can bypass the cache | ||
34 | * server and send requests to the original server directly. | ||
35 | * | ||
36 | */ | ||
37 | |||
38 | #include <linux/ip.h> | ||
39 | #include <linux/module.h> | ||
40 | #include <linux/kernel.h> | ||
41 | #include <linux/skbuff.h> | ||
42 | |||
43 | #include <net/ip_vs.h> | ||
44 | |||
45 | |||
46 | /* | ||
47 | * IPVS DH bucket | ||
48 | */ | ||
49 | struct ip_vs_dh_bucket { | ||
50 | struct ip_vs_dest *dest; /* real server (cache) */ | ||
51 | }; | ||
52 | |||
53 | /* | ||
54 | * for IPVS DH entry hash table | ||
55 | */ | ||
56 | #ifndef CONFIG_IP_VS_DH_TAB_BITS | ||
57 | #define CONFIG_IP_VS_DH_TAB_BITS 8 | ||
58 | #endif | ||
59 | #define IP_VS_DH_TAB_BITS CONFIG_IP_VS_DH_TAB_BITS | ||
60 | #define IP_VS_DH_TAB_SIZE (1 << IP_VS_DH_TAB_BITS) | ||
61 | #define IP_VS_DH_TAB_MASK (IP_VS_DH_TAB_SIZE - 1) | ||
62 | |||
63 | |||
64 | /* | ||
65 | * Returns hash value for IPVS DH entry | ||
66 | */ | ||
67 | static inline unsigned ip_vs_dh_hashkey(__be32 addr) | ||
68 | { | ||
69 | return (ntohl(addr)*2654435761UL) & IP_VS_DH_TAB_MASK; | ||
70 | } | ||
71 | |||
72 | |||
73 | /* | ||
74 | * Get ip_vs_dest associated with supplied parameters. | ||
75 | */ | ||
76 | static inline struct ip_vs_dest * | ||
77 | ip_vs_dh_get(struct ip_vs_dh_bucket *tbl, __be32 addr) | ||
78 | { | ||
79 | return (tbl[ip_vs_dh_hashkey(addr)]).dest; | ||
80 | } | ||
81 | |||
82 | |||
83 | /* | ||
84 | * Assign all the hash buckets of the specified table with the service. | ||
85 | */ | ||
86 | static int | ||
87 | ip_vs_dh_assign(struct ip_vs_dh_bucket *tbl, struct ip_vs_service *svc) | ||
88 | { | ||
89 | int i; | ||
90 | struct ip_vs_dh_bucket *b; | ||
91 | struct list_head *p; | ||
92 | struct ip_vs_dest *dest; | ||
93 | |||
94 | b = tbl; | ||
95 | p = &svc->destinations; | ||
96 | for (i=0; i<IP_VS_DH_TAB_SIZE; i++) { | ||
97 | if (list_empty(p)) { | ||
98 | b->dest = NULL; | ||
99 | } else { | ||
100 | if (p == &svc->destinations) | ||
101 | p = p->next; | ||
102 | |||
103 | dest = list_entry(p, struct ip_vs_dest, n_list); | ||
104 | atomic_inc(&dest->refcnt); | ||
105 | b->dest = dest; | ||
106 | |||
107 | p = p->next; | ||
108 | } | ||
109 | b++; | ||
110 | } | ||
111 | return 0; | ||
112 | } | ||
113 | |||
114 | |||
115 | /* | ||
116 | * Flush all the hash buckets of the specified table. | ||
117 | */ | ||
118 | static void ip_vs_dh_flush(struct ip_vs_dh_bucket *tbl) | ||
119 | { | ||
120 | int i; | ||
121 | struct ip_vs_dh_bucket *b; | ||
122 | |||
123 | b = tbl; | ||
124 | for (i=0; i<IP_VS_DH_TAB_SIZE; i++) { | ||
125 | if (b->dest) { | ||
126 | atomic_dec(&b->dest->refcnt); | ||
127 | b->dest = NULL; | ||
128 | } | ||
129 | b++; | ||
130 | } | ||
131 | } | ||
132 | |||
133 | |||
134 | static int ip_vs_dh_init_svc(struct ip_vs_service *svc) | ||
135 | { | ||
136 | struct ip_vs_dh_bucket *tbl; | ||
137 | |||
138 | /* allocate the DH table for this service */ | ||
139 | tbl = kmalloc(sizeof(struct ip_vs_dh_bucket)*IP_VS_DH_TAB_SIZE, | ||
140 | GFP_ATOMIC); | ||
141 | if (tbl == NULL) { | ||
142 | IP_VS_ERR("ip_vs_dh_init_svc(): no memory\n"); | ||
143 | return -ENOMEM; | ||
144 | } | ||
145 | svc->sched_data = tbl; | ||
146 | IP_VS_DBG(6, "DH hash table (memory=%Zdbytes) allocated for " | ||
147 | "current service\n", | ||
148 | sizeof(struct ip_vs_dh_bucket)*IP_VS_DH_TAB_SIZE); | ||
149 | |||
150 | /* assign the hash buckets with the updated service */ | ||
151 | ip_vs_dh_assign(tbl, svc); | ||
152 | |||
153 | return 0; | ||
154 | } | ||
155 | |||
156 | |||
157 | static int ip_vs_dh_done_svc(struct ip_vs_service *svc) | ||
158 | { | ||
159 | struct ip_vs_dh_bucket *tbl = svc->sched_data; | ||
160 | |||
161 | /* got to clean up hash buckets here */ | ||
162 | ip_vs_dh_flush(tbl); | ||
163 | |||
164 | /* release the table itself */ | ||
165 | kfree(svc->sched_data); | ||
166 | IP_VS_DBG(6, "DH hash table (memory=%Zdbytes) released\n", | ||
167 | sizeof(struct ip_vs_dh_bucket)*IP_VS_DH_TAB_SIZE); | ||
168 | |||
169 | return 0; | ||
170 | } | ||
171 | |||
172 | |||
173 | static int ip_vs_dh_update_svc(struct ip_vs_service *svc) | ||
174 | { | ||
175 | struct ip_vs_dh_bucket *tbl = svc->sched_data; | ||
176 | |||
177 | /* got to clean up hash buckets here */ | ||
178 | ip_vs_dh_flush(tbl); | ||
179 | |||
180 | /* assign the hash buckets with the updated service */ | ||
181 | ip_vs_dh_assign(tbl, svc); | ||
182 | |||
183 | return 0; | ||
184 | } | ||
185 | |||
186 | |||
187 | /* | ||
188 | * If the dest flags is set with IP_VS_DEST_F_OVERLOAD, | ||
189 | * consider that the server is overloaded here. | ||
190 | */ | ||
191 | static inline int is_overloaded(struct ip_vs_dest *dest) | ||
192 | { | ||
193 | return dest->flags & IP_VS_DEST_F_OVERLOAD; | ||
194 | } | ||
195 | |||
196 | |||
197 | /* | ||
198 | * Destination hashing scheduling | ||
199 | */ | ||
200 | static struct ip_vs_dest * | ||
201 | ip_vs_dh_schedule(struct ip_vs_service *svc, const struct sk_buff *skb) | ||
202 | { | ||
203 | struct ip_vs_dest *dest; | ||
204 | struct ip_vs_dh_bucket *tbl; | ||
205 | struct iphdr *iph = ip_hdr(skb); | ||
206 | |||
207 | IP_VS_DBG(6, "ip_vs_dh_schedule(): Scheduling...\n"); | ||
208 | |||
209 | tbl = (struct ip_vs_dh_bucket *)svc->sched_data; | ||
210 | dest = ip_vs_dh_get(tbl, iph->daddr); | ||
211 | if (!dest | ||
212 | || !(dest->flags & IP_VS_DEST_F_AVAILABLE) | ||
213 | || atomic_read(&dest->weight) <= 0 | ||
214 | || is_overloaded(dest)) { | ||
215 | return NULL; | ||
216 | } | ||
217 | |||
218 | IP_VS_DBG(6, "DH: destination IP address %u.%u.%u.%u " | ||
219 | "--> server %u.%u.%u.%u:%d\n", | ||
220 | NIPQUAD(iph->daddr), | ||
221 | NIPQUAD(dest->addr.ip), | ||
222 | ntohs(dest->port)); | ||
223 | |||
224 | return dest; | ||
225 | } | ||
226 | |||
227 | |||
228 | /* | ||
229 | * IPVS DH Scheduler structure | ||
230 | */ | ||
231 | static struct ip_vs_scheduler ip_vs_dh_scheduler = | ||
232 | { | ||
233 | .name = "dh", | ||
234 | .refcnt = ATOMIC_INIT(0), | ||
235 | .module = THIS_MODULE, | ||
236 | .n_list = LIST_HEAD_INIT(ip_vs_dh_scheduler.n_list), | ||
237 | #ifdef CONFIG_IP_VS_IPV6 | ||
238 | .supports_ipv6 = 0, | ||
239 | #endif | ||
240 | .init_service = ip_vs_dh_init_svc, | ||
241 | .done_service = ip_vs_dh_done_svc, | ||
242 | .update_service = ip_vs_dh_update_svc, | ||
243 | .schedule = ip_vs_dh_schedule, | ||
244 | }; | ||
245 | |||
246 | |||
247 | static int __init ip_vs_dh_init(void) | ||
248 | { | ||
249 | return register_ip_vs_scheduler(&ip_vs_dh_scheduler); | ||
250 | } | ||
251 | |||
252 | |||
253 | static void __exit ip_vs_dh_cleanup(void) | ||
254 | { | ||
255 | unregister_ip_vs_scheduler(&ip_vs_dh_scheduler); | ||
256 | } | ||
257 | |||
258 | |||
259 | module_init(ip_vs_dh_init); | ||
260 | module_exit(ip_vs_dh_cleanup); | ||
261 | MODULE_LICENSE("GPL"); | ||
diff --git a/net/ipv4/ipvs/ip_vs_est.c b/net/netfilter/ipvs/ip_vs_est.c index 2eb2860dabb5..2eb2860dabb5 100644 --- a/net/ipv4/ipvs/ip_vs_est.c +++ b/net/netfilter/ipvs/ip_vs_est.c | |||
diff --git a/net/ipv4/ipvs/ip_vs_ftp.c b/net/netfilter/ipvs/ip_vs_ftp.c index 2e7dbd8b73a4..2e7dbd8b73a4 100644 --- a/net/ipv4/ipvs/ip_vs_ftp.c +++ b/net/netfilter/ipvs/ip_vs_ftp.c | |||
diff --git a/net/ipv4/ipvs/ip_vs_lblc.c b/net/netfilter/ipvs/ip_vs_lblc.c index 6ecef3518cac..6ecef3518cac 100644 --- a/net/ipv4/ipvs/ip_vs_lblc.c +++ b/net/netfilter/ipvs/ip_vs_lblc.c | |||
diff --git a/net/ipv4/ipvs/ip_vs_lblcr.c b/net/netfilter/ipvs/ip_vs_lblcr.c index 1f75ea83bcf8..1f75ea83bcf8 100644 --- a/net/ipv4/ipvs/ip_vs_lblcr.c +++ b/net/netfilter/ipvs/ip_vs_lblcr.c | |||
diff --git a/net/ipv4/ipvs/ip_vs_lc.c b/net/netfilter/ipvs/ip_vs_lc.c index b69f808ac461..b69f808ac461 100644 --- a/net/ipv4/ipvs/ip_vs_lc.c +++ b/net/netfilter/ipvs/ip_vs_lc.c | |||
diff --git a/net/ipv4/ipvs/ip_vs_nq.c b/net/netfilter/ipvs/ip_vs_nq.c index 9a2d8033f08f..9a2d8033f08f 100644 --- a/net/ipv4/ipvs/ip_vs_nq.c +++ b/net/netfilter/ipvs/ip_vs_nq.c | |||
diff --git a/net/ipv4/ipvs/ip_vs_proto.c b/net/netfilter/ipvs/ip_vs_proto.c index 0791f9e08feb..0791f9e08feb 100644 --- a/net/ipv4/ipvs/ip_vs_proto.c +++ b/net/netfilter/ipvs/ip_vs_proto.c | |||
diff --git a/net/ipv4/ipvs/ip_vs_proto_ah_esp.c b/net/netfilter/ipvs/ip_vs_proto_ah_esp.c index 80ab0c8e5b4a..80ab0c8e5b4a 100644 --- a/net/ipv4/ipvs/ip_vs_proto_ah_esp.c +++ b/net/netfilter/ipvs/ip_vs_proto_ah_esp.c | |||
diff --git a/net/ipv4/ipvs/ip_vs_proto_tcp.c b/net/netfilter/ipvs/ip_vs_proto_tcp.c index dd4566ea2bff..dd4566ea2bff 100644 --- a/net/ipv4/ipvs/ip_vs_proto_tcp.c +++ b/net/netfilter/ipvs/ip_vs_proto_tcp.c | |||
diff --git a/net/ipv4/ipvs/ip_vs_proto_udp.c b/net/netfilter/ipvs/ip_vs_proto_udp.c index 6eb6039d6343..6eb6039d6343 100644 --- a/net/ipv4/ipvs/ip_vs_proto_udp.c +++ b/net/netfilter/ipvs/ip_vs_proto_udp.c | |||
diff --git a/net/ipv4/ipvs/ip_vs_rr.c b/net/netfilter/ipvs/ip_vs_rr.c index a22195f68ac4..a22195f68ac4 100644 --- a/net/ipv4/ipvs/ip_vs_rr.c +++ b/net/netfilter/ipvs/ip_vs_rr.c | |||
diff --git a/net/ipv4/ipvs/ip_vs_sched.c b/net/netfilter/ipvs/ip_vs_sched.c index a46ad9e35016..a46ad9e35016 100644 --- a/net/ipv4/ipvs/ip_vs_sched.c +++ b/net/netfilter/ipvs/ip_vs_sched.c | |||
diff --git a/net/ipv4/ipvs/ip_vs_sed.c b/net/netfilter/ipvs/ip_vs_sed.c index 7d2f22f04b83..7d2f22f04b83 100644 --- a/net/ipv4/ipvs/ip_vs_sed.c +++ b/net/netfilter/ipvs/ip_vs_sed.c | |||
diff --git a/net/ipv4/ipvs/ip_vs_sh.c b/net/netfilter/ipvs/ip_vs_sh.c index 1d96de27fefd..1d96de27fefd 100644 --- a/net/ipv4/ipvs/ip_vs_sh.c +++ b/net/netfilter/ipvs/ip_vs_sh.c | |||
diff --git a/net/ipv4/ipvs/ip_vs_sync.c b/net/netfilter/ipvs/ip_vs_sync.c index 28237a5f62e2..de5e7e118eed 100644 --- a/net/ipv4/ipvs/ip_vs_sync.c +++ b/net/netfilter/ipvs/ip_vs_sync.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <linux/err.h> | 30 | #include <linux/err.h> |
31 | #include <linux/kthread.h> | 31 | #include <linux/kthread.h> |
32 | #include <linux/wait.h> | 32 | #include <linux/wait.h> |
33 | #include <linux/kernel.h> | ||
33 | 34 | ||
34 | #include <net/ip.h> | 35 | #include <net/ip.h> |
35 | #include <net/sock.h> | 36 | #include <net/sock.h> |
@@ -99,6 +100,7 @@ struct ip_vs_sync_thread_data { | |||
99 | */ | 100 | */ |
100 | 101 | ||
101 | #define SYNC_MESG_HEADER_LEN 4 | 102 | #define SYNC_MESG_HEADER_LEN 4 |
103 | #define MAX_CONNS_PER_SYNCBUFF 255 /* nr_conns in ip_vs_sync_mesg is 8 bit */ | ||
102 | 104 | ||
103 | struct ip_vs_sync_mesg { | 105 | struct ip_vs_sync_mesg { |
104 | __u8 nr_conns; | 106 | __u8 nr_conns; |
@@ -516,8 +518,8 @@ static int set_sync_mesg_maxlen(int sync_state) | |||
516 | num = (dev->mtu - sizeof(struct iphdr) - | 518 | num = (dev->mtu - sizeof(struct iphdr) - |
517 | sizeof(struct udphdr) - | 519 | sizeof(struct udphdr) - |
518 | SYNC_MESG_HEADER_LEN - 20) / SIMPLE_CONN_SIZE; | 520 | SYNC_MESG_HEADER_LEN - 20) / SIMPLE_CONN_SIZE; |
519 | sync_send_mesg_maxlen = | 521 | sync_send_mesg_maxlen = SYNC_MESG_HEADER_LEN + |
520 | SYNC_MESG_HEADER_LEN + SIMPLE_CONN_SIZE * num; | 522 | SIMPLE_CONN_SIZE * min(num, MAX_CONNS_PER_SYNCBUFF); |
521 | IP_VS_DBG(7, "setting the maximum length of sync sending " | 523 | IP_VS_DBG(7, "setting the maximum length of sync sending " |
522 | "message %d.\n", sync_send_mesg_maxlen); | 524 | "message %d.\n", sync_send_mesg_maxlen); |
523 | } else if (sync_state == IP_VS_STATE_BACKUP) { | 525 | } else if (sync_state == IP_VS_STATE_BACKUP) { |
diff --git a/net/ipv4/ipvs/ip_vs_wlc.c b/net/netfilter/ipvs/ip_vs_wlc.c index 8c596e712599..8c596e712599 100644 --- a/net/ipv4/ipvs/ip_vs_wlc.c +++ b/net/netfilter/ipvs/ip_vs_wlc.c | |||
diff --git a/net/ipv4/ipvs/ip_vs_wrr.c b/net/netfilter/ipvs/ip_vs_wrr.c index 7ea92fed50bf..7ea92fed50bf 100644 --- a/net/ipv4/ipvs/ip_vs_wrr.c +++ b/net/netfilter/ipvs/ip_vs_wrr.c | |||
diff --git a/net/ipv4/ipvs/ip_vs_xmit.c b/net/netfilter/ipvs/ip_vs_xmit.c index 02ddc2b3ce2e..02ddc2b3ce2e 100644 --- a/net/ipv4/ipvs/ip_vs_xmit.c +++ b/net/netfilter/ipvs/ip_vs_xmit.c | |||