aboutsummaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
authorSimon Horman <horms@verge.net.au>2014-09-29 21:50:06 -0400
committerPablo Neira Ayuso <pablo@netfilter.org>2014-10-02 12:30:58 -0400
commit07dcc686fa8f6667dec4696804cdb43a90267b9a (patch)
tree56fb37eb652ad4fe203669aa171c94a4a9df0c48 /include/net
parent4b7fd5d97ee6e599247b4a55122ca6ba80c8148d (diff)
ipvs: Clean up comment style in ip_vs.h
* Consistently use the multi-line comment style for networking code: /* This * That * The other thing */ * Use single-line comment style for comments with only one line of text. * In general follow the leading '*' of each line of a comment with a single space and then text. * Add missing line break between functions, remove double line break, align comments to previous lines whenever possible. Reported-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> Signed-off-by: Simon Horman <horms@verge.net.au> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'include/net')
-rw-r--r--include/net/ip_vs.h214
1 files changed, 75 insertions, 139 deletions
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index 576d7f0bed5d..615b20b58545 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -1,6 +1,5 @@
1/* 1/* IP Virtual Server
2 * IP Virtual Server 2 * data structure and functionality definitions
3 * data structure and functionality definitions
4 */ 3 */
5 4
6#ifndef _NET_IP_VS_H 5#ifndef _NET_IP_VS_H
@@ -12,7 +11,7 @@
12 11
13#include <linux/list.h> /* for struct list_head */ 12#include <linux/list.h> /* for struct list_head */
14#include <linux/spinlock.h> /* for struct rwlock_t */ 13#include <linux/spinlock.h> /* for struct rwlock_t */
15#include <linux/atomic.h> /* for struct atomic_t */ 14#include <linux/atomic.h> /* for struct atomic_t */
16#include <linux/compiler.h> 15#include <linux/compiler.h>
17#include <linux/timer.h> 16#include <linux/timer.h>
18#include <linux/bug.h> 17#include <linux/bug.h>
@@ -30,15 +29,13 @@
30#endif 29#endif
31#include <net/net_namespace.h> /* Netw namespace */ 30#include <net/net_namespace.h> /* Netw namespace */
32 31
33/* 32/* Generic access of ipvs struct */
34 * Generic access of ipvs struct
35 */
36static inline struct netns_ipvs *net_ipvs(struct net* net) 33static inline struct netns_ipvs *net_ipvs(struct net* net)
37{ 34{
38 return net->ipvs; 35 return net->ipvs;
39} 36}
40/* 37
41 * Get net ptr from skb in traffic cases 38/* Get net ptr from skb in traffic cases
42 * use skb_sknet when call is from userland (ioctl or netlink) 39 * use skb_sknet when call is from userland (ioctl or netlink)
43 */ 40 */
44static inline struct net *skb_net(const struct sk_buff *skb) 41static inline struct net *skb_net(const struct sk_buff *skb)
@@ -90,8 +87,8 @@ static inline struct net *skb_sknet(const struct sk_buff *skb)
90 return &init_net; 87 return &init_net;
91#endif 88#endif
92} 89}
93/* 90
94 * This one needed for single_open_net since net is stored directly in 91/* This one needed for single_open_net since net is stored directly in
95 * private not as a struct i.e. seq_file_net can't be used. 92 * private not as a struct i.e. seq_file_net can't be used.
96 */ 93 */
97static inline struct net *seq_file_single_net(struct seq_file *seq) 94static inline struct net *seq_file_single_net(struct seq_file *seq)
@@ -108,7 +105,7 @@ extern int ip_vs_conn_tab_size;
108 105
109struct ip_vs_iphdr { 106struct ip_vs_iphdr {
110 __u32 len; /* IPv4 simply where L4 starts 107 __u32 len; /* IPv4 simply where L4 starts
111 IPv6 where L4 Transport Header starts */ 108 * IPv6 where L4 Transport Header starts */
112 __u16 fragoffs; /* IPv6 fragment offset, 0 if first frag (or not frag)*/ 109 __u16 fragoffs; /* IPv6 fragment offset, 0 if first frag (or not frag)*/
113 __s16 protocol; 110 __s16 protocol;
114 __s32 flags; 111 __s32 flags;
@@ -304,16 +301,11 @@ static inline const char *ip_vs_dbg_addr(int af, char *buf, size_t buf_len,
304#define LeaveFunction(level) do {} while (0) 301#define LeaveFunction(level) do {} while (0)
305#endif 302#endif
306 303
307 304/* The port number of FTP service (in network order). */
308/*
309 * The port number of FTP service (in network order).
310 */
311#define FTPPORT cpu_to_be16(21) 305#define FTPPORT cpu_to_be16(21)
312#define FTPDATA cpu_to_be16(20) 306#define FTPDATA cpu_to_be16(20)
313 307
314/* 308/* TCP State Values */
315 * TCP State Values
316 */
317enum { 309enum {
318 IP_VS_TCP_S_NONE = 0, 310 IP_VS_TCP_S_NONE = 0,
319 IP_VS_TCP_S_ESTABLISHED, 311 IP_VS_TCP_S_ESTABLISHED,
@@ -329,25 +321,19 @@ enum {
329 IP_VS_TCP_S_LAST 321 IP_VS_TCP_S_LAST
330}; 322};
331 323
332/* 324/* UDP State Values */
333 * UDP State Values
334 */
335enum { 325enum {
336 IP_VS_UDP_S_NORMAL, 326 IP_VS_UDP_S_NORMAL,
337 IP_VS_UDP_S_LAST, 327 IP_VS_UDP_S_LAST,
338}; 328};
339 329
340/* 330/* ICMP State Values */
341 * ICMP State Values
342 */
343enum { 331enum {
344 IP_VS_ICMP_S_NORMAL, 332 IP_VS_ICMP_S_NORMAL,
345 IP_VS_ICMP_S_LAST, 333 IP_VS_ICMP_S_LAST,
346}; 334};
347 335
348/* 336/* SCTP State Values */
349 * SCTP State Values
350 */
351enum ip_vs_sctp_states { 337enum ip_vs_sctp_states {
352 IP_VS_SCTP_S_NONE, 338 IP_VS_SCTP_S_NONE,
353 IP_VS_SCTP_S_INIT1, 339 IP_VS_SCTP_S_INIT1,
@@ -366,21 +352,18 @@ enum ip_vs_sctp_states {
366 IP_VS_SCTP_S_LAST 352 IP_VS_SCTP_S_LAST
367}; 353};
368 354
369/* 355/* Delta sequence info structure
370 * Delta sequence info structure 356 * Each ip_vs_conn has 2 (output AND input seq. changes).
371 * Each ip_vs_conn has 2 (output AND input seq. changes). 357 * Only used in the VS/NAT.
372 * Only used in the VS/NAT.
373 */ 358 */
374struct ip_vs_seq { 359struct ip_vs_seq {
375 __u32 init_seq; /* Add delta from this seq */ 360 __u32 init_seq; /* Add delta from this seq */
376 __u32 delta; /* Delta in sequence numbers */ 361 __u32 delta; /* Delta in sequence numbers */
377 __u32 previous_delta; /* Delta in sequence numbers 362 __u32 previous_delta; /* Delta in sequence numbers
378 before last resized pkt */ 363 * before last resized pkt */
379}; 364};
380 365
381/* 366/* counters per cpu */
382 * counters per cpu
383 */
384struct ip_vs_counters { 367struct ip_vs_counters {
385 __u32 conns; /* connections scheduled */ 368 __u32 conns; /* connections scheduled */
386 __u32 inpkts; /* incoming packets */ 369 __u32 inpkts; /* incoming packets */
@@ -388,17 +371,13 @@ struct ip_vs_counters {
388 __u64 inbytes; /* incoming bytes */ 371 __u64 inbytes; /* incoming bytes */
389 __u64 outbytes; /* outgoing bytes */ 372 __u64 outbytes; /* outgoing bytes */
390}; 373};
391/* 374/* Stats per cpu */
392 * Stats per cpu
393 */
394struct ip_vs_cpu_stats { 375struct ip_vs_cpu_stats {
395 struct ip_vs_counters ustats; 376 struct ip_vs_counters ustats;
396 struct u64_stats_sync syncp; 377 struct u64_stats_sync syncp;
397}; 378};
398 379
399/* 380/* IPVS statistics objects */
400 * IPVS statistics objects
401 */
402struct ip_vs_estimator { 381struct ip_vs_estimator {
403 struct list_head list; 382 struct list_head list;
404 383
@@ -491,9 +470,7 @@ struct ip_vs_protocol {
491 void (*timeout_change)(struct ip_vs_proto_data *pd, int flags); 470 void (*timeout_change)(struct ip_vs_proto_data *pd, int flags);
492}; 471};
493 472
494/* 473/* protocol data per netns */
495 * protocol data per netns
496 */
497struct ip_vs_proto_data { 474struct ip_vs_proto_data {
498 struct ip_vs_proto_data *next; 475 struct ip_vs_proto_data *next;
499 struct ip_vs_protocol *pp; 476 struct ip_vs_protocol *pp;
@@ -520,9 +497,7 @@ struct ip_vs_conn_param {
520 __u8 pe_data_len; 497 __u8 pe_data_len;
521}; 498};
522 499
523/* 500/* IP_VS structure allocated for each dynamically scheduled connection */
524 * IP_VS structure allocated for each dynamically scheduled connection
525 */
526struct ip_vs_conn { 501struct ip_vs_conn {
527 struct hlist_node c_list; /* hashed list heads */ 502 struct hlist_node c_list; /* hashed list heads */
528 /* Protocol, addresses and port numbers */ 503 /* Protocol, addresses and port numbers */
@@ -561,17 +536,18 @@ struct ip_vs_conn {
561 struct ip_vs_dest *dest; /* real server */ 536 struct ip_vs_dest *dest; /* real server */
562 atomic_t in_pkts; /* incoming packet counter */ 537 atomic_t in_pkts; /* incoming packet counter */
563 538
564 /* packet transmitter for different forwarding methods. If it 539 /* Packet transmitter for different forwarding methods. If it
565 mangles the packet, it must return NF_DROP or better NF_STOLEN, 540 * mangles the packet, it must return NF_DROP or better NF_STOLEN,
566 otherwise this must be changed to a sk_buff **. 541 * otherwise this must be changed to a sk_buff **.
567 NF_ACCEPT can be returned when destination is local. 542 * NF_ACCEPT can be returned when destination is local.
568 */ 543 */
569 int (*packet_xmit)(struct sk_buff *skb, struct ip_vs_conn *cp, 544 int (*packet_xmit)(struct sk_buff *skb, struct ip_vs_conn *cp,
570 struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph); 545 struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph);
571 546
572 /* Note: we can group the following members into a structure, 547 /* Note: we can group the following members into a structure,
573 in order to save more space, and the following members are 548 * in order to save more space, and the following members are
574 only used in VS/NAT anyway */ 549 * only used in VS/NAT anyway
550 */
575 struct ip_vs_app *app; /* bound ip_vs_app object */ 551 struct ip_vs_app *app; /* bound ip_vs_app object */
576 void *app_data; /* Application private data */ 552 void *app_data; /* Application private data */
577 struct ip_vs_seq in_seq; /* incoming seq. struct */ 553 struct ip_vs_seq in_seq; /* incoming seq. struct */
@@ -584,9 +560,7 @@ struct ip_vs_conn {
584 struct rcu_head rcu_head; 560 struct rcu_head rcu_head;
585}; 561};
586 562
587/* 563/* To save some memory in conn table when name space is disabled. */
588 * To save some memory in conn table when name space is disabled.
589 */
590static inline struct net *ip_vs_conn_net(const struct ip_vs_conn *cp) 564static inline struct net *ip_vs_conn_net(const struct ip_vs_conn *cp)
591{ 565{
592#ifdef CONFIG_NET_NS 566#ifdef CONFIG_NET_NS
@@ -595,6 +569,7 @@ static inline struct net *ip_vs_conn_net(const struct ip_vs_conn *cp)
595 return &init_net; 569 return &init_net;
596#endif 570#endif
597} 571}
572
598static inline void ip_vs_conn_net_set(struct ip_vs_conn *cp, struct net *net) 573static inline void ip_vs_conn_net_set(struct ip_vs_conn *cp, struct net *net)
599{ 574{
600#ifdef CONFIG_NET_NS 575#ifdef CONFIG_NET_NS
@@ -612,13 +587,12 @@ static inline int ip_vs_conn_net_eq(const struct ip_vs_conn *cp,
612#endif 587#endif
613} 588}
614 589
615/* 590/* Extended internal versions of struct ip_vs_service_user and ip_vs_dest_user
616 * Extended internal versions of struct ip_vs_service_user and 591 * for IPv6 support.
617 * ip_vs_dest_user for IPv6 support.
618 * 592 *
619 * We need these to conveniently pass around service and destination 593 * We need these to conveniently pass around service and destination
620 * options, but unfortunately, we also need to keep the old definitions to 594 * options, but unfortunately, we also need to keep the old definitions to
621 * maintain userspace backwards compatibility for the setsockopt interface. 595 * maintain userspace backwards compatibility for the setsockopt interface.
622 */ 596 */
623struct ip_vs_service_user_kern { 597struct ip_vs_service_user_kern {
624 /* virtual service addresses */ 598 /* virtual service addresses */
@@ -656,8 +630,8 @@ struct ip_vs_dest_user_kern {
656 630
657 631
658/* 632/*
659 * The information about the virtual service offered to the net 633 * The information about the virtual service offered to the net and the
660 * and the forwarding entries 634 * forwarding entries.
661 */ 635 */
662struct ip_vs_service { 636struct ip_vs_service {
663 struct hlist_node s_list; /* for normal service table */ 637 struct hlist_node s_list; /* for normal service table */
@@ -697,9 +671,8 @@ struct ip_vs_dest_dst {
697 struct rcu_head rcu_head; 671 struct rcu_head rcu_head;
698}; 672};
699 673
700/* 674/* The real server destination forwarding entry with ip address, port number,
701 * The real server destination forwarding entry 675 * and so on.
702 * with ip address, port number, and so on.
703 */ 676 */
704struct ip_vs_dest { 677struct ip_vs_dest {
705 struct list_head n_list; /* for the dests in the service */ 678 struct list_head n_list; /* for the dests in the service */
@@ -738,10 +711,7 @@ struct ip_vs_dest {
738 unsigned int in_rs_table:1; /* we are in rs_table */ 711 unsigned int in_rs_table:1; /* we are in rs_table */
739}; 712};
740 713
741 714/* The scheduler object */
742/*
743 * The scheduler object
744 */
745struct ip_vs_scheduler { 715struct ip_vs_scheduler {
746 struct list_head n_list; /* d-linked list head */ 716 struct list_head n_list; /* d-linked list head */
747 char *name; /* scheduler name */ 717 char *name; /* scheduler name */
@@ -781,9 +751,7 @@ struct ip_vs_pe {
781 int (*show_pe_data)(const struct ip_vs_conn *cp, char *buf); 751 int (*show_pe_data)(const struct ip_vs_conn *cp, char *buf);
782}; 752};
783 753
784/* 754/* The application module object (a.k.a. app incarnation) */
785 * The application module object (a.k.a. app incarnation)
786 */
787struct ip_vs_app { 755struct ip_vs_app {
788 struct list_head a_list; /* member in app list */ 756 struct list_head a_list; /* member in app list */
789 int type; /* IP_VS_APP_TYPE_xxx */ 757 int type; /* IP_VS_APP_TYPE_xxx */
@@ -799,16 +767,14 @@ struct ip_vs_app {
799 atomic_t usecnt; /* usage counter */ 767 atomic_t usecnt; /* usage counter */
800 struct rcu_head rcu_head; 768 struct rcu_head rcu_head;
801 769
802 /* 770 /* output hook: Process packet in inout direction, diff set for TCP.
803 * output hook: Process packet in inout direction, diff set for TCP.
804 * Return: 0=Error, 1=Payload Not Mangled/Mangled but checksum is ok, 771 * Return: 0=Error, 1=Payload Not Mangled/Mangled but checksum is ok,
805 * 2=Mangled but checksum was not updated 772 * 2=Mangled but checksum was not updated
806 */ 773 */
807 int (*pkt_out)(struct ip_vs_app *, struct ip_vs_conn *, 774 int (*pkt_out)(struct ip_vs_app *, struct ip_vs_conn *,
808 struct sk_buff *, int *diff); 775 struct sk_buff *, int *diff);
809 776
810 /* 777 /* input hook: Process packet in outin direction, diff set for TCP.
811 * input hook: Process packet in outin direction, diff set for TCP.
812 * Return: 0=Error, 1=Payload Not Mangled/Mangled but checksum is ok, 778 * Return: 0=Error, 1=Payload Not Mangled/Mangled but checksum is ok,
813 * 2=Mangled but checksum was not updated 779 * 2=Mangled but checksum was not updated
814 */ 780 */
@@ -867,9 +833,7 @@ struct ipvs_master_sync_state {
867struct netns_ipvs { 833struct netns_ipvs {
868 int gen; /* Generation */ 834 int gen; /* Generation */
869 int enable; /* enable like nf_hooks do */ 835 int enable; /* enable like nf_hooks do */
870 /* 836 /* Hash table: for real service lookups */
871 * Hash table: for real service lookups
872 */
873 #define IP_VS_RTAB_BITS 4 837 #define IP_VS_RTAB_BITS 4
874 #define IP_VS_RTAB_SIZE (1 << IP_VS_RTAB_BITS) 838 #define IP_VS_RTAB_SIZE (1 << IP_VS_RTAB_BITS)
875 #define IP_VS_RTAB_MASK (IP_VS_RTAB_SIZE - 1) 839 #define IP_VS_RTAB_MASK (IP_VS_RTAB_SIZE - 1)
@@ -903,7 +867,7 @@ struct netns_ipvs {
903 struct list_head sctp_apps[SCTP_APP_TAB_SIZE]; 867 struct list_head sctp_apps[SCTP_APP_TAB_SIZE];
904#endif 868#endif
905 /* ip_vs_conn */ 869 /* ip_vs_conn */
906 atomic_t conn_count; /* connection counter */ 870 atomic_t conn_count; /* connection counter */
907 871
908 /* ip_vs_ctl */ 872 /* ip_vs_ctl */
909 struct ip_vs_stats tot_stats; /* Statistics & est. */ 873 struct ip_vs_stats tot_stats; /* Statistics & est. */
@@ -990,9 +954,9 @@ struct netns_ipvs {
990 char backup_mcast_ifn[IP_VS_IFNAME_MAXLEN]; 954 char backup_mcast_ifn[IP_VS_IFNAME_MAXLEN];
991 /* net name space ptr */ 955 /* net name space ptr */
992 struct net *net; /* Needed by timer routines */ 956 struct net *net; /* Needed by timer routines */
993 /* Number of heterogeneous destinations, needed because 957 /* Number of heterogeneous destinations, needed becaus heterogeneous
994 * heterogeneous are not supported when synchronization is 958 * are not supported when synchronization is enabled.
995 * enabled */ 959 */
996 unsigned int mixed_address_family_dests; 960 unsigned int mixed_address_family_dests;
997}; 961};
998 962
@@ -1147,9 +1111,8 @@ static inline int sysctl_backup_only(struct netns_ipvs *ipvs)
1147 1111
1148#endif 1112#endif
1149 1113
1150/* 1114/* IPVS core functions
1151 * IPVS core functions 1115 * (from ip_vs_core.c)
1152 * (from ip_vs_core.c)
1153 */ 1116 */
1154const char *ip_vs_proto_name(unsigned int proto); 1117const char *ip_vs_proto_name(unsigned int proto);
1155void ip_vs_init_hash_table(struct list_head *table, int rows); 1118void ip_vs_init_hash_table(struct list_head *table, int rows);
@@ -1157,11 +1120,9 @@ void ip_vs_init_hash_table(struct list_head *table, int rows);
1157 1120
1158#define IP_VS_APP_TYPE_FTP 1 1121#define IP_VS_APP_TYPE_FTP 1
1159 1122
1160/* 1123/* ip_vs_conn handling functions
1161 * ip_vs_conn handling functions 1124 * (from ip_vs_conn.c)
1162 * (from ip_vs_conn.c)
1163 */ 1125 */
1164
1165enum { 1126enum {
1166 IP_VS_DIR_INPUT = 0, 1127 IP_VS_DIR_INPUT = 0,
1167 IP_VS_DIR_OUTPUT, 1128 IP_VS_DIR_OUTPUT,
@@ -1292,9 +1253,7 @@ ip_vs_control_add(struct ip_vs_conn *cp, struct ip_vs_conn *ctl_cp)
1292 atomic_inc(&ctl_cp->n_control); 1253 atomic_inc(&ctl_cp->n_control);
1293} 1254}
1294 1255
1295/* 1256/* IPVS netns init & cleanup functions */
1296 * IPVS netns init & cleanup functions
1297 */
1298int ip_vs_estimator_net_init(struct net *net); 1257int ip_vs_estimator_net_init(struct net *net);
1299int ip_vs_control_net_init(struct net *net); 1258int ip_vs_control_net_init(struct net *net);
1300int ip_vs_protocol_net_init(struct net *net); 1259int ip_vs_protocol_net_init(struct net *net);
@@ -1309,9 +1268,8 @@ void ip_vs_estimator_net_cleanup(struct net *net);
1309void ip_vs_sync_net_cleanup(struct net *net); 1268void ip_vs_sync_net_cleanup(struct net *net);
1310void ip_vs_service_net_cleanup(struct net *net); 1269void ip_vs_service_net_cleanup(struct net *net);
1311 1270
1312/* 1271/* IPVS application functions
1313 * IPVS application functions 1272 * (from ip_vs_app.c)
1314 * (from ip_vs_app.c)
1315 */ 1273 */
1316#define IP_VS_APP_MAX_PORTS 8 1274#define IP_VS_APP_MAX_PORTS 8
1317struct ip_vs_app *register_ip_vs_app(struct net *net, struct ip_vs_app *app); 1275struct ip_vs_app *register_ip_vs_app(struct net *net, struct ip_vs_app *app);
@@ -1331,9 +1289,7 @@ int unregister_ip_vs_pe(struct ip_vs_pe *pe);
1331struct ip_vs_pe *ip_vs_pe_getbyname(const char *name); 1289struct ip_vs_pe *ip_vs_pe_getbyname(const char *name);
1332struct ip_vs_pe *__ip_vs_pe_getbyname(const char *pe_name); 1290struct ip_vs_pe *__ip_vs_pe_getbyname(const char *pe_name);
1333 1291
1334/* 1292/* Use a #define to avoid all of module.h just for these trivial ops */
1335 * Use a #define to avoid all of module.h just for these trivial ops
1336 */
1337#define ip_vs_pe_get(pe) \ 1293#define ip_vs_pe_get(pe) \
1338 if (pe && pe->module) \ 1294 if (pe && pe->module) \
1339 __module_get(pe->module); 1295 __module_get(pe->module);
@@ -1342,9 +1298,7 @@ struct ip_vs_pe *__ip_vs_pe_getbyname(const char *pe_name);
1342 if (pe && pe->module) \ 1298 if (pe && pe->module) \
1343 module_put(pe->module); 1299 module_put(pe->module);
1344 1300
1345/* 1301/* IPVS protocol functions (from ip_vs_proto.c) */
1346 * IPVS protocol functions (from ip_vs_proto.c)
1347 */
1348int ip_vs_protocol_init(void); 1302int ip_vs_protocol_init(void);
1349void ip_vs_protocol_cleanup(void); 1303void ip_vs_protocol_cleanup(void);
1350void ip_vs_protocol_timeout_change(struct netns_ipvs *ipvs, int flags); 1304void ip_vs_protocol_timeout_change(struct netns_ipvs *ipvs, int flags);
@@ -1362,9 +1316,8 @@ extern struct ip_vs_protocol ip_vs_protocol_esp;
1362extern struct ip_vs_protocol ip_vs_protocol_ah; 1316extern struct ip_vs_protocol ip_vs_protocol_ah;
1363extern struct ip_vs_protocol ip_vs_protocol_sctp; 1317extern struct ip_vs_protocol ip_vs_protocol_sctp;
1364 1318
1365/* 1319/* Registering/unregistering scheduler functions
1366 * Registering/unregistering scheduler functions 1320 * (from ip_vs_sched.c)
1367 * (from ip_vs_sched.c)
1368 */ 1321 */
1369int register_ip_vs_scheduler(struct ip_vs_scheduler *scheduler); 1322int register_ip_vs_scheduler(struct ip_vs_scheduler *scheduler);
1370int unregister_ip_vs_scheduler(struct ip_vs_scheduler *scheduler); 1323int unregister_ip_vs_scheduler(struct ip_vs_scheduler *scheduler);
@@ -1383,10 +1336,7 @@ int ip_vs_leave(struct ip_vs_service *svc, struct sk_buff *skb,
1383 1336
1384void ip_vs_scheduler_err(struct ip_vs_service *svc, const char *msg); 1337void ip_vs_scheduler_err(struct ip_vs_service *svc, const char *msg);
1385 1338
1386 1339/* IPVS control data and functions (from ip_vs_ctl.c) */
1387/*
1388 * IPVS control data and functions (from ip_vs_ctl.c)
1389 */
1390extern struct ip_vs_stats ip_vs_stats; 1340extern struct ip_vs_stats ip_vs_stats;
1391extern int sysctl_ip_vs_sync_ver; 1341extern int sysctl_ip_vs_sync_ver;
1392 1342
@@ -1427,26 +1377,21 @@ static inline void ip_vs_dest_put_and_free(struct ip_vs_dest *dest)
1427 kfree(dest); 1377 kfree(dest);
1428} 1378}
1429 1379
1430/* 1380/* IPVS sync daemon data and function prototypes
1431 * IPVS sync daemon data and function prototypes 1381 * (from ip_vs_sync.c)
1432 * (from ip_vs_sync.c)
1433 */ 1382 */
1434int start_sync_thread(struct net *net, int state, char *mcast_ifn, __u8 syncid); 1383int start_sync_thread(struct net *net, int state, char *mcast_ifn, __u8 syncid);
1435int stop_sync_thread(struct net *net, int state); 1384int stop_sync_thread(struct net *net, int state);
1436void ip_vs_sync_conn(struct net *net, struct ip_vs_conn *cp, int pkts); 1385void ip_vs_sync_conn(struct net *net, struct ip_vs_conn *cp, int pkts);
1437 1386
1438/* 1387/* IPVS rate estimator prototypes (from ip_vs_est.c) */
1439 * IPVS rate estimator prototypes (from ip_vs_est.c)
1440 */
1441void ip_vs_start_estimator(struct net *net, struct ip_vs_stats *stats); 1388void ip_vs_start_estimator(struct net *net, struct ip_vs_stats *stats);
1442void ip_vs_stop_estimator(struct net *net, struct ip_vs_stats *stats); 1389void ip_vs_stop_estimator(struct net *net, struct ip_vs_stats *stats);
1443void ip_vs_zero_estimator(struct ip_vs_stats *stats); 1390void ip_vs_zero_estimator(struct ip_vs_stats *stats);
1444void ip_vs_read_estimator(struct ip_vs_stats_user *dst, 1391void ip_vs_read_estimator(struct ip_vs_stats_user *dst,
1445 struct ip_vs_stats *stats); 1392 struct ip_vs_stats *stats);
1446 1393
1447/* 1394/* Various IPVS packet transmitters (from ip_vs_xmit.c) */
1448 * Various IPVS packet transmitters (from ip_vs_xmit.c)
1449 */
1450int ip_vs_null_xmit(struct sk_buff *skb, struct ip_vs_conn *cp, 1395int ip_vs_null_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
1451 struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph); 1396 struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph);
1452int ip_vs_bypass_xmit(struct sk_buff *skb, struct ip_vs_conn *cp, 1397int ip_vs_bypass_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
@@ -1477,12 +1422,10 @@ int ip_vs_icmp_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp,
1477#endif 1422#endif
1478 1423
1479#ifdef CONFIG_SYSCTL 1424#ifdef CONFIG_SYSCTL
1480/* 1425/* This is a simple mechanism to ignore packets when
1481 * This is a simple mechanism to ignore packets when 1426 * we are loaded. Just set ip_vs_drop_rate to 'n' and
1482 * we are loaded. Just set ip_vs_drop_rate to 'n' and 1427 * we start to drop 1/rate of the packets
1483 * we start to drop 1/rate of the packets
1484 */ 1428 */
1485
1486static inline int ip_vs_todrop(struct netns_ipvs *ipvs) 1429static inline int ip_vs_todrop(struct netns_ipvs *ipvs)
1487{ 1430{
1488 if (!ipvs->drop_rate) 1431 if (!ipvs->drop_rate)
@@ -1496,9 +1439,7 @@ static inline int ip_vs_todrop(struct netns_ipvs *ipvs)
1496static inline int ip_vs_todrop(struct netns_ipvs *ipvs) { return 0; } 1439static inline int ip_vs_todrop(struct netns_ipvs *ipvs) { return 0; }
1497#endif 1440#endif
1498 1441
1499/* 1442/* ip_vs_fwd_tag returns the forwarding tag of the connection */
1500 * ip_vs_fwd_tag returns the forwarding tag of the connection
1501 */
1502#define IP_VS_FWD_METHOD(cp) (cp->flags & IP_VS_CONN_F_FWD_MASK) 1443#define IP_VS_FWD_METHOD(cp) (cp->flags & IP_VS_CONN_F_FWD_MASK)
1503 1444
1504static inline char ip_vs_fwd_tag(struct ip_vs_conn *cp) 1445static inline char ip_vs_fwd_tag(struct ip_vs_conn *cp)
@@ -1557,9 +1498,7 @@ static inline __wsum ip_vs_check_diff2(__be16 old, __be16 new, __wsum oldsum)
1557 return csum_partial(diff, sizeof(diff), oldsum); 1498 return csum_partial(diff, sizeof(diff), oldsum);
1558} 1499}
1559 1500
1560/* 1501/* Forget current conntrack (unconfirmed) and attach notrack entry */
1561 * Forget current conntrack (unconfirmed) and attach notrack entry
1562 */
1563static inline void ip_vs_notrack(struct sk_buff *skb) 1502static inline void ip_vs_notrack(struct sk_buff *skb)
1564{ 1503{
1565#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 1504#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
@@ -1576,9 +1515,8 @@ static inline void ip_vs_notrack(struct sk_buff *skb)
1576} 1515}
1577 1516
1578#ifdef CONFIG_IP_VS_NFCT 1517#ifdef CONFIG_IP_VS_NFCT
1579/* 1518/* Netfilter connection tracking
1580 * Netfilter connection tracking 1519 * (from ip_vs_nfct.c)
1581 * (from ip_vs_nfct.c)
1582 */ 1520 */
1583static inline int ip_vs_conntrack_enabled(struct netns_ipvs *ipvs) 1521static inline int ip_vs_conntrack_enabled(struct netns_ipvs *ipvs)
1584{ 1522{
@@ -1617,14 +1555,12 @@ static inline int ip_vs_confirm_conntrack(struct sk_buff *skb)
1617static inline void ip_vs_conn_drop_conntrack(struct ip_vs_conn *cp) 1555static inline void ip_vs_conn_drop_conntrack(struct ip_vs_conn *cp)
1618{ 1556{
1619} 1557}
1620/* CONFIG_IP_VS_NFCT */ 1558#endif /* CONFIG_IP_VS_NFCT */
1621#endif
1622 1559
1623static inline int 1560static inline int
1624ip_vs_dest_conn_overhead(struct ip_vs_dest *dest) 1561ip_vs_dest_conn_overhead(struct ip_vs_dest *dest)
1625{ 1562{
1626 /* 1563 /* We think the overhead of processing active connections is 256
1627 * We think the overhead of processing active connections is 256
1628 * times higher than that of inactive connections in average. (This 1564 * times higher than that of inactive connections in average. (This
1629 * 256 times might not be accurate, we will change it later) We 1565 * 256 times might not be accurate, we will change it later) We
1630 * use the following formula to estimate the overhead now: 1566 * use the following formula to estimate the overhead now: