Commit 07dcc686 authored by Simon Horman's avatar Simon Horman Committed by Pablo Neira Ayuso

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: default avatarSergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: default avatarSimon Horman <horms@verge.net.au>
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent 4b7fd5d9
/* /* IP Virtual Server
* IP Virtual Server * data structure and functionality definitions
* data structure and functionality definitions
*/ */
#ifndef _NET_IP_VS_H #ifndef _NET_IP_VS_H
...@@ -12,7 +11,7 @@ ...@@ -12,7 +11,7 @@
#include <linux/list.h> /* for struct list_head */ #include <linux/list.h> /* for struct list_head */
#include <linux/spinlock.h> /* for struct rwlock_t */ #include <linux/spinlock.h> /* for struct rwlock_t */
#include <linux/atomic.h> /* for struct atomic_t */ #include <linux/atomic.h> /* for struct atomic_t */
#include <linux/compiler.h> #include <linux/compiler.h>
#include <linux/timer.h> #include <linux/timer.h>
#include <linux/bug.h> #include <linux/bug.h>
...@@ -30,15 +29,13 @@ ...@@ -30,15 +29,13 @@
#endif #endif
#include <net/net_namespace.h> /* Netw namespace */ #include <net/net_namespace.h> /* Netw namespace */
/* /* Generic access of ipvs struct */
* Generic access of ipvs struct
*/
static inline struct netns_ipvs *net_ipvs(struct net* net) static inline struct netns_ipvs *net_ipvs(struct net* net)
{ {
return net->ipvs; return net->ipvs;
} }
/*
* Get net ptr from skb in traffic cases /* Get net ptr from skb in traffic cases
* use skb_sknet when call is from userland (ioctl or netlink) * use skb_sknet when call is from userland (ioctl or netlink)
*/ */
static inline struct net *skb_net(const struct sk_buff *skb) static 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,8 +87,8 @@ static inline struct net *skb_sknet(const struct sk_buff *skb)
return &init_net; return &init_net;
#endif #endif
} }
/*
* This one needed for single_open_net since net is stored directly in /* This one needed for single_open_net since net is stored directly in
* private not as a struct i.e. seq_file_net can't be used. * private not as a struct i.e. seq_file_net can't be used.
*/ */
static inline struct net *seq_file_single_net(struct seq_file *seq) static inline struct net *seq_file_single_net(struct seq_file *seq)
...@@ -108,7 +105,7 @@ extern int ip_vs_conn_tab_size; ...@@ -108,7 +105,7 @@ extern int ip_vs_conn_tab_size;
struct ip_vs_iphdr { struct ip_vs_iphdr {
__u32 len; /* IPv4 simply where L4 starts __u32 len; /* IPv4 simply where L4 starts
IPv6 where L4 Transport Header starts */ * IPv6 where L4 Transport Header starts */
__u16 fragoffs; /* IPv6 fragment offset, 0 if first frag (or not frag)*/ __u16 fragoffs; /* IPv6 fragment offset, 0 if first frag (or not frag)*/
__s16 protocol; __s16 protocol;
__s32 flags; __s32 flags;
...@@ -304,16 +301,11 @@ static inline const char *ip_vs_dbg_addr(int af, char *buf, size_t buf_len, ...@@ -304,16 +301,11 @@ static inline const char *ip_vs_dbg_addr(int af, char *buf, size_t buf_len,
#define LeaveFunction(level) do {} while (0) #define LeaveFunction(level) do {} while (0)
#endif #endif
/* The port number of FTP service (in network order). */
/*
* The port number of FTP service (in network order).
*/
#define FTPPORT cpu_to_be16(21) #define FTPPORT cpu_to_be16(21)
#define FTPDATA cpu_to_be16(20) #define FTPDATA cpu_to_be16(20)
/* /* TCP State Values */
* TCP State Values
*/
enum { enum {
IP_VS_TCP_S_NONE = 0, IP_VS_TCP_S_NONE = 0,
IP_VS_TCP_S_ESTABLISHED, IP_VS_TCP_S_ESTABLISHED,
...@@ -329,25 +321,19 @@ enum { ...@@ -329,25 +321,19 @@ enum {
IP_VS_TCP_S_LAST IP_VS_TCP_S_LAST
}; };
/* /* UDP State Values */
* UDP State Values
*/
enum { enum {
IP_VS_UDP_S_NORMAL, IP_VS_UDP_S_NORMAL,
IP_VS_UDP_S_LAST, IP_VS_UDP_S_LAST,
}; };
/* /* ICMP State Values */
* ICMP State Values
*/
enum { enum {
IP_VS_ICMP_S_NORMAL, IP_VS_ICMP_S_NORMAL,
IP_VS_ICMP_S_LAST, IP_VS_ICMP_S_LAST,
}; };
/* /* SCTP State Values */
* SCTP State Values
*/
enum ip_vs_sctp_states { enum ip_vs_sctp_states {
IP_VS_SCTP_S_NONE, IP_VS_SCTP_S_NONE,
IP_VS_SCTP_S_INIT1, IP_VS_SCTP_S_INIT1,
...@@ -366,21 +352,18 @@ enum ip_vs_sctp_states { ...@@ -366,21 +352,18 @@ enum ip_vs_sctp_states {
IP_VS_SCTP_S_LAST IP_VS_SCTP_S_LAST
}; };
/* /* Delta sequence info structure
* Delta sequence info structure * Each ip_vs_conn has 2 (output AND input seq. changes).
* Each ip_vs_conn has 2 (output AND input seq. changes). * Only used in the VS/NAT.
* Only used in the VS/NAT.
*/ */
struct ip_vs_seq { struct ip_vs_seq {
__u32 init_seq; /* Add delta from this seq */ __u32 init_seq; /* Add delta from this seq */
__u32 delta; /* Delta in sequence numbers */ __u32 delta; /* Delta in sequence numbers */
__u32 previous_delta; /* Delta in sequence numbers __u32 previous_delta; /* Delta in sequence numbers
before last resized pkt */ * before last resized pkt */
}; };
/* /* counters per cpu */
* counters per cpu
*/
struct ip_vs_counters { struct ip_vs_counters {
__u32 conns; /* connections scheduled */ __u32 conns; /* connections scheduled */
__u32 inpkts; /* incoming packets */ __u32 inpkts; /* incoming packets */
...@@ -388,17 +371,13 @@ struct ip_vs_counters { ...@@ -388,17 +371,13 @@ struct ip_vs_counters {
__u64 inbytes; /* incoming bytes */ __u64 inbytes; /* incoming bytes */
__u64 outbytes; /* outgoing bytes */ __u64 outbytes; /* outgoing bytes */
}; };
/* /* Stats per cpu */
* Stats per cpu
*/
struct ip_vs_cpu_stats { struct ip_vs_cpu_stats {
struct ip_vs_counters ustats; struct ip_vs_counters ustats;
struct u64_stats_sync syncp; struct u64_stats_sync syncp;
}; };
/* /* IPVS statistics objects */
* IPVS statistics objects
*/
struct ip_vs_estimator { struct ip_vs_estimator {
struct list_head list; struct list_head list;
...@@ -491,9 +470,7 @@ struct ip_vs_protocol { ...@@ -491,9 +470,7 @@ struct ip_vs_protocol {
void (*timeout_change)(struct ip_vs_proto_data *pd, int flags); void (*timeout_change)(struct ip_vs_proto_data *pd, int flags);
}; };
/* /* protocol data per netns */
* protocol data per netns
*/
struct ip_vs_proto_data { struct ip_vs_proto_data {
struct ip_vs_proto_data *next; struct ip_vs_proto_data *next;
struct ip_vs_protocol *pp; struct ip_vs_protocol *pp;
...@@ -520,9 +497,7 @@ struct ip_vs_conn_param { ...@@ -520,9 +497,7 @@ struct ip_vs_conn_param {
__u8 pe_data_len; __u8 pe_data_len;
}; };
/* /* IP_VS structure allocated for each dynamically scheduled connection */
* IP_VS structure allocated for each dynamically scheduled connection
*/
struct ip_vs_conn { struct ip_vs_conn {
struct hlist_node c_list; /* hashed list heads */ struct hlist_node c_list; /* hashed list heads */
/* Protocol, addresses and port numbers */ /* Protocol, addresses and port numbers */
...@@ -561,17 +536,18 @@ struct ip_vs_conn { ...@@ -561,17 +536,18 @@ struct ip_vs_conn {
struct ip_vs_dest *dest; /* real server */ struct ip_vs_dest *dest; /* real server */
atomic_t in_pkts; /* incoming packet counter */ atomic_t in_pkts; /* incoming packet counter */
/* packet transmitter for different forwarding methods. If it /* Packet transmitter for different forwarding methods. If it
mangles the packet, it must return NF_DROP or better NF_STOLEN, * mangles the packet, it must return NF_DROP or better NF_STOLEN,
otherwise this must be changed to a sk_buff **. * otherwise this must be changed to a sk_buff **.
NF_ACCEPT can be returned when destination is local. * NF_ACCEPT can be returned when destination is local.
*/ */
int (*packet_xmit)(struct sk_buff *skb, struct ip_vs_conn *cp, int (*packet_xmit)(struct sk_buff *skb, struct ip_vs_conn *cp,
struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph); struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph);
/* Note: we can group the following members into a structure, /* Note: we can group the following members into a structure,
in order to save more space, and the following members are * in order to save more space, and the following members are
only used in VS/NAT anyway */ * only used in VS/NAT anyway
*/
struct ip_vs_app *app; /* bound ip_vs_app object */ struct ip_vs_app *app; /* bound ip_vs_app object */
void *app_data; /* Application private data */ void *app_data; /* Application private data */
struct ip_vs_seq in_seq; /* incoming seq. struct */ struct ip_vs_seq in_seq; /* incoming seq. struct */
...@@ -584,9 +560,7 @@ struct ip_vs_conn { ...@@ -584,9 +560,7 @@ struct ip_vs_conn {
struct rcu_head rcu_head; struct rcu_head rcu_head;
}; };
/* /* To save some memory in conn table when name space is disabled. */
* To save some memory in conn table when name space is disabled.
*/
static inline struct net *ip_vs_conn_net(const struct ip_vs_conn *cp) static inline struct net *ip_vs_conn_net(const struct ip_vs_conn *cp)
{ {
#ifdef CONFIG_NET_NS #ifdef CONFIG_NET_NS
...@@ -595,6 +569,7 @@ static inline struct net *ip_vs_conn_net(const struct ip_vs_conn *cp) ...@@ -595,6 +569,7 @@ static inline struct net *ip_vs_conn_net(const struct ip_vs_conn *cp)
return &init_net; return &init_net;
#endif #endif
} }
static inline void ip_vs_conn_net_set(struct ip_vs_conn *cp, struct net *net) static inline void ip_vs_conn_net_set(struct ip_vs_conn *cp, struct net *net)
{ {
#ifdef CONFIG_NET_NS #ifdef CONFIG_NET_NS
...@@ -612,13 +587,12 @@ static inline int ip_vs_conn_net_eq(const struct ip_vs_conn *cp, ...@@ -612,13 +587,12 @@ static inline int ip_vs_conn_net_eq(const struct ip_vs_conn *cp,
#endif #endif
} }
/* /* Extended internal versions of struct ip_vs_service_user and ip_vs_dest_user
* Extended internal versions of struct ip_vs_service_user and * for IPv6 support.
* ip_vs_dest_user for IPv6 support.
* *
* We need these to conveniently pass around service and destination * We need these to conveniently pass around service and destination
* options, but unfortunately, we also need to keep the old definitions to * options, but unfortunately, we also need to keep the old definitions to
* maintain userspace backwards compatibility for the setsockopt interface. * maintain userspace backwards compatibility for the setsockopt interface.
*/ */
struct ip_vs_service_user_kern { struct ip_vs_service_user_kern {
/* virtual service addresses */ /* virtual service addresses */
...@@ -656,8 +630,8 @@ struct ip_vs_dest_user_kern { ...@@ -656,8 +630,8 @@ struct ip_vs_dest_user_kern {
/* /*
* The information about the virtual service offered to the net * The information about the virtual service offered to the net and the
* and the forwarding entries * forwarding entries.
*/ */
struct ip_vs_service { struct ip_vs_service {
struct hlist_node s_list; /* for normal service table */ struct hlist_node s_list; /* for normal service table */
...@@ -697,9 +671,8 @@ struct ip_vs_dest_dst { ...@@ -697,9 +671,8 @@ struct ip_vs_dest_dst {
struct rcu_head rcu_head; struct rcu_head rcu_head;
}; };
/* /* The real server destination forwarding entry with ip address, port number,
* The real server destination forwarding entry * and so on.
* with ip address, port number, and so on.
*/ */
struct ip_vs_dest { struct ip_vs_dest {
struct list_head n_list; /* for the dests in the service */ struct list_head n_list; /* for the dests in the service */
...@@ -738,10 +711,7 @@ struct ip_vs_dest { ...@@ -738,10 +711,7 @@ struct ip_vs_dest {
unsigned int in_rs_table:1; /* we are in rs_table */ unsigned int in_rs_table:1; /* we are in rs_table */
}; };
/* The scheduler object */
/*
* The scheduler object
*/
struct ip_vs_scheduler { struct ip_vs_scheduler {
struct list_head n_list; /* d-linked list head */ struct list_head n_list; /* d-linked list head */
char *name; /* scheduler name */ char *name; /* scheduler name */
...@@ -781,9 +751,7 @@ struct ip_vs_pe { ...@@ -781,9 +751,7 @@ struct ip_vs_pe {
int (*show_pe_data)(const struct ip_vs_conn *cp, char *buf); int (*show_pe_data)(const struct ip_vs_conn *cp, char *buf);
}; };
/* /* The application module object (a.k.a. app incarnation) */
* The application module object (a.k.a. app incarnation)
*/
struct ip_vs_app { struct ip_vs_app {
struct list_head a_list; /* member in app list */ struct list_head a_list; /* member in app list */
int type; /* IP_VS_APP_TYPE_xxx */ int type; /* IP_VS_APP_TYPE_xxx */
...@@ -799,16 +767,14 @@ struct ip_vs_app { ...@@ -799,16 +767,14 @@ struct ip_vs_app {
atomic_t usecnt; /* usage counter */ atomic_t usecnt; /* usage counter */
struct rcu_head rcu_head; struct rcu_head rcu_head;
/* /* output hook: Process packet in inout direction, diff set for TCP.
* output hook: Process packet in inout direction, diff set for TCP.
* Return: 0=Error, 1=Payload Not Mangled/Mangled but checksum is ok, * Return: 0=Error, 1=Payload Not Mangled/Mangled but checksum is ok,
* 2=Mangled but checksum was not updated * 2=Mangled but checksum was not updated
*/ */
int (*pkt_out)(struct ip_vs_app *, struct ip_vs_conn *, int (*pkt_out)(struct ip_vs_app *, struct ip_vs_conn *,
struct sk_buff *, int *diff); struct sk_buff *, int *diff);
/* /* input hook: Process packet in outin direction, diff set for TCP.
* input hook: Process packet in outin direction, diff set for TCP.
* Return: 0=Error, 1=Payload Not Mangled/Mangled but checksum is ok, * Return: 0=Error, 1=Payload Not Mangled/Mangled but checksum is ok,
* 2=Mangled but checksum was not updated * 2=Mangled but checksum was not updated
*/ */
...@@ -867,9 +833,7 @@ struct ipvs_master_sync_state { ...@@ -867,9 +833,7 @@ struct ipvs_master_sync_state {
struct netns_ipvs { struct netns_ipvs {
int gen; /* Generation */ int gen; /* Generation */
int enable; /* enable like nf_hooks do */ int enable; /* enable like nf_hooks do */
/* /* Hash table: for real service lookups */
* Hash table: for real service lookups
*/
#define IP_VS_RTAB_BITS 4 #define IP_VS_RTAB_BITS 4
#define IP_VS_RTAB_SIZE (1 << IP_VS_RTAB_BITS) #define IP_VS_RTAB_SIZE (1 << IP_VS_RTAB_BITS)
#define IP_VS_RTAB_MASK (IP_VS_RTAB_SIZE - 1) #define IP_VS_RTAB_MASK (IP_VS_RTAB_SIZE - 1)
...@@ -903,7 +867,7 @@ struct netns_ipvs { ...@@ -903,7 +867,7 @@ struct netns_ipvs {
struct list_head sctp_apps[SCTP_APP_TAB_SIZE]; struct list_head sctp_apps[SCTP_APP_TAB_SIZE];
#endif #endif
/* ip_vs_conn */ /* ip_vs_conn */
atomic_t conn_count; /* connection counter */ atomic_t conn_count; /* connection counter */
/* ip_vs_ctl */ /* ip_vs_ctl */
struct ip_vs_stats tot_stats; /* Statistics & est. */ struct ip_vs_stats tot_stats; /* Statistics & est. */
...@@ -990,9 +954,9 @@ struct netns_ipvs { ...@@ -990,9 +954,9 @@ struct netns_ipvs {
char backup_mcast_ifn[IP_VS_IFNAME_MAXLEN]; char backup_mcast_ifn[IP_VS_IFNAME_MAXLEN];
/* net name space ptr */ /* net name space ptr */
struct net *net; /* Needed by timer routines */ struct net *net; /* Needed by timer routines */
/* Number of heterogeneous destinations, needed because /* Number of heterogeneous destinations, needed becaus heterogeneous
* heterogeneous are not supported when synchronization is * are not supported when synchronization is enabled.
* enabled */ */
unsigned int mixed_address_family_dests; unsigned int mixed_address_family_dests;
}; };
...@@ -1147,9 +1111,8 @@ static inline int sysctl_backup_only(struct netns_ipvs *ipvs) ...@@ -1147,9 +1111,8 @@ static inline int sysctl_backup_only(struct netns_ipvs *ipvs)
#endif #endif
/* /* IPVS core functions
* IPVS core functions * (from ip_vs_core.c)
* (from ip_vs_core.c)
*/ */
const char *ip_vs_proto_name(unsigned int proto); const char *ip_vs_proto_name(unsigned int proto);
void ip_vs_init_hash_table(struct list_head *table, int rows); void 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,11 +1120,9 @@ void ip_vs_init_hash_table(struct list_head *table, int rows);
#define IP_VS_APP_TYPE_FTP 1 #define IP_VS_APP_TYPE_FTP 1
/* /* ip_vs_conn handling functions
* ip_vs_conn handling functions * (from ip_vs_conn.c)
* (from ip_vs_conn.c)
*/ */
enum { enum {
IP_VS_DIR_INPUT = 0, IP_VS_DIR_INPUT = 0,
IP_VS_DIR_OUTPUT, IP_VS_DIR_OUTPUT,
...@@ -1292,9 +1253,7 @@ ip_vs_control_add(struct ip_vs_conn *cp, struct ip_vs_conn *ctl_cp) ...@@ -1292,9 +1253,7 @@ ip_vs_control_add(struct ip_vs_conn *cp, struct ip_vs_conn *ctl_cp)
atomic_inc(&ctl_cp->n_control); atomic_inc(&ctl_cp->n_control);
} }
/* /* IPVS netns init & cleanup functions */
* IPVS netns init & cleanup functions
*/
int ip_vs_estimator_net_init(struct net *net); int ip_vs_estimator_net_init(struct net *net);
int ip_vs_control_net_init(struct net *net); int ip_vs_control_net_init(struct net *net);
int ip_vs_protocol_net_init(struct net *net); int ip_vs_protocol_net_init(struct net *net);
...@@ -1309,9 +1268,8 @@ void ip_vs_estimator_net_cleanup(struct net *net); ...@@ -1309,9 +1268,8 @@ void ip_vs_estimator_net_cleanup(struct net *net);
void ip_vs_sync_net_cleanup(struct net *net); void ip_vs_sync_net_cleanup(struct net *net);
void ip_vs_service_net_cleanup(struct net *net); void ip_vs_service_net_cleanup(struct net *net);
/* /* IPVS application functions
* IPVS application functions * (from ip_vs_app.c)
* (from ip_vs_app.c)
*/ */
#define IP_VS_APP_MAX_PORTS 8 #define IP_VS_APP_MAX_PORTS 8
struct ip_vs_app *register_ip_vs_app(struct net *net, struct ip_vs_app *app); struct 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); ...@@ -1331,9 +1289,7 @@ int unregister_ip_vs_pe(struct ip_vs_pe *pe);
struct ip_vs_pe *ip_vs_pe_getbyname(const char *name); struct ip_vs_pe *ip_vs_pe_getbyname(const char *name);
struct ip_vs_pe *__ip_vs_pe_getbyname(const char *pe_name); struct ip_vs_pe *__ip_vs_pe_getbyname(const char *pe_name);
/* /* Use a #define to avoid all of module.h just for these trivial ops */
* Use a #define to avoid all of module.h just for these trivial ops
*/
#define ip_vs_pe_get(pe) \ #define ip_vs_pe_get(pe) \
if (pe && pe->module) \ if (pe && pe->module) \
__module_get(pe->module); __module_get(pe->module);
...@@ -1342,9 +1298,7 @@ struct ip_vs_pe *__ip_vs_pe_getbyname(const char *pe_name); ...@@ -1342,9 +1298,7 @@ struct ip_vs_pe *__ip_vs_pe_getbyname(const char *pe_name);
if (pe && pe->module) \ if (pe && pe->module) \
module_put(pe->module); module_put(pe->module);
/* /* IPVS protocol functions (from ip_vs_proto.c) */
* IPVS protocol functions (from ip_vs_proto.c)
*/
int ip_vs_protocol_init(void); int ip_vs_protocol_init(void);
void ip_vs_protocol_cleanup(void); void ip_vs_protocol_cleanup(void);
void ip_vs_protocol_timeout_change(struct netns_ipvs *ipvs, int flags); void ip_vs_protocol_timeout_change(struct netns_ipvs *ipvs, int flags);
...@@ -1362,9 +1316,8 @@ extern struct ip_vs_protocol ip_vs_protocol_esp; ...@@ -1362,9 +1316,8 @@ extern struct ip_vs_protocol ip_vs_protocol_esp;
extern struct ip_vs_protocol ip_vs_protocol_ah; extern struct ip_vs_protocol ip_vs_protocol_ah;
extern struct ip_vs_protocol ip_vs_protocol_sctp; extern struct ip_vs_protocol ip_vs_protocol_sctp;
/* /* Registering/unregistering scheduler functions
* Registering/unregistering scheduler functions * (from ip_vs_sched.c)
* (from ip_vs_sched.c)
*/ */
int register_ip_vs_scheduler(struct ip_vs_scheduler *scheduler); int register_ip_vs_scheduler(struct ip_vs_scheduler *scheduler);
int unregister_ip_vs_scheduler(struct ip_vs_scheduler *scheduler); int 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,10 +1336,7 @@ int ip_vs_leave(struct ip_vs_service *svc, struct sk_buff *skb,
void ip_vs_scheduler_err(struct ip_vs_service *svc, const char *msg); void ip_vs_scheduler_err(struct ip_vs_service *svc, const char *msg);
/* IPVS control data and functions (from ip_vs_ctl.c) */
/*
* IPVS control data and functions (from ip_vs_ctl.c)
*/
extern struct ip_vs_stats ip_vs_stats; extern struct ip_vs_stats ip_vs_stats;
extern int sysctl_ip_vs_sync_ver; extern int sysctl_ip_vs_sync_ver;
...@@ -1427,26 +1377,21 @@ static inline void ip_vs_dest_put_and_free(struct ip_vs_dest *dest) ...@@ -1427,26 +1377,21 @@ static inline void ip_vs_dest_put_and_free(struct ip_vs_dest *dest)
kfree(dest); kfree(dest);
} }
/* /* IPVS sync daemon data and function prototypes
* IPVS sync daemon data and function prototypes * (from ip_vs_sync.c)
* (from ip_vs_sync.c)
*/ */
int start_sync_thread(struct net *net, int state, char *mcast_ifn, __u8 syncid); int start_sync_thread(struct net *net, int state, char *mcast_ifn, __u8 syncid);
int stop_sync_thread(struct net *net, int state); int stop_sync_thread(struct net *net, int state);
void ip_vs_sync_conn(struct net *net, struct ip_vs_conn *cp, int pkts); void ip_vs_sync_conn(struct net *net, struct ip_vs_conn *cp, int pkts);
/* /* IPVS rate estimator prototypes (from ip_vs_est.c) */
* IPVS rate estimator prototypes (from ip_vs_est.c)
*/
void ip_vs_start_estimator(struct net *net, struct ip_vs_stats *stats); void ip_vs_start_estimator(struct net *net, struct ip_vs_stats *stats);
void ip_vs_stop_estimator(struct net *net, struct ip_vs_stats *stats); void ip_vs_stop_estimator(struct net *net, struct ip_vs_stats *stats);
void ip_vs_zero_estimator(struct ip_vs_stats *stats); void ip_vs_zero_estimator(struct ip_vs_stats *stats);
void ip_vs_read_estimator(struct ip_vs_stats_user *dst, void ip_vs_read_estimator(struct ip_vs_stats_user *dst,
struct ip_vs_stats *stats); struct ip_vs_stats *stats);
/* /* Various IPVS packet transmitters (from ip_vs_xmit.c) */
* Various IPVS packet transmitters (from ip_vs_xmit.c)
*/
int ip_vs_null_xmit(struct sk_buff *skb, struct ip_vs_conn *cp, int ip_vs_null_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph); struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph);
int ip_vs_bypass_xmit(struct sk_buff *skb, struct ip_vs_conn *cp, int 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,12 +1422,10 @@ int ip_vs_icmp_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp,
#endif #endif
#ifdef CONFIG_SYSCTL #ifdef CONFIG_SYSCTL
/* /* This is a simple mechanism to ignore packets when
* This is a simple mechanism to ignore packets when * we are loaded. Just set ip_vs_drop_rate to 'n' and
* we are loaded. Just set ip_vs_drop_rate to 'n' and * we start to drop 1/rate of the packets
* we start to drop 1/rate of the packets
*/ */
static inline int ip_vs_todrop(struct netns_ipvs *ipvs) static inline int ip_vs_todrop(struct netns_ipvs *ipvs)
{ {
if (!ipvs->drop_rate) if (!ipvs->drop_rate)
...@@ -1496,9 +1439,7 @@ static inline int ip_vs_todrop(struct netns_ipvs *ipvs) ...@@ -1496,9 +1439,7 @@ static inline int ip_vs_todrop(struct netns_ipvs *ipvs)
static inline int ip_vs_todrop(struct netns_ipvs *ipvs) { return 0; } static inline int ip_vs_todrop(struct netns_ipvs *ipvs) { return 0; }
#endif #endif
/* /* ip_vs_fwd_tag returns the forwarding tag of the connection */
* ip_vs_fwd_tag returns the forwarding tag of the connection
*/
#define IP_VS_FWD_METHOD(cp) (cp->flags & IP_VS_CONN_F_FWD_MASK) #define IP_VS_FWD_METHOD(cp) (cp->flags & IP_VS_CONN_F_FWD_MASK)
static inline char ip_vs_fwd_tag(struct ip_vs_conn *cp) static 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,9 +1498,7 @@ static inline __wsum ip_vs_check_diff2(__be16 old, __be16 new, __wsum oldsum)
return csum_partial(diff, sizeof(diff), oldsum); return csum_partial(diff, sizeof(diff), oldsum);
} }
/* /* Forget current conntrack (unconfirmed) and attach notrack entry */
* Forget current conntrack (unconfirmed) and attach notrack entry
*/
static inline void ip_vs_notrack(struct sk_buff *skb) static inline void ip_vs_notrack(struct sk_buff *skb)
{ {
#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) #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,9 +1515,8 @@ static inline void ip_vs_notrack(struct sk_buff *skb)
} }
#ifdef CONFIG_IP_VS_NFCT #ifdef CONFIG_IP_VS_NFCT
/* /* Netfilter connection tracking
* Netfilter connection tracking * (from ip_vs_nfct.c)
* (from ip_vs_nfct.c)
*/ */
static inline int ip_vs_conntrack_enabled(struct netns_ipvs *ipvs) static inline int ip_vs_conntrack_enabled(struct netns_ipvs *ipvs)
{ {
...@@ -1617,14 +1555,12 @@ static inline int ip_vs_confirm_conntrack(struct sk_buff *skb) ...@@ -1617,14 +1555,12 @@ static inline int ip_vs_confirm_conntrack(struct sk_buff *skb)
static inline void ip_vs_conn_drop_conntrack(struct ip_vs_conn *cp) static inline void ip_vs_conn_drop_conntrack(struct ip_vs_conn *cp)
{ {
} }
/* CONFIG_IP_VS_NFCT */ #endif /* CONFIG_IP_VS_NFCT */
#endif
static inline int static inline int
ip_vs_dest_conn_overhead(struct ip_vs_dest *dest) ip_vs_dest_conn_overhead(struct ip_vs_dest *dest)
{ {
/* /* We think the overhead of processing active connections is 256
* We think the overhead of processing active connections is 256
* times higher than that of inactive connections in average. (This * times higher than that of inactive connections in average. (This
* 256 times might not be accurate, we will change it later) We * 256 times might not be accurate, we will change it later) We
* use the following formula to estimate the overhead now: * use the following formula to estimate the overhead now:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment