ipvsadm: new attributes for sync daemon
Julian Anastasov
maintainerRFC PATCH 1/1 ipvsadm: new attributes for sync daemon
Add support for --sync-maxlen, --mcast-group, --mcast-port and --mcast-ttl options for the --start-daemon command.
Signed-off-by Julian Anastasov <[email protected]>
--- ipvsadm.8 | 55 ++++++++++++++----- ipvsadm.c | 137 +++++++++++++++++++++++++++++++++++++--------- libipvs/ip_vs.h | 31 +++++++++++ libipvs/ip_vs_nl_policy.c | 6 ++ libipvs/libipvs.c | 71 ++++++++++++++++++++++-- 5 files changed, 256 insertions(+), 44 deletions(-)
Patch is for ipvsadm from git, use:
git clone git://git.kernel.org/pub/scm/utils/kernel/ipvsadm/ipvsadm.git
cd ipvsadm/ && make
ipvsadm.8 +41 -14
@@ -59,7 +59,7 @@ ipvsadm \- Linux Virtual Server administration .br .B ipvsadm --set \fItcp\fP \fItcpfin\fP \fIudp\fP .br -.B ipvsadm --start-daemon \fIstate\fP [--mcast-interface \fIinterface\fP] +.B ipvsadm --start-daemon \fIstate\fP [daemon-options] .ti 15 .B [--syncid \fIsyncid\fP] .br
@@ -167,7 +167,7 @@ balancer fails, a backup load balancer will takeover, and it has state of almost all connections, so that almost all established connections can continue to access the service. .PP -The sync daemon currently only supports IPv4 connections. +The sync daemon supports IPv4 and IPv6 connections. .TP .B --stop-daemon Stop the connection synchronization daemon.
@@ -359,18 +359,6 @@ connections drops below its lower connection threshold. If will receive new connections when the number of its connections drops below three forth of its upper connection threshold. .TP -.B --mcast-interface \fIinterface\fP -Specify the multicast interface that the sync master daemon sends -outgoing multicasts through, or the sync backup daemon listens to for -multicasts. -.TP -.B --syncid \fIsyncid\fP -Specify the \fIsyncid\fP that the sync master daemon fills in the -SyncID header while sending multicast messages, or the sync backup -daemon uses to filter out multicast messages not matched with the -SyncID value. The valid values of \fIsyncid\fP are 0 through to -255. The default is 0, which means no filtering at all. -.TP .B -c, --connection Connection output. The \fIlist\fP command with this option will list current IPVS connections.
@@ -438,6 +426,45 @@ One-packet scheduling. Used in conjunction with a UDP virtual service or a fwmark virtual service that handles only UDP packets. All connections are created such that they only schedule one packet. +.SS PARAMETERS FOR SYNCHRONIZATION DAEMON +The --start-daemon requires zero or more of the following +parameters. +.TP +.B --syncid \fIsyncid\fP +Specify the \fIsyncid\fP that the sync master daemon fills in the +SyncID header while sending multicast messages, or the sync backup +daemon uses to filter out multicast messages not matched with the +SyncID value. The valid values of \fIsyncid\fP are 0 through to +255. The default is 0, which means no filtering at all. +.TP +.B --sync-maxlen \fIlength\fP +Specify the desired length of sync messages (UDP payload size). +It is expected that backup server will use value not less than +the used value in master server. +The valid values of \fIlength\fP are in the 1 .. (65535 - 20 - 8) +range but the kernel ensures a space for at least one sync message. +If value is lower than MTU the sync messages will be fragmented by +IP layer. +The default value is derived from the MTU value when daemon is started +but master daemon will not default to value above 1500 for compatibility +reasons. +.TP +.B --mcast-interface \fIinterface\fP +Specify the multicast interface that the sync master daemon sends +outgoing multicasts through, or the sync backup daemon listens to for +multicasts. +.TP +.B --mcast-group \fIaddress\fP +Specify IPv4 or IPv6 multicast address for the sync messages. +The default value is 224.0.0.81. +.TP +.B --mcast-port \fIport\fP +Specify the UDP port for sync messages. +The default value is 8848. +.TP +.B --mcast-ttl \fIttl\fP +Specify the TTL value for sync messages (1 .. 255). +The default value is 1. .SH EXAMPLE 1 - Simple Virtual Service The following commands configure a Linux Director to distribute incoming requests addressed to port 80 on 207.175.44.110 equally to
ipvsadm.c +112 -25
198 lines not on this page · raw message
libipvs/ip_vs.h +31 -0
@@ -348,6 +348,17 @@ struct ip_vs_timeout_user {/* The argument to IP_VS_SO_GET_DAEMON */ +struct ip_vs_daemon_kern { +/* sync daemon state (master/backup) */ +int state; + +/* multicast interface name */ +char mcast_ifn[IP_VS_IFNAME_MAXLEN ]; + +/* SyncID we belong to */ +int syncid; +}; +struct ip_vs_daemon_user {/* sync daemon state (master/backup) */ int state;
@@ -357,6 +368,21 @@ struct ip_vs_daemon_user {/* SyncID we belong to */ int syncid; + +/* UDP Payload Size */ +int sync_maxlen; + +/* Multicast Port (base) */ +u_int16_t mcast_port; + +/* Multicast TTL */ +u_int16_t mcast_ttl; + +/* Multicast Address Family */ +u_int16_t mcast_af; + +/* Multicast Address */ +union nf_inet_addr mcast_group; };
@@ -488,6 +514,11 @@ enum {IPVS_DAEMON_ATTR_STATE ,/* sync daemon state (master/backup) */ IPVS_DAEMON_ATTR_MCAST_IFN ,/* multicast interface name */ IPVS_DAEMON_ATTR_SYNC_ID ,/* SyncID we belong to */ +IPVS_DAEMON_ATTR_SYNC_MAXLEN ,/* UDP Payload Size */ +IPVS_DAEMON_ATTR_MCAST_GROUP ,/* IPv4 Multicast Address */ +IPVS_DAEMON_ATTR_MCAST_GROUP6 ,/* IPv6 Multicast Address */ +IPVS_DAEMON_ATTR_MCAST_PORT ,/* Multicast Port (base) */ +IPVS_DAEMON_ATTR_MCAST_TTL ,/* Multicast TTL */ __IPVS_DAEMON_ATTR_MAX, };
libipvs/ip_vs_nl_policy.c +6 -0
@@ -65,6 +65,12 @@ struct nla_policy ipvs_daemon_policy[IPVS_DAEMON_ATTR_MAX + 1] = { [IPVS_DAEMON_ATTR_MCAST_IFN] = { .type = NLA_STRING, .maxlen = IP_VS_IFNAME_MAXLEN }, [IPVS_DAEMON_ATTR_SYNC_ID] = { .type = NLA_U32 }, + [IPVS_DAEMON_ATTR_SYNC_MAXLEN] = { .type = NLA_U16 }, + [IPVS_DAEMON_ATTR_MCAST_GROUP] = { .type = NLA_U32 }, + [IPVS_DAEMON_ATTR_MCAST_GROUP6] = { .type = NLA_UNSPEC, + .maxlen = sizeof(struct in6_addr) }, + [IPVS_DAEMON_ATTR_MCAST_PORT] = { .type = NLA_U16 }, + [IPVS_DAEMON_ATTR_MCAST_TTL] = { .type = NLA_U8 }, };#endif /* LIBIPVS_USE_NL */
libipvs/libipvs.c +66 -5
141 lines not on this page · raw message
Signature · 1 line
1.9.3