* [PATCH] IPVS: Move userspace definitions to include/linux/ip_vs.h
@ 2008-07-24 10:14 Julius Volz
2008-07-24 11:14 ` Simon Horman
0 siblings, 1 reply; 19+ messages in thread
From: Julius Volz @ 2008-07-24 10:14 UTC (permalink / raw)
To: lvs-devel, netdev; +Cc: davem, kaber, horms, vbusam, Julius Volz
Current versions of ipvsadm include "/usr/src/linux/include/net/ip_vs.h"
directly. This file also contains kernel-only definitions. Normally, public
definitions should live in include/linux, so this patch moves the
definitions shared with userspace to a new file, "include/linux/ip_vs.h".
To make old ipvsadms still compile with this, the old header file includes
the new one.
Thanks to Dave Miller and Horms for noting/adding the missing Kbuild entry
for the new header file.
Signed-off-by: Julius Volz <juliusv@google.com>
---
include/linux/Kbuild | 1 +
include/linux/ip_vs.h | 248 ++++++++++++++++++++++++++++++++++++++++++++++++
include/net/ip_vs.h | 253 ++-----------------------------------------------
3 files changed, 257 insertions(+), 245 deletions(-)
create mode 100644 include/linux/ip_vs.h
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index 71d70d1..3273039 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -97,6 +97,7 @@ header-y += ioctl.h
header-y += ip6_tunnel.h
header-y += ipmi_msgdefs.h
header-y += ipsec.h
+header-y += ip_vs.h
header-y += ipx.h
header-y += irda.h
header-y += iso_fs.h
diff --git a/include/linux/ip_vs.h b/include/linux/ip_vs.h
new file mode 100644
index 0000000..2d4eb68
--- /dev/null
+++ b/include/linux/ip_vs.h
@@ -0,0 +1,248 @@
+/*
+ * IP Virtual Server
+ * data structure and functionality definitions
+ */
+
+#ifndef _IP_VS_H
+#define _IP_VS_H
+
+#include <linux/types.h> /* For __beXX types in userland */
+
+#define IP_VS_VERSION_CODE 0x010201
+#define NVERSION(version) \
+ (version >> 16) & 0xFF, \
+ (version >> 8) & 0xFF, \
+ version & 0xFF
+
+/*
+ * Virtual Service Flags
+ */
+#define IP_VS_SVC_F_PERSISTENT 0x0001 /* persistent port */
+#define IP_VS_SVC_F_HASHED 0x0002 /* hashed entry */
+
+/*
+ * Destination Server Flags
+ */
+#define IP_VS_DEST_F_AVAILABLE 0x0001 /* server is available */
+#define IP_VS_DEST_F_OVERLOAD 0x0002 /* server is overloaded */
+
+/*
+ * IPVS sync daemon states
+ */
+#define IP_VS_STATE_NONE 0x0000 /* daemon is stopped */
+#define IP_VS_STATE_MASTER 0x0001 /* started as master */
+#define IP_VS_STATE_BACKUP 0x0002 /* started as backup */
+
+/*
+ * IPVS socket options
+ */
+#define IP_VS_BASE_CTL (64+1024+64) /* base */
+
+#define IP_VS_SO_SET_NONE IP_VS_BASE_CTL /* just peek */
+#define IP_VS_SO_SET_INSERT (IP_VS_BASE_CTL+1)
+#define IP_VS_SO_SET_ADD (IP_VS_BASE_CTL+2)
+#define IP_VS_SO_SET_EDIT (IP_VS_BASE_CTL+3)
+#define IP_VS_SO_SET_DEL (IP_VS_BASE_CTL+4)
+#define IP_VS_SO_SET_FLUSH (IP_VS_BASE_CTL+5)
+#define IP_VS_SO_SET_LIST (IP_VS_BASE_CTL+6)
+#define IP_VS_SO_SET_ADDDEST (IP_VS_BASE_CTL+7)
+#define IP_VS_SO_SET_DELDEST (IP_VS_BASE_CTL+8)
+#define IP_VS_SO_SET_EDITDEST (IP_VS_BASE_CTL+9)
+#define IP_VS_SO_SET_TIMEOUT (IP_VS_BASE_CTL+10)
+#define IP_VS_SO_SET_STARTDAEMON (IP_VS_BASE_CTL+11)
+#define IP_VS_SO_SET_STOPDAEMON (IP_VS_BASE_CTL+12)
+#define IP_VS_SO_SET_RESTORE (IP_VS_BASE_CTL+13)
+#define IP_VS_SO_SET_SAVE (IP_VS_BASE_CTL+14)
+#define IP_VS_SO_SET_ZERO (IP_VS_BASE_CTL+15)
+#define IP_VS_SO_SET_MAX IP_VS_SO_SET_ZERO
+
+#define IP_VS_SO_GET_VERSION IP_VS_BASE_CTL
+#define IP_VS_SO_GET_INFO (IP_VS_BASE_CTL+1)
+#define IP_VS_SO_GET_SERVICES (IP_VS_BASE_CTL+2)
+#define IP_VS_SO_GET_SERVICE (IP_VS_BASE_CTL+3)
+#define IP_VS_SO_GET_DESTS (IP_VS_BASE_CTL+4)
+#define IP_VS_SO_GET_DEST (IP_VS_BASE_CTL+5) /* not used now */
+#define IP_VS_SO_GET_TIMEOUT (IP_VS_BASE_CTL+6)
+#define IP_VS_SO_GET_DAEMON (IP_VS_BASE_CTL+7)
+#define IP_VS_SO_GET_MAX IP_VS_SO_GET_DAEMON
+
+
+/*
+ * IPVS Connection Flags
+ */
+#define IP_VS_CONN_F_FWD_MASK 0x0007 /* mask for the fwd methods */
+#define IP_VS_CONN_F_MASQ 0x0000 /* masquerading/NAT */
+#define IP_VS_CONN_F_LOCALNODE 0x0001 /* local node */
+#define IP_VS_CONN_F_TUNNEL 0x0002 /* tunneling */
+#define IP_VS_CONN_F_DROUTE 0x0003 /* direct routing */
+#define IP_VS_CONN_F_BYPASS 0x0004 /* cache bypass */
+#define IP_VS_CONN_F_SYNC 0x0020 /* entry created by sync */
+#define IP_VS_CONN_F_HASHED 0x0040 /* hashed entry */
+#define IP_VS_CONN_F_NOOUTPUT 0x0080 /* no output packets */
+#define IP_VS_CONN_F_INACTIVE 0x0100 /* not established */
+#define IP_VS_CONN_F_OUT_SEQ 0x0200 /* must do output seq adjust */
+#define IP_VS_CONN_F_IN_SEQ 0x0400 /* must do input seq adjust */
+#define IP_VS_CONN_F_SEQ_MASK 0x0600 /* in/out sequence mask */
+#define IP_VS_CONN_F_NO_CPORT 0x0800 /* no client port set yet */
+#define IP_VS_CONN_F_TEMPLATE 0x1000 /* template, not connection */
+
+/* Move it to better place one day, for now keep it unique */
+#define NFC_IPVS_PROPERTY 0x10000
+
+#define IP_VS_SCHEDNAME_MAXLEN 16
+#define IP_VS_IFNAME_MAXLEN 16
+
+
+/*
+ * The struct ip_vs_service_user and struct ip_vs_dest_user are
+ * used to set IPVS rules through setsockopt.
+ */
+struct ip_vs_service_user {
+ /* virtual service addresses */
+ u_int16_t protocol;
+ __be32 addr; /* virtual ip address */
+ __be16 port;
+ u_int32_t fwmark; /* firwall mark of service */
+
+ /* virtual service options */
+ char sched_name[IP_VS_SCHEDNAME_MAXLEN];
+ unsigned flags; /* virtual service flags */
+ unsigned timeout; /* persistent timeout in sec */
+ __be32 netmask; /* persistent netmask */
+};
+
+
+struct ip_vs_dest_user {
+ /* destination server address */
+ __be32 addr;
+ __be16 port;
+
+ /* real server options */
+ unsigned conn_flags; /* connection flags */
+ int weight; /* destination weight */
+
+ /* thresholds for active connections */
+ u_int32_t u_threshold; /* upper threshold */
+ u_int32_t l_threshold; /* lower threshold */
+};
+
+
+/*
+ * IPVS statistics object (for user space)
+ */
+struct ip_vs_stats_user
+{
+ __u32 conns; /* connections scheduled */
+ __u32 inpkts; /* incoming packets */
+ __u32 outpkts; /* outgoing packets */
+ __u64 inbytes; /* incoming bytes */
+ __u64 outbytes; /* outgoing bytes */
+
+ __u32 cps; /* current connection rate */
+ __u32 inpps; /* current in packet rate */
+ __u32 outpps; /* current out packet rate */
+ __u32 inbps; /* current in byte rate */
+ __u32 outbps; /* current out byte rate */
+};
+
+
+/* The argument to IP_VS_SO_GET_INFO */
+struct ip_vs_getinfo {
+ /* version number */
+ unsigned int version;
+
+ /* size of connection hash table */
+ unsigned int size;
+
+ /* number of virtual services */
+ unsigned int num_services;
+};
+
+
+/* The argument to IP_VS_SO_GET_SERVICE */
+struct ip_vs_service_entry {
+ /* which service: user fills in these */
+ u_int16_t protocol;
+ __be32 addr; /* virtual address */
+ __be16 port;
+ u_int32_t fwmark; /* firwall mark of service */
+
+ /* service options */
+ char sched_name[IP_VS_SCHEDNAME_MAXLEN];
+ unsigned flags; /* virtual service flags */
+ unsigned timeout; /* persistent timeout */
+ __be32 netmask; /* persistent netmask */
+
+ /* number of real servers */
+ unsigned int num_dests;
+
+ /* statistics */
+ struct ip_vs_stats_user stats;
+};
+
+
+struct ip_vs_dest_entry {
+ __be32 addr; /* destination address */
+ __be16 port;
+ unsigned conn_flags; /* connection flags */
+ int weight; /* destination weight */
+
+ u_int32_t u_threshold; /* upper threshold */
+ u_int32_t l_threshold; /* lower threshold */
+
+ u_int32_t activeconns; /* active connections */
+ u_int32_t inactconns; /* inactive connections */
+ u_int32_t persistconns; /* persistent connections */
+
+ /* statistics */
+ struct ip_vs_stats_user stats;
+};
+
+
+/* The argument to IP_VS_SO_GET_DESTS */
+struct ip_vs_get_dests {
+ /* which service: user fills in these */
+ u_int16_t protocol;
+ __be32 addr; /* virtual address */
+ __be16 port;
+ u_int32_t fwmark; /* firwall mark of service */
+
+ /* number of real servers */
+ unsigned int num_dests;
+
+ /* the real servers */
+ struct ip_vs_dest_entry entrytable[0];
+};
+
+
+/* The argument to IP_VS_SO_GET_SERVICES */
+struct ip_vs_get_services {
+ /* number of virtual services */
+ unsigned int num_services;
+
+ /* service table */
+ struct ip_vs_service_entry entrytable[0];
+};
+
+
+/* The argument to IP_VS_SO_GET_TIMEOUT */
+struct ip_vs_timeout_user {
+ int tcp_timeout;
+ int tcp_fin_timeout;
+ int udp_timeout;
+};
+
+
+/* The argument to IP_VS_SO_GET_DAEMON */
+struct ip_vs_daemon_user {
+ /* sync daemon state (master/backup) */
+ int state;
+
+ /* multicast interface name */
+ char mcast_ifn[IP_VS_IFNAME_MAXLEN];
+
+ /* SyncID we belong to */
+ int syncid;
+};
+
+#endif /* _IP_VS_H */
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index 9a51eba..cbb59eb 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -3,254 +3,17 @@
* data structure and functionality definitions
*/
-#ifndef _IP_VS_H
-#define _IP_VS_H
-
-#include <asm/types.h> /* For __uXX types */
-#include <linux/types.h> /* For __beXX types in userland */
-
-#include <linux/sysctl.h> /* For ctl_path */
-
-#define IP_VS_VERSION_CODE 0x010201
-#define NVERSION(version) \
- (version >> 16) & 0xFF, \
- (version >> 8) & 0xFF, \
- version & 0xFF
-
-/*
- * Virtual Service Flags
- */
-#define IP_VS_SVC_F_PERSISTENT 0x0001 /* persistent port */
-#define IP_VS_SVC_F_HASHED 0x0002 /* hashed entry */
-
-/*
- * Destination Server Flags
- */
-#define IP_VS_DEST_F_AVAILABLE 0x0001 /* server is available */
-#define IP_VS_DEST_F_OVERLOAD 0x0002 /* server is overloaded */
-
-/*
- * IPVS sync daemon states
- */
-#define IP_VS_STATE_NONE 0x0000 /* daemon is stopped */
-#define IP_VS_STATE_MASTER 0x0001 /* started as master */
-#define IP_VS_STATE_BACKUP 0x0002 /* started as backup */
-
-/*
- * IPVS socket options
- */
-#define IP_VS_BASE_CTL (64+1024+64) /* base */
-
-#define IP_VS_SO_SET_NONE IP_VS_BASE_CTL /* just peek */
-#define IP_VS_SO_SET_INSERT (IP_VS_BASE_CTL+1)
-#define IP_VS_SO_SET_ADD (IP_VS_BASE_CTL+2)
-#define IP_VS_SO_SET_EDIT (IP_VS_BASE_CTL+3)
-#define IP_VS_SO_SET_DEL (IP_VS_BASE_CTL+4)
-#define IP_VS_SO_SET_FLUSH (IP_VS_BASE_CTL+5)
-#define IP_VS_SO_SET_LIST (IP_VS_BASE_CTL+6)
-#define IP_VS_SO_SET_ADDDEST (IP_VS_BASE_CTL+7)
-#define IP_VS_SO_SET_DELDEST (IP_VS_BASE_CTL+8)
-#define IP_VS_SO_SET_EDITDEST (IP_VS_BASE_CTL+9)
-#define IP_VS_SO_SET_TIMEOUT (IP_VS_BASE_CTL+10)
-#define IP_VS_SO_SET_STARTDAEMON (IP_VS_BASE_CTL+11)
-#define IP_VS_SO_SET_STOPDAEMON (IP_VS_BASE_CTL+12)
-#define IP_VS_SO_SET_RESTORE (IP_VS_BASE_CTL+13)
-#define IP_VS_SO_SET_SAVE (IP_VS_BASE_CTL+14)
-#define IP_VS_SO_SET_ZERO (IP_VS_BASE_CTL+15)
-#define IP_VS_SO_SET_MAX IP_VS_SO_SET_ZERO
-
-#define IP_VS_SO_GET_VERSION IP_VS_BASE_CTL
-#define IP_VS_SO_GET_INFO (IP_VS_BASE_CTL+1)
-#define IP_VS_SO_GET_SERVICES (IP_VS_BASE_CTL+2)
-#define IP_VS_SO_GET_SERVICE (IP_VS_BASE_CTL+3)
-#define IP_VS_SO_GET_DESTS (IP_VS_BASE_CTL+4)
-#define IP_VS_SO_GET_DEST (IP_VS_BASE_CTL+5) /* not used now */
-#define IP_VS_SO_GET_TIMEOUT (IP_VS_BASE_CTL+6)
-#define IP_VS_SO_GET_DAEMON (IP_VS_BASE_CTL+7)
-#define IP_VS_SO_GET_MAX IP_VS_SO_GET_DAEMON
-
-
-/*
- * IPVS Connection Flags
- */
-#define IP_VS_CONN_F_FWD_MASK 0x0007 /* mask for the fwd methods */
-#define IP_VS_CONN_F_MASQ 0x0000 /* masquerading/NAT */
-#define IP_VS_CONN_F_LOCALNODE 0x0001 /* local node */
-#define IP_VS_CONN_F_TUNNEL 0x0002 /* tunneling */
-#define IP_VS_CONN_F_DROUTE 0x0003 /* direct routing */
-#define IP_VS_CONN_F_BYPASS 0x0004 /* cache bypass */
-#define IP_VS_CONN_F_SYNC 0x0020 /* entry created by sync */
-#define IP_VS_CONN_F_HASHED 0x0040 /* hashed entry */
-#define IP_VS_CONN_F_NOOUTPUT 0x0080 /* no output packets */
-#define IP_VS_CONN_F_INACTIVE 0x0100 /* not established */
-#define IP_VS_CONN_F_OUT_SEQ 0x0200 /* must do output seq adjust */
-#define IP_VS_CONN_F_IN_SEQ 0x0400 /* must do input seq adjust */
-#define IP_VS_CONN_F_SEQ_MASK 0x0600 /* in/out sequence mask */
-#define IP_VS_CONN_F_NO_CPORT 0x0800 /* no client port set yet */
-#define IP_VS_CONN_F_TEMPLATE 0x1000 /* template, not connection */
-
-/* Move it to better place one day, for now keep it unique */
-#define NFC_IPVS_PROPERTY 0x10000
-
-#define IP_VS_SCHEDNAME_MAXLEN 16
-#define IP_VS_IFNAME_MAXLEN 16
-
-
-/*
- * The struct ip_vs_service_user and struct ip_vs_dest_user are
- * used to set IPVS rules through setsockopt.
- */
-struct ip_vs_service_user {
- /* virtual service addresses */
- u_int16_t protocol;
- __be32 addr; /* virtual ip address */
- __be16 port;
- u_int32_t fwmark; /* firwall mark of service */
-
- /* virtual service options */
- char sched_name[IP_VS_SCHEDNAME_MAXLEN];
- unsigned flags; /* virtual service flags */
- unsigned timeout; /* persistent timeout in sec */
- __be32 netmask; /* persistent netmask */
-};
-
-
-struct ip_vs_dest_user {
- /* destination server address */
- __be32 addr;
- __be16 port;
-
- /* real server options */
- unsigned conn_flags; /* connection flags */
- int weight; /* destination weight */
-
- /* thresholds for active connections */
- u_int32_t u_threshold; /* upper threshold */
- u_int32_t l_threshold; /* lower threshold */
-};
-
-
-/*
- * IPVS statistics object (for user space)
- */
-struct ip_vs_stats_user
-{
- __u32 conns; /* connections scheduled */
- __u32 inpkts; /* incoming packets */
- __u32 outpkts; /* outgoing packets */
- __u64 inbytes; /* incoming bytes */
- __u64 outbytes; /* outgoing bytes */
-
- __u32 cps; /* current connection rate */
- __u32 inpps; /* current in packet rate */
- __u32 outpps; /* current out packet rate */
- __u32 inbps; /* current in byte rate */
- __u32 outbps; /* current out byte rate */
-};
-
-
-/* The argument to IP_VS_SO_GET_INFO */
-struct ip_vs_getinfo {
- /* version number */
- unsigned int version;
-
- /* size of connection hash table */
- unsigned int size;
-
- /* number of virtual services */
- unsigned int num_services;
-};
-
-
-/* The argument to IP_VS_SO_GET_SERVICE */
-struct ip_vs_service_entry {
- /* which service: user fills in these */
- u_int16_t protocol;
- __be32 addr; /* virtual address */
- __be16 port;
- u_int32_t fwmark; /* firwall mark of service */
-
- /* service options */
- char sched_name[IP_VS_SCHEDNAME_MAXLEN];
- unsigned flags; /* virtual service flags */
- unsigned timeout; /* persistent timeout */
- __be32 netmask; /* persistent netmask */
-
- /* number of real servers */
- unsigned int num_dests;
-
- /* statistics */
- struct ip_vs_stats_user stats;
-};
-
-
-struct ip_vs_dest_entry {
- __be32 addr; /* destination address */
- __be16 port;
- unsigned conn_flags; /* connection flags */
- int weight; /* destination weight */
-
- u_int32_t u_threshold; /* upper threshold */
- u_int32_t l_threshold; /* lower threshold */
-
- u_int32_t activeconns; /* active connections */
- u_int32_t inactconns; /* inactive connections */
- u_int32_t persistconns; /* persistent connections */
-
- /* statistics */
- struct ip_vs_stats_user stats;
-};
-
-
-/* The argument to IP_VS_SO_GET_DESTS */
-struct ip_vs_get_dests {
- /* which service: user fills in these */
- u_int16_t protocol;
- __be32 addr; /* virtual address */
- __be16 port;
- u_int32_t fwmark; /* firwall mark of service */
-
- /* number of real servers */
- unsigned int num_dests;
-
- /* the real servers */
- struct ip_vs_dest_entry entrytable[0];
-};
-
-
-/* The argument to IP_VS_SO_GET_SERVICES */
-struct ip_vs_get_services {
- /* number of virtual services */
- unsigned int num_services;
-
- /* service table */
- struct ip_vs_service_entry entrytable[0];
-};
-
-
-/* The argument to IP_VS_SO_GET_TIMEOUT */
-struct ip_vs_timeout_user {
- int tcp_timeout;
- int tcp_fin_timeout;
- int udp_timeout;
-};
-
-
-/* The argument to IP_VS_SO_GET_DAEMON */
-struct ip_vs_daemon_user {
- /* sync daemon state (master/backup) */
- int state;
-
- /* multicast interface name */
- char mcast_ifn[IP_VS_IFNAME_MAXLEN];
-
- /* SyncID we belong to */
- int syncid;
-};
+#ifndef _NET_IP_VS_H
+#define _NET_IP_VS_H
+#include <linux/ip_vs.h> /* definitions shared with userland */
+/* old ipvsadm versions still include this file directly */
#ifdef __KERNEL__
+#include <asm/types.h> /* for __uXX types */
+
+#include <linux/sysctl.h> /* for ctl_path */
#include <linux/list.h> /* for struct list_head */
#include <linux/spinlock.h> /* for struct rwlock_t */
#include <asm/atomic.h> /* for struct atomic_t */
@@ -981,4 +744,4 @@ static inline __wsum ip_vs_check_diff2(__be16 old, __be16 new, __wsum oldsum)
#endif /* __KERNEL__ */
-#endif /* _IP_VS_H */
+#endif /* _NET_IP_VS_H */
--
1.5.4.5
^ permalink raw reply related [flat|nested] 19+ messages in thread* Re: [PATCH] IPVS: Move userspace definitions to include/linux/ip_vs.h
2008-07-24 10:14 [PATCH] IPVS: Move userspace definitions to include/linux/ip_vs.h Julius Volz
@ 2008-07-24 11:14 ` Simon Horman
2008-07-24 11:22 ` Patrick McHardy
0 siblings, 1 reply; 19+ messages in thread
From: Simon Horman @ 2008-07-24 11:14 UTC (permalink / raw)
To: Julius Volz; +Cc: lvs-devel, netdev, davem, kaber, vbusam
On Thu, Jul 24, 2008 at 12:14:49PM +0200, Julius Volz wrote:
> Current versions of ipvsadm include "/usr/src/linux/include/net/ip_vs.h"
> directly. This file also contains kernel-only definitions. Normally, public
> definitions should live in include/linux, so this patch moves the
> definitions shared with userspace to a new file, "include/linux/ip_vs.h".
>
> To make old ipvsadms still compile with this, the old header file includes
> the new one.
>
> Thanks to Dave Miller and Horms for noting/adding the missing Kbuild entry
> for the new header file.
>
> Signed-off-by: Julius Volz <juliusv@google.com>
Acked-by: Simon Horman <horms@verge.net.au>
> ---
> include/linux/Kbuild | 1 +
> include/linux/ip_vs.h | 248 ++++++++++++++++++++++++++++++++++++++++++++++++
> include/net/ip_vs.h | 253 ++-----------------------------------------------
> 3 files changed, 257 insertions(+), 245 deletions(-)
> create mode 100644 include/linux/ip_vs.h
>
> diff --git a/include/linux/Kbuild b/include/linux/Kbuild
> index 71d70d1..3273039 100644
> --- a/include/linux/Kbuild
> +++ b/include/linux/Kbuild
> @@ -97,6 +97,7 @@ header-y += ioctl.h
> header-y += ip6_tunnel.h
> header-y += ipmi_msgdefs.h
> header-y += ipsec.h
> +header-y += ip_vs.h
> header-y += ipx.h
> header-y += irda.h
> header-y += iso_fs.h
> diff --git a/include/linux/ip_vs.h b/include/linux/ip_vs.h
> new file mode 100644
> index 0000000..2d4eb68
> --- /dev/null
> +++ b/include/linux/ip_vs.h
> @@ -0,0 +1,248 @@
> +/*
> + * IP Virtual Server
> + * data structure and functionality definitions
> + */
> +
> +#ifndef _IP_VS_H
> +#define _IP_VS_H
> +
> +#include <linux/types.h> /* For __beXX types in userland */
> +
> +#define IP_VS_VERSION_CODE 0x010201
> +#define NVERSION(version) \
> + (version >> 16) & 0xFF, \
> + (version >> 8) & 0xFF, \
> + version & 0xFF
> +
> +/*
> + * Virtual Service Flags
> + */
> +#define IP_VS_SVC_F_PERSISTENT 0x0001 /* persistent port */
> +#define IP_VS_SVC_F_HASHED 0x0002 /* hashed entry */
> +
> +/*
> + * Destination Server Flags
> + */
> +#define IP_VS_DEST_F_AVAILABLE 0x0001 /* server is available */
> +#define IP_VS_DEST_F_OVERLOAD 0x0002 /* server is overloaded */
> +
> +/*
> + * IPVS sync daemon states
> + */
> +#define IP_VS_STATE_NONE 0x0000 /* daemon is stopped */
> +#define IP_VS_STATE_MASTER 0x0001 /* started as master */
> +#define IP_VS_STATE_BACKUP 0x0002 /* started as backup */
> +
> +/*
> + * IPVS socket options
> + */
> +#define IP_VS_BASE_CTL (64+1024+64) /* base */
> +
> +#define IP_VS_SO_SET_NONE IP_VS_BASE_CTL /* just peek */
> +#define IP_VS_SO_SET_INSERT (IP_VS_BASE_CTL+1)
> +#define IP_VS_SO_SET_ADD (IP_VS_BASE_CTL+2)
> +#define IP_VS_SO_SET_EDIT (IP_VS_BASE_CTL+3)
> +#define IP_VS_SO_SET_DEL (IP_VS_BASE_CTL+4)
> +#define IP_VS_SO_SET_FLUSH (IP_VS_BASE_CTL+5)
> +#define IP_VS_SO_SET_LIST (IP_VS_BASE_CTL+6)
> +#define IP_VS_SO_SET_ADDDEST (IP_VS_BASE_CTL+7)
> +#define IP_VS_SO_SET_DELDEST (IP_VS_BASE_CTL+8)
> +#define IP_VS_SO_SET_EDITDEST (IP_VS_BASE_CTL+9)
> +#define IP_VS_SO_SET_TIMEOUT (IP_VS_BASE_CTL+10)
> +#define IP_VS_SO_SET_STARTDAEMON (IP_VS_BASE_CTL+11)
> +#define IP_VS_SO_SET_STOPDAEMON (IP_VS_BASE_CTL+12)
> +#define IP_VS_SO_SET_RESTORE (IP_VS_BASE_CTL+13)
> +#define IP_VS_SO_SET_SAVE (IP_VS_BASE_CTL+14)
> +#define IP_VS_SO_SET_ZERO (IP_VS_BASE_CTL+15)
> +#define IP_VS_SO_SET_MAX IP_VS_SO_SET_ZERO
> +
> +#define IP_VS_SO_GET_VERSION IP_VS_BASE_CTL
> +#define IP_VS_SO_GET_INFO (IP_VS_BASE_CTL+1)
> +#define IP_VS_SO_GET_SERVICES (IP_VS_BASE_CTL+2)
> +#define IP_VS_SO_GET_SERVICE (IP_VS_BASE_CTL+3)
> +#define IP_VS_SO_GET_DESTS (IP_VS_BASE_CTL+4)
> +#define IP_VS_SO_GET_DEST (IP_VS_BASE_CTL+5) /* not used now */
> +#define IP_VS_SO_GET_TIMEOUT (IP_VS_BASE_CTL+6)
> +#define IP_VS_SO_GET_DAEMON (IP_VS_BASE_CTL+7)
> +#define IP_VS_SO_GET_MAX IP_VS_SO_GET_DAEMON
> +
> +
> +/*
> + * IPVS Connection Flags
> + */
> +#define IP_VS_CONN_F_FWD_MASK 0x0007 /* mask for the fwd methods */
> +#define IP_VS_CONN_F_MASQ 0x0000 /* masquerading/NAT */
> +#define IP_VS_CONN_F_LOCALNODE 0x0001 /* local node */
> +#define IP_VS_CONN_F_TUNNEL 0x0002 /* tunneling */
> +#define IP_VS_CONN_F_DROUTE 0x0003 /* direct routing */
> +#define IP_VS_CONN_F_BYPASS 0x0004 /* cache bypass */
> +#define IP_VS_CONN_F_SYNC 0x0020 /* entry created by sync */
> +#define IP_VS_CONN_F_HASHED 0x0040 /* hashed entry */
> +#define IP_VS_CONN_F_NOOUTPUT 0x0080 /* no output packets */
> +#define IP_VS_CONN_F_INACTIVE 0x0100 /* not established */
> +#define IP_VS_CONN_F_OUT_SEQ 0x0200 /* must do output seq adjust */
> +#define IP_VS_CONN_F_IN_SEQ 0x0400 /* must do input seq adjust */
> +#define IP_VS_CONN_F_SEQ_MASK 0x0600 /* in/out sequence mask */
> +#define IP_VS_CONN_F_NO_CPORT 0x0800 /* no client port set yet */
> +#define IP_VS_CONN_F_TEMPLATE 0x1000 /* template, not connection */
> +
> +/* Move it to better place one day, for now keep it unique */
> +#define NFC_IPVS_PROPERTY 0x10000
> +
> +#define IP_VS_SCHEDNAME_MAXLEN 16
> +#define IP_VS_IFNAME_MAXLEN 16
> +
> +
> +/*
> + * The struct ip_vs_service_user and struct ip_vs_dest_user are
> + * used to set IPVS rules through setsockopt.
> + */
> +struct ip_vs_service_user {
> + /* virtual service addresses */
> + u_int16_t protocol;
> + __be32 addr; /* virtual ip address */
> + __be16 port;
> + u_int32_t fwmark; /* firwall mark of service */
> +
> + /* virtual service options */
> + char sched_name[IP_VS_SCHEDNAME_MAXLEN];
> + unsigned flags; /* virtual service flags */
> + unsigned timeout; /* persistent timeout in sec */
> + __be32 netmask; /* persistent netmask */
> +};
> +
> +
> +struct ip_vs_dest_user {
> + /* destination server address */
> + __be32 addr;
> + __be16 port;
> +
> + /* real server options */
> + unsigned conn_flags; /* connection flags */
> + int weight; /* destination weight */
> +
> + /* thresholds for active connections */
> + u_int32_t u_threshold; /* upper threshold */
> + u_int32_t l_threshold; /* lower threshold */
> +};
> +
> +
> +/*
> + * IPVS statistics object (for user space)
> + */
> +struct ip_vs_stats_user
> +{
> + __u32 conns; /* connections scheduled */
> + __u32 inpkts; /* incoming packets */
> + __u32 outpkts; /* outgoing packets */
> + __u64 inbytes; /* incoming bytes */
> + __u64 outbytes; /* outgoing bytes */
> +
> + __u32 cps; /* current connection rate */
> + __u32 inpps; /* current in packet rate */
> + __u32 outpps; /* current out packet rate */
> + __u32 inbps; /* current in byte rate */
> + __u32 outbps; /* current out byte rate */
> +};
> +
> +
> +/* The argument to IP_VS_SO_GET_INFO */
> +struct ip_vs_getinfo {
> + /* version number */
> + unsigned int version;
> +
> + /* size of connection hash table */
> + unsigned int size;
> +
> + /* number of virtual services */
> + unsigned int num_services;
> +};
> +
> +
> +/* The argument to IP_VS_SO_GET_SERVICE */
> +struct ip_vs_service_entry {
> + /* which service: user fills in these */
> + u_int16_t protocol;
> + __be32 addr; /* virtual address */
> + __be16 port;
> + u_int32_t fwmark; /* firwall mark of service */
> +
> + /* service options */
> + char sched_name[IP_VS_SCHEDNAME_MAXLEN];
> + unsigned flags; /* virtual service flags */
> + unsigned timeout; /* persistent timeout */
> + __be32 netmask; /* persistent netmask */
> +
> + /* number of real servers */
> + unsigned int num_dests;
> +
> + /* statistics */
> + struct ip_vs_stats_user stats;
> +};
> +
> +
> +struct ip_vs_dest_entry {
> + __be32 addr; /* destination address */
> + __be16 port;
> + unsigned conn_flags; /* connection flags */
> + int weight; /* destination weight */
> +
> + u_int32_t u_threshold; /* upper threshold */
> + u_int32_t l_threshold; /* lower threshold */
> +
> + u_int32_t activeconns; /* active connections */
> + u_int32_t inactconns; /* inactive connections */
> + u_int32_t persistconns; /* persistent connections */
> +
> + /* statistics */
> + struct ip_vs_stats_user stats;
> +};
> +
> +
> +/* The argument to IP_VS_SO_GET_DESTS */
> +struct ip_vs_get_dests {
> + /* which service: user fills in these */
> + u_int16_t protocol;
> + __be32 addr; /* virtual address */
> + __be16 port;
> + u_int32_t fwmark; /* firwall mark of service */
> +
> + /* number of real servers */
> + unsigned int num_dests;
> +
> + /* the real servers */
> + struct ip_vs_dest_entry entrytable[0];
> +};
> +
> +
> +/* The argument to IP_VS_SO_GET_SERVICES */
> +struct ip_vs_get_services {
> + /* number of virtual services */
> + unsigned int num_services;
> +
> + /* service table */
> + struct ip_vs_service_entry entrytable[0];
> +};
> +
> +
> +/* The argument to IP_VS_SO_GET_TIMEOUT */
> +struct ip_vs_timeout_user {
> + int tcp_timeout;
> + int tcp_fin_timeout;
> + int udp_timeout;
> +};
> +
> +
> +/* The argument to IP_VS_SO_GET_DAEMON */
> +struct ip_vs_daemon_user {
> + /* sync daemon state (master/backup) */
> + int state;
> +
> + /* multicast interface name */
> + char mcast_ifn[IP_VS_IFNAME_MAXLEN];
> +
> + /* SyncID we belong to */
> + int syncid;
> +};
> +
> +#endif /* _IP_VS_H */
> diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
> index 9a51eba..cbb59eb 100644
> --- a/include/net/ip_vs.h
> +++ b/include/net/ip_vs.h
> @@ -3,254 +3,17 @@
> * data structure and functionality definitions
> */
>
> -#ifndef _IP_VS_H
> -#define _IP_VS_H
> -
> -#include <asm/types.h> /* For __uXX types */
> -#include <linux/types.h> /* For __beXX types in userland */
> -
> -#include <linux/sysctl.h> /* For ctl_path */
> -
> -#define IP_VS_VERSION_CODE 0x010201
> -#define NVERSION(version) \
> - (version >> 16) & 0xFF, \
> - (version >> 8) & 0xFF, \
> - version & 0xFF
> -
> -/*
> - * Virtual Service Flags
> - */
> -#define IP_VS_SVC_F_PERSISTENT 0x0001 /* persistent port */
> -#define IP_VS_SVC_F_HASHED 0x0002 /* hashed entry */
> -
> -/*
> - * Destination Server Flags
> - */
> -#define IP_VS_DEST_F_AVAILABLE 0x0001 /* server is available */
> -#define IP_VS_DEST_F_OVERLOAD 0x0002 /* server is overloaded */
> -
> -/*
> - * IPVS sync daemon states
> - */
> -#define IP_VS_STATE_NONE 0x0000 /* daemon is stopped */
> -#define IP_VS_STATE_MASTER 0x0001 /* started as master */
> -#define IP_VS_STATE_BACKUP 0x0002 /* started as backup */
> -
> -/*
> - * IPVS socket options
> - */
> -#define IP_VS_BASE_CTL (64+1024+64) /* base */
> -
> -#define IP_VS_SO_SET_NONE IP_VS_BASE_CTL /* just peek */
> -#define IP_VS_SO_SET_INSERT (IP_VS_BASE_CTL+1)
> -#define IP_VS_SO_SET_ADD (IP_VS_BASE_CTL+2)
> -#define IP_VS_SO_SET_EDIT (IP_VS_BASE_CTL+3)
> -#define IP_VS_SO_SET_DEL (IP_VS_BASE_CTL+4)
> -#define IP_VS_SO_SET_FLUSH (IP_VS_BASE_CTL+5)
> -#define IP_VS_SO_SET_LIST (IP_VS_BASE_CTL+6)
> -#define IP_VS_SO_SET_ADDDEST (IP_VS_BASE_CTL+7)
> -#define IP_VS_SO_SET_DELDEST (IP_VS_BASE_CTL+8)
> -#define IP_VS_SO_SET_EDITDEST (IP_VS_BASE_CTL+9)
> -#define IP_VS_SO_SET_TIMEOUT (IP_VS_BASE_CTL+10)
> -#define IP_VS_SO_SET_STARTDAEMON (IP_VS_BASE_CTL+11)
> -#define IP_VS_SO_SET_STOPDAEMON (IP_VS_BASE_CTL+12)
> -#define IP_VS_SO_SET_RESTORE (IP_VS_BASE_CTL+13)
> -#define IP_VS_SO_SET_SAVE (IP_VS_BASE_CTL+14)
> -#define IP_VS_SO_SET_ZERO (IP_VS_BASE_CTL+15)
> -#define IP_VS_SO_SET_MAX IP_VS_SO_SET_ZERO
> -
> -#define IP_VS_SO_GET_VERSION IP_VS_BASE_CTL
> -#define IP_VS_SO_GET_INFO (IP_VS_BASE_CTL+1)
> -#define IP_VS_SO_GET_SERVICES (IP_VS_BASE_CTL+2)
> -#define IP_VS_SO_GET_SERVICE (IP_VS_BASE_CTL+3)
> -#define IP_VS_SO_GET_DESTS (IP_VS_BASE_CTL+4)
> -#define IP_VS_SO_GET_DEST (IP_VS_BASE_CTL+5) /* not used now */
> -#define IP_VS_SO_GET_TIMEOUT (IP_VS_BASE_CTL+6)
> -#define IP_VS_SO_GET_DAEMON (IP_VS_BASE_CTL+7)
> -#define IP_VS_SO_GET_MAX IP_VS_SO_GET_DAEMON
> -
> -
> -/*
> - * IPVS Connection Flags
> - */
> -#define IP_VS_CONN_F_FWD_MASK 0x0007 /* mask for the fwd methods */
> -#define IP_VS_CONN_F_MASQ 0x0000 /* masquerading/NAT */
> -#define IP_VS_CONN_F_LOCALNODE 0x0001 /* local node */
> -#define IP_VS_CONN_F_TUNNEL 0x0002 /* tunneling */
> -#define IP_VS_CONN_F_DROUTE 0x0003 /* direct routing */
> -#define IP_VS_CONN_F_BYPASS 0x0004 /* cache bypass */
> -#define IP_VS_CONN_F_SYNC 0x0020 /* entry created by sync */
> -#define IP_VS_CONN_F_HASHED 0x0040 /* hashed entry */
> -#define IP_VS_CONN_F_NOOUTPUT 0x0080 /* no output packets */
> -#define IP_VS_CONN_F_INACTIVE 0x0100 /* not established */
> -#define IP_VS_CONN_F_OUT_SEQ 0x0200 /* must do output seq adjust */
> -#define IP_VS_CONN_F_IN_SEQ 0x0400 /* must do input seq adjust */
> -#define IP_VS_CONN_F_SEQ_MASK 0x0600 /* in/out sequence mask */
> -#define IP_VS_CONN_F_NO_CPORT 0x0800 /* no client port set yet */
> -#define IP_VS_CONN_F_TEMPLATE 0x1000 /* template, not connection */
> -
> -/* Move it to better place one day, for now keep it unique */
> -#define NFC_IPVS_PROPERTY 0x10000
> -
> -#define IP_VS_SCHEDNAME_MAXLEN 16
> -#define IP_VS_IFNAME_MAXLEN 16
> -
> -
> -/*
> - * The struct ip_vs_service_user and struct ip_vs_dest_user are
> - * used to set IPVS rules through setsockopt.
> - */
> -struct ip_vs_service_user {
> - /* virtual service addresses */
> - u_int16_t protocol;
> - __be32 addr; /* virtual ip address */
> - __be16 port;
> - u_int32_t fwmark; /* firwall mark of service */
> -
> - /* virtual service options */
> - char sched_name[IP_VS_SCHEDNAME_MAXLEN];
> - unsigned flags; /* virtual service flags */
> - unsigned timeout; /* persistent timeout in sec */
> - __be32 netmask; /* persistent netmask */
> -};
> -
> -
> -struct ip_vs_dest_user {
> - /* destination server address */
> - __be32 addr;
> - __be16 port;
> -
> - /* real server options */
> - unsigned conn_flags; /* connection flags */
> - int weight; /* destination weight */
> -
> - /* thresholds for active connections */
> - u_int32_t u_threshold; /* upper threshold */
> - u_int32_t l_threshold; /* lower threshold */
> -};
> -
> -
> -/*
> - * IPVS statistics object (for user space)
> - */
> -struct ip_vs_stats_user
> -{
> - __u32 conns; /* connections scheduled */
> - __u32 inpkts; /* incoming packets */
> - __u32 outpkts; /* outgoing packets */
> - __u64 inbytes; /* incoming bytes */
> - __u64 outbytes; /* outgoing bytes */
> -
> - __u32 cps; /* current connection rate */
> - __u32 inpps; /* current in packet rate */
> - __u32 outpps; /* current out packet rate */
> - __u32 inbps; /* current in byte rate */
> - __u32 outbps; /* current out byte rate */
> -};
> -
> -
> -/* The argument to IP_VS_SO_GET_INFO */
> -struct ip_vs_getinfo {
> - /* version number */
> - unsigned int version;
> -
> - /* size of connection hash table */
> - unsigned int size;
> -
> - /* number of virtual services */
> - unsigned int num_services;
> -};
> -
> -
> -/* The argument to IP_VS_SO_GET_SERVICE */
> -struct ip_vs_service_entry {
> - /* which service: user fills in these */
> - u_int16_t protocol;
> - __be32 addr; /* virtual address */
> - __be16 port;
> - u_int32_t fwmark; /* firwall mark of service */
> -
> - /* service options */
> - char sched_name[IP_VS_SCHEDNAME_MAXLEN];
> - unsigned flags; /* virtual service flags */
> - unsigned timeout; /* persistent timeout */
> - __be32 netmask; /* persistent netmask */
> -
> - /* number of real servers */
> - unsigned int num_dests;
> -
> - /* statistics */
> - struct ip_vs_stats_user stats;
> -};
> -
> -
> -struct ip_vs_dest_entry {
> - __be32 addr; /* destination address */
> - __be16 port;
> - unsigned conn_flags; /* connection flags */
> - int weight; /* destination weight */
> -
> - u_int32_t u_threshold; /* upper threshold */
> - u_int32_t l_threshold; /* lower threshold */
> -
> - u_int32_t activeconns; /* active connections */
> - u_int32_t inactconns; /* inactive connections */
> - u_int32_t persistconns; /* persistent connections */
> -
> - /* statistics */
> - struct ip_vs_stats_user stats;
> -};
> -
> -
> -/* The argument to IP_VS_SO_GET_DESTS */
> -struct ip_vs_get_dests {
> - /* which service: user fills in these */
> - u_int16_t protocol;
> - __be32 addr; /* virtual address */
> - __be16 port;
> - u_int32_t fwmark; /* firwall mark of service */
> -
> - /* number of real servers */
> - unsigned int num_dests;
> -
> - /* the real servers */
> - struct ip_vs_dest_entry entrytable[0];
> -};
> -
> -
> -/* The argument to IP_VS_SO_GET_SERVICES */
> -struct ip_vs_get_services {
> - /* number of virtual services */
> - unsigned int num_services;
> -
> - /* service table */
> - struct ip_vs_service_entry entrytable[0];
> -};
> -
> -
> -/* The argument to IP_VS_SO_GET_TIMEOUT */
> -struct ip_vs_timeout_user {
> - int tcp_timeout;
> - int tcp_fin_timeout;
> - int udp_timeout;
> -};
> -
> -
> -/* The argument to IP_VS_SO_GET_DAEMON */
> -struct ip_vs_daemon_user {
> - /* sync daemon state (master/backup) */
> - int state;
> -
> - /* multicast interface name */
> - char mcast_ifn[IP_VS_IFNAME_MAXLEN];
> -
> - /* SyncID we belong to */
> - int syncid;
> -};
> +#ifndef _NET_IP_VS_H
> +#define _NET_IP_VS_H
>
> +#include <linux/ip_vs.h> /* definitions shared with userland */
>
> +/* old ipvsadm versions still include this file directly */
> #ifdef __KERNEL__
>
> +#include <asm/types.h> /* for __uXX types */
> +
> +#include <linux/sysctl.h> /* for ctl_path */
> #include <linux/list.h> /* for struct list_head */
> #include <linux/spinlock.h> /* for struct rwlock_t */
> #include <asm/atomic.h> /* for struct atomic_t */
> @@ -981,4 +744,4 @@ static inline __wsum ip_vs_check_diff2(__be16 old, __be16 new, __wsum oldsum)
>
> #endif /* __KERNEL__ */
>
> -#endif /* _IP_VS_H */
> +#endif /* _NET_IP_VS_H */
> --
> 1.5.4.5
--
Horms
^ permalink raw reply [flat|nested] 19+ messages in thread* Re: [PATCH] IPVS: Move userspace definitions to include/linux/ip_vs.h
2008-07-24 11:14 ` Simon Horman
@ 2008-07-24 11:22 ` Patrick McHardy
2008-07-24 11:34 ` Julius Volz
0 siblings, 1 reply; 19+ messages in thread
From: Patrick McHardy @ 2008-07-24 11:22 UTC (permalink / raw)
To: Simon Horman; +Cc: Julius Volz, lvs-devel, netdev, davem, vbusam
Simon Horman wrote:
> On Thu, Jul 24, 2008 at 12:14:49PM +0200, Julius Volz wrote:
>> Current versions of ipvsadm include "/usr/src/linux/include/net/ip_vs.h"
>> directly. This file also contains kernel-only definitions. Normally, public
>> definitions should live in include/linux, so this patch moves the
>> definitions shared with userspace to a new file, "include/linux/ip_vs.h".
>>
>> To make old ipvsadms still compile with this, the old header file includes
>> the new one.
>>
>> Thanks to Dave Miller and Horms for noting/adding the missing Kbuild entry
>> for the new header file.
>>
>> Signed-off-by: Julius Volz <juliusv@google.com>
>
> Acked-by: Simon Horman <horms@verge.net.au>
>
>> ---
>> +/* Move it to better place one day, for now keep it unique */
>> +#define NFC_IPVS_PROPERTY 0x10000
Does this have any connection to the skb flag? If so, does
it really belong in the userspace interface?
>> +struct ip_vs_service_user {
>> + /* virtual service addresses */
>> + u_int16_t protocol;
>> + __be32 addr; /* virtual ip address */
>> + __be16 port;
If you switch the above two you plug two holes in the struct.
>> + u_int32_t fwmark; /* firwall mark of service */
>> +
>> + /* virtual service options */
>> + char sched_name[IP_VS_SCHEDNAME_MAXLEN];
>> + unsigned flags; /* virtual service flags */
>> + unsigned timeout; /* persistent timeout in sec */
>> + __be32 netmask; /* persistent netmask */
>> +};
>> +
>> +
>> +struct ip_vs_dest_user {
>> + /* destination server address */
>> + __be32 addr;
>> + __be16 port;
This also leaves a hole, you should make sure its zeroed explicitly
to avoid leaking information to userspace.
>> +
>> + /* real server options */
>> + unsigned conn_flags; /* connection flags */
>> + int weight; /* destination weight */
>> +
>> + /* thresholds for active connections */
>> + u_int32_t u_threshold; /* upper threshold */
>> + u_int32_t l_threshold; /* lower threshold */
>> +};
>> +
>> +
>> +/*
>> + * IPVS statistics object (for user space)
>> + */
>> +struct ip_vs_stats_user
>> +{
>> + __u32 conns; /* connections scheduled */
>> + __u32 inpkts; /* incoming packets */
>> + __u32 outpkts; /* outgoing packets */
>> + __u64 inbytes; /* incoming bytes */
>> + __u64 outbytes; /* outgoing bytes */
Putting the u64s first would also plug a hole.
>> +
>> + __u32 cps; /* current connection rate */
>> + __u32 inpps; /* current in packet rate */
>> + __u32 outpps; /* current out packet rate */
>> + __u32 inbps; /* current in byte rate */
>> + __u32 outbps; /* current out byte rate */
>> +};
>> +
>> +
>> +/* The argument to IP_VS_SO_GET_INFO */
>> +struct ip_vs_getinfo {
>> + /* version number */
>> + unsigned int version;
>> +
>> + /* size of connection hash table */
>> + unsigned int size;
>> +
>> + /* number of virtual services */
>> + unsigned int num_services;
>> +};
>> +
>> +
>> +/* The argument to IP_VS_SO_GET_SERVICE */
>> +struct ip_vs_service_entry {
>> + /* which service: user fills in these */
>> + u_int16_t protocol;
>> + __be32 addr; /* virtual address */
>> + __be16 port;
Same as above.
>> + u_int32_t fwmark; /* firwall mark of service */
>> +
>> + /* service options */
>> + char sched_name[IP_VS_SCHEDNAME_MAXLEN];
>> + unsigned flags; /* virtual service flags */
>> + unsigned timeout; /* persistent timeout */
>> + __be32 netmask; /* persistent netmask */
>> +
>> + /* number of real servers */
>> + unsigned int num_dests;
>> +
>> + /* statistics */
>> + struct ip_vs_stats_user stats;
>> +};
>> +
>> +
>> +struct ip_vs_dest_entry {
>> + __be32 addr; /* destination address */
>> + __be16 port;
Also a hole that should be cleared.
>> + unsigned conn_flags; /* connection flags */
>> + int weight; /* destination weight */
>> +
>> + u_int32_t u_threshold; /* upper threshold */
>> + u_int32_t l_threshold; /* lower threshold */
>> +
>> + u_int32_t activeconns; /* active connections */
>> + u_int32_t inactconns; /* inactive connections */
>> + u_int32_t persistconns; /* persistent connections */
>> +
>> + /* statistics */
>> + struct ip_vs_stats_user stats;
You might also have a hole before stats since it has 8b alignment.
I'd suggest to use pahole to figure out which structs need to be
restructured.
>> ...
^ permalink raw reply [flat|nested] 19+ messages in thread* Re: [PATCH] IPVS: Move userspace definitions to include/linux/ip_vs.h
2008-07-24 11:22 ` Patrick McHardy
@ 2008-07-24 11:34 ` Julius Volz
2008-07-24 11:40 ` Patrick McHardy
0 siblings, 1 reply; 19+ messages in thread
From: Julius Volz @ 2008-07-24 11:34 UTC (permalink / raw)
To: Patrick McHardy; +Cc: Simon Horman, lvs-devel, netdev, davem, vbusam
On Thu, Jul 24, 2008 at 1:22 PM, Patrick McHardy <kaber@trash.net> wrote:
>>> +/* Move it to better place one day, for now keep it unique */
>>> +#define NFC_IPVS_PROPERTY 0x10000
>
> Does this have any connection to the skb flag? If so, does
> it really belong in the userspace interface?
This doesn't seem to be used at all anymore, but I didn't want to
remove it in the same patch... should I?
>>> +struct ip_vs_service_user {
>>> + /* virtual service addresses */
>>> + u_int16_t protocol;
>>> + __be32 addr; /* virtual ip address */
>>> + __be16 port;
>
> If you switch the above two you plug two holes in the struct.
Unfortunately, these structs all have to stay as they are because they
are used by old ipvsadms. That was the whole reason for implementing
the Netlink interface.
Julius
--
Google Switzerland GmbH
^ permalink raw reply [flat|nested] 19+ messages in thread* Re: [PATCH] IPVS: Move userspace definitions to include/linux/ip_vs.h
2008-07-24 11:34 ` Julius Volz
@ 2008-07-24 11:40 ` Patrick McHardy
2008-07-24 11:46 ` Julius Volz
0 siblings, 1 reply; 19+ messages in thread
From: Patrick McHardy @ 2008-07-24 11:40 UTC (permalink / raw)
To: Julius Volz; +Cc: Simon Horman, lvs-devel, netdev, davem, vbusam
Julius Volz wrote:
> On Thu, Jul 24, 2008 at 1:22 PM, Patrick McHardy <kaber@trash.net> wrote:
>>>> +/* Move it to better place one day, for now keep it unique */
>>>> +#define NFC_IPVS_PROPERTY 0x10000
>> Does this have any connection to the skb flag? If so, does
>> it really belong in the userspace interface?
>
> This doesn't seem to be used at all anymore, but I didn't want to
> remove it in the same patch... should I?
I'm not sure if this is (or has been) used by userspace, someone
more familiar with IPVS should answer that.
>>>> +struct ip_vs_service_user {
>>>> + /* virtual service addresses */
>>>> + u_int16_t protocol;
>>>> + __be32 addr; /* virtual ip address */
>>>> + __be16 port;
>> If you switch the above two you plug two holes in the struct.
>
> Unfortunately, these structs all have to stay as they are because they
> are used by old ipvsadms. That was the whole reason for implementing
> the Netlink interface.
Ah I see, I assumed you would be using them in the new
interface :) So thats fine obviously.
^ permalink raw reply [flat|nested] 19+ messages in thread* Re: [PATCH] IPVS: Move userspace definitions to include/linux/ip_vs.h
2008-07-24 11:40 ` Patrick McHardy
@ 2008-07-24 11:46 ` Julius Volz
2008-07-24 11:58 ` Julius Volz
2008-07-25 0:18 ` Simon Horman
0 siblings, 2 replies; 19+ messages in thread
From: Julius Volz @ 2008-07-24 11:46 UTC (permalink / raw)
To: Patrick McHardy; +Cc: Simon Horman, lvs-devel, netdev, davem, vbusam
On Thu, Jul 24, 2008 at 1:40 PM, Patrick McHardy <kaber@trash.net> wrote:
> Julius Volz wrote:
>>
>> On Thu, Jul 24, 2008 at 1:22 PM, Patrick McHardy <kaber@trash.net> wrote:
>>>>>
>>>>> +/* Move it to better place one day, for now keep it unique */
>>>>> +#define NFC_IPVS_PROPERTY 0x10000
>>>
>>> Does this have any connection to the skb flag? If so, does
>>> it really belong in the userspace interface?
>>
>> This doesn't seem to be used at all anymore, but I didn't want to
>> remove it in the same patch... should I?
>
> I'm not sure if this is (or has been) used by userspace, someone
> more familiar with IPVS should answer that.
I don't think so. It was once used as a bitmask into skb->nfcache,
which does not even exist anymore. There's no use of it in the current
ipvsadm. I think it can go away, I'll post an updated patch again.
Julius
--
Google Switzerland GmbH
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH] IPVS: Move userspace definitions to include/linux/ip_vs.h
2008-07-24 11:46 ` Julius Volz
@ 2008-07-24 11:58 ` Julius Volz
2008-07-25 0:22 ` Simon Horman
2008-07-31 2:09 ` Simon Horman
2008-07-25 0:18 ` Simon Horman
1 sibling, 2 replies; 19+ messages in thread
From: Julius Volz @ 2008-07-24 11:58 UTC (permalink / raw)
To: lvs-devel, netdev; +Cc: davem, kaber, horms, vbusam, Julius Volz
Current versions of ipvsadm include "/usr/src/linux/include/net/ip_vs.h"
directly. This file also contains kernel-only definitions. Normally, public
definitions should live in include/linux, so this patch moves the
definitions shared with userspace to a new file, "include/linux/ip_vs.h".
This also removes the unused NFC_IPVS_PROPERTY bitmask, which was once
used to point into skb->nfcache.
To make old ipvsadms still compile with this, the old header file includes
the new one.
Thanks to Dave Miller and Horms for noting/adding the missing Kbuild entry
for the new header file.
Signed-off-by: Julius Volz <juliusv@google.com>
---
include/linux/Kbuild | 1 +
include/linux/ip_vs.h | 245 +++++++++++++++++++++++++++++++++++++++++++++++
include/net/ip_vs.h | 253 ++-----------------------------------------------
3 files changed, 254 insertions(+), 245 deletions(-)
create mode 100644 include/linux/ip_vs.h
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index 71d70d1..3273039 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -97,6 +97,7 @@ header-y += ioctl.h
header-y += ip6_tunnel.h
header-y += ipmi_msgdefs.h
header-y += ipsec.h
+header-y += ip_vs.h
header-y += ipx.h
header-y += irda.h
header-y += iso_fs.h
diff --git a/include/linux/ip_vs.h b/include/linux/ip_vs.h
new file mode 100644
index 0000000..ec6eb49
--- /dev/null
+++ b/include/linux/ip_vs.h
@@ -0,0 +1,245 @@
+/*
+ * IP Virtual Server
+ * data structure and functionality definitions
+ */
+
+#ifndef _IP_VS_H
+#define _IP_VS_H
+
+#include <linux/types.h> /* For __beXX types in userland */
+
+#define IP_VS_VERSION_CODE 0x010201
+#define NVERSION(version) \
+ (version >> 16) & 0xFF, \
+ (version >> 8) & 0xFF, \
+ version & 0xFF
+
+/*
+ * Virtual Service Flags
+ */
+#define IP_VS_SVC_F_PERSISTENT 0x0001 /* persistent port */
+#define IP_VS_SVC_F_HASHED 0x0002 /* hashed entry */
+
+/*
+ * Destination Server Flags
+ */
+#define IP_VS_DEST_F_AVAILABLE 0x0001 /* server is available */
+#define IP_VS_DEST_F_OVERLOAD 0x0002 /* server is overloaded */
+
+/*
+ * IPVS sync daemon states
+ */
+#define IP_VS_STATE_NONE 0x0000 /* daemon is stopped */
+#define IP_VS_STATE_MASTER 0x0001 /* started as master */
+#define IP_VS_STATE_BACKUP 0x0002 /* started as backup */
+
+/*
+ * IPVS socket options
+ */
+#define IP_VS_BASE_CTL (64+1024+64) /* base */
+
+#define IP_VS_SO_SET_NONE IP_VS_BASE_CTL /* just peek */
+#define IP_VS_SO_SET_INSERT (IP_VS_BASE_CTL+1)
+#define IP_VS_SO_SET_ADD (IP_VS_BASE_CTL+2)
+#define IP_VS_SO_SET_EDIT (IP_VS_BASE_CTL+3)
+#define IP_VS_SO_SET_DEL (IP_VS_BASE_CTL+4)
+#define IP_VS_SO_SET_FLUSH (IP_VS_BASE_CTL+5)
+#define IP_VS_SO_SET_LIST (IP_VS_BASE_CTL+6)
+#define IP_VS_SO_SET_ADDDEST (IP_VS_BASE_CTL+7)
+#define IP_VS_SO_SET_DELDEST (IP_VS_BASE_CTL+8)
+#define IP_VS_SO_SET_EDITDEST (IP_VS_BASE_CTL+9)
+#define IP_VS_SO_SET_TIMEOUT (IP_VS_BASE_CTL+10)
+#define IP_VS_SO_SET_STARTDAEMON (IP_VS_BASE_CTL+11)
+#define IP_VS_SO_SET_STOPDAEMON (IP_VS_BASE_CTL+12)
+#define IP_VS_SO_SET_RESTORE (IP_VS_BASE_CTL+13)
+#define IP_VS_SO_SET_SAVE (IP_VS_BASE_CTL+14)
+#define IP_VS_SO_SET_ZERO (IP_VS_BASE_CTL+15)
+#define IP_VS_SO_SET_MAX IP_VS_SO_SET_ZERO
+
+#define IP_VS_SO_GET_VERSION IP_VS_BASE_CTL
+#define IP_VS_SO_GET_INFO (IP_VS_BASE_CTL+1)
+#define IP_VS_SO_GET_SERVICES (IP_VS_BASE_CTL+2)
+#define IP_VS_SO_GET_SERVICE (IP_VS_BASE_CTL+3)
+#define IP_VS_SO_GET_DESTS (IP_VS_BASE_CTL+4)
+#define IP_VS_SO_GET_DEST (IP_VS_BASE_CTL+5) /* not used now */
+#define IP_VS_SO_GET_TIMEOUT (IP_VS_BASE_CTL+6)
+#define IP_VS_SO_GET_DAEMON (IP_VS_BASE_CTL+7)
+#define IP_VS_SO_GET_MAX IP_VS_SO_GET_DAEMON
+
+
+/*
+ * IPVS Connection Flags
+ */
+#define IP_VS_CONN_F_FWD_MASK 0x0007 /* mask for the fwd methods */
+#define IP_VS_CONN_F_MASQ 0x0000 /* masquerading/NAT */
+#define IP_VS_CONN_F_LOCALNODE 0x0001 /* local node */
+#define IP_VS_CONN_F_TUNNEL 0x0002 /* tunneling */
+#define IP_VS_CONN_F_DROUTE 0x0003 /* direct routing */
+#define IP_VS_CONN_F_BYPASS 0x0004 /* cache bypass */
+#define IP_VS_CONN_F_SYNC 0x0020 /* entry created by sync */
+#define IP_VS_CONN_F_HASHED 0x0040 /* hashed entry */
+#define IP_VS_CONN_F_NOOUTPUT 0x0080 /* no output packets */
+#define IP_VS_CONN_F_INACTIVE 0x0100 /* not established */
+#define IP_VS_CONN_F_OUT_SEQ 0x0200 /* must do output seq adjust */
+#define IP_VS_CONN_F_IN_SEQ 0x0400 /* must do input seq adjust */
+#define IP_VS_CONN_F_SEQ_MASK 0x0600 /* in/out sequence mask */
+#define IP_VS_CONN_F_NO_CPORT 0x0800 /* no client port set yet */
+#define IP_VS_CONN_F_TEMPLATE 0x1000 /* template, not connection */
+
+#define IP_VS_SCHEDNAME_MAXLEN 16
+#define IP_VS_IFNAME_MAXLEN 16
+
+
+/*
+ * The struct ip_vs_service_user and struct ip_vs_dest_user are
+ * used to set IPVS rules through setsockopt.
+ */
+struct ip_vs_service_user {
+ /* virtual service addresses */
+ u_int16_t protocol;
+ __be32 addr; /* virtual ip address */
+ __be16 port;
+ u_int32_t fwmark; /* firwall mark of service */
+
+ /* virtual service options */
+ char sched_name[IP_VS_SCHEDNAME_MAXLEN];
+ unsigned flags; /* virtual service flags */
+ unsigned timeout; /* persistent timeout in sec */
+ __be32 netmask; /* persistent netmask */
+};
+
+
+struct ip_vs_dest_user {
+ /* destination server address */
+ __be32 addr;
+ __be16 port;
+
+ /* real server options */
+ unsigned conn_flags; /* connection flags */
+ int weight; /* destination weight */
+
+ /* thresholds for active connections */
+ u_int32_t u_threshold; /* upper threshold */
+ u_int32_t l_threshold; /* lower threshold */
+};
+
+
+/*
+ * IPVS statistics object (for user space)
+ */
+struct ip_vs_stats_user
+{
+ __u32 conns; /* connections scheduled */
+ __u32 inpkts; /* incoming packets */
+ __u32 outpkts; /* outgoing packets */
+ __u64 inbytes; /* incoming bytes */
+ __u64 outbytes; /* outgoing bytes */
+
+ __u32 cps; /* current connection rate */
+ __u32 inpps; /* current in packet rate */
+ __u32 outpps; /* current out packet rate */
+ __u32 inbps; /* current in byte rate */
+ __u32 outbps; /* current out byte rate */
+};
+
+
+/* The argument to IP_VS_SO_GET_INFO */
+struct ip_vs_getinfo {
+ /* version number */
+ unsigned int version;
+
+ /* size of connection hash table */
+ unsigned int size;
+
+ /* number of virtual services */
+ unsigned int num_services;
+};
+
+
+/* The argument to IP_VS_SO_GET_SERVICE */
+struct ip_vs_service_entry {
+ /* which service: user fills in these */
+ u_int16_t protocol;
+ __be32 addr; /* virtual address */
+ __be16 port;
+ u_int32_t fwmark; /* firwall mark of service */
+
+ /* service options */
+ char sched_name[IP_VS_SCHEDNAME_MAXLEN];
+ unsigned flags; /* virtual service flags */
+ unsigned timeout; /* persistent timeout */
+ __be32 netmask; /* persistent netmask */
+
+ /* number of real servers */
+ unsigned int num_dests;
+
+ /* statistics */
+ struct ip_vs_stats_user stats;
+};
+
+
+struct ip_vs_dest_entry {
+ __be32 addr; /* destination address */
+ __be16 port;
+ unsigned conn_flags; /* connection flags */
+ int weight; /* destination weight */
+
+ u_int32_t u_threshold; /* upper threshold */
+ u_int32_t l_threshold; /* lower threshold */
+
+ u_int32_t activeconns; /* active connections */
+ u_int32_t inactconns; /* inactive connections */
+ u_int32_t persistconns; /* persistent connections */
+
+ /* statistics */
+ struct ip_vs_stats_user stats;
+};
+
+
+/* The argument to IP_VS_SO_GET_DESTS */
+struct ip_vs_get_dests {
+ /* which service: user fills in these */
+ u_int16_t protocol;
+ __be32 addr; /* virtual address */
+ __be16 port;
+ u_int32_t fwmark; /* firwall mark of service */
+
+ /* number of real servers */
+ unsigned int num_dests;
+
+ /* the real servers */
+ struct ip_vs_dest_entry entrytable[0];
+};
+
+
+/* The argument to IP_VS_SO_GET_SERVICES */
+struct ip_vs_get_services {
+ /* number of virtual services */
+ unsigned int num_services;
+
+ /* service table */
+ struct ip_vs_service_entry entrytable[0];
+};
+
+
+/* The argument to IP_VS_SO_GET_TIMEOUT */
+struct ip_vs_timeout_user {
+ int tcp_timeout;
+ int tcp_fin_timeout;
+ int udp_timeout;
+};
+
+
+/* The argument to IP_VS_SO_GET_DAEMON */
+struct ip_vs_daemon_user {
+ /* sync daemon state (master/backup) */
+ int state;
+
+ /* multicast interface name */
+ char mcast_ifn[IP_VS_IFNAME_MAXLEN];
+
+ /* SyncID we belong to */
+ int syncid;
+};
+
+#endif /* _IP_VS_H */
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index 9a51eba..cbb59eb 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -3,254 +3,17 @@
* data structure and functionality definitions
*/
-#ifndef _IP_VS_H
-#define _IP_VS_H
-
-#include <asm/types.h> /* For __uXX types */
-#include <linux/types.h> /* For __beXX types in userland */
-
-#include <linux/sysctl.h> /* For ctl_path */
-
-#define IP_VS_VERSION_CODE 0x010201
-#define NVERSION(version) \
- (version >> 16) & 0xFF, \
- (version >> 8) & 0xFF, \
- version & 0xFF
-
-/*
- * Virtual Service Flags
- */
-#define IP_VS_SVC_F_PERSISTENT 0x0001 /* persistent port */
-#define IP_VS_SVC_F_HASHED 0x0002 /* hashed entry */
-
-/*
- * Destination Server Flags
- */
-#define IP_VS_DEST_F_AVAILABLE 0x0001 /* server is available */
-#define IP_VS_DEST_F_OVERLOAD 0x0002 /* server is overloaded */
-
-/*
- * IPVS sync daemon states
- */
-#define IP_VS_STATE_NONE 0x0000 /* daemon is stopped */
-#define IP_VS_STATE_MASTER 0x0001 /* started as master */
-#define IP_VS_STATE_BACKUP 0x0002 /* started as backup */
-
-/*
- * IPVS socket options
- */
-#define IP_VS_BASE_CTL (64+1024+64) /* base */
-
-#define IP_VS_SO_SET_NONE IP_VS_BASE_CTL /* just peek */
-#define IP_VS_SO_SET_INSERT (IP_VS_BASE_CTL+1)
-#define IP_VS_SO_SET_ADD (IP_VS_BASE_CTL+2)
-#define IP_VS_SO_SET_EDIT (IP_VS_BASE_CTL+3)
-#define IP_VS_SO_SET_DEL (IP_VS_BASE_CTL+4)
-#define IP_VS_SO_SET_FLUSH (IP_VS_BASE_CTL+5)
-#define IP_VS_SO_SET_LIST (IP_VS_BASE_CTL+6)
-#define IP_VS_SO_SET_ADDDEST (IP_VS_BASE_CTL+7)
-#define IP_VS_SO_SET_DELDEST (IP_VS_BASE_CTL+8)
-#define IP_VS_SO_SET_EDITDEST (IP_VS_BASE_CTL+9)
-#define IP_VS_SO_SET_TIMEOUT (IP_VS_BASE_CTL+10)
-#define IP_VS_SO_SET_STARTDAEMON (IP_VS_BASE_CTL+11)
-#define IP_VS_SO_SET_STOPDAEMON (IP_VS_BASE_CTL+12)
-#define IP_VS_SO_SET_RESTORE (IP_VS_BASE_CTL+13)
-#define IP_VS_SO_SET_SAVE (IP_VS_BASE_CTL+14)
-#define IP_VS_SO_SET_ZERO (IP_VS_BASE_CTL+15)
-#define IP_VS_SO_SET_MAX IP_VS_SO_SET_ZERO
-
-#define IP_VS_SO_GET_VERSION IP_VS_BASE_CTL
-#define IP_VS_SO_GET_INFO (IP_VS_BASE_CTL+1)
-#define IP_VS_SO_GET_SERVICES (IP_VS_BASE_CTL+2)
-#define IP_VS_SO_GET_SERVICE (IP_VS_BASE_CTL+3)
-#define IP_VS_SO_GET_DESTS (IP_VS_BASE_CTL+4)
-#define IP_VS_SO_GET_DEST (IP_VS_BASE_CTL+5) /* not used now */
-#define IP_VS_SO_GET_TIMEOUT (IP_VS_BASE_CTL+6)
-#define IP_VS_SO_GET_DAEMON (IP_VS_BASE_CTL+7)
-#define IP_VS_SO_GET_MAX IP_VS_SO_GET_DAEMON
-
-
-/*
- * IPVS Connection Flags
- */
-#define IP_VS_CONN_F_FWD_MASK 0x0007 /* mask for the fwd methods */
-#define IP_VS_CONN_F_MASQ 0x0000 /* masquerading/NAT */
-#define IP_VS_CONN_F_LOCALNODE 0x0001 /* local node */
-#define IP_VS_CONN_F_TUNNEL 0x0002 /* tunneling */
-#define IP_VS_CONN_F_DROUTE 0x0003 /* direct routing */
-#define IP_VS_CONN_F_BYPASS 0x0004 /* cache bypass */
-#define IP_VS_CONN_F_SYNC 0x0020 /* entry created by sync */
-#define IP_VS_CONN_F_HASHED 0x0040 /* hashed entry */
-#define IP_VS_CONN_F_NOOUTPUT 0x0080 /* no output packets */
-#define IP_VS_CONN_F_INACTIVE 0x0100 /* not established */
-#define IP_VS_CONN_F_OUT_SEQ 0x0200 /* must do output seq adjust */
-#define IP_VS_CONN_F_IN_SEQ 0x0400 /* must do input seq adjust */
-#define IP_VS_CONN_F_SEQ_MASK 0x0600 /* in/out sequence mask */
-#define IP_VS_CONN_F_NO_CPORT 0x0800 /* no client port set yet */
-#define IP_VS_CONN_F_TEMPLATE 0x1000 /* template, not connection */
-
-/* Move it to better place one day, for now keep it unique */
-#define NFC_IPVS_PROPERTY 0x10000
-
-#define IP_VS_SCHEDNAME_MAXLEN 16
-#define IP_VS_IFNAME_MAXLEN 16
-
-
-/*
- * The struct ip_vs_service_user and struct ip_vs_dest_user are
- * used to set IPVS rules through setsockopt.
- */
-struct ip_vs_service_user {
- /* virtual service addresses */
- u_int16_t protocol;
- __be32 addr; /* virtual ip address */
- __be16 port;
- u_int32_t fwmark; /* firwall mark of service */
-
- /* virtual service options */
- char sched_name[IP_VS_SCHEDNAME_MAXLEN];
- unsigned flags; /* virtual service flags */
- unsigned timeout; /* persistent timeout in sec */
- __be32 netmask; /* persistent netmask */
-};
-
-
-struct ip_vs_dest_user {
- /* destination server address */
- __be32 addr;
- __be16 port;
-
- /* real server options */
- unsigned conn_flags; /* connection flags */
- int weight; /* destination weight */
-
- /* thresholds for active connections */
- u_int32_t u_threshold; /* upper threshold */
- u_int32_t l_threshold; /* lower threshold */
-};
-
-
-/*
- * IPVS statistics object (for user space)
- */
-struct ip_vs_stats_user
-{
- __u32 conns; /* connections scheduled */
- __u32 inpkts; /* incoming packets */
- __u32 outpkts; /* outgoing packets */
- __u64 inbytes; /* incoming bytes */
- __u64 outbytes; /* outgoing bytes */
-
- __u32 cps; /* current connection rate */
- __u32 inpps; /* current in packet rate */
- __u32 outpps; /* current out packet rate */
- __u32 inbps; /* current in byte rate */
- __u32 outbps; /* current out byte rate */
-};
-
-
-/* The argument to IP_VS_SO_GET_INFO */
-struct ip_vs_getinfo {
- /* version number */
- unsigned int version;
-
- /* size of connection hash table */
- unsigned int size;
-
- /* number of virtual services */
- unsigned int num_services;
-};
-
-
-/* The argument to IP_VS_SO_GET_SERVICE */
-struct ip_vs_service_entry {
- /* which service: user fills in these */
- u_int16_t protocol;
- __be32 addr; /* virtual address */
- __be16 port;
- u_int32_t fwmark; /* firwall mark of service */
-
- /* service options */
- char sched_name[IP_VS_SCHEDNAME_MAXLEN];
- unsigned flags; /* virtual service flags */
- unsigned timeout; /* persistent timeout */
- __be32 netmask; /* persistent netmask */
-
- /* number of real servers */
- unsigned int num_dests;
-
- /* statistics */
- struct ip_vs_stats_user stats;
-};
-
-
-struct ip_vs_dest_entry {
- __be32 addr; /* destination address */
- __be16 port;
- unsigned conn_flags; /* connection flags */
- int weight; /* destination weight */
-
- u_int32_t u_threshold; /* upper threshold */
- u_int32_t l_threshold; /* lower threshold */
-
- u_int32_t activeconns; /* active connections */
- u_int32_t inactconns; /* inactive connections */
- u_int32_t persistconns; /* persistent connections */
-
- /* statistics */
- struct ip_vs_stats_user stats;
-};
-
-
-/* The argument to IP_VS_SO_GET_DESTS */
-struct ip_vs_get_dests {
- /* which service: user fills in these */
- u_int16_t protocol;
- __be32 addr; /* virtual address */
- __be16 port;
- u_int32_t fwmark; /* firwall mark of service */
-
- /* number of real servers */
- unsigned int num_dests;
-
- /* the real servers */
- struct ip_vs_dest_entry entrytable[0];
-};
-
-
-/* The argument to IP_VS_SO_GET_SERVICES */
-struct ip_vs_get_services {
- /* number of virtual services */
- unsigned int num_services;
-
- /* service table */
- struct ip_vs_service_entry entrytable[0];
-};
-
-
-/* The argument to IP_VS_SO_GET_TIMEOUT */
-struct ip_vs_timeout_user {
- int tcp_timeout;
- int tcp_fin_timeout;
- int udp_timeout;
-};
-
-
-/* The argument to IP_VS_SO_GET_DAEMON */
-struct ip_vs_daemon_user {
- /* sync daemon state (master/backup) */
- int state;
-
- /* multicast interface name */
- char mcast_ifn[IP_VS_IFNAME_MAXLEN];
-
- /* SyncID we belong to */
- int syncid;
-};
+#ifndef _NET_IP_VS_H
+#define _NET_IP_VS_H
+#include <linux/ip_vs.h> /* definitions shared with userland */
+/* old ipvsadm versions still include this file directly */
#ifdef __KERNEL__
+#include <asm/types.h> /* for __uXX types */
+
+#include <linux/sysctl.h> /* for ctl_path */
#include <linux/list.h> /* for struct list_head */
#include <linux/spinlock.h> /* for struct rwlock_t */
#include <asm/atomic.h> /* for struct atomic_t */
@@ -981,4 +744,4 @@ static inline __wsum ip_vs_check_diff2(__be16 old, __be16 new, __wsum oldsum)
#endif /* __KERNEL__ */
-#endif /* _IP_VS_H */
+#endif /* _NET_IP_VS_H */
--
1.5.4.5
^ permalink raw reply related [flat|nested] 19+ messages in thread* Re: [PATCH] IPVS: Move userspace definitions to include/linux/ip_vs.h
2008-07-24 11:58 ` Julius Volz
@ 2008-07-25 0:22 ` Simon Horman
2008-07-31 2:09 ` Simon Horman
1 sibling, 0 replies; 19+ messages in thread
From: Simon Horman @ 2008-07-25 0:22 UTC (permalink / raw)
To: Julius Volz; +Cc: lvs-devel, netdev, davem, kaber, vbusam
On Thu, Jul 24, 2008 at 01:58:36PM +0200, Julius Volz wrote:
> Current versions of ipvsadm include "/usr/src/linux/include/net/ip_vs.h"
> directly. This file also contains kernel-only definitions. Normally, public
> definitions should live in include/linux, so this patch moves the
> definitions shared with userspace to a new file, "include/linux/ip_vs.h".
>
> This also removes the unused NFC_IPVS_PROPERTY bitmask, which was once
> used to point into skb->nfcache.
>
> To make old ipvsadms still compile with this, the old header file includes
> the new one.
>
> Thanks to Dave Miller and Horms for noting/adding the missing Kbuild entry
> for the new header file.
>
> Signed-off-by: Julius Volz <juliusv@google.com>
Acked-by: Simon Horman <horms@verge.net.au>
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH] IPVS: Move userspace definitions to include/linux/ip_vs.h
2008-07-24 11:58 ` Julius Volz
2008-07-25 0:22 ` Simon Horman
@ 2008-07-31 2:09 ` Simon Horman
2008-08-01 3:45 ` David Miller
1 sibling, 1 reply; 19+ messages in thread
From: Simon Horman @ 2008-07-31 2:09 UTC (permalink / raw)
To: lvs-devel, netdev; +Cc: Julius Volz, David Miller, Patrick McHardy, Vince Busam
From: Julius Volz <juliusv@google.com>
Current versions of ipvsadm include "/usr/src/linux/include/net/ip_vs.h"
directly. This file also contains kernel-only definitions. Normally, public
definitions should live in include/linux, so this patch moves the
definitions shared with userspace to a new file, "include/linux/ip_vs.h".
This also removes the unused NFC_IPVS_PROPERTY bitmask, which was once
used to point into skb->nfcache.
To make old ipvsadms still compile with this, the old header file includes
the new one.
Thanks to Dave Miller and Horms for noting/adding the missing Kbuild entry
for the new header file.
Signed-off-by: Julius Volz <juliusv@google.com>
Acked-by: Simon Horman <horms@verge.net.au>
---
include/linux/Kbuild | 1 +
include/linux/ip_vs.h | 245 +++++++++++++++++++++++++++++++++++++++++++++++
include/net/ip_vs.h | 253 ++-----------------------------------------------
3 files changed, 254 insertions(+), 245 deletions(-)
create mode 100644 include/linux/ip_vs.h
Hi,
there has been quite a bit of discussiona round this patch,
and each time it has been posted various fixes have been proposed.
I believe that Julius has fixed all of these concerns and that there
has been no futher discussion since he sent this version,
dated Thu, 24 Jul 2008 13:58:36 +0200.
Please consider merging it.
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index 71d70d1..3273039 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -97,6 +97,7 @@ header-y += ioctl.h
header-y += ip6_tunnel.h
header-y += ipmi_msgdefs.h
header-y += ipsec.h
+header-y += ip_vs.h
header-y += ipx.h
header-y += irda.h
header-y += iso_fs.h
diff --git a/include/linux/ip_vs.h b/include/linux/ip_vs.h
new file mode 100644
index 0000000..ec6eb49
--- /dev/null
+++ b/include/linux/ip_vs.h
@@ -0,0 +1,245 @@
+/*
+ * IP Virtual Server
+ * data structure and functionality definitions
+ */
+
+#ifndef _IP_VS_H
+#define _IP_VS_H
+
+#include <linux/types.h> /* For __beXX types in userland */
+
+#define IP_VS_VERSION_CODE 0x010201
+#define NVERSION(version) \
+ (version >> 16) & 0xFF, \
+ (version >> 8) & 0xFF, \
+ version & 0xFF
+
+/*
+ * Virtual Service Flags
+ */
+#define IP_VS_SVC_F_PERSISTENT 0x0001 /* persistent port */
+#define IP_VS_SVC_F_HASHED 0x0002 /* hashed entry */
+
+/*
+ * Destination Server Flags
+ */
+#define IP_VS_DEST_F_AVAILABLE 0x0001 /* server is available */
+#define IP_VS_DEST_F_OVERLOAD 0x0002 /* server is overloaded */
+
+/*
+ * IPVS sync daemon states
+ */
+#define IP_VS_STATE_NONE 0x0000 /* daemon is stopped */
+#define IP_VS_STATE_MASTER 0x0001 /* started as master */
+#define IP_VS_STATE_BACKUP 0x0002 /* started as backup */
+
+/*
+ * IPVS socket options
+ */
+#define IP_VS_BASE_CTL (64+1024+64) /* base */
+
+#define IP_VS_SO_SET_NONE IP_VS_BASE_CTL /* just peek */
+#define IP_VS_SO_SET_INSERT (IP_VS_BASE_CTL+1)
+#define IP_VS_SO_SET_ADD (IP_VS_BASE_CTL+2)
+#define IP_VS_SO_SET_EDIT (IP_VS_BASE_CTL+3)
+#define IP_VS_SO_SET_DEL (IP_VS_BASE_CTL+4)
+#define IP_VS_SO_SET_FLUSH (IP_VS_BASE_CTL+5)
+#define IP_VS_SO_SET_LIST (IP_VS_BASE_CTL+6)
+#define IP_VS_SO_SET_ADDDEST (IP_VS_BASE_CTL+7)
+#define IP_VS_SO_SET_DELDEST (IP_VS_BASE_CTL+8)
+#define IP_VS_SO_SET_EDITDEST (IP_VS_BASE_CTL+9)
+#define IP_VS_SO_SET_TIMEOUT (IP_VS_BASE_CTL+10)
+#define IP_VS_SO_SET_STARTDAEMON (IP_VS_BASE_CTL+11)
+#define IP_VS_SO_SET_STOPDAEMON (IP_VS_BASE_CTL+12)
+#define IP_VS_SO_SET_RESTORE (IP_VS_BASE_CTL+13)
+#define IP_VS_SO_SET_SAVE (IP_VS_BASE_CTL+14)
+#define IP_VS_SO_SET_ZERO (IP_VS_BASE_CTL+15)
+#define IP_VS_SO_SET_MAX IP_VS_SO_SET_ZERO
+
+#define IP_VS_SO_GET_VERSION IP_VS_BASE_CTL
+#define IP_VS_SO_GET_INFO (IP_VS_BASE_CTL+1)
+#define IP_VS_SO_GET_SERVICES (IP_VS_BASE_CTL+2)
+#define IP_VS_SO_GET_SERVICE (IP_VS_BASE_CTL+3)
+#define IP_VS_SO_GET_DESTS (IP_VS_BASE_CTL+4)
+#define IP_VS_SO_GET_DEST (IP_VS_BASE_CTL+5) /* not used now */
+#define IP_VS_SO_GET_TIMEOUT (IP_VS_BASE_CTL+6)
+#define IP_VS_SO_GET_DAEMON (IP_VS_BASE_CTL+7)
+#define IP_VS_SO_GET_MAX IP_VS_SO_GET_DAEMON
+
+
+/*
+ * IPVS Connection Flags
+ */
+#define IP_VS_CONN_F_FWD_MASK 0x0007 /* mask for the fwd methods */
+#define IP_VS_CONN_F_MASQ 0x0000 /* masquerading/NAT */
+#define IP_VS_CONN_F_LOCALNODE 0x0001 /* local node */
+#define IP_VS_CONN_F_TUNNEL 0x0002 /* tunneling */
+#define IP_VS_CONN_F_DROUTE 0x0003 /* direct routing */
+#define IP_VS_CONN_F_BYPASS 0x0004 /* cache bypass */
+#define IP_VS_CONN_F_SYNC 0x0020 /* entry created by sync */
+#define IP_VS_CONN_F_HASHED 0x0040 /* hashed entry */
+#define IP_VS_CONN_F_NOOUTPUT 0x0080 /* no output packets */
+#define IP_VS_CONN_F_INACTIVE 0x0100 /* not established */
+#define IP_VS_CONN_F_OUT_SEQ 0x0200 /* must do output seq adjust */
+#define IP_VS_CONN_F_IN_SEQ 0x0400 /* must do input seq adjust */
+#define IP_VS_CONN_F_SEQ_MASK 0x0600 /* in/out sequence mask */
+#define IP_VS_CONN_F_NO_CPORT 0x0800 /* no client port set yet */
+#define IP_VS_CONN_F_TEMPLATE 0x1000 /* template, not connection */
+
+#define IP_VS_SCHEDNAME_MAXLEN 16
+#define IP_VS_IFNAME_MAXLEN 16
+
+
+/*
+ * The struct ip_vs_service_user and struct ip_vs_dest_user are
+ * used to set IPVS rules through setsockopt.
+ */
+struct ip_vs_service_user {
+ /* virtual service addresses */
+ u_int16_t protocol;
+ __be32 addr; /* virtual ip address */
+ __be16 port;
+ u_int32_t fwmark; /* firwall mark of service */
+
+ /* virtual service options */
+ char sched_name[IP_VS_SCHEDNAME_MAXLEN];
+ unsigned flags; /* virtual service flags */
+ unsigned timeout; /* persistent timeout in sec */
+ __be32 netmask; /* persistent netmask */
+};
+
+
+struct ip_vs_dest_user {
+ /* destination server address */
+ __be32 addr;
+ __be16 port;
+
+ /* real server options */
+ unsigned conn_flags; /* connection flags */
+ int weight; /* destination weight */
+
+ /* thresholds for active connections */
+ u_int32_t u_threshold; /* upper threshold */
+ u_int32_t l_threshold; /* lower threshold */
+};
+
+
+/*
+ * IPVS statistics object (for user space)
+ */
+struct ip_vs_stats_user
+{
+ __u32 conns; /* connections scheduled */
+ __u32 inpkts; /* incoming packets */
+ __u32 outpkts; /* outgoing packets */
+ __u64 inbytes; /* incoming bytes */
+ __u64 outbytes; /* outgoing bytes */
+
+ __u32 cps; /* current connection rate */
+ __u32 inpps; /* current in packet rate */
+ __u32 outpps; /* current out packet rate */
+ __u32 inbps; /* current in byte rate */
+ __u32 outbps; /* current out byte rate */
+};
+
+
+/* The argument to IP_VS_SO_GET_INFO */
+struct ip_vs_getinfo {
+ /* version number */
+ unsigned int version;
+
+ /* size of connection hash table */
+ unsigned int size;
+
+ /* number of virtual services */
+ unsigned int num_services;
+};
+
+
+/* The argument to IP_VS_SO_GET_SERVICE */
+struct ip_vs_service_entry {
+ /* which service: user fills in these */
+ u_int16_t protocol;
+ __be32 addr; /* virtual address */
+ __be16 port;
+ u_int32_t fwmark; /* firwall mark of service */
+
+ /* service options */
+ char sched_name[IP_VS_SCHEDNAME_MAXLEN];
+ unsigned flags; /* virtual service flags */
+ unsigned timeout; /* persistent timeout */
+ __be32 netmask; /* persistent netmask */
+
+ /* number of real servers */
+ unsigned int num_dests;
+
+ /* statistics */
+ struct ip_vs_stats_user stats;
+};
+
+
+struct ip_vs_dest_entry {
+ __be32 addr; /* destination address */
+ __be16 port;
+ unsigned conn_flags; /* connection flags */
+ int weight; /* destination weight */
+
+ u_int32_t u_threshold; /* upper threshold */
+ u_int32_t l_threshold; /* lower threshold */
+
+ u_int32_t activeconns; /* active connections */
+ u_int32_t inactconns; /* inactive connections */
+ u_int32_t persistconns; /* persistent connections */
+
+ /* statistics */
+ struct ip_vs_stats_user stats;
+};
+
+
+/* The argument to IP_VS_SO_GET_DESTS */
+struct ip_vs_get_dests {
+ /* which service: user fills in these */
+ u_int16_t protocol;
+ __be32 addr; /* virtual address */
+ __be16 port;
+ u_int32_t fwmark; /* firwall mark of service */
+
+ /* number of real servers */
+ unsigned int num_dests;
+
+ /* the real servers */
+ struct ip_vs_dest_entry entrytable[0];
+};
+
+
+/* The argument to IP_VS_SO_GET_SERVICES */
+struct ip_vs_get_services {
+ /* number of virtual services */
+ unsigned int num_services;
+
+ /* service table */
+ struct ip_vs_service_entry entrytable[0];
+};
+
+
+/* The argument to IP_VS_SO_GET_TIMEOUT */
+struct ip_vs_timeout_user {
+ int tcp_timeout;
+ int tcp_fin_timeout;
+ int udp_timeout;
+};
+
+
+/* The argument to IP_VS_SO_GET_DAEMON */
+struct ip_vs_daemon_user {
+ /* sync daemon state (master/backup) */
+ int state;
+
+ /* multicast interface name */
+ char mcast_ifn[IP_VS_IFNAME_MAXLEN];
+
+ /* SyncID we belong to */
+ int syncid;
+};
+
+#endif /* _IP_VS_H */
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index 9a51eba..cbb59eb 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -3,254 +3,17 @@
* data structure and functionality definitions
*/
-#ifndef _IP_VS_H
-#define _IP_VS_H
-
-#include <asm/types.h> /* For __uXX types */
-#include <linux/types.h> /* For __beXX types in userland */
-
-#include <linux/sysctl.h> /* For ctl_path */
-
-#define IP_VS_VERSION_CODE 0x010201
-#define NVERSION(version) \
- (version >> 16) & 0xFF, \
- (version >> 8) & 0xFF, \
- version & 0xFF
-
-/*
- * Virtual Service Flags
- */
-#define IP_VS_SVC_F_PERSISTENT 0x0001 /* persistent port */
-#define IP_VS_SVC_F_HASHED 0x0002 /* hashed entry */
-
-/*
- * Destination Server Flags
- */
-#define IP_VS_DEST_F_AVAILABLE 0x0001 /* server is available */
-#define IP_VS_DEST_F_OVERLOAD 0x0002 /* server is overloaded */
-
-/*
- * IPVS sync daemon states
- */
-#define IP_VS_STATE_NONE 0x0000 /* daemon is stopped */
-#define IP_VS_STATE_MASTER 0x0001 /* started as master */
-#define IP_VS_STATE_BACKUP 0x0002 /* started as backup */
-
-/*
- * IPVS socket options
- */
-#define IP_VS_BASE_CTL (64+1024+64) /* base */
-
-#define IP_VS_SO_SET_NONE IP_VS_BASE_CTL /* just peek */
-#define IP_VS_SO_SET_INSERT (IP_VS_BASE_CTL+1)
-#define IP_VS_SO_SET_ADD (IP_VS_BASE_CTL+2)
-#define IP_VS_SO_SET_EDIT (IP_VS_BASE_CTL+3)
-#define IP_VS_SO_SET_DEL (IP_VS_BASE_CTL+4)
-#define IP_VS_SO_SET_FLUSH (IP_VS_BASE_CTL+5)
-#define IP_VS_SO_SET_LIST (IP_VS_BASE_CTL+6)
-#define IP_VS_SO_SET_ADDDEST (IP_VS_BASE_CTL+7)
-#define IP_VS_SO_SET_DELDEST (IP_VS_BASE_CTL+8)
-#define IP_VS_SO_SET_EDITDEST (IP_VS_BASE_CTL+9)
-#define IP_VS_SO_SET_TIMEOUT (IP_VS_BASE_CTL+10)
-#define IP_VS_SO_SET_STARTDAEMON (IP_VS_BASE_CTL+11)
-#define IP_VS_SO_SET_STOPDAEMON (IP_VS_BASE_CTL+12)
-#define IP_VS_SO_SET_RESTORE (IP_VS_BASE_CTL+13)
-#define IP_VS_SO_SET_SAVE (IP_VS_BASE_CTL+14)
-#define IP_VS_SO_SET_ZERO (IP_VS_BASE_CTL+15)
-#define IP_VS_SO_SET_MAX IP_VS_SO_SET_ZERO
-
-#define IP_VS_SO_GET_VERSION IP_VS_BASE_CTL
-#define IP_VS_SO_GET_INFO (IP_VS_BASE_CTL+1)
-#define IP_VS_SO_GET_SERVICES (IP_VS_BASE_CTL+2)
-#define IP_VS_SO_GET_SERVICE (IP_VS_BASE_CTL+3)
-#define IP_VS_SO_GET_DESTS (IP_VS_BASE_CTL+4)
-#define IP_VS_SO_GET_DEST (IP_VS_BASE_CTL+5) /* not used now */
-#define IP_VS_SO_GET_TIMEOUT (IP_VS_BASE_CTL+6)
-#define IP_VS_SO_GET_DAEMON (IP_VS_BASE_CTL+7)
-#define IP_VS_SO_GET_MAX IP_VS_SO_GET_DAEMON
-
-
-/*
- * IPVS Connection Flags
- */
-#define IP_VS_CONN_F_FWD_MASK 0x0007 /* mask for the fwd methods */
-#define IP_VS_CONN_F_MASQ 0x0000 /* masquerading/NAT */
-#define IP_VS_CONN_F_LOCALNODE 0x0001 /* local node */
-#define IP_VS_CONN_F_TUNNEL 0x0002 /* tunneling */
-#define IP_VS_CONN_F_DROUTE 0x0003 /* direct routing */
-#define IP_VS_CONN_F_BYPASS 0x0004 /* cache bypass */
-#define IP_VS_CONN_F_SYNC 0x0020 /* entry created by sync */
-#define IP_VS_CONN_F_HASHED 0x0040 /* hashed entry */
-#define IP_VS_CONN_F_NOOUTPUT 0x0080 /* no output packets */
-#define IP_VS_CONN_F_INACTIVE 0x0100 /* not established */
-#define IP_VS_CONN_F_OUT_SEQ 0x0200 /* must do output seq adjust */
-#define IP_VS_CONN_F_IN_SEQ 0x0400 /* must do input seq adjust */
-#define IP_VS_CONN_F_SEQ_MASK 0x0600 /* in/out sequence mask */
-#define IP_VS_CONN_F_NO_CPORT 0x0800 /* no client port set yet */
-#define IP_VS_CONN_F_TEMPLATE 0x1000 /* template, not connection */
-
-/* Move it to better place one day, for now keep it unique */
-#define NFC_IPVS_PROPERTY 0x10000
-
-#define IP_VS_SCHEDNAME_MAXLEN 16
-#define IP_VS_IFNAME_MAXLEN 16
-
-
-/*
- * The struct ip_vs_service_user and struct ip_vs_dest_user are
- * used to set IPVS rules through setsockopt.
- */
-struct ip_vs_service_user {
- /* virtual service addresses */
- u_int16_t protocol;
- __be32 addr; /* virtual ip address */
- __be16 port;
- u_int32_t fwmark; /* firwall mark of service */
-
- /* virtual service options */
- char sched_name[IP_VS_SCHEDNAME_MAXLEN];
- unsigned flags; /* virtual service flags */
- unsigned timeout; /* persistent timeout in sec */
- __be32 netmask; /* persistent netmask */
-};
-
-
-struct ip_vs_dest_user {
- /* destination server address */
- __be32 addr;
- __be16 port;
-
- /* real server options */
- unsigned conn_flags; /* connection flags */
- int weight; /* destination weight */
-
- /* thresholds for active connections */
- u_int32_t u_threshold; /* upper threshold */
- u_int32_t l_threshold; /* lower threshold */
-};
-
-
-/*
- * IPVS statistics object (for user space)
- */
-struct ip_vs_stats_user
-{
- __u32 conns; /* connections scheduled */
- __u32 inpkts; /* incoming packets */
- __u32 outpkts; /* outgoing packets */
- __u64 inbytes; /* incoming bytes */
- __u64 outbytes; /* outgoing bytes */
-
- __u32 cps; /* current connection rate */
- __u32 inpps; /* current in packet rate */
- __u32 outpps; /* current out packet rate */
- __u32 inbps; /* current in byte rate */
- __u32 outbps; /* current out byte rate */
-};
-
-
-/* The argument to IP_VS_SO_GET_INFO */
-struct ip_vs_getinfo {
- /* version number */
- unsigned int version;
-
- /* size of connection hash table */
- unsigned int size;
-
- /* number of virtual services */
- unsigned int num_services;
-};
-
-
-/* The argument to IP_VS_SO_GET_SERVICE */
-struct ip_vs_service_entry {
- /* which service: user fills in these */
- u_int16_t protocol;
- __be32 addr; /* virtual address */
- __be16 port;
- u_int32_t fwmark; /* firwall mark of service */
-
- /* service options */
- char sched_name[IP_VS_SCHEDNAME_MAXLEN];
- unsigned flags; /* virtual service flags */
- unsigned timeout; /* persistent timeout */
- __be32 netmask; /* persistent netmask */
-
- /* number of real servers */
- unsigned int num_dests;
-
- /* statistics */
- struct ip_vs_stats_user stats;
-};
-
-
-struct ip_vs_dest_entry {
- __be32 addr; /* destination address */
- __be16 port;
- unsigned conn_flags; /* connection flags */
- int weight; /* destination weight */
-
- u_int32_t u_threshold; /* upper threshold */
- u_int32_t l_threshold; /* lower threshold */
-
- u_int32_t activeconns; /* active connections */
- u_int32_t inactconns; /* inactive connections */
- u_int32_t persistconns; /* persistent connections */
-
- /* statistics */
- struct ip_vs_stats_user stats;
-};
-
-
-/* The argument to IP_VS_SO_GET_DESTS */
-struct ip_vs_get_dests {
- /* which service: user fills in these */
- u_int16_t protocol;
- __be32 addr; /* virtual address */
- __be16 port;
- u_int32_t fwmark; /* firwall mark of service */
-
- /* number of real servers */
- unsigned int num_dests;
-
- /* the real servers */
- struct ip_vs_dest_entry entrytable[0];
-};
-
-
-/* The argument to IP_VS_SO_GET_SERVICES */
-struct ip_vs_get_services {
- /* number of virtual services */
- unsigned int num_services;
-
- /* service table */
- struct ip_vs_service_entry entrytable[0];
-};
-
-
-/* The argument to IP_VS_SO_GET_TIMEOUT */
-struct ip_vs_timeout_user {
- int tcp_timeout;
- int tcp_fin_timeout;
- int udp_timeout;
-};
-
-
-/* The argument to IP_VS_SO_GET_DAEMON */
-struct ip_vs_daemon_user {
- /* sync daemon state (master/backup) */
- int state;
-
- /* multicast interface name */
- char mcast_ifn[IP_VS_IFNAME_MAXLEN];
-
- /* SyncID we belong to */
- int syncid;
-};
+#ifndef _NET_IP_VS_H
+#define _NET_IP_VS_H
+#include <linux/ip_vs.h> /* definitions shared with userland */
+/* old ipvsadm versions still include this file directly */
#ifdef __KERNEL__
+#include <asm/types.h> /* for __uXX types */
+
+#include <linux/sysctl.h> /* for ctl_path */
#include <linux/list.h> /* for struct list_head */
#include <linux/spinlock.h> /* for struct rwlock_t */
#include <asm/atomic.h> /* for struct atomic_t */
@@ -981,4 +744,4 @@ static inline __wsum ip_vs_check_diff2(__be16 old, __be16 new, __wsum oldsum)
#endif /* __KERNEL__ */
-#endif /* _IP_VS_H */
+#endif /* _NET_IP_VS_H */
--
1.5.4.5
^ permalink raw reply related [flat|nested] 19+ messages in thread* Re: [PATCH] IPVS: Move userspace definitions to include/linux/ip_vs.h
2008-07-31 2:09 ` Simon Horman
@ 2008-08-01 3:45 ` David Miller
0 siblings, 0 replies; 19+ messages in thread
From: David Miller @ 2008-08-01 3:45 UTC (permalink / raw)
To: horms; +Cc: lvs-devel, netdev, juliusv, kaber, vbusam
From: Simon Horman <horms@verge.net.au>
Date: Thu, 31 Jul 2008 12:09:28 +1000
> Current versions of ipvsadm include "/usr/src/linux/include/net/ip_vs.h"
> directly. This file also contains kernel-only definitions. Normally, public
> definitions should live in include/linux, so this patch moves the
> definitions shared with userspace to a new file, "include/linux/ip_vs.h".
>
> This also removes the unused NFC_IPVS_PROPERTY bitmask, which was once
> used to point into skb->nfcache.
>
> To make old ipvsadms still compile with this, the old header file includes
> the new one.
>
> Thanks to Dave Miller and Horms for noting/adding the missing Kbuild entry
> for the new header file.
>
> Signed-off-by: Julius Volz <juliusv@google.com>
> Acked-by: Simon Horman <horms@verge.net.au>
Applied, thanks everyone.
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH] IPVS: Move userspace definitions to include/linux/ip_vs.h
2008-07-24 11:46 ` Julius Volz
2008-07-24 11:58 ` Julius Volz
@ 2008-07-25 0:18 ` Simon Horman
1 sibling, 0 replies; 19+ messages in thread
From: Simon Horman @ 2008-07-25 0:18 UTC (permalink / raw)
To: Julius Volz; +Cc: Patrick McHardy, lvs-devel, netdev, davem, vbusam
On Thu, Jul 24, 2008 at 01:46:38PM +0200, Julius Volz wrote:
> On Thu, Jul 24, 2008 at 1:40 PM, Patrick McHardy <kaber@trash.net> wrote:
> > Julius Volz wrote:
> >>
> >> On Thu, Jul 24, 2008 at 1:22 PM, Patrick McHardy <kaber@trash.net> wrote:
> >>>>>
> >>>>> +/* Move it to better place one day, for now keep it unique */
> >>>>> +#define NFC_IPVS_PROPERTY 0x10000
> >>>
> >>> Does this have any connection to the skb flag? If so, does
> >>> it really belong in the userspace interface?
> >>
> >> This doesn't seem to be used at all anymore, but I didn't want to
> >> remove it in the same patch... should I?
> >
> > I'm not sure if this is (or has been) used by userspace, someone
> > more familiar with IPVS should answer that.
>
> I don't think so. It was once used as a bitmask into skb->nfcache,
> which does not even exist anymore. There's no use of it in the current
> ipvsadm. I think it can go away, I'll post an updated patch again.
I'm pretty sure that it is safe to get rid of NFC_IPVS_PROPERTY
--
Horms
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH] IPVS: Move userspace definitions to include/linux/ip_vs.h
@ 2008-07-22 0:37 Simon Horman
2008-07-23 23:42 ` David Miller
0 siblings, 1 reply; 19+ messages in thread
From: Simon Horman @ 2008-07-22 0:37 UTC (permalink / raw)
To: lvs-devel, netdev; +Cc: David Miller, Julius Volz, Patrick McHardy, Vince Busam
From: Julius Volz <juliusv@google.com>
Current versions of ipvsadm include "/usr/src/linux/include/net/ip_vs.h"
directly. This file also contains kernel-only definitions. Normally, public
definitions should live in include/linux, so this patch moves the
definitions shared with userspace to a new file, "include/linux/ip_vs.h".
To make old ipvsadms still compile with this, the old header file includes
the new one.
The motivation for this cleanup is the planned Netlink interface for IPVS.
Signed-off-by: Julius Volz <juliusv@google.com>
Acked-by: Simon Horman <horms@verge.net.au>
---
Dave, please consider applying this change.
include/linux/ip_vs.h | 248 ++++++++++++++++++++++++++++++++++++++++++++++++
include/net/ip_vs.h | 253 ++-----------------------------------------------
2 files changed, 256 insertions(+), 245 deletions(-)
create mode 100644 include/linux/ip_vs.h
diff --git a/include/linux/ip_vs.h b/include/linux/ip_vs.h
new file mode 100644
index 0000000..2d4eb68
--- /dev/null
+++ b/include/linux/ip_vs.h
@@ -0,0 +1,248 @@
+/*
+ * IP Virtual Server
+ * data structure and functionality definitions
+ */
+
+#ifndef _IP_VS_H
+#define _IP_VS_H
+
+#include <linux/types.h> /* For __beXX types in userland */
+
+#define IP_VS_VERSION_CODE 0x010201
+#define NVERSION(version) \
+ (version >> 16) & 0xFF, \
+ (version >> 8) & 0xFF, \
+ version & 0xFF
+
+/*
+ * Virtual Service Flags
+ */
+#define IP_VS_SVC_F_PERSISTENT 0x0001 /* persistent port */
+#define IP_VS_SVC_F_HASHED 0x0002 /* hashed entry */
+
+/*
+ * Destination Server Flags
+ */
+#define IP_VS_DEST_F_AVAILABLE 0x0001 /* server is available */
+#define IP_VS_DEST_F_OVERLOAD 0x0002 /* server is overloaded */
+
+/*
+ * IPVS sync daemon states
+ */
+#define IP_VS_STATE_NONE 0x0000 /* daemon is stopped */
+#define IP_VS_STATE_MASTER 0x0001 /* started as master */
+#define IP_VS_STATE_BACKUP 0x0002 /* started as backup */
+
+/*
+ * IPVS socket options
+ */
+#define IP_VS_BASE_CTL (64+1024+64) /* base */
+
+#define IP_VS_SO_SET_NONE IP_VS_BASE_CTL /* just peek */
+#define IP_VS_SO_SET_INSERT (IP_VS_BASE_CTL+1)
+#define IP_VS_SO_SET_ADD (IP_VS_BASE_CTL+2)
+#define IP_VS_SO_SET_EDIT (IP_VS_BASE_CTL+3)
+#define IP_VS_SO_SET_DEL (IP_VS_BASE_CTL+4)
+#define IP_VS_SO_SET_FLUSH (IP_VS_BASE_CTL+5)
+#define IP_VS_SO_SET_LIST (IP_VS_BASE_CTL+6)
+#define IP_VS_SO_SET_ADDDEST (IP_VS_BASE_CTL+7)
+#define IP_VS_SO_SET_DELDEST (IP_VS_BASE_CTL+8)
+#define IP_VS_SO_SET_EDITDEST (IP_VS_BASE_CTL+9)
+#define IP_VS_SO_SET_TIMEOUT (IP_VS_BASE_CTL+10)
+#define IP_VS_SO_SET_STARTDAEMON (IP_VS_BASE_CTL+11)
+#define IP_VS_SO_SET_STOPDAEMON (IP_VS_BASE_CTL+12)
+#define IP_VS_SO_SET_RESTORE (IP_VS_BASE_CTL+13)
+#define IP_VS_SO_SET_SAVE (IP_VS_BASE_CTL+14)
+#define IP_VS_SO_SET_ZERO (IP_VS_BASE_CTL+15)
+#define IP_VS_SO_SET_MAX IP_VS_SO_SET_ZERO
+
+#define IP_VS_SO_GET_VERSION IP_VS_BASE_CTL
+#define IP_VS_SO_GET_INFO (IP_VS_BASE_CTL+1)
+#define IP_VS_SO_GET_SERVICES (IP_VS_BASE_CTL+2)
+#define IP_VS_SO_GET_SERVICE (IP_VS_BASE_CTL+3)
+#define IP_VS_SO_GET_DESTS (IP_VS_BASE_CTL+4)
+#define IP_VS_SO_GET_DEST (IP_VS_BASE_CTL+5) /* not used now */
+#define IP_VS_SO_GET_TIMEOUT (IP_VS_BASE_CTL+6)
+#define IP_VS_SO_GET_DAEMON (IP_VS_BASE_CTL+7)
+#define IP_VS_SO_GET_MAX IP_VS_SO_GET_DAEMON
+
+
+/*
+ * IPVS Connection Flags
+ */
+#define IP_VS_CONN_F_FWD_MASK 0x0007 /* mask for the fwd methods */
+#define IP_VS_CONN_F_MASQ 0x0000 /* masquerading/NAT */
+#define IP_VS_CONN_F_LOCALNODE 0x0001 /* local node */
+#define IP_VS_CONN_F_TUNNEL 0x0002 /* tunneling */
+#define IP_VS_CONN_F_DROUTE 0x0003 /* direct routing */
+#define IP_VS_CONN_F_BYPASS 0x0004 /* cache bypass */
+#define IP_VS_CONN_F_SYNC 0x0020 /* entry created by sync */
+#define IP_VS_CONN_F_HASHED 0x0040 /* hashed entry */
+#define IP_VS_CONN_F_NOOUTPUT 0x0080 /* no output packets */
+#define IP_VS_CONN_F_INACTIVE 0x0100 /* not established */
+#define IP_VS_CONN_F_OUT_SEQ 0x0200 /* must do output seq adjust */
+#define IP_VS_CONN_F_IN_SEQ 0x0400 /* must do input seq adjust */
+#define IP_VS_CONN_F_SEQ_MASK 0x0600 /* in/out sequence mask */
+#define IP_VS_CONN_F_NO_CPORT 0x0800 /* no client port set yet */
+#define IP_VS_CONN_F_TEMPLATE 0x1000 /* template, not connection */
+
+/* Move it to better place one day, for now keep it unique */
+#define NFC_IPVS_PROPERTY 0x10000
+
+#define IP_VS_SCHEDNAME_MAXLEN 16
+#define IP_VS_IFNAME_MAXLEN 16
+
+
+/*
+ * The struct ip_vs_service_user and struct ip_vs_dest_user are
+ * used to set IPVS rules through setsockopt.
+ */
+struct ip_vs_service_user {
+ /* virtual service addresses */
+ u_int16_t protocol;
+ __be32 addr; /* virtual ip address */
+ __be16 port;
+ u_int32_t fwmark; /* firwall mark of service */
+
+ /* virtual service options */
+ char sched_name[IP_VS_SCHEDNAME_MAXLEN];
+ unsigned flags; /* virtual service flags */
+ unsigned timeout; /* persistent timeout in sec */
+ __be32 netmask; /* persistent netmask */
+};
+
+
+struct ip_vs_dest_user {
+ /* destination server address */
+ __be32 addr;
+ __be16 port;
+
+ /* real server options */
+ unsigned conn_flags; /* connection flags */
+ int weight; /* destination weight */
+
+ /* thresholds for active connections */
+ u_int32_t u_threshold; /* upper threshold */
+ u_int32_t l_threshold; /* lower threshold */
+};
+
+
+/*
+ * IPVS statistics object (for user space)
+ */
+struct ip_vs_stats_user
+{
+ __u32 conns; /* connections scheduled */
+ __u32 inpkts; /* incoming packets */
+ __u32 outpkts; /* outgoing packets */
+ __u64 inbytes; /* incoming bytes */
+ __u64 outbytes; /* outgoing bytes */
+
+ __u32 cps; /* current connection rate */
+ __u32 inpps; /* current in packet rate */
+ __u32 outpps; /* current out packet rate */
+ __u32 inbps; /* current in byte rate */
+ __u32 outbps; /* current out byte rate */
+};
+
+
+/* The argument to IP_VS_SO_GET_INFO */
+struct ip_vs_getinfo {
+ /* version number */
+ unsigned int version;
+
+ /* size of connection hash table */
+ unsigned int size;
+
+ /* number of virtual services */
+ unsigned int num_services;
+};
+
+
+/* The argument to IP_VS_SO_GET_SERVICE */
+struct ip_vs_service_entry {
+ /* which service: user fills in these */
+ u_int16_t protocol;
+ __be32 addr; /* virtual address */
+ __be16 port;
+ u_int32_t fwmark; /* firwall mark of service */
+
+ /* service options */
+ char sched_name[IP_VS_SCHEDNAME_MAXLEN];
+ unsigned flags; /* virtual service flags */
+ unsigned timeout; /* persistent timeout */
+ __be32 netmask; /* persistent netmask */
+
+ /* number of real servers */
+ unsigned int num_dests;
+
+ /* statistics */
+ struct ip_vs_stats_user stats;
+};
+
+
+struct ip_vs_dest_entry {
+ __be32 addr; /* destination address */
+ __be16 port;
+ unsigned conn_flags; /* connection flags */
+ int weight; /* destination weight */
+
+ u_int32_t u_threshold; /* upper threshold */
+ u_int32_t l_threshold; /* lower threshold */
+
+ u_int32_t activeconns; /* active connections */
+ u_int32_t inactconns; /* inactive connections */
+ u_int32_t persistconns; /* persistent connections */
+
+ /* statistics */
+ struct ip_vs_stats_user stats;
+};
+
+
+/* The argument to IP_VS_SO_GET_DESTS */
+struct ip_vs_get_dests {
+ /* which service: user fills in these */
+ u_int16_t protocol;
+ __be32 addr; /* virtual address */
+ __be16 port;
+ u_int32_t fwmark; /* firwall mark of service */
+
+ /* number of real servers */
+ unsigned int num_dests;
+
+ /* the real servers */
+ struct ip_vs_dest_entry entrytable[0];
+};
+
+
+/* The argument to IP_VS_SO_GET_SERVICES */
+struct ip_vs_get_services {
+ /* number of virtual services */
+ unsigned int num_services;
+
+ /* service table */
+ struct ip_vs_service_entry entrytable[0];
+};
+
+
+/* The argument to IP_VS_SO_GET_TIMEOUT */
+struct ip_vs_timeout_user {
+ int tcp_timeout;
+ int tcp_fin_timeout;
+ int udp_timeout;
+};
+
+
+/* The argument to IP_VS_SO_GET_DAEMON */
+struct ip_vs_daemon_user {
+ /* sync daemon state (master/backup) */
+ int state;
+
+ /* multicast interface name */
+ char mcast_ifn[IP_VS_IFNAME_MAXLEN];
+
+ /* SyncID we belong to */
+ int syncid;
+};
+
+#endif /* _IP_VS_H */
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index 9a51eba..cbb59eb 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -3,254 +3,17 @@
* data structure and functionality definitions
*/
-#ifndef _IP_VS_H
-#define _IP_VS_H
-
-#include <asm/types.h> /* For __uXX types */
-#include <linux/types.h> /* For __beXX types in userland */
-
-#include <linux/sysctl.h> /* For ctl_path */
-
-#define IP_VS_VERSION_CODE 0x010201
-#define NVERSION(version) \
- (version >> 16) & 0xFF, \
- (version >> 8) & 0xFF, \
- version & 0xFF
-
-/*
- * Virtual Service Flags
- */
-#define IP_VS_SVC_F_PERSISTENT 0x0001 /* persistent port */
-#define IP_VS_SVC_F_HASHED 0x0002 /* hashed entry */
-
-/*
- * Destination Server Flags
- */
-#define IP_VS_DEST_F_AVAILABLE 0x0001 /* server is available */
-#define IP_VS_DEST_F_OVERLOAD 0x0002 /* server is overloaded */
-
-/*
- * IPVS sync daemon states
- */
-#define IP_VS_STATE_NONE 0x0000 /* daemon is stopped */
-#define IP_VS_STATE_MASTER 0x0001 /* started as master */
-#define IP_VS_STATE_BACKUP 0x0002 /* started as backup */
-
-/*
- * IPVS socket options
- */
-#define IP_VS_BASE_CTL (64+1024+64) /* base */
-
-#define IP_VS_SO_SET_NONE IP_VS_BASE_CTL /* just peek */
-#define IP_VS_SO_SET_INSERT (IP_VS_BASE_CTL+1)
-#define IP_VS_SO_SET_ADD (IP_VS_BASE_CTL+2)
-#define IP_VS_SO_SET_EDIT (IP_VS_BASE_CTL+3)
-#define IP_VS_SO_SET_DEL (IP_VS_BASE_CTL+4)
-#define IP_VS_SO_SET_FLUSH (IP_VS_BASE_CTL+5)
-#define IP_VS_SO_SET_LIST (IP_VS_BASE_CTL+6)
-#define IP_VS_SO_SET_ADDDEST (IP_VS_BASE_CTL+7)
-#define IP_VS_SO_SET_DELDEST (IP_VS_BASE_CTL+8)
-#define IP_VS_SO_SET_EDITDEST (IP_VS_BASE_CTL+9)
-#define IP_VS_SO_SET_TIMEOUT (IP_VS_BASE_CTL+10)
-#define IP_VS_SO_SET_STARTDAEMON (IP_VS_BASE_CTL+11)
-#define IP_VS_SO_SET_STOPDAEMON (IP_VS_BASE_CTL+12)
-#define IP_VS_SO_SET_RESTORE (IP_VS_BASE_CTL+13)
-#define IP_VS_SO_SET_SAVE (IP_VS_BASE_CTL+14)
-#define IP_VS_SO_SET_ZERO (IP_VS_BASE_CTL+15)
-#define IP_VS_SO_SET_MAX IP_VS_SO_SET_ZERO
-
-#define IP_VS_SO_GET_VERSION IP_VS_BASE_CTL
-#define IP_VS_SO_GET_INFO (IP_VS_BASE_CTL+1)
-#define IP_VS_SO_GET_SERVICES (IP_VS_BASE_CTL+2)
-#define IP_VS_SO_GET_SERVICE (IP_VS_BASE_CTL+3)
-#define IP_VS_SO_GET_DESTS (IP_VS_BASE_CTL+4)
-#define IP_VS_SO_GET_DEST (IP_VS_BASE_CTL+5) /* not used now */
-#define IP_VS_SO_GET_TIMEOUT (IP_VS_BASE_CTL+6)
-#define IP_VS_SO_GET_DAEMON (IP_VS_BASE_CTL+7)
-#define IP_VS_SO_GET_MAX IP_VS_SO_GET_DAEMON
-
-
-/*
- * IPVS Connection Flags
- */
-#define IP_VS_CONN_F_FWD_MASK 0x0007 /* mask for the fwd methods */
-#define IP_VS_CONN_F_MASQ 0x0000 /* masquerading/NAT */
-#define IP_VS_CONN_F_LOCALNODE 0x0001 /* local node */
-#define IP_VS_CONN_F_TUNNEL 0x0002 /* tunneling */
-#define IP_VS_CONN_F_DROUTE 0x0003 /* direct routing */
-#define IP_VS_CONN_F_BYPASS 0x0004 /* cache bypass */
-#define IP_VS_CONN_F_SYNC 0x0020 /* entry created by sync */
-#define IP_VS_CONN_F_HASHED 0x0040 /* hashed entry */
-#define IP_VS_CONN_F_NOOUTPUT 0x0080 /* no output packets */
-#define IP_VS_CONN_F_INACTIVE 0x0100 /* not established */
-#define IP_VS_CONN_F_OUT_SEQ 0x0200 /* must do output seq adjust */
-#define IP_VS_CONN_F_IN_SEQ 0x0400 /* must do input seq adjust */
-#define IP_VS_CONN_F_SEQ_MASK 0x0600 /* in/out sequence mask */
-#define IP_VS_CONN_F_NO_CPORT 0x0800 /* no client port set yet */
-#define IP_VS_CONN_F_TEMPLATE 0x1000 /* template, not connection */
-
-/* Move it to better place one day, for now keep it unique */
-#define NFC_IPVS_PROPERTY 0x10000
-
-#define IP_VS_SCHEDNAME_MAXLEN 16
-#define IP_VS_IFNAME_MAXLEN 16
-
-
-/*
- * The struct ip_vs_service_user and struct ip_vs_dest_user are
- * used to set IPVS rules through setsockopt.
- */
-struct ip_vs_service_user {
- /* virtual service addresses */
- u_int16_t protocol;
- __be32 addr; /* virtual ip address */
- __be16 port;
- u_int32_t fwmark; /* firwall mark of service */
-
- /* virtual service options */
- char sched_name[IP_VS_SCHEDNAME_MAXLEN];
- unsigned flags; /* virtual service flags */
- unsigned timeout; /* persistent timeout in sec */
- __be32 netmask; /* persistent netmask */
-};
-
-
-struct ip_vs_dest_user {
- /* destination server address */
- __be32 addr;
- __be16 port;
-
- /* real server options */
- unsigned conn_flags; /* connection flags */
- int weight; /* destination weight */
-
- /* thresholds for active connections */
- u_int32_t u_threshold; /* upper threshold */
- u_int32_t l_threshold; /* lower threshold */
-};
-
-
-/*
- * IPVS statistics object (for user space)
- */
-struct ip_vs_stats_user
-{
- __u32 conns; /* connections scheduled */
- __u32 inpkts; /* incoming packets */
- __u32 outpkts; /* outgoing packets */
- __u64 inbytes; /* incoming bytes */
- __u64 outbytes; /* outgoing bytes */
-
- __u32 cps; /* current connection rate */
- __u32 inpps; /* current in packet rate */
- __u32 outpps; /* current out packet rate */
- __u32 inbps; /* current in byte rate */
- __u32 outbps; /* current out byte rate */
-};
-
-
-/* The argument to IP_VS_SO_GET_INFO */
-struct ip_vs_getinfo {
- /* version number */
- unsigned int version;
-
- /* size of connection hash table */
- unsigned int size;
-
- /* number of virtual services */
- unsigned int num_services;
-};
-
-
-/* The argument to IP_VS_SO_GET_SERVICE */
-struct ip_vs_service_entry {
- /* which service: user fills in these */
- u_int16_t protocol;
- __be32 addr; /* virtual address */
- __be16 port;
- u_int32_t fwmark; /* firwall mark of service */
-
- /* service options */
- char sched_name[IP_VS_SCHEDNAME_MAXLEN];
- unsigned flags; /* virtual service flags */
- unsigned timeout; /* persistent timeout */
- __be32 netmask; /* persistent netmask */
-
- /* number of real servers */
- unsigned int num_dests;
-
- /* statistics */
- struct ip_vs_stats_user stats;
-};
-
-
-struct ip_vs_dest_entry {
- __be32 addr; /* destination address */
- __be16 port;
- unsigned conn_flags; /* connection flags */
- int weight; /* destination weight */
-
- u_int32_t u_threshold; /* upper threshold */
- u_int32_t l_threshold; /* lower threshold */
-
- u_int32_t activeconns; /* active connections */
- u_int32_t inactconns; /* inactive connections */
- u_int32_t persistconns; /* persistent connections */
-
- /* statistics */
- struct ip_vs_stats_user stats;
-};
-
-
-/* The argument to IP_VS_SO_GET_DESTS */
-struct ip_vs_get_dests {
- /* which service: user fills in these */
- u_int16_t protocol;
- __be32 addr; /* virtual address */
- __be16 port;
- u_int32_t fwmark; /* firwall mark of service */
-
- /* number of real servers */
- unsigned int num_dests;
-
- /* the real servers */
- struct ip_vs_dest_entry entrytable[0];
-};
-
-
-/* The argument to IP_VS_SO_GET_SERVICES */
-struct ip_vs_get_services {
- /* number of virtual services */
- unsigned int num_services;
-
- /* service table */
- struct ip_vs_service_entry entrytable[0];
-};
-
-
-/* The argument to IP_VS_SO_GET_TIMEOUT */
-struct ip_vs_timeout_user {
- int tcp_timeout;
- int tcp_fin_timeout;
- int udp_timeout;
-};
-
-
-/* The argument to IP_VS_SO_GET_DAEMON */
-struct ip_vs_daemon_user {
- /* sync daemon state (master/backup) */
- int state;
-
- /* multicast interface name */
- char mcast_ifn[IP_VS_IFNAME_MAXLEN];
^ permalink raw reply related [flat|nested] 19+ messages in thread* Re: [PATCH] IPVS: Move userspace definitions to include/linux/ip_vs.h
2008-07-22 0:37 Simon Horman
@ 2008-07-23 23:42 ` David Miller
2008-07-24 0:20 ` Simon Horman
0 siblings, 1 reply; 19+ messages in thread
From: David Miller @ 2008-07-23 23:42 UTC (permalink / raw)
To: horms; +Cc: lvs-devel, netdev, juliusv, kaber, vbusam
From: Simon Horman <horms@verge.net.au>
Date: Tue, 22 Jul 2008 10:37:57 +1000
> From: Julius Volz <juliusv@google.com>
>
> Current versions of ipvsadm include "/usr/src/linux/include/net/ip_vs.h"
> directly. This file also contains kernel-only definitions. Normally, public
> definitions should live in include/linux, so this patch moves the
> definitions shared with userspace to a new file, "include/linux/ip_vs.h".
>
> To make old ipvsadms still compile with this, the old header file includes
> the new one.
>
> The motivation for this cleanup is the planned Netlink interface for IPVS.
>
> Signed-off-by: Julius Volz <juliusv@google.com>
> Acked-by: Simon Horman <horms@verge.net.au>
Userland exported headers need to have an entry in include/linux/Kbuild
Since this linux/ip_vs.h file is new, a new entry needs to be added there.
Thanks.
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH] IPVS: Move userspace definitions to include/linux/ip_vs.h
2008-07-23 23:42 ` David Miller
@ 2008-07-24 0:20 ` Simon Horman
2008-07-24 10:09 ` Julius Volz
0 siblings, 1 reply; 19+ messages in thread
From: Simon Horman @ 2008-07-24 0:20 UTC (permalink / raw)
To: David Miller; +Cc: lvs-devel, netdev, juliusv, kaber, vbusam
On Wed, Jul 23, 2008 at 04:42:15PM -0700, David Miller wrote:
> From: Simon Horman <horms@verge.net.au>
> Date: Tue, 22 Jul 2008 10:37:57 +1000
>
> > From: Julius Volz <juliusv@google.com>
> >
> > Current versions of ipvsadm include "/usr/src/linux/include/net/ip_vs.h"
> > directly. This file also contains kernel-only definitions. Normally, public
> > definitions should live in include/linux, so this patch moves the
> > definitions shared with userspace to a new file, "include/linux/ip_vs.h".
> >
> > To make old ipvsadms still compile with this, the old header file includes
> > the new one.
> >
> > The motivation for this cleanup is the planned Netlink interface for IPVS.
> >
> > Signed-off-by: Julius Volz <juliusv@google.com>
> > Acked-by: Simon Horman <horms@verge.net.au>
>
> Userland exported headers need to have an entry in include/linux/Kbuild
>
> Since this linux/ip_vs.h file is new, a new entry needs to be added there.
Thanks, I wasn't aware of that.
Julius, I think this is the bit we are missing:
Index: net-next-2.6/include/linux/Kbuild
===================================================================
--- net-next-2.6.orig/include/linux/Kbuild 2008-07-24 10:15:52.000000000 +1000
+++ net-next-2.6/include/linux/Kbuild 2008-07-24 10:19:08.000000000 +1000
@@ -97,6 +97,7 @@ header-y += ioctl.h
header-y += ip6_tunnel.h
header-y += ipmi_msgdefs.h
header-y += ipsec.h
+header-y += ip_vs.h
header-y += ipx.h
header-y += irda.h
header-y += iso_fs.h
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH] IPVS: Move userspace definitions to include/linux/ip_vs.h
2008-07-24 0:20 ` Simon Horman
@ 2008-07-24 10:09 ` Julius Volz
0 siblings, 0 replies; 19+ messages in thread
From: Julius Volz @ 2008-07-24 10:09 UTC (permalink / raw)
To: Simon Horman; +Cc: David Miller, lvs-devel, netdev, kaber, vbusam
On Thu, Jul 24, 2008 at 2:20 AM, Simon Horman <horms@verge.net.au> wrote:
> On Wed, Jul 23, 2008 at 04:42:15PM -0700, David Miller wrote:
>> Userland exported headers need to have an entry in include/linux/Kbuild
>>
>> Since this linux/ip_vs.h file is new, a new entry needs to be added there.
>
> Thanks, I wasn't aware of that.
Oh, me neither.
> Julius, I think this is the bit we are missing:
>
> Index: net-next-2.6/include/linux/Kbuild
> ===================================================================
> --- net-next-2.6.orig/include/linux/Kbuild 2008-07-24 10:15:52.000000000 +1000
> +++ net-next-2.6/include/linux/Kbuild 2008-07-24 10:19:08.000000000 +1000
> @@ -97,6 +97,7 @@ header-y += ioctl.h
> header-y += ip6_tunnel.h
> header-y += ipmi_msgdefs.h
> header-y += ipsec.h
> +header-y += ip_vs.h
> header-y += ipx.h
> header-y += irda.h
> header-y += iso_fs.h
Thanks, I'll post the patch again with this!
Julius
--
Google Switzerland GmbH
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH] IPVS: Move userspace definitions to include/linux/ip_vs.h
@ 2008-07-08 14:29 Julius Volz
2008-07-09 1:11 ` Simon Horman
0 siblings, 1 reply; 19+ messages in thread
From: Julius Volz @ 2008-07-08 14:29 UTC (permalink / raw)
To: lvs-devel, netdev; +Cc: horms, kaber, vbusam, Julius Volz
Current versions of ipvsadm include "/usr/src/linux/include/net/ip_vs.h"
directly. This file also contains kernel-only definitions. Normally, public
definitions should live in include/linux, so this patch moves the
definitions shared with userspace to a new file, "include/linux/ip_vs.h".
To make old ipvsadms still compile with this, the old header file includes
the new one.
The motivation for this cleanup is the planned Netlink interface for IPVS.
Signed-off-by: Julius Volz <juliusv@google.com>
---
include/linux/ip_vs.h | 248 ++++++++++++++++++++++++++++++++++++++++++++++++
include/net/ip_vs.h | 253 ++-----------------------------------------------
2 files changed, 256 insertions(+), 245 deletions(-)
create mode 100644 include/linux/ip_vs.h
diff --git a/include/linux/ip_vs.h b/include/linux/ip_vs.h
new file mode 100644
index 0000000..2d4eb68
--- /dev/null
+++ b/include/linux/ip_vs.h
@@ -0,0 +1,248 @@
+/*
+ * IP Virtual Server
+ * data structure and functionality definitions
+ */
+
+#ifndef _IP_VS_H
+#define _IP_VS_H
+
+#include <linux/types.h> /* For __beXX types in userland */
+
+#define IP_VS_VERSION_CODE 0x010201
+#define NVERSION(version) \
+ (version >> 16) & 0xFF, \
+ (version >> 8) & 0xFF, \
+ version & 0xFF
+
+/*
+ * Virtual Service Flags
+ */
+#define IP_VS_SVC_F_PERSISTENT 0x0001 /* persistent port */
+#define IP_VS_SVC_F_HASHED 0x0002 /* hashed entry */
+
+/*
+ * Destination Server Flags
+ */
+#define IP_VS_DEST_F_AVAILABLE 0x0001 /* server is available */
+#define IP_VS_DEST_F_OVERLOAD 0x0002 /* server is overloaded */
+
+/*
+ * IPVS sync daemon states
+ */
+#define IP_VS_STATE_NONE 0x0000 /* daemon is stopped */
+#define IP_VS_STATE_MASTER 0x0001 /* started as master */
+#define IP_VS_STATE_BACKUP 0x0002 /* started as backup */
+
+/*
+ * IPVS socket options
+ */
+#define IP_VS_BASE_CTL (64+1024+64) /* base */
+
+#define IP_VS_SO_SET_NONE IP_VS_BASE_CTL /* just peek */
+#define IP_VS_SO_SET_INSERT (IP_VS_BASE_CTL+1)
+#define IP_VS_SO_SET_ADD (IP_VS_BASE_CTL+2)
+#define IP_VS_SO_SET_EDIT (IP_VS_BASE_CTL+3)
+#define IP_VS_SO_SET_DEL (IP_VS_BASE_CTL+4)
+#define IP_VS_SO_SET_FLUSH (IP_VS_BASE_CTL+5)
+#define IP_VS_SO_SET_LIST (IP_VS_BASE_CTL+6)
+#define IP_VS_SO_SET_ADDDEST (IP_VS_BASE_CTL+7)
+#define IP_VS_SO_SET_DELDEST (IP_VS_BASE_CTL+8)
+#define IP_VS_SO_SET_EDITDEST (IP_VS_BASE_CTL+9)
+#define IP_VS_SO_SET_TIMEOUT (IP_VS_BASE_CTL+10)
+#define IP_VS_SO_SET_STARTDAEMON (IP_VS_BASE_CTL+11)
+#define IP_VS_SO_SET_STOPDAEMON (IP_VS_BASE_CTL+12)
+#define IP_VS_SO_SET_RESTORE (IP_VS_BASE_CTL+13)
+#define IP_VS_SO_SET_SAVE (IP_VS_BASE_CTL+14)
+#define IP_VS_SO_SET_ZERO (IP_VS_BASE_CTL+15)
+#define IP_VS_SO_SET_MAX IP_VS_SO_SET_ZERO
+
+#define IP_VS_SO_GET_VERSION IP_VS_BASE_CTL
+#define IP_VS_SO_GET_INFO (IP_VS_BASE_CTL+1)
+#define IP_VS_SO_GET_SERVICES (IP_VS_BASE_CTL+2)
+#define IP_VS_SO_GET_SERVICE (IP_VS_BASE_CTL+3)
+#define IP_VS_SO_GET_DESTS (IP_VS_BASE_CTL+4)
+#define IP_VS_SO_GET_DEST (IP_VS_BASE_CTL+5) /* not used now */
+#define IP_VS_SO_GET_TIMEOUT (IP_VS_BASE_CTL+6)
+#define IP_VS_SO_GET_DAEMON (IP_VS_BASE_CTL+7)
+#define IP_VS_SO_GET_MAX IP_VS_SO_GET_DAEMON
+
+
+/*
+ * IPVS Connection Flags
+ */
+#define IP_VS_CONN_F_FWD_MASK 0x0007 /* mask for the fwd methods */
+#define IP_VS_CONN_F_MASQ 0x0000 /* masquerading/NAT */
+#define IP_VS_CONN_F_LOCALNODE 0x0001 /* local node */
+#define IP_VS_CONN_F_TUNNEL 0x0002 /* tunneling */
+#define IP_VS_CONN_F_DROUTE 0x0003 /* direct routing */
+#define IP_VS_CONN_F_BYPASS 0x0004 /* cache bypass */
+#define IP_VS_CONN_F_SYNC 0x0020 /* entry created by sync */
+#define IP_VS_CONN_F_HASHED 0x0040 /* hashed entry */
+#define IP_VS_CONN_F_NOOUTPUT 0x0080 /* no output packets */
+#define IP_VS_CONN_F_INACTIVE 0x0100 /* not established */
+#define IP_VS_CONN_F_OUT_SEQ 0x0200 /* must do output seq adjust */
+#define IP_VS_CONN_F_IN_SEQ 0x0400 /* must do input seq adjust */
+#define IP_VS_CONN_F_SEQ_MASK 0x0600 /* in/out sequence mask */
+#define IP_VS_CONN_F_NO_CPORT 0x0800 /* no client port set yet */
+#define IP_VS_CONN_F_TEMPLATE 0x1000 /* template, not connection */
+
+/* Move it to better place one day, for now keep it unique */
+#define NFC_IPVS_PROPERTY 0x10000
+
+#define IP_VS_SCHEDNAME_MAXLEN 16
+#define IP_VS_IFNAME_MAXLEN 16
+
+
+/*
+ * The struct ip_vs_service_user and struct ip_vs_dest_user are
+ * used to set IPVS rules through setsockopt.
+ */
+struct ip_vs_service_user {
+ /* virtual service addresses */
+ u_int16_t protocol;
+ __be32 addr; /* virtual ip address */
+ __be16 port;
+ u_int32_t fwmark; /* firwall mark of service */
+
+ /* virtual service options */
+ char sched_name[IP_VS_SCHEDNAME_MAXLEN];
+ unsigned flags; /* virtual service flags */
+ unsigned timeout; /* persistent timeout in sec */
+ __be32 netmask; /* persistent netmask */
+};
+
+
+struct ip_vs_dest_user {
+ /* destination server address */
+ __be32 addr;
+ __be16 port;
+
+ /* real server options */
+ unsigned conn_flags; /* connection flags */
+ int weight; /* destination weight */
+
+ /* thresholds for active connections */
+ u_int32_t u_threshold; /* upper threshold */
+ u_int32_t l_threshold; /* lower threshold */
+};
+
+
+/*
+ * IPVS statistics object (for user space)
+ */
+struct ip_vs_stats_user
+{
+ __u32 conns; /* connections scheduled */
+ __u32 inpkts; /* incoming packets */
+ __u32 outpkts; /* outgoing packets */
+ __u64 inbytes; /* incoming bytes */
+ __u64 outbytes; /* outgoing bytes */
+
+ __u32 cps; /* current connection rate */
+ __u32 inpps; /* current in packet rate */
+ __u32 outpps; /* current out packet rate */
+ __u32 inbps; /* current in byte rate */
+ __u32 outbps; /* current out byte rate */
+};
+
+
+/* The argument to IP_VS_SO_GET_INFO */
+struct ip_vs_getinfo {
+ /* version number */
+ unsigned int version;
+
+ /* size of connection hash table */
+ unsigned int size;
+
+ /* number of virtual services */
+ unsigned int num_services;
+};
+
+
+/* The argument to IP_VS_SO_GET_SERVICE */
+struct ip_vs_service_entry {
+ /* which service: user fills in these */
+ u_int16_t protocol;
+ __be32 addr; /* virtual address */
+ __be16 port;
+ u_int32_t fwmark; /* firwall mark of service */
+
+ /* service options */
+ char sched_name[IP_VS_SCHEDNAME_MAXLEN];
+ unsigned flags; /* virtual service flags */
+ unsigned timeout; /* persistent timeout */
+ __be32 netmask; /* persistent netmask */
+
+ /* number of real servers */
+ unsigned int num_dests;
+
+ /* statistics */
+ struct ip_vs_stats_user stats;
+};
+
+
+struct ip_vs_dest_entry {
+ __be32 addr; /* destination address */
+ __be16 port;
+ unsigned conn_flags; /* connection flags */
+ int weight; /* destination weight */
+
+ u_int32_t u_threshold; /* upper threshold */
+ u_int32_t l_threshold; /* lower threshold */
+
+ u_int32_t activeconns; /* active connections */
+ u_int32_t inactconns; /* inactive connections */
+ u_int32_t persistconns; /* persistent connections */
+
+ /* statistics */
+ struct ip_vs_stats_user stats;
+};
+
+
+/* The argument to IP_VS_SO_GET_DESTS */
+struct ip_vs_get_dests {
+ /* which service: user fills in these */
+ u_int16_t protocol;
+ __be32 addr; /* virtual address */
+ __be16 port;
+ u_int32_t fwmark; /* firwall mark of service */
+
+ /* number of real servers */
+ unsigned int num_dests;
+
+ /* the real servers */
+ struct ip_vs_dest_entry entrytable[0];
+};
+
+
+/* The argument to IP_VS_SO_GET_SERVICES */
+struct ip_vs_get_services {
+ /* number of virtual services */
+ unsigned int num_services;
+
+ /* service table */
+ struct ip_vs_service_entry entrytable[0];
+};
+
+
+/* The argument to IP_VS_SO_GET_TIMEOUT */
+struct ip_vs_timeout_user {
+ int tcp_timeout;
+ int tcp_fin_timeout;
+ int udp_timeout;
+};
+
+
+/* The argument to IP_VS_SO_GET_DAEMON */
+struct ip_vs_daemon_user {
+ /* sync daemon state (master/backup) */
+ int state;
+
+ /* multicast interface name */
+ char mcast_ifn[IP_VS_IFNAME_MAXLEN];
+
+ /* SyncID we belong to */
+ int syncid;
+};
+
+#endif /* _IP_VS_H */
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index 9a51eba..cbb59eb 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -3,254 +3,17 @@
* data structure and functionality definitions
*/
-#ifndef _IP_VS_H
-#define _IP_VS_H
-
-#include <asm/types.h> /* For __uXX types */
-#include <linux/types.h> /* For __beXX types in userland */
-
-#include <linux/sysctl.h> /* For ctl_path */
-
-#define IP_VS_VERSION_CODE 0x010201
-#define NVERSION(version) \
- (version >> 16) & 0xFF, \
- (version >> 8) & 0xFF, \
- version & 0xFF
-
-/*
- * Virtual Service Flags
- */
-#define IP_VS_SVC_F_PERSISTENT 0x0001 /* persistent port */
-#define IP_VS_SVC_F_HASHED 0x0002 /* hashed entry */
-
-/*
- * Destination Server Flags
- */
-#define IP_VS_DEST_F_AVAILABLE 0x0001 /* server is available */
-#define IP_VS_DEST_F_OVERLOAD 0x0002 /* server is overloaded */
-
-/*
- * IPVS sync daemon states
- */
-#define IP_VS_STATE_NONE 0x0000 /* daemon is stopped */
-#define IP_VS_STATE_MASTER 0x0001 /* started as master */
-#define IP_VS_STATE_BACKUP 0x0002 /* started as backup */
-
-/*
- * IPVS socket options
- */
-#define IP_VS_BASE_CTL (64+1024+64) /* base */
-
-#define IP_VS_SO_SET_NONE IP_VS_BASE_CTL /* just peek */
-#define IP_VS_SO_SET_INSERT (IP_VS_BASE_CTL+1)
-#define IP_VS_SO_SET_ADD (IP_VS_BASE_CTL+2)
-#define IP_VS_SO_SET_EDIT (IP_VS_BASE_CTL+3)
-#define IP_VS_SO_SET_DEL (IP_VS_BASE_CTL+4)
-#define IP_VS_SO_SET_FLUSH (IP_VS_BASE_CTL+5)
-#define IP_VS_SO_SET_LIST (IP_VS_BASE_CTL+6)
-#define IP_VS_SO_SET_ADDDEST (IP_VS_BASE_CTL+7)
-#define IP_VS_SO_SET_DELDEST (IP_VS_BASE_CTL+8)
-#define IP_VS_SO_SET_EDITDEST (IP_VS_BASE_CTL+9)
-#define IP_VS_SO_SET_TIMEOUT (IP_VS_BASE_CTL+10)
-#define IP_VS_SO_SET_STARTDAEMON (IP_VS_BASE_CTL+11)
-#define IP_VS_SO_SET_STOPDAEMON (IP_VS_BASE_CTL+12)
-#define IP_VS_SO_SET_RESTORE (IP_VS_BASE_CTL+13)
-#define IP_VS_SO_SET_SAVE (IP_VS_BASE_CTL+14)
-#define IP_VS_SO_SET_ZERO (IP_VS_BASE_CTL+15)
-#define IP_VS_SO_SET_MAX IP_VS_SO_SET_ZERO
-
-#define IP_VS_SO_GET_VERSION IP_VS_BASE_CTL
-#define IP_VS_SO_GET_INFO (IP_VS_BASE_CTL+1)
-#define IP_VS_SO_GET_SERVICES (IP_VS_BASE_CTL+2)
-#define IP_VS_SO_GET_SERVICE (IP_VS_BASE_CTL+3)
-#define IP_VS_SO_GET_DESTS (IP_VS_BASE_CTL+4)
-#define IP_VS_SO_GET_DEST (IP_VS_BASE_CTL+5) /* not used now */
-#define IP_VS_SO_GET_TIMEOUT (IP_VS_BASE_CTL+6)
-#define IP_VS_SO_GET_DAEMON (IP_VS_BASE_CTL+7)
-#define IP_VS_SO_GET_MAX IP_VS_SO_GET_DAEMON
-
-
-/*
- * IPVS Connection Flags
- */
-#define IP_VS_CONN_F_FWD_MASK 0x0007 /* mask for the fwd methods */
-#define IP_VS_CONN_F_MASQ 0x0000 /* masquerading/NAT */
-#define IP_VS_CONN_F_LOCALNODE 0x0001 /* local node */
-#define IP_VS_CONN_F_TUNNEL 0x0002 /* tunneling */
-#define IP_VS_CONN_F_DROUTE 0x0003 /* direct routing */
-#define IP_VS_CONN_F_BYPASS 0x0004 /* cache bypass */
-#define IP_VS_CONN_F_SYNC 0x0020 /* entry created by sync */
-#define IP_VS_CONN_F_HASHED 0x0040 /* hashed entry */
-#define IP_VS_CONN_F_NOOUTPUT 0x0080 /* no output packets */
-#define IP_VS_CONN_F_INACTIVE 0x0100 /* not established */
-#define IP_VS_CONN_F_OUT_SEQ 0x0200 /* must do output seq adjust */
-#define IP_VS_CONN_F_IN_SEQ 0x0400 /* must do input seq adjust */
-#define IP_VS_CONN_F_SEQ_MASK 0x0600 /* in/out sequence mask */
-#define IP_VS_CONN_F_NO_CPORT 0x0800 /* no client port set yet */
-#define IP_VS_CONN_F_TEMPLATE 0x1000 /* template, not connection */
-
-/* Move it to better place one day, for now keep it unique */
-#define NFC_IPVS_PROPERTY 0x10000
-
-#define IP_VS_SCHEDNAME_MAXLEN 16
-#define IP_VS_IFNAME_MAXLEN 16
-
-
-/*
- * The struct ip_vs_service_user and struct ip_vs_dest_user are
- * used to set IPVS rules through setsockopt.
- */
-struct ip_vs_service_user {
- /* virtual service addresses */
- u_int16_t protocol;
- __be32 addr; /* virtual ip address */
- __be16 port;
- u_int32_t fwmark; /* firwall mark of service */
-
- /* virtual service options */
- char sched_name[IP_VS_SCHEDNAME_MAXLEN];
- unsigned flags; /* virtual service flags */
- unsigned timeout; /* persistent timeout in sec */
- __be32 netmask; /* persistent netmask */
-};
-
-
-struct ip_vs_dest_user {
- /* destination server address */
- __be32 addr;
- __be16 port;
-
- /* real server options */
- unsigned conn_flags; /* connection flags */
- int weight; /* destination weight */
-
- /* thresholds for active connections */
- u_int32_t u_threshold; /* upper threshold */
- u_int32_t l_threshold; /* lower threshold */
-};
-
-
-/*
- * IPVS statistics object (for user space)
- */
-struct ip_vs_stats_user
-{
- __u32 conns; /* connections scheduled */
- __u32 inpkts; /* incoming packets */
- __u32 outpkts; /* outgoing packets */
- __u64 inbytes; /* incoming bytes */
- __u64 outbytes; /* outgoing bytes */
-
- __u32 cps; /* current connection rate */
- __u32 inpps; /* current in packet rate */
- __u32 outpps; /* current out packet rate */
- __u32 inbps; /* current in byte rate */
- __u32 outbps; /* current out byte rate */
-};
-
-
-/* The argument to IP_VS_SO_GET_INFO */
-struct ip_vs_getinfo {
- /* version number */
- unsigned int version;
-
- /* size of connection hash table */
- unsigned int size;
-
- /* number of virtual services */
- unsigned int num_services;
-};
-
-
-/* The argument to IP_VS_SO_GET_SERVICE */
-struct ip_vs_service_entry {
- /* which service: user fills in these */
- u_int16_t protocol;
- __be32 addr; /* virtual address */
- __be16 port;
- u_int32_t fwmark; /* firwall mark of service */
-
- /* service options */
- char sched_name[IP_VS_SCHEDNAME_MAXLEN];
- unsigned flags; /* virtual service flags */
- unsigned timeout; /* persistent timeout */
- __be32 netmask; /* persistent netmask */
-
- /* number of real servers */
- unsigned int num_dests;
-
- /* statistics */
- struct ip_vs_stats_user stats;
-};
-
-
-struct ip_vs_dest_entry {
- __be32 addr; /* destination address */
- __be16 port;
- unsigned conn_flags; /* connection flags */
- int weight; /* destination weight */
-
- u_int32_t u_threshold; /* upper threshold */
- u_int32_t l_threshold; /* lower threshold */
-
- u_int32_t activeconns; /* active connections */
- u_int32_t inactconns; /* inactive connections */
- u_int32_t persistconns; /* persistent connections */
-
- /* statistics */
- struct ip_vs_stats_user stats;
-};
-
-
-/* The argument to IP_VS_SO_GET_DESTS */
-struct ip_vs_get_dests {
- /* which service: user fills in these */
- u_int16_t protocol;
- __be32 addr; /* virtual address */
- __be16 port;
- u_int32_t fwmark; /* firwall mark of service */
-
- /* number of real servers */
- unsigned int num_dests;
-
- /* the real servers */
- struct ip_vs_dest_entry entrytable[0];
-};
-
-
-/* The argument to IP_VS_SO_GET_SERVICES */
-struct ip_vs_get_services {
- /* number of virtual services */
- unsigned int num_services;
-
- /* service table */
- struct ip_vs_service_entry entrytable[0];
-};
-
-
-/* The argument to IP_VS_SO_GET_TIMEOUT */
-struct ip_vs_timeout_user {
- int tcp_timeout;
- int tcp_fin_timeout;
- int udp_timeout;
-};
-
-
-/* The argument to IP_VS_SO_GET_DAEMON */
-struct ip_vs_daemon_user {
- /* sync daemon state (master/backup) */
- int state;
-
- /* multicast interface name */
- char mcast_ifn[IP_VS_IFNAME_MAXLEN];
-
- /* SyncID we belong to */
- int syncid;
-};
+#ifndef _NET_IP_VS_H
+#define _NET_IP_VS_H
+#include <linux/ip_vs.h> /* definitions shared with userland */
+/* old ipvsadm versions still include this file directly */
#ifdef __KERNEL__
+#include <asm/types.h> /* for __uXX types */
+
+#include <linux/sysctl.h> /* for ctl_path */
#include <linux/list.h> /* for struct list_head */
#include <linux/spinlock.h> /* for struct rwlock_t */
#include <asm/atomic.h> /* for struct atomic_t */
@@ -981,4 +744,4 @@ static inline __wsum ip_vs_check_diff2(__be16 old, __be16 new, __wsum oldsum)
#endif /* __KERNEL__ */
-#endif /* _IP_VS_H */
+#endif /* _NET_IP_VS_H */
--
1.5.4.5
^ permalink raw reply related [flat|nested] 19+ messages in thread* Re: [PATCH] IPVS: Move userspace definitions to include/linux/ip_vs.h
2008-07-08 14:29 Julius Volz
@ 2008-07-09 1:11 ` Simon Horman
2008-07-09 11:24 ` Julius Volz
0 siblings, 1 reply; 19+ messages in thread
From: Simon Horman @ 2008-07-09 1:11 UTC (permalink / raw)
To: Julius Volz; +Cc: lvs-devel, netdev, kaber, vbusam
On Tue, Jul 08, 2008 at 04:29:56PM +0200, Julius Volz wrote:
> Current versions of ipvsadm include "/usr/src/linux/include/net/ip_vs.h"
> directly. This file also contains kernel-only definitions. Normally, public
> definitions should live in include/linux, so this patch moves the
> definitions shared with userspace to a new file, "include/linux/ip_vs.h".
>
> To make old ipvsadms still compile with this, the old header file includes
> the new one.
>
> The motivation for this cleanup is the planned Netlink interface for IPVS.
Hi Julius,
Firstly these changes look fine: Acked
Secondly, What are your plans for ipvsadm? Do you think that a fork will
be neccessasry to utilise the netlink interface? Or even a new tool with
a completely new name?
--
Horms
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH] IPVS: Move userspace definitions to include/linux/ip_vs.h
2008-07-09 1:11 ` Simon Horman
@ 2008-07-09 11:24 ` Julius Volz
2008-07-09 12:20 ` Simon Horman
0 siblings, 1 reply; 19+ messages in thread
From: Julius Volz @ 2008-07-09 11:24 UTC (permalink / raw)
To: Simon Horman; +Cc: lvs-devel, netdev, kaber, vbusam
On Wed, Jul 9, 2008, Simon Horman wrote:
> Firstly these changes look fine: Acked
Thanks!
> Secondly, What are your plans for ipvsadm? Do you think that a fork will
> be neccessasry to utilise the netlink interface? Or even a new tool with
> a completely new name?
Vince is converting the latest available ipvsadm version to support
the Netlink interface and IPv6 features. So ideally, there will be no
fork or new tool, just a new version. We are keeping the old sockopt
interface in the kernel for userspace backwards compatibility, so
people will only need the new ipvsadm version if they need the new
features. The way Vince is currently implementing it, the new ipvsadm
will probably also keep supporting the sockopt interface as a
fallback, which would mean full backwards compatibility in both
directions.
As for the kernel part, I'm planning to post the Netlink interface
implementation (with minimal stubs for IPv6 support) sometime the next
days.
Julius
--
Google Switzerland GmbH
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH] IPVS: Move userspace definitions to include/linux/ip_vs.h
2008-07-09 11:24 ` Julius Volz
@ 2008-07-09 12:20 ` Simon Horman
0 siblings, 0 replies; 19+ messages in thread
From: Simon Horman @ 2008-07-09 12:20 UTC (permalink / raw)
To: Julius Volz; +Cc: lvs-devel, netdev, kaber, vbusam
On Wed, Jul 09, 2008 at 01:24:35PM +0200, Julius Volz wrote:
> On Wed, Jul 9, 2008, Simon Horman wrote:
> > Firstly these changes look fine: Acked
>
> Thanks!
>
> > Secondly, What are your plans for ipvsadm? Do you think that a fork will
> > be neccessasry to utilise the netlink interface? Or even a new tool with
> > a completely new name?
>
> Vince is converting the latest available ipvsadm version to support
> the Netlink interface and IPv6 features. So ideally, there will be no
> fork or new tool, just a new version. We are keeping the old sockopt
> interface in the kernel for userspace backwards compatibility, so
> people will only need the new ipvsadm version if they need the new
> features. The way Vince is currently implementing it, the new ipvsadm
> will probably also keep supporting the sockopt interface as a
> fallback, which would mean full backwards compatibility in both
> directions.
That sounds great.
> As for the kernel part, I'm planning to post the Netlink interface
> implementation (with minimal stubs for IPv6 support) sometime the next
> days.
--
Horms
^ permalink raw reply [flat|nested] 19+ messages in thread
end of thread, other threads:[~2008-08-01 3:45 UTC | newest]
Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-24 10:14 [PATCH] IPVS: Move userspace definitions to include/linux/ip_vs.h Julius Volz
2008-07-24 11:14 ` Simon Horman
2008-07-24 11:22 ` Patrick McHardy
2008-07-24 11:34 ` Julius Volz
2008-07-24 11:40 ` Patrick McHardy
2008-07-24 11:46 ` Julius Volz
2008-07-24 11:58 ` Julius Volz
2008-07-25 0:22 ` Simon Horman
2008-07-31 2:09 ` Simon Horman
2008-08-01 3:45 ` David Miller
2008-07-25 0:18 ` Simon Horman
-- strict thread matches above, loose matches on Subject: below --
2008-07-22 0:37 Simon Horman
2008-07-23 23:42 ` David Miller
2008-07-24 0:20 ` Simon Horman
2008-07-24 10:09 ` Julius Volz
2008-07-08 14:29 Julius Volz
2008-07-09 1:11 ` Simon Horman
2008-07-09 11:24 ` Julius Volz
2008-07-09 12:20 ` Simon Horman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).