Skip to contentSkip to conversation

ipvs: new sync parameters

PATCH In review Julian Anastasov 2 participants 4 messages Jul 26, 2015 – Aug 21, 2015

Subsystems (4)
lore
Share & tools
lore

Julian Anastasov

author maintainer
#0 lore raw

cover ipvs: new sync parameters

Add new parameters for the sync damon:
sync_maxlen, mcast_group, mcast_port, mcast_ttl.

Stop sending the sync packets with DF=1 to allow fragmentation, eg. on possible MTU changes, reported by Dan Carpenter.

This patchset is based on net-next but requires also the "ipvs: call rtnl_lock early" change.

Julian Anastasov (2):
ipvs: add sync_maxlen parameter for the sync daemon
ipvs: add more mcast parameters for the sync daemon

 include/net/ip_vs.h             |  23 ++--
 include/uapi/linux/ip_vs.h      |   5 +
 net/netfilter/ipvs/ip_vs_ctl.c  | 101 ++++++++++++---
 net/netfilter/ipvs/ip_vs_sync.c | 267 ++++++++++++++++++++++++++--------------
 4 files changed, 275 insertions(+), 121 deletions(-)
Signature · 1 line
1.9.3
author maintainer
#1 lore raw

PATCH 1/2 ipvs: add sync_maxlen parameter for the sync daemon

Allow setups with large MTU to send large sync packets by adding sync_maxlen parameter. The default value is now based on MTU but no more than 1500 for compatibility reasons.

To avoid problems if MTU changes allow fragmentation by sending packets with DF=0. Problem reported by Dan Carpenter.

---
 include/net/ip_vs.h             |  19 +++---
 include/uapi/linux/ip_vs.h      |   1 +
 net/netfilter/ipvs/ip_vs_ctl.c  |  53 ++++++++++------
 net/netfilter/ipvs/ip_vs_sync.c | 137 ++++++++++++++++++----------------------
 4 files changed, 108 insertions(+), 102 deletions(-)
include/net/ip_vs.h +11 -8
index 4e3731e..2fdc13c 100644
@@ -846,6 +846,13 @@ struct ipvs_master_sync_state {
 /* How much time to keep dests in trash */
 #define IP_VS_DEST_TRASH_PERIOD		(120 * HZ)
 
+struct ipvs_sync_daemon_cfg {
+	int			syncid;
+	u16			sync_maxlen;
+	/* multicast interface name */
+	char			mcast_ifn[IP_VS_IFNAME_MAXLEN];
+};
+
 /* IPVS in network namespace */
 struct netns_ipvs {
 	int			gen;		/* Generation */
@@ -961,15 +968,10 @@ struct netns_ipvs {
 	spinlock_t		sync_buff_lock;
 	struct task_struct	**backup_threads;
 	int			threads_mask;
-	int			send_mesg_maxlen;
-	int			recv_mesg_maxlen;
 	volatile int		sync_state;
-	volatile int		master_syncid;
-	volatile int		backup_syncid;
 	struct mutex		sync_mutex;
-	/* multicast interface name */
-	char			master_mcast_ifn[IP_VS_IFNAME_MAXLEN];
-	char			backup_mcast_ifn[IP_VS_IFNAME_MAXLEN];
+	struct ipvs_sync_daemon_cfg	mcfg;	/* Master Configuration */
+	struct ipvs_sync_daemon_cfg	bcfg;	/* Backup Configuration */
 	/* net name space ptr */
 	struct net		*net;            /* Needed by timer routines */
 	/* Number of heterogeneous destinations, needed becaus heterogeneous
@@ -1408,7 +1410,8 @@ static inline void ip_vs_dest_put_and_free(struct ip_vs_dest *dest)
 /* IPVS sync daemon data and function prototypes
  * (from ip_vs_sync.c)
  */
-int start_sync_thread(struct net *net, int state, char *mcast_ifn, __u8 syncid);
+int start_sync_thread(struct net *net, struct ipvs_sync_daemon_cfg *cfg,
+		      int state);
 int stop_sync_thread(struct net *net, int state);
 void ip_vs_sync_conn(struct net *net, struct ip_vs_conn *cp, int pkts);
 
include/uapi/linux/ip_vs.h +1 -0
index 3199243..68377d8 100644
@@ -406,6 +406,7 @@ 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_MAX,
 };
 
net/netfilter/ipvs/ip_vs_ctl.c +33 -20

134 lines not on this page · raw message

net/netfilter/ipvs/ip_vs_sync.c +63 -74

318 lines not on this page · raw message

Signature · 1 line
1.9.3
author maintainer
#2 lore raw

PATCH 2/2 ipvs: add more mcast parameters for the sync daemon

In reply to Julian Anastasov

- mcast_group: configure the multicast address, now IPv6 is supported too

- mcast_port: configure the multicast port

- mcast_ttl: configure the multicast TTL/HOP_LIMIT

---
 include/net/ip_vs.h             |   4 ++
 include/uapi/linux/ip_vs.h      |   4 ++
 net/netfilter/ipvs/ip_vs_ctl.c  |  50 ++++++++++++++-
 net/netfilter/ipvs/ip_vs_sync.c | 138 +++++++++++++++++++++++++++++++++-------
 4 files changed, 172 insertions(+), 24 deletions(-)
include/net/ip_vs.h +4 -0
index 2fdc13c..9b9ca87 100644
@@ -847,8 +847,12 @@ struct ipvs_master_sync_state {
 #define IP_VS_DEST_TRASH_PERIOD		(120 * HZ)
 
 struct ipvs_sync_daemon_cfg {
+	union nf_inet_addr	mcast_group;
 	int			syncid;
 	u16			sync_maxlen;
+	u16			mcast_port;
+	u8			mcast_af;
+	u8			mcast_ttl;
 	/* multicast interface name */
 	char			mcast_ifn[IP_VS_IFNAME_MAXLEN];
 };
include/uapi/linux/ip_vs.h +4 -0
index 68377d8..391395c 100644
@@ -407,6 +407,10 @@ enum {
 	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,
 };
 
net/netfilter/ipvs/ip_vs_ctl.c +49 -1

69 lines not on this page · raw message

net/netfilter/ipvs/ip_vs_sync.c +115 -23

239 lines not on this page · raw message

Signature · 1 line
1.9.3
maintainer
#3 lore raw
In reply to Julian Anastasov
Quoted 9 lines · Julian Anastasov

Add new parameters for the sync damon:
sync_maxlen, mcast_group, mcast_port, mcast_ttl.

Stop sending the sync packets with DF=1 to allow fragmentation, eg. on possible MTU changes, reported by Dan Carpenter.

This patchset is based on net-next but requires also the "ipvs: call rtnl_lock early" change.

Thanks, I have queued this up.