diff options
Diffstat (limited to 'include/net/ip_vs.h')
-rw-r--r-- | include/net/ip_vs.h | 292 |
1 files changed, 127 insertions, 165 deletions
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h index f0d70f066f3d..5679d927562b 100644 --- a/include/net/ip_vs.h +++ b/include/net/ip_vs.h | |||
@@ -109,7 +109,6 @@ extern int ip_vs_conn_tab_size; | |||
109 | struct ip_vs_iphdr { | 109 | struct ip_vs_iphdr { |
110 | __u32 len; /* IPv4 simply where L4 starts | 110 | __u32 len; /* IPv4 simply where L4 starts |
111 | IPv6 where L4 Transport Header starts */ | 111 | IPv6 where L4 Transport Header starts */ |
112 | __u32 thoff_reasm; /* Transport Header Offset in nfct_reasm skb */ | ||
113 | __u16 fragoffs; /* IPv6 fragment offset, 0 if first frag (or not frag)*/ | 112 | __u16 fragoffs; /* IPv6 fragment offset, 0 if first frag (or not frag)*/ |
114 | __s16 protocol; | 113 | __s16 protocol; |
115 | __s32 flags; | 114 | __s32 flags; |
@@ -117,34 +116,12 @@ struct ip_vs_iphdr { | |||
117 | union nf_inet_addr daddr; | 116 | union nf_inet_addr daddr; |
118 | }; | 117 | }; |
119 | 118 | ||
120 | /* Dependency to module: nf_defrag_ipv6 */ | ||
121 | #if defined(CONFIG_NF_DEFRAG_IPV6) || defined(CONFIG_NF_DEFRAG_IPV6_MODULE) | ||
122 | static inline struct sk_buff *skb_nfct_reasm(const struct sk_buff *skb) | ||
123 | { | ||
124 | return skb->nfct_reasm; | ||
125 | } | ||
126 | static inline void *frag_safe_skb_hp(const struct sk_buff *skb, int offset, | ||
127 | int len, void *buffer, | ||
128 | const struct ip_vs_iphdr *ipvsh) | ||
129 | { | ||
130 | if (unlikely(ipvsh->fragoffs && skb_nfct_reasm(skb))) | ||
131 | return skb_header_pointer(skb_nfct_reasm(skb), | ||
132 | ipvsh->thoff_reasm, len, buffer); | ||
133 | |||
134 | return skb_header_pointer(skb, offset, len, buffer); | ||
135 | } | ||
136 | #else | ||
137 | static inline struct sk_buff *skb_nfct_reasm(const struct sk_buff *skb) | ||
138 | { | ||
139 | return NULL; | ||
140 | } | ||
141 | static inline void *frag_safe_skb_hp(const struct sk_buff *skb, int offset, | 119 | static inline void *frag_safe_skb_hp(const struct sk_buff *skb, int offset, |
142 | int len, void *buffer, | 120 | int len, void *buffer, |
143 | const struct ip_vs_iphdr *ipvsh) | 121 | const struct ip_vs_iphdr *ipvsh) |
144 | { | 122 | { |
145 | return skb_header_pointer(skb, offset, len, buffer); | 123 | return skb_header_pointer(skb, offset, len, buffer); |
146 | } | 124 | } |
147 | #endif | ||
148 | 125 | ||
149 | static inline void | 126 | static inline void |
150 | ip_vs_fill_ip4hdr(const void *nh, struct ip_vs_iphdr *iphdr) | 127 | ip_vs_fill_ip4hdr(const void *nh, struct ip_vs_iphdr *iphdr) |
@@ -171,19 +148,12 @@ ip_vs_fill_iph_skb(int af, const struct sk_buff *skb, struct ip_vs_iphdr *iphdr) | |||
171 | (struct ipv6hdr *)skb_network_header(skb); | 148 | (struct ipv6hdr *)skb_network_header(skb); |
172 | iphdr->saddr.in6 = iph->saddr; | 149 | iphdr->saddr.in6 = iph->saddr; |
173 | iphdr->daddr.in6 = iph->daddr; | 150 | iphdr->daddr.in6 = iph->daddr; |
174 | /* ipv6_find_hdr() updates len, flags, thoff_reasm */ | 151 | /* ipv6_find_hdr() updates len, flags */ |
175 | iphdr->thoff_reasm = 0; | ||
176 | iphdr->len = 0; | 152 | iphdr->len = 0; |
177 | iphdr->flags = 0; | 153 | iphdr->flags = 0; |
178 | iphdr->protocol = ipv6_find_hdr(skb, &iphdr->len, -1, | 154 | iphdr->protocol = ipv6_find_hdr(skb, &iphdr->len, -1, |
179 | &iphdr->fragoffs, | 155 | &iphdr->fragoffs, |
180 | &iphdr->flags); | 156 | &iphdr->flags); |
181 | /* get proto from re-assembled packet and it's offset */ | ||
182 | if (skb_nfct_reasm(skb)) | ||
183 | iphdr->protocol = ipv6_find_hdr(skb_nfct_reasm(skb), | ||
184 | &iphdr->thoff_reasm, | ||
185 | -1, NULL, NULL); | ||
186 | |||
187 | } else | 157 | } else |
188 | #endif | 158 | #endif |
189 | { | 159 | { |
@@ -236,7 +206,7 @@ static inline int ip_vs_addr_equal(int af, const union nf_inet_addr *a, | |||
236 | #ifdef CONFIG_IP_VS_DEBUG | 206 | #ifdef CONFIG_IP_VS_DEBUG |
237 | #include <linux/net.h> | 207 | #include <linux/net.h> |
238 | 208 | ||
239 | extern int ip_vs_get_debug_level(void); | 209 | int ip_vs_get_debug_level(void); |
240 | 210 | ||
241 | static inline const char *ip_vs_dbg_addr(int af, char *buf, size_t buf_len, | 211 | static inline const char *ip_vs_dbg_addr(int af, char *buf, size_t buf_len, |
242 | const union nf_inet_addr *addr, | 212 | const union nf_inet_addr *addr, |
@@ -532,9 +502,9 @@ struct ip_vs_proto_data { | |||
532 | struct tcp_states_t *tcp_state_table; | 502 | struct tcp_states_t *tcp_state_table; |
533 | }; | 503 | }; |
534 | 504 | ||
535 | extern struct ip_vs_protocol *ip_vs_proto_get(unsigned short proto); | 505 | struct ip_vs_protocol *ip_vs_proto_get(unsigned short proto); |
536 | extern struct ip_vs_proto_data *ip_vs_proto_data_get(struct net *net, | 506 | struct ip_vs_proto_data *ip_vs_proto_data_get(struct net *net, |
537 | unsigned short proto); | 507 | unsigned short proto); |
538 | 508 | ||
539 | struct ip_vs_conn_param { | 509 | struct ip_vs_conn_param { |
540 | struct net *net; | 510 | struct net *net; |
@@ -723,8 +693,6 @@ struct ip_vs_dest_dst { | |||
723 | struct rcu_head rcu_head; | 693 | struct rcu_head rcu_head; |
724 | }; | 694 | }; |
725 | 695 | ||
726 | /* In grace period after removing */ | ||
727 | #define IP_VS_DEST_STATE_REMOVING 0x01 | ||
728 | /* | 696 | /* |
729 | * The real server destination forwarding entry | 697 | * The real server destination forwarding entry |
730 | * with ip address, port number, and so on. | 698 | * with ip address, port number, and so on. |
@@ -742,7 +710,7 @@ struct ip_vs_dest { | |||
742 | 710 | ||
743 | atomic_t refcnt; /* reference counter */ | 711 | atomic_t refcnt; /* reference counter */ |
744 | struct ip_vs_stats stats; /* statistics */ | 712 | struct ip_vs_stats stats; /* statistics */ |
745 | unsigned long state; /* state flags */ | 713 | unsigned long idle_start; /* start time, jiffies */ |
746 | 714 | ||
747 | /* connection counters and thresholds */ | 715 | /* connection counters and thresholds */ |
748 | atomic_t activeconns; /* active connections */ | 716 | atomic_t activeconns; /* active connections */ |
@@ -756,14 +724,13 @@ struct ip_vs_dest { | |||
756 | struct ip_vs_dest_dst __rcu *dest_dst; /* cached dst info */ | 724 | struct ip_vs_dest_dst __rcu *dest_dst; /* cached dst info */ |
757 | 725 | ||
758 | /* for virtual service */ | 726 | /* for virtual service */ |
759 | struct ip_vs_service *svc; /* service it belongs to */ | 727 | struct ip_vs_service __rcu *svc; /* service it belongs to */ |
760 | __u16 protocol; /* which protocol (TCP/UDP) */ | 728 | __u16 protocol; /* which protocol (TCP/UDP) */ |
761 | __be16 vport; /* virtual port number */ | 729 | __be16 vport; /* virtual port number */ |
762 | union nf_inet_addr vaddr; /* virtual IP address */ | 730 | union nf_inet_addr vaddr; /* virtual IP address */ |
763 | __u32 vfwmark; /* firewall mark of service */ | 731 | __u32 vfwmark; /* firewall mark of service */ |
764 | 732 | ||
765 | struct list_head t_list; /* in dest_trash */ | 733 | struct list_head t_list; /* in dest_trash */ |
766 | struct rcu_head rcu_head; | ||
767 | unsigned int in_rs_table:1; /* we are in rs_table */ | 734 | unsigned int in_rs_table:1; /* we are in rs_table */ |
768 | }; | 735 | }; |
769 | 736 | ||
@@ -1176,8 +1143,8 @@ static inline int sysctl_backup_only(struct netns_ipvs *ipvs) | |||
1176 | * IPVS core functions | 1143 | * IPVS core functions |
1177 | * (from ip_vs_core.c) | 1144 | * (from ip_vs_core.c) |
1178 | */ | 1145 | */ |
1179 | extern const char *ip_vs_proto_name(unsigned int proto); | 1146 | const char *ip_vs_proto_name(unsigned int proto); |
1180 | extern void ip_vs_init_hash_table(struct list_head *table, int rows); | 1147 | void ip_vs_init_hash_table(struct list_head *table, int rows); |
1181 | #define IP_VS_INIT_HASH_TABLE(t) ip_vs_init_hash_table((t), ARRAY_SIZE((t))) | 1148 | #define IP_VS_INIT_HASH_TABLE(t) ip_vs_init_hash_table((t), ARRAY_SIZE((t))) |
1182 | 1149 | ||
1183 | #define IP_VS_APP_TYPE_FTP 1 | 1150 | #define IP_VS_APP_TYPE_FTP 1 |
@@ -1240,22 +1207,22 @@ static inline void __ip_vs_conn_put(struct ip_vs_conn *cp) | |||
1240 | smp_mb__before_atomic_dec(); | 1207 | smp_mb__before_atomic_dec(); |
1241 | atomic_dec(&cp->refcnt); | 1208 | atomic_dec(&cp->refcnt); |
1242 | } | 1209 | } |
1243 | extern void ip_vs_conn_put(struct ip_vs_conn *cp); | 1210 | void ip_vs_conn_put(struct ip_vs_conn *cp); |
1244 | extern void ip_vs_conn_fill_cport(struct ip_vs_conn *cp, __be16 cport); | 1211 | void ip_vs_conn_fill_cport(struct ip_vs_conn *cp, __be16 cport); |
1245 | 1212 | ||
1246 | struct ip_vs_conn *ip_vs_conn_new(const struct ip_vs_conn_param *p, | 1213 | struct ip_vs_conn *ip_vs_conn_new(const struct ip_vs_conn_param *p, |
1247 | const union nf_inet_addr *daddr, | 1214 | const union nf_inet_addr *daddr, |
1248 | __be16 dport, unsigned int flags, | 1215 | __be16 dport, unsigned int flags, |
1249 | struct ip_vs_dest *dest, __u32 fwmark); | 1216 | struct ip_vs_dest *dest, __u32 fwmark); |
1250 | extern void ip_vs_conn_expire_now(struct ip_vs_conn *cp); | 1217 | void ip_vs_conn_expire_now(struct ip_vs_conn *cp); |
1251 | 1218 | ||
1252 | extern const char * ip_vs_state_name(__u16 proto, int state); | 1219 | const char *ip_vs_state_name(__u16 proto, int state); |
1253 | 1220 | ||
1254 | extern void ip_vs_tcp_conn_listen(struct net *net, struct ip_vs_conn *cp); | 1221 | void ip_vs_tcp_conn_listen(struct net *net, struct ip_vs_conn *cp); |
1255 | extern int ip_vs_check_template(struct ip_vs_conn *ct); | 1222 | int ip_vs_check_template(struct ip_vs_conn *ct); |
1256 | extern void ip_vs_random_dropentry(struct net *net); | 1223 | void ip_vs_random_dropentry(struct net *net); |
1257 | extern int ip_vs_conn_init(void); | 1224 | int ip_vs_conn_init(void); |
1258 | extern void ip_vs_conn_cleanup(void); | 1225 | void ip_vs_conn_cleanup(void); |
1259 | 1226 | ||
1260 | static inline void ip_vs_control_del(struct ip_vs_conn *cp) | 1227 | static inline void ip_vs_control_del(struct ip_vs_conn *cp) |
1261 | { | 1228 | { |
@@ -1320,37 +1287,36 @@ ip_vs_control_add(struct ip_vs_conn *cp, struct ip_vs_conn *ctl_cp) | |||
1320 | /* | 1287 | /* |
1321 | * IPVS netns init & cleanup functions | 1288 | * IPVS netns init & cleanup functions |
1322 | */ | 1289 | */ |
1323 | extern int ip_vs_estimator_net_init(struct net *net); | 1290 | int ip_vs_estimator_net_init(struct net *net); |
1324 | extern int ip_vs_control_net_init(struct net *net); | 1291 | int ip_vs_control_net_init(struct net *net); |
1325 | extern int ip_vs_protocol_net_init(struct net *net); | 1292 | int ip_vs_protocol_net_init(struct net *net); |
1326 | extern int ip_vs_app_net_init(struct net *net); | 1293 | int ip_vs_app_net_init(struct net *net); |
1327 | extern int ip_vs_conn_net_init(struct net *net); | 1294 | int ip_vs_conn_net_init(struct net *net); |
1328 | extern int ip_vs_sync_net_init(struct net *net); | 1295 | int ip_vs_sync_net_init(struct net *net); |
1329 | extern void ip_vs_conn_net_cleanup(struct net *net); | 1296 | void ip_vs_conn_net_cleanup(struct net *net); |
1330 | extern void ip_vs_app_net_cleanup(struct net *net); | 1297 | void ip_vs_app_net_cleanup(struct net *net); |
1331 | extern void ip_vs_protocol_net_cleanup(struct net *net); | 1298 | void ip_vs_protocol_net_cleanup(struct net *net); |
1332 | extern void ip_vs_control_net_cleanup(struct net *net); | 1299 | void ip_vs_control_net_cleanup(struct net *net); |
1333 | extern void ip_vs_estimator_net_cleanup(struct net *net); | 1300 | void ip_vs_estimator_net_cleanup(struct net *net); |
1334 | extern void ip_vs_sync_net_cleanup(struct net *net); | 1301 | void ip_vs_sync_net_cleanup(struct net *net); |
1335 | extern void ip_vs_service_net_cleanup(struct net *net); | 1302 | void ip_vs_service_net_cleanup(struct net *net); |
1336 | 1303 | ||
1337 | /* | 1304 | /* |
1338 | * IPVS application functions | 1305 | * IPVS application functions |
1339 | * (from ip_vs_app.c) | 1306 | * (from ip_vs_app.c) |
1340 | */ | 1307 | */ |
1341 | #define IP_VS_APP_MAX_PORTS 8 | 1308 | #define IP_VS_APP_MAX_PORTS 8 |
1342 | extern struct ip_vs_app *register_ip_vs_app(struct net *net, | 1309 | struct ip_vs_app *register_ip_vs_app(struct net *net, struct ip_vs_app *app); |
1343 | struct ip_vs_app *app); | 1310 | void unregister_ip_vs_app(struct net *net, struct ip_vs_app *app); |
1344 | extern void unregister_ip_vs_app(struct net *net, struct ip_vs_app *app); | 1311 | int ip_vs_bind_app(struct ip_vs_conn *cp, struct ip_vs_protocol *pp); |
1345 | extern int ip_vs_bind_app(struct ip_vs_conn *cp, struct ip_vs_protocol *pp); | 1312 | void ip_vs_unbind_app(struct ip_vs_conn *cp); |
1346 | extern void ip_vs_unbind_app(struct ip_vs_conn *cp); | 1313 | int register_ip_vs_app_inc(struct net *net, struct ip_vs_app *app, __u16 proto, |
1347 | extern int register_ip_vs_app_inc(struct net *net, struct ip_vs_app *app, | 1314 | __u16 port); |
1348 | __u16 proto, __u16 port); | 1315 | int ip_vs_app_inc_get(struct ip_vs_app *inc); |
1349 | extern int ip_vs_app_inc_get(struct ip_vs_app *inc); | 1316 | void ip_vs_app_inc_put(struct ip_vs_app *inc); |
1350 | extern void ip_vs_app_inc_put(struct ip_vs_app *inc); | 1317 | |
1351 | 1318 | int ip_vs_app_pkt_out(struct ip_vs_conn *, struct sk_buff *skb); | |
1352 | extern int ip_vs_app_pkt_out(struct ip_vs_conn *, struct sk_buff *skb); | 1319 | int ip_vs_app_pkt_in(struct ip_vs_conn *, struct sk_buff *skb); |
1353 | extern int ip_vs_app_pkt_in(struct ip_vs_conn *, struct sk_buff *skb); | ||
1354 | 1320 | ||
1355 | int register_ip_vs_pe(struct ip_vs_pe *pe); | 1321 | int register_ip_vs_pe(struct ip_vs_pe *pe); |
1356 | int unregister_ip_vs_pe(struct ip_vs_pe *pe); | 1322 | int unregister_ip_vs_pe(struct ip_vs_pe *pe); |
@@ -1371,17 +1337,15 @@ struct ip_vs_pe *__ip_vs_pe_getbyname(const char *pe_name); | |||
1371 | /* | 1337 | /* |
1372 | * IPVS protocol functions (from ip_vs_proto.c) | 1338 | * IPVS protocol functions (from ip_vs_proto.c) |
1373 | */ | 1339 | */ |
1374 | extern int ip_vs_protocol_init(void); | 1340 | int ip_vs_protocol_init(void); |
1375 | extern void ip_vs_protocol_cleanup(void); | 1341 | void ip_vs_protocol_cleanup(void); |
1376 | extern void ip_vs_protocol_timeout_change(struct netns_ipvs *ipvs, int flags); | 1342 | void ip_vs_protocol_timeout_change(struct netns_ipvs *ipvs, int flags); |
1377 | extern int *ip_vs_create_timeout_table(int *table, int size); | 1343 | int *ip_vs_create_timeout_table(int *table, int size); |
1378 | extern int | 1344 | int ip_vs_set_state_timeout(int *table, int num, const char *const *names, |
1379 | ip_vs_set_state_timeout(int *table, int num, const char *const *names, | 1345 | const char *name, int to); |
1380 | const char *name, int to); | 1346 | void ip_vs_tcpudp_debug_packet(int af, struct ip_vs_protocol *pp, |
1381 | extern void | 1347 | const struct sk_buff *skb, int offset, |
1382 | ip_vs_tcpudp_debug_packet(int af, struct ip_vs_protocol *pp, | 1348 | const char *msg); |
1383 | const struct sk_buff *skb, | ||
1384 | int offset, const char *msg); | ||
1385 | 1349 | ||
1386 | extern struct ip_vs_protocol ip_vs_protocol_tcp; | 1350 | extern struct ip_vs_protocol ip_vs_protocol_tcp; |
1387 | extern struct ip_vs_protocol ip_vs_protocol_udp; | 1351 | extern struct ip_vs_protocol ip_vs_protocol_udp; |
@@ -1394,22 +1358,22 @@ extern struct ip_vs_protocol ip_vs_protocol_sctp; | |||
1394 | * Registering/unregistering scheduler functions | 1358 | * Registering/unregistering scheduler functions |
1395 | * (from ip_vs_sched.c) | 1359 | * (from ip_vs_sched.c) |
1396 | */ | 1360 | */ |
1397 | extern int register_ip_vs_scheduler(struct ip_vs_scheduler *scheduler); | 1361 | int register_ip_vs_scheduler(struct ip_vs_scheduler *scheduler); |
1398 | extern int unregister_ip_vs_scheduler(struct ip_vs_scheduler *scheduler); | 1362 | int unregister_ip_vs_scheduler(struct ip_vs_scheduler *scheduler); |
1399 | extern int ip_vs_bind_scheduler(struct ip_vs_service *svc, | 1363 | int ip_vs_bind_scheduler(struct ip_vs_service *svc, |
1400 | struct ip_vs_scheduler *scheduler); | 1364 | struct ip_vs_scheduler *scheduler); |
1401 | extern void ip_vs_unbind_scheduler(struct ip_vs_service *svc, | 1365 | void ip_vs_unbind_scheduler(struct ip_vs_service *svc, |
1402 | struct ip_vs_scheduler *sched); | 1366 | struct ip_vs_scheduler *sched); |
1403 | extern struct ip_vs_scheduler *ip_vs_scheduler_get(const char *sched_name); | 1367 | struct ip_vs_scheduler *ip_vs_scheduler_get(const char *sched_name); |
1404 | extern void ip_vs_scheduler_put(struct ip_vs_scheduler *scheduler); | 1368 | void ip_vs_scheduler_put(struct ip_vs_scheduler *scheduler); |
1405 | extern struct ip_vs_conn * | 1369 | struct ip_vs_conn * |
1406 | ip_vs_schedule(struct ip_vs_service *svc, struct sk_buff *skb, | 1370 | ip_vs_schedule(struct ip_vs_service *svc, struct sk_buff *skb, |
1407 | struct ip_vs_proto_data *pd, int *ignored, | 1371 | struct ip_vs_proto_data *pd, int *ignored, |
1408 | struct ip_vs_iphdr *iph); | 1372 | struct ip_vs_iphdr *iph); |
1409 | extern int ip_vs_leave(struct ip_vs_service *svc, struct sk_buff *skb, | 1373 | int ip_vs_leave(struct ip_vs_service *svc, struct sk_buff *skb, |
1410 | struct ip_vs_proto_data *pd, struct ip_vs_iphdr *iph); | 1374 | struct ip_vs_proto_data *pd, struct ip_vs_iphdr *iph); |
1411 | 1375 | ||
1412 | extern void ip_vs_scheduler_err(struct ip_vs_service *svc, const char *msg); | 1376 | void ip_vs_scheduler_err(struct ip_vs_service *svc, const char *msg); |
1413 | 1377 | ||
1414 | 1378 | ||
1415 | /* | 1379 | /* |
@@ -1418,25 +1382,24 @@ extern void ip_vs_scheduler_err(struct ip_vs_service *svc, const char *msg); | |||
1418 | extern struct ip_vs_stats ip_vs_stats; | 1382 | extern struct ip_vs_stats ip_vs_stats; |
1419 | extern int sysctl_ip_vs_sync_ver; | 1383 | extern int sysctl_ip_vs_sync_ver; |
1420 | 1384 | ||
1421 | extern struct ip_vs_service * | 1385 | struct ip_vs_service * |
1422 | ip_vs_service_find(struct net *net, int af, __u32 fwmark, __u16 protocol, | 1386 | ip_vs_service_find(struct net *net, int af, __u32 fwmark, __u16 protocol, |
1423 | const union nf_inet_addr *vaddr, __be16 vport); | 1387 | const union nf_inet_addr *vaddr, __be16 vport); |
1424 | 1388 | ||
1425 | extern bool | 1389 | bool ip_vs_has_real_service(struct net *net, int af, __u16 protocol, |
1426 | ip_vs_has_real_service(struct net *net, int af, __u16 protocol, | 1390 | const union nf_inet_addr *daddr, __be16 dport); |
1427 | const union nf_inet_addr *daddr, __be16 dport); | 1391 | |
1428 | 1392 | int ip_vs_use_count_inc(void); | |
1429 | extern int ip_vs_use_count_inc(void); | 1393 | void ip_vs_use_count_dec(void); |
1430 | extern void ip_vs_use_count_dec(void); | 1394 | int ip_vs_register_nl_ioctl(void); |
1431 | extern int ip_vs_register_nl_ioctl(void); | 1395 | void ip_vs_unregister_nl_ioctl(void); |
1432 | extern void ip_vs_unregister_nl_ioctl(void); | 1396 | int ip_vs_control_init(void); |
1433 | extern int ip_vs_control_init(void); | 1397 | void ip_vs_control_cleanup(void); |
1434 | extern void ip_vs_control_cleanup(void); | 1398 | struct ip_vs_dest * |
1435 | extern struct ip_vs_dest * | ||
1436 | ip_vs_find_dest(struct net *net, int af, const union nf_inet_addr *daddr, | 1399 | ip_vs_find_dest(struct net *net, int af, const union nf_inet_addr *daddr, |
1437 | __be16 dport, const union nf_inet_addr *vaddr, __be16 vport, | 1400 | __be16 dport, const union nf_inet_addr *vaddr, __be16 vport, |
1438 | __u16 protocol, __u32 fwmark, __u32 flags); | 1401 | __u16 protocol, __u32 fwmark, __u32 flags); |
1439 | extern void ip_vs_try_bind_dest(struct ip_vs_conn *cp); | 1402 | void ip_vs_try_bind_dest(struct ip_vs_conn *cp); |
1440 | 1403 | ||
1441 | static inline void ip_vs_dest_hold(struct ip_vs_dest *dest) | 1404 | static inline void ip_vs_dest_hold(struct ip_vs_dest *dest) |
1442 | { | 1405 | { |
@@ -1449,60 +1412,59 @@ static inline void ip_vs_dest_put(struct ip_vs_dest *dest) | |||
1449 | atomic_dec(&dest->refcnt); | 1412 | atomic_dec(&dest->refcnt); |
1450 | } | 1413 | } |
1451 | 1414 | ||
1415 | static inline void ip_vs_dest_put_and_free(struct ip_vs_dest *dest) | ||
1416 | { | ||
1417 | if (atomic_dec_return(&dest->refcnt) < 0) | ||
1418 | kfree(dest); | ||
1419 | } | ||
1420 | |||
1452 | /* | 1421 | /* |
1453 | * IPVS sync daemon data and function prototypes | 1422 | * IPVS sync daemon data and function prototypes |
1454 | * (from ip_vs_sync.c) | 1423 | * (from ip_vs_sync.c) |
1455 | */ | 1424 | */ |
1456 | extern int start_sync_thread(struct net *net, int state, char *mcast_ifn, | 1425 | int start_sync_thread(struct net *net, int state, char *mcast_ifn, __u8 syncid); |
1457 | __u8 syncid); | 1426 | int stop_sync_thread(struct net *net, int state); |
1458 | extern int stop_sync_thread(struct net *net, int state); | 1427 | void ip_vs_sync_conn(struct net *net, struct ip_vs_conn *cp, int pkts); |
1459 | extern void ip_vs_sync_conn(struct net *net, struct ip_vs_conn *cp, int pkts); | ||
1460 | |||
1461 | 1428 | ||
1462 | /* | 1429 | /* |
1463 | * IPVS rate estimator prototypes (from ip_vs_est.c) | 1430 | * IPVS rate estimator prototypes (from ip_vs_est.c) |
1464 | */ | 1431 | */ |
1465 | extern void ip_vs_start_estimator(struct net *net, struct ip_vs_stats *stats); | 1432 | void ip_vs_start_estimator(struct net *net, struct ip_vs_stats *stats); |
1466 | extern void ip_vs_stop_estimator(struct net *net, struct ip_vs_stats *stats); | 1433 | void ip_vs_stop_estimator(struct net *net, struct ip_vs_stats *stats); |
1467 | extern void ip_vs_zero_estimator(struct ip_vs_stats *stats); | 1434 | void ip_vs_zero_estimator(struct ip_vs_stats *stats); |
1468 | extern void ip_vs_read_estimator(struct ip_vs_stats_user *dst, | 1435 | void ip_vs_read_estimator(struct ip_vs_stats_user *dst, |
1469 | struct ip_vs_stats *stats); | 1436 | struct ip_vs_stats *stats); |
1470 | 1437 | ||
1471 | /* | 1438 | /* |
1472 | * Various IPVS packet transmitters (from ip_vs_xmit.c) | 1439 | * Various IPVS packet transmitters (from ip_vs_xmit.c) |
1473 | */ | 1440 | */ |
1474 | extern int ip_vs_null_xmit(struct sk_buff *skb, struct ip_vs_conn *cp, | 1441 | int ip_vs_null_xmit(struct sk_buff *skb, struct ip_vs_conn *cp, |
1475 | struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph); | 1442 | struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph); |
1476 | extern int ip_vs_bypass_xmit(struct sk_buff *skb, struct ip_vs_conn *cp, | 1443 | int ip_vs_bypass_xmit(struct sk_buff *skb, struct ip_vs_conn *cp, |
1477 | struct ip_vs_protocol *pp, | 1444 | struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph); |
1478 | struct ip_vs_iphdr *iph); | 1445 | int ip_vs_nat_xmit(struct sk_buff *skb, struct ip_vs_conn *cp, |
1479 | extern int ip_vs_nat_xmit(struct sk_buff *skb, struct ip_vs_conn *cp, | 1446 | struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph); |
1480 | struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph); | 1447 | int ip_vs_tunnel_xmit(struct sk_buff *skb, struct ip_vs_conn *cp, |
1481 | extern int ip_vs_tunnel_xmit(struct sk_buff *skb, struct ip_vs_conn *cp, | 1448 | struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph); |
1482 | struct ip_vs_protocol *pp, | 1449 | int ip_vs_dr_xmit(struct sk_buff *skb, struct ip_vs_conn *cp, |
1483 | struct ip_vs_iphdr *iph); | 1450 | struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph); |
1484 | extern int ip_vs_dr_xmit(struct sk_buff *skb, struct ip_vs_conn *cp, | 1451 | int ip_vs_icmp_xmit(struct sk_buff *skb, struct ip_vs_conn *cp, |
1485 | struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph); | 1452 | struct ip_vs_protocol *pp, int offset, |
1486 | extern int ip_vs_icmp_xmit(struct sk_buff *skb, struct ip_vs_conn *cp, | 1453 | unsigned int hooknum, struct ip_vs_iphdr *iph); |
1487 | struct ip_vs_protocol *pp, int offset, | 1454 | void ip_vs_dest_dst_rcu_free(struct rcu_head *head); |
1488 | unsigned int hooknum, struct ip_vs_iphdr *iph); | ||
1489 | extern void ip_vs_dest_dst_rcu_free(struct rcu_head *head); | ||
1490 | 1455 | ||
1491 | #ifdef CONFIG_IP_VS_IPV6 | 1456 | #ifdef CONFIG_IP_VS_IPV6 |
1492 | extern int ip_vs_bypass_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp, | 1457 | int ip_vs_bypass_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp, |
1493 | struct ip_vs_protocol *pp, | 1458 | struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph); |
1494 | struct ip_vs_iphdr *iph); | 1459 | int ip_vs_nat_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp, |
1495 | extern int ip_vs_nat_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp, | 1460 | struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph); |
1496 | struct ip_vs_protocol *pp, | 1461 | int ip_vs_tunnel_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp, |
1497 | struct ip_vs_iphdr *iph); | 1462 | struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph); |
1498 | extern int ip_vs_tunnel_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp, | 1463 | int ip_vs_dr_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp, |
1499 | struct ip_vs_protocol *pp, | 1464 | struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph); |
1500 | struct ip_vs_iphdr *iph); | 1465 | int ip_vs_icmp_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp, |
1501 | extern int ip_vs_dr_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp, | 1466 | struct ip_vs_protocol *pp, int offset, |
1502 | struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph); | 1467 | unsigned int hooknum, struct ip_vs_iphdr *iph); |
1503 | extern int ip_vs_icmp_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp, | ||
1504 | struct ip_vs_protocol *pp, int offset, | ||
1505 | unsigned int hooknum, struct ip_vs_iphdr *iph); | ||
1506 | #endif | 1468 | #endif |
1507 | 1469 | ||
1508 | #ifdef CONFIG_SYSCTL | 1470 | #ifdef CONFIG_SYSCTL |
@@ -1551,15 +1513,15 @@ static inline char ip_vs_fwd_tag(struct ip_vs_conn *cp) | |||
1551 | return fwd; | 1513 | return fwd; |
1552 | } | 1514 | } |
1553 | 1515 | ||
1554 | extern void ip_vs_nat_icmp(struct sk_buff *skb, struct ip_vs_protocol *pp, | 1516 | void ip_vs_nat_icmp(struct sk_buff *skb, struct ip_vs_protocol *pp, |
1555 | struct ip_vs_conn *cp, int dir); | 1517 | struct ip_vs_conn *cp, int dir); |
1556 | 1518 | ||
1557 | #ifdef CONFIG_IP_VS_IPV6 | 1519 | #ifdef CONFIG_IP_VS_IPV6 |
1558 | extern void ip_vs_nat_icmp_v6(struct sk_buff *skb, struct ip_vs_protocol *pp, | 1520 | void ip_vs_nat_icmp_v6(struct sk_buff *skb, struct ip_vs_protocol *pp, |
1559 | struct ip_vs_conn *cp, int dir); | 1521 | struct ip_vs_conn *cp, int dir); |
1560 | #endif | 1522 | #endif |
1561 | 1523 | ||
1562 | extern __sum16 ip_vs_checksum_complete(struct sk_buff *skb, int offset); | 1524 | __sum16 ip_vs_checksum_complete(struct sk_buff *skb, int offset); |
1563 | 1525 | ||
1564 | static inline __wsum ip_vs_check_diff4(__be32 old, __be32 new, __wsum oldsum) | 1526 | static inline __wsum ip_vs_check_diff4(__be32 old, __be32 new, __wsum oldsum) |
1565 | { | 1527 | { |
@@ -1618,13 +1580,13 @@ static inline int ip_vs_conntrack_enabled(struct netns_ipvs *ipvs) | |||
1618 | #endif | 1580 | #endif |
1619 | } | 1581 | } |
1620 | 1582 | ||
1621 | extern void ip_vs_update_conntrack(struct sk_buff *skb, struct ip_vs_conn *cp, | 1583 | void ip_vs_update_conntrack(struct sk_buff *skb, struct ip_vs_conn *cp, |
1622 | int outin); | 1584 | int outin); |
1623 | extern int ip_vs_confirm_conntrack(struct sk_buff *skb); | 1585 | int ip_vs_confirm_conntrack(struct sk_buff *skb); |
1624 | extern void ip_vs_nfct_expect_related(struct sk_buff *skb, struct nf_conn *ct, | 1586 | void ip_vs_nfct_expect_related(struct sk_buff *skb, struct nf_conn *ct, |
1625 | struct ip_vs_conn *cp, u_int8_t proto, | 1587 | struct ip_vs_conn *cp, u_int8_t proto, |
1626 | const __be16 port, int from_rs); | 1588 | const __be16 port, int from_rs); |
1627 | extern void ip_vs_conn_drop_conntrack(struct ip_vs_conn *cp); | 1589 | void ip_vs_conn_drop_conntrack(struct ip_vs_conn *cp); |
1628 | 1590 | ||
1629 | #else | 1591 | #else |
1630 | 1592 | ||
@@ -1649,7 +1611,7 @@ static inline void ip_vs_conn_drop_conntrack(struct ip_vs_conn *cp) | |||
1649 | /* CONFIG_IP_VS_NFCT */ | 1611 | /* CONFIG_IP_VS_NFCT */ |
1650 | #endif | 1612 | #endif |
1651 | 1613 | ||
1652 | static inline unsigned int | 1614 | static inline int |
1653 | ip_vs_dest_conn_overhead(struct ip_vs_dest *dest) | 1615 | ip_vs_dest_conn_overhead(struct ip_vs_dest *dest) |
1654 | { | 1616 | { |
1655 | /* | 1617 | /* |