aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/ip_vs.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/net/ip_vs.h')
-rw-r--r--include/net/ip_vs.h278
1 files changed, 210 insertions, 68 deletions
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index d858264217ba..b23bea62f708 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -28,6 +28,80 @@
28#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 28#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
29#include <net/netfilter/nf_conntrack.h> 29#include <net/netfilter/nf_conntrack.h>
30#endif 30#endif
31#include <net/net_namespace.h> /* Netw namespace */
32
33/*
34 * Generic access of ipvs struct
35 */
36static inline struct netns_ipvs *net_ipvs(struct net* net)
37{
38 return net->ipvs;
39}
40/*
41 * Get net ptr from skb in traffic cases
42 * use skb_sknet when call is from userland (ioctl or netlink)
43 */
44static inline struct net *skb_net(const struct sk_buff *skb)
45{
46#ifdef CONFIG_NET_NS
47#ifdef CONFIG_IP_VS_DEBUG
48 /*
49 * This is used for debug only.
50 * Start with the most likely hit
51 * End with BUG
52 */
53 if (likely(skb->dev && skb->dev->nd_net))
54 return dev_net(skb->dev);
55 if (skb_dst(skb)->dev)
56 return dev_net(skb_dst(skb)->dev);
57 WARN(skb->sk, "Maybe skb_sknet should be used in %s() at line:%d\n",
58 __func__, __LINE__);
59 if (likely(skb->sk && skb->sk->sk_net))
60 return sock_net(skb->sk);
61 pr_err("There is no net ptr to find in the skb in %s() line:%d\n",
62 __func__, __LINE__);
63 BUG();
64#else
65 return dev_net(skb->dev ? : skb_dst(skb)->dev);
66#endif
67#else
68 return &init_net;
69#endif
70}
71
72static inline struct net *skb_sknet(const struct sk_buff *skb)
73{
74#ifdef CONFIG_NET_NS
75#ifdef CONFIG_IP_VS_DEBUG
76 /* Start with the most likely hit */
77 if (likely(skb->sk && skb->sk->sk_net))
78 return sock_net(skb->sk);
79 WARN(skb->dev, "Maybe skb_net should be used instead in %s() line:%d\n",
80 __func__, __LINE__);
81 if (likely(skb->dev && skb->dev->nd_net))
82 return dev_net(skb->dev);
83 pr_err("There is no net ptr to find in the skb in %s() line:%d\n",
84 __func__, __LINE__);
85 BUG();
86#else
87 return sock_net(skb->sk);
88#endif
89#else
90 return &init_net;
91#endif
92}
93/*
94 * This one needed for single_open_net since net is stored directly in
95 * private not as a struct i.e. seq_file_net cant be used.
96 */
97static inline struct net *seq_file_single_net(struct seq_file *seq)
98{
99#ifdef CONFIG_NET_NS
100 return (struct net *)seq->private;
101#else
102 return &init_net;
103#endif
104}
31 105
32/* Connections' size value needed by ip_vs_ctl.c */ 106/* Connections' size value needed by ip_vs_ctl.c */
33extern int ip_vs_conn_tab_size; 107extern int ip_vs_conn_tab_size;
@@ -258,6 +332,23 @@ struct ip_vs_seq {
258 before last resized pkt */ 332 before last resized pkt */
259}; 333};
260 334
335/*
336 * counters per cpu
337 */
338struct ip_vs_counters {
339 __u32 conns; /* connections scheduled */
340 __u32 inpkts; /* incoming packets */
341 __u32 outpkts; /* outgoing packets */
342 __u64 inbytes; /* incoming bytes */
343 __u64 outbytes; /* outgoing bytes */
344};
345/*
346 * Stats per cpu
347 */
348struct ip_vs_cpu_stats {
349 struct ip_vs_counters ustats;
350 struct u64_stats_sync syncp;
351};
261 352
262/* 353/*
263 * IPVS statistics objects 354 * IPVS statistics objects
@@ -279,17 +370,34 @@ struct ip_vs_estimator {
279}; 370};
280 371
281struct ip_vs_stats { 372struct ip_vs_stats {
282 struct ip_vs_stats_user ustats; /* statistics */ 373 struct ip_vs_stats_user ustats; /* statistics */
283 struct ip_vs_estimator est; /* estimator */ 374 struct ip_vs_estimator est; /* estimator */
284 375 struct ip_vs_cpu_stats *cpustats; /* per cpu counters */
285 spinlock_t lock; /* spin lock */ 376 spinlock_t lock; /* spin lock */
286}; 377};
287 378
379/*
380 * Helper Macros for per cpu
381 * ipvs->tot_stats->ustats.count
382 */
383#define IPVS_STAT_INC(ipvs, count) \
384 __this_cpu_inc((ipvs)->ustats->count)
385
386#define IPVS_STAT_ADD(ipvs, count, value) \
387 do {\
388 write_seqcount_begin(per_cpu_ptr((ipvs)->ustats_seq, \
389 raw_smp_processor_id())); \
390 __this_cpu_add((ipvs)->ustats->count, value); \
391 write_seqcount_end(per_cpu_ptr((ipvs)->ustats_seq, \
392 raw_smp_processor_id())); \
393 } while (0)
394
288struct dst_entry; 395struct dst_entry;
289struct iphdr; 396struct iphdr;
290struct ip_vs_conn; 397struct ip_vs_conn;
291struct ip_vs_app; 398struct ip_vs_app;
292struct sk_buff; 399struct sk_buff;
400struct ip_vs_proto_data;
293 401
294struct ip_vs_protocol { 402struct ip_vs_protocol {
295 struct ip_vs_protocol *next; 403 struct ip_vs_protocol *next;
@@ -297,21 +405,22 @@ struct ip_vs_protocol {
297 u16 protocol; 405 u16 protocol;
298 u16 num_states; 406 u16 num_states;
299 int dont_defrag; 407 int dont_defrag;
300 atomic_t appcnt; /* counter of proto app incs */
301 int *timeout_table; /* protocol timeout table */
302 408
303 void (*init)(struct ip_vs_protocol *pp); 409 void (*init)(struct ip_vs_protocol *pp);
304 410
305 void (*exit)(struct ip_vs_protocol *pp); 411 void (*exit)(struct ip_vs_protocol *pp);
306 412
413 void (*init_netns)(struct net *net, struct ip_vs_proto_data *pd);
414
415 void (*exit_netns)(struct net *net, struct ip_vs_proto_data *pd);
416
307 int (*conn_schedule)(int af, struct sk_buff *skb, 417 int (*conn_schedule)(int af, struct sk_buff *skb,
308 struct ip_vs_protocol *pp, 418 struct ip_vs_proto_data *pd,
309 int *verdict, struct ip_vs_conn **cpp); 419 int *verdict, struct ip_vs_conn **cpp);
310 420
311 struct ip_vs_conn * 421 struct ip_vs_conn *
312 (*conn_in_get)(int af, 422 (*conn_in_get)(int af,
313 const struct sk_buff *skb, 423 const struct sk_buff *skb,
314 struct ip_vs_protocol *pp,
315 const struct ip_vs_iphdr *iph, 424 const struct ip_vs_iphdr *iph,
316 unsigned int proto_off, 425 unsigned int proto_off,
317 int inverse); 426 int inverse);
@@ -319,7 +428,6 @@ struct ip_vs_protocol {
319 struct ip_vs_conn * 428 struct ip_vs_conn *
320 (*conn_out_get)(int af, 429 (*conn_out_get)(int af,
321 const struct sk_buff *skb, 430 const struct sk_buff *skb,
322 struct ip_vs_protocol *pp,
323 const struct ip_vs_iphdr *iph, 431 const struct ip_vs_iphdr *iph,
324 unsigned int proto_off, 432 unsigned int proto_off,
325 int inverse); 433 int inverse);
@@ -337,11 +445,11 @@ struct ip_vs_protocol {
337 445
338 int (*state_transition)(struct ip_vs_conn *cp, int direction, 446 int (*state_transition)(struct ip_vs_conn *cp, int direction,
339 const struct sk_buff *skb, 447 const struct sk_buff *skb,
340 struct ip_vs_protocol *pp); 448 struct ip_vs_proto_data *pd);
341 449
342 int (*register_app)(struct ip_vs_app *inc); 450 int (*register_app)(struct net *net, struct ip_vs_app *inc);
343 451
344 void (*unregister_app)(struct ip_vs_app *inc); 452 void (*unregister_app)(struct net *net, struct ip_vs_app *inc);
345 453
346 int (*app_conn_bind)(struct ip_vs_conn *cp); 454 int (*app_conn_bind)(struct ip_vs_conn *cp);
347 455
@@ -350,14 +458,26 @@ struct ip_vs_protocol {
350 int offset, 458 int offset,
351 const char *msg); 459 const char *msg);
352 460
353 void (*timeout_change)(struct ip_vs_protocol *pp, int flags); 461 void (*timeout_change)(struct ip_vs_proto_data *pd, int flags);
462};
354 463
355 int (*set_state_timeout)(struct ip_vs_protocol *pp, char *sname, int to); 464/*
465 * protocol data per netns
466 */
467struct ip_vs_proto_data {
468 struct ip_vs_proto_data *next;
469 struct ip_vs_protocol *pp;
470 int *timeout_table; /* protocol timeout table */
471 atomic_t appcnt; /* counter of proto app incs. */
472 struct tcp_states_t *tcp_state_table;
356}; 473};
357 474
358extern struct ip_vs_protocol * ip_vs_proto_get(unsigned short proto); 475extern struct ip_vs_protocol *ip_vs_proto_get(unsigned short proto);
476extern struct ip_vs_proto_data *ip_vs_proto_data_get(struct net *net,
477 unsigned short proto);
359 478
360struct ip_vs_conn_param { 479struct ip_vs_conn_param {
480 struct net *net;
361 const union nf_inet_addr *caddr; 481 const union nf_inet_addr *caddr;
362 const union nf_inet_addr *vaddr; 482 const union nf_inet_addr *vaddr;
363 __be16 cport; 483 __be16 cport;
@@ -375,17 +495,19 @@ struct ip_vs_conn_param {
375 */ 495 */
376struct ip_vs_conn { 496struct ip_vs_conn {
377 struct list_head c_list; /* hashed list heads */ 497 struct list_head c_list; /* hashed list heads */
378 498#ifdef CONFIG_NET_NS
499 struct net *net; /* Name space */
500#endif
379 /* Protocol, addresses and port numbers */ 501 /* Protocol, addresses and port numbers */
380 u16 af; /* address family */ 502 u16 af; /* address family */
381 union nf_inet_addr caddr; /* client address */ 503 __be16 cport;
382 union nf_inet_addr vaddr; /* virtual address */ 504 __be16 vport;
383 union nf_inet_addr daddr; /* destination address */ 505 __be16 dport;
384 volatile __u32 flags; /* status flags */ 506 __u32 fwmark; /* Fire wall mark from skb */
385 __u32 fwmark; /* Fire wall mark from skb */ 507 union nf_inet_addr caddr; /* client address */
386 __be16 cport; 508 union nf_inet_addr vaddr; /* virtual address */
387 __be16 vport; 509 union nf_inet_addr daddr; /* destination address */
388 __be16 dport; 510 volatile __u32 flags; /* status flags */
389 __u16 protocol; /* Which protocol (TCP/UDP) */ 511 __u16 protocol; /* Which protocol (TCP/UDP) */
390 512
391 /* counter and timer */ 513 /* counter and timer */
@@ -428,6 +550,33 @@ struct ip_vs_conn {
428 __u8 pe_data_len; 550 __u8 pe_data_len;
429}; 551};
430 552
553/*
554 * To save some memory in conn table when name space is disabled.
555 */
556static inline struct net *ip_vs_conn_net(const struct ip_vs_conn *cp)
557{
558#ifdef CONFIG_NET_NS
559 return cp->net;
560#else
561 return &init_net;
562#endif
563}
564static inline void ip_vs_conn_net_set(struct ip_vs_conn *cp, struct net *net)
565{
566#ifdef CONFIG_NET_NS
567 cp->net = net;
568#endif
569}
570
571static inline int ip_vs_conn_net_eq(const struct ip_vs_conn *cp,
572 struct net *net)
573{
574#ifdef CONFIG_NET_NS
575 return cp->net == net;
576#else
577 return 1;
578#endif
579}
431 580
432/* 581/*
433 * Extended internal versions of struct ip_vs_service_user and 582 * Extended internal versions of struct ip_vs_service_user and
@@ -487,6 +636,7 @@ struct ip_vs_service {
487 unsigned flags; /* service status flags */ 636 unsigned flags; /* service status flags */
488 unsigned timeout; /* persistent timeout in ticks */ 637 unsigned timeout; /* persistent timeout in ticks */
489 __be32 netmask; /* grouping granularity */ 638 __be32 netmask; /* grouping granularity */
639 struct net *net;
490 640
491 struct list_head destinations; /* real server d-linked list */ 641 struct list_head destinations; /* real server d-linked list */
492 __u32 num_dests; /* number of servers */ 642 __u32 num_dests; /* number of servers */
@@ -512,8 +662,8 @@ struct ip_vs_dest {
512 struct list_head d_list; /* for table with all the dests */ 662 struct list_head d_list; /* for table with all the dests */
513 663
514 u16 af; /* address family */ 664 u16 af; /* address family */
515 union nf_inet_addr addr; /* IP address of the server */
516 __be16 port; /* port number of the server */ 665 __be16 port; /* port number of the server */
666 union nf_inet_addr addr; /* IP address of the server */
517 volatile unsigned flags; /* dest status flags */ 667 volatile unsigned flags; /* dest status flags */
518 atomic_t conn_flags; /* flags to copy to conn */ 668 atomic_t conn_flags; /* flags to copy to conn */
519 atomic_t weight; /* server weight */ 669 atomic_t weight; /* server weight */
@@ -540,8 +690,8 @@ struct ip_vs_dest {
540 /* for virtual service */ 690 /* for virtual service */
541 struct ip_vs_service *svc; /* service it belongs to */ 691 struct ip_vs_service *svc; /* service it belongs to */
542 __u16 protocol; /* which protocol (TCP/UDP) */ 692 __u16 protocol; /* which protocol (TCP/UDP) */
543 union nf_inet_addr vaddr; /* virtual IP address */
544 __be16 vport; /* virtual port number */ 693 __be16 vport; /* virtual port number */
694 union nf_inet_addr vaddr; /* virtual IP address */
545 __u32 vfwmark; /* firewall mark of service */ 695 __u32 vfwmark; /* firewall mark of service */
546}; 696};
547 697
@@ -676,13 +826,14 @@ enum {
676 IP_VS_DIR_LAST, 826 IP_VS_DIR_LAST,
677}; 827};
678 828
679static inline void ip_vs_conn_fill_param(int af, int protocol, 829static inline void ip_vs_conn_fill_param(struct net *net, int af, int protocol,
680 const union nf_inet_addr *caddr, 830 const union nf_inet_addr *caddr,
681 __be16 cport, 831 __be16 cport,
682 const union nf_inet_addr *vaddr, 832 const union nf_inet_addr *vaddr,
683 __be16 vport, 833 __be16 vport,
684 struct ip_vs_conn_param *p) 834 struct ip_vs_conn_param *p)
685{ 835{
836 p->net = net;
686 p->af = af; 837 p->af = af;
687 p->protocol = protocol; 838 p->protocol = protocol;
688 p->caddr = caddr; 839 p->caddr = caddr;
@@ -697,7 +848,6 @@ struct ip_vs_conn *ip_vs_conn_in_get(const struct ip_vs_conn_param *p);
697struct ip_vs_conn *ip_vs_ct_in_get(const struct ip_vs_conn_param *p); 848struct ip_vs_conn *ip_vs_ct_in_get(const struct ip_vs_conn_param *p);
698 849
699struct ip_vs_conn * ip_vs_conn_in_get_proto(int af, const struct sk_buff *skb, 850struct ip_vs_conn * ip_vs_conn_in_get_proto(int af, const struct sk_buff *skb,
700 struct ip_vs_protocol *pp,
701 const struct ip_vs_iphdr *iph, 851 const struct ip_vs_iphdr *iph,
702 unsigned int proto_off, 852 unsigned int proto_off,
703 int inverse); 853 int inverse);
@@ -705,7 +855,6 @@ struct ip_vs_conn * ip_vs_conn_in_get_proto(int af, const struct sk_buff *skb,
705struct ip_vs_conn *ip_vs_conn_out_get(const struct ip_vs_conn_param *p); 855struct ip_vs_conn *ip_vs_conn_out_get(const struct ip_vs_conn_param *p);
706 856
707struct ip_vs_conn * ip_vs_conn_out_get_proto(int af, const struct sk_buff *skb, 857struct ip_vs_conn * ip_vs_conn_out_get_proto(int af, const struct sk_buff *skb,
708 struct ip_vs_protocol *pp,
709 const struct ip_vs_iphdr *iph, 858 const struct ip_vs_iphdr *iph,
710 unsigned int proto_off, 859 unsigned int proto_off,
711 int inverse); 860 int inverse);
@@ -726,9 +875,9 @@ extern void ip_vs_conn_expire_now(struct ip_vs_conn *cp);
726 875
727extern const char * ip_vs_state_name(__u16 proto, int state); 876extern const char * ip_vs_state_name(__u16 proto, int state);
728 877
729extern void ip_vs_tcp_conn_listen(struct ip_vs_conn *cp); 878extern void ip_vs_tcp_conn_listen(struct net *net, struct ip_vs_conn *cp);
730extern int ip_vs_check_template(struct ip_vs_conn *ct); 879extern int ip_vs_check_template(struct ip_vs_conn *ct);
731extern void ip_vs_random_dropentry(void); 880extern void ip_vs_random_dropentry(struct net *net);
732extern int ip_vs_conn_init(void); 881extern int ip_vs_conn_init(void);
733extern void ip_vs_conn_cleanup(void); 882extern void ip_vs_conn_cleanup(void);
734 883
@@ -798,12 +947,12 @@ ip_vs_control_add(struct ip_vs_conn *cp, struct ip_vs_conn *ctl_cp)
798 * (from ip_vs_app.c) 947 * (from ip_vs_app.c)
799 */ 948 */
800#define IP_VS_APP_MAX_PORTS 8 949#define IP_VS_APP_MAX_PORTS 8
801extern int register_ip_vs_app(struct ip_vs_app *app); 950extern int register_ip_vs_app(struct net *net, struct ip_vs_app *app);
802extern void unregister_ip_vs_app(struct ip_vs_app *app); 951extern void unregister_ip_vs_app(struct net *net, struct ip_vs_app *app);
803extern int ip_vs_bind_app(struct ip_vs_conn *cp, struct ip_vs_protocol *pp); 952extern int ip_vs_bind_app(struct ip_vs_conn *cp, struct ip_vs_protocol *pp);
804extern void ip_vs_unbind_app(struct ip_vs_conn *cp); 953extern void ip_vs_unbind_app(struct ip_vs_conn *cp);
805extern int 954extern int register_ip_vs_app_inc(struct net *net, struct ip_vs_app *app,
806register_ip_vs_app_inc(struct ip_vs_app *app, __u16 proto, __u16 port); 955 __u16 proto, __u16 port);
807extern int ip_vs_app_inc_get(struct ip_vs_app *inc); 956extern int ip_vs_app_inc_get(struct ip_vs_app *inc);
808extern void ip_vs_app_inc_put(struct ip_vs_app *inc); 957extern void ip_vs_app_inc_put(struct ip_vs_app *inc);
809 958
@@ -836,7 +985,7 @@ static inline void ip_vs_pe_put(const struct ip_vs_pe *pe)
836 */ 985 */
837extern int ip_vs_protocol_init(void); 986extern int ip_vs_protocol_init(void);
838extern void ip_vs_protocol_cleanup(void); 987extern void ip_vs_protocol_cleanup(void);
839extern void ip_vs_protocol_timeout_change(int flags); 988extern void ip_vs_protocol_timeout_change(struct netns_ipvs *ipvs, int flags);
840extern int *ip_vs_create_timeout_table(int *table, int size); 989extern int *ip_vs_create_timeout_table(int *table, int size);
841extern int 990extern int
842ip_vs_set_state_timeout(int *table, int num, const char *const *names, 991ip_vs_set_state_timeout(int *table, int num, const char *const *names,
@@ -866,28 +1015,21 @@ extern struct ip_vs_scheduler *ip_vs_scheduler_get(const char *sched_name);
866extern void ip_vs_scheduler_put(struct ip_vs_scheduler *scheduler); 1015extern void ip_vs_scheduler_put(struct ip_vs_scheduler *scheduler);
867extern struct ip_vs_conn * 1016extern struct ip_vs_conn *
868ip_vs_schedule(struct ip_vs_service *svc, struct sk_buff *skb, 1017ip_vs_schedule(struct ip_vs_service *svc, struct sk_buff *skb,
869 struct ip_vs_protocol *pp, int *ignored); 1018 struct ip_vs_proto_data *pd, int *ignored);
870extern int ip_vs_leave(struct ip_vs_service *svc, struct sk_buff *skb, 1019extern int ip_vs_leave(struct ip_vs_service *svc, struct sk_buff *skb,
871 struct ip_vs_protocol *pp); 1020 struct ip_vs_proto_data *pd);
872 1021
873 1022
874/* 1023/*
875 * IPVS control data and functions (from ip_vs_ctl.c) 1024 * IPVS control data and functions (from ip_vs_ctl.c)
876 */ 1025 */
877extern int sysctl_ip_vs_cache_bypass;
878extern int sysctl_ip_vs_expire_nodest_conn;
879extern int sysctl_ip_vs_expire_quiescent_template;
880extern int sysctl_ip_vs_sync_threshold[2];
881extern int sysctl_ip_vs_nat_icmp_send;
882extern int sysctl_ip_vs_conntrack;
883extern int sysctl_ip_vs_snat_reroute;
884extern struct ip_vs_stats ip_vs_stats; 1026extern struct ip_vs_stats ip_vs_stats;
885extern const struct ctl_path net_vs_ctl_path[]; 1027extern const struct ctl_path net_vs_ctl_path[];
886extern int sysctl_ip_vs_sync_ver; 1028extern int sysctl_ip_vs_sync_ver;
887 1029
888extern void ip_vs_sync_switch_mode(int mode); 1030extern void ip_vs_sync_switch_mode(struct net *net, int mode);
889extern struct ip_vs_service * 1031extern struct ip_vs_service *
890ip_vs_service_get(int af, __u32 fwmark, __u16 protocol, 1032ip_vs_service_get(struct net *net, int af, __u32 fwmark, __u16 protocol,
891 const union nf_inet_addr *vaddr, __be16 vport); 1033 const union nf_inet_addr *vaddr, __be16 vport);
892 1034
893static inline void ip_vs_service_put(struct ip_vs_service *svc) 1035static inline void ip_vs_service_put(struct ip_vs_service *svc)
@@ -896,7 +1038,7 @@ static inline void ip_vs_service_put(struct ip_vs_service *svc)
896} 1038}
897 1039
898extern struct ip_vs_dest * 1040extern struct ip_vs_dest *
899ip_vs_lookup_real_service(int af, __u16 protocol, 1041ip_vs_lookup_real_service(struct net *net, int af, __u16 protocol,
900 const union nf_inet_addr *daddr, __be16 dport); 1042 const union nf_inet_addr *daddr, __be16 dport);
901 1043
902extern int ip_vs_use_count_inc(void); 1044extern int ip_vs_use_count_inc(void);
@@ -904,9 +1046,9 @@ extern void ip_vs_use_count_dec(void);
904extern int ip_vs_control_init(void); 1046extern int ip_vs_control_init(void);
905extern void ip_vs_control_cleanup(void); 1047extern void ip_vs_control_cleanup(void);
906extern struct ip_vs_dest * 1048extern struct ip_vs_dest *
907ip_vs_find_dest(int af, const union nf_inet_addr *daddr, __be16 dport, 1049ip_vs_find_dest(struct net *net, int af, const union nf_inet_addr *daddr,
908 const union nf_inet_addr *vaddr, __be16 vport, __u16 protocol, 1050 __be16 dport, const union nf_inet_addr *vaddr, __be16 vport,
909 __u32 fwmark); 1051 __u16 protocol, __u32 fwmark);
910extern struct ip_vs_dest *ip_vs_try_bind_dest(struct ip_vs_conn *cp); 1052extern struct ip_vs_dest *ip_vs_try_bind_dest(struct ip_vs_conn *cp);
911 1053
912 1054
@@ -914,14 +1056,12 @@ extern struct ip_vs_dest *ip_vs_try_bind_dest(struct ip_vs_conn *cp);
914 * IPVS sync daemon data and function prototypes 1056 * IPVS sync daemon data and function prototypes
915 * (from ip_vs_sync.c) 1057 * (from ip_vs_sync.c)
916 */ 1058 */
917extern volatile int ip_vs_sync_state; 1059extern int start_sync_thread(struct net *net, int state, char *mcast_ifn,
918extern volatile int ip_vs_master_syncid; 1060 __u8 syncid);
919extern volatile int ip_vs_backup_syncid; 1061extern int stop_sync_thread(struct net *net, int state);
920extern char ip_vs_master_mcast_ifn[IP_VS_IFNAME_MAXLEN]; 1062extern void ip_vs_sync_conn(struct net *net, struct ip_vs_conn *cp);
921extern char ip_vs_backup_mcast_ifn[IP_VS_IFNAME_MAXLEN]; 1063extern int ip_vs_sync_init(void);
922extern int start_sync_thread(int state, char *mcast_ifn, __u8 syncid); 1064extern void ip_vs_sync_cleanup(void);
923extern int stop_sync_thread(int state);
924extern void ip_vs_sync_conn(struct ip_vs_conn *cp);
925 1065
926 1066
927/* 1067/*
@@ -929,8 +1069,8 @@ extern void ip_vs_sync_conn(struct ip_vs_conn *cp);
929 */ 1069 */
930extern int ip_vs_estimator_init(void); 1070extern int ip_vs_estimator_init(void);
931extern void ip_vs_estimator_cleanup(void); 1071extern void ip_vs_estimator_cleanup(void);
932extern void ip_vs_new_estimator(struct ip_vs_stats *stats); 1072extern void ip_vs_new_estimator(struct net *net, struct ip_vs_stats *stats);
933extern void ip_vs_kill_estimator(struct ip_vs_stats *stats); 1073extern void ip_vs_kill_estimator(struct net *net, struct ip_vs_stats *stats);
934extern void ip_vs_zero_estimator(struct ip_vs_stats *stats); 1074extern void ip_vs_zero_estimator(struct ip_vs_stats *stats);
935 1075
936/* 1076/*
@@ -972,11 +1112,13 @@ extern int ip_vs_icmp_xmit_v6
972extern int ip_vs_drop_rate; 1112extern int ip_vs_drop_rate;
973extern int ip_vs_drop_counter; 1113extern int ip_vs_drop_counter;
974 1114
975static __inline__ int ip_vs_todrop(void) 1115static inline int ip_vs_todrop(struct netns_ipvs *ipvs)
976{ 1116{
977 if (!ip_vs_drop_rate) return 0; 1117 if (!ipvs->drop_rate)
978 if (--ip_vs_drop_counter > 0) return 0; 1118 return 0;
979 ip_vs_drop_counter = ip_vs_drop_rate; 1119 if (--ipvs->drop_counter > 0)
1120 return 0;
1121 ipvs->drop_counter = ipvs->drop_rate;
980 return 1; 1122 return 1;
981} 1123}
982 1124
@@ -1064,9 +1206,9 @@ static inline void ip_vs_notrack(struct sk_buff *skb)
1064 * Netfilter connection tracking 1206 * Netfilter connection tracking
1065 * (from ip_vs_nfct.c) 1207 * (from ip_vs_nfct.c)
1066 */ 1208 */
1067static inline int ip_vs_conntrack_enabled(void) 1209static inline int ip_vs_conntrack_enabled(struct netns_ipvs *ipvs)
1068{ 1210{
1069 return sysctl_ip_vs_conntrack; 1211 return ipvs->sysctl_conntrack;
1070} 1212}
1071 1213
1072extern void ip_vs_update_conntrack(struct sk_buff *skb, struct ip_vs_conn *cp, 1214extern void ip_vs_update_conntrack(struct sk_buff *skb, struct ip_vs_conn *cp,
@@ -1079,7 +1221,7 @@ extern void ip_vs_conn_drop_conntrack(struct ip_vs_conn *cp);
1079 1221
1080#else 1222#else
1081 1223
1082static inline int ip_vs_conntrack_enabled(void) 1224static inline int ip_vs_conntrack_enabled(struct netns_ipvs *ipvs)
1083{ 1225{
1084 return 0; 1226 return 0;
1085} 1227}