Skip to contentSkip to conversation

Allow tunneling with gue encapsulation

PATCH Superseded Jacky Hu 2 participants 4 messages May 26, 2019 – May 30, 2019 IPVS

v7 of 8 Superseded Latest is v8 →

lore
Share & tools
lore

Jacky Hu

author
#0 lore raw

v7 cover Allow tunneling with gue encapsulation

This patchset allows tunneling with gue encapsulation.

v7->v6:
1) fix type of local variable in parse_tun_type
2) use up to 4 letters in the comments
3) document new options

v6->v5:
1) split the patch into two:
- ipvsadm: convert options to unsigned long long
- ipvsadm: allow tunneling with gue encapsulation
2) do not mix static and dynamic allocation in fwd_tun_info
3) use correct nla_get/put function for tun_flags
4) fixed || style
5) use correct return value for parse_tun_type

v5->v4:
1) add checksum support for gue encapsulation

v4->v3:
1) removed changes to setsockopt interface
2) use correct nla_get/put function for tun_port

v3->v2:
1) added missing break statements to a few switch cases

v2->v1:
1) pass tun_type and tun_port as new optional parameters instead of a few bits in existing conn_flags parameters

Jacky Hu (2):
ipvsadm: convert options to unsigned long long
ipvsadm: allow tunneling with gue encapsulation

 ipvsadm.8         |  72 ++++++++
 ipvsadm.c         | 427 +++++++++++++++++++++++++++++++++++++++-------
 libipvs/ip_vs.h   |  28 +++
 libipvs/libipvs.c |  15 ++
 4 files changed, 476 insertions(+), 66 deletions(-)
Signature · 1 line
2.21.0
author
#1 lore raw

PATCH v7 1/2 ipvsadm: convert options to unsigned long long

To allow up to 64 options to be specified.
Add calculated logarithm constants for existing options. Remove opt2name function to avoid recalculation.

---
 ipvsadm.c | 117 ++++++++++++++++++++++++++++++++----------------------
 1 file changed, 69 insertions(+), 48 deletions(-)
ipvsadm.c +69 -48
index 0cb2b68..9e7a448 100644
@@ -189,6 +189,35 @@ static const char* cmdnames[] = {
 #define OPT_SYNC_MAXLEN	0x08000000
 #define NUMBER_OF_OPT		28
 
+#define OPTC_NUMERIC		0
+#define OPTC_CONNECTION		1
+#define OPTC_SERVICE		2
+#define OPTC_SCHEDULER		3
+#define OPTC_PERSISTENT		4
+#define OPTC_NETMASK		5
+#define OPTC_SERVER		6
+#define OPTC_FORWARD		7
+#define OPTC_WEIGHT		8
+#define OPTC_UTHRESHOLD		9
+#define OPTC_LTHRESHOLD		10
+#define OPTC_MCAST		11
+#define OPTC_TIMEOUT		12
+#define OPTC_DAEMON		13
+#define OPTC_STATS		14
+#define OPTC_RATE		15
+#define OPTC_THRESHOLDS		16
+#define OPTC_PERSISTENTCONN	17
+#define OPTC_NOSORT		18
+#define OPTC_SYNCID		19
+#define OPTC_EXACT		20
+#define OPTC_ONEPACKET		21
+#define OPTC_PERSISTENCE_ENGINE	22
+#define OPTC_SCHED_FLAGS	23
+#define OPTC_MCAST_GROUP	24
+#define OPTC_MCAST_PORT		25
+#define OPTC_MCAST_TTL		26
+#define OPTC_SYNC_MAXLEN	27
+
 static const char* optnames[] = {
 	"numeric",
 	"connection",
@@ -320,9 +349,9 @@ static unsigned int parse_fwmark(char *buf);
 static unsigned int parse_sched_flags(const char *sched, char *optarg);
 
 /* check the options based on the commands_v_options table */
-static void generic_opt_check(int command, int options);
+static void generic_opt_check(int command, unsigned long long options);
 static void set_command(int *cmd, const int newcmd);
-static void set_option(unsigned int *options, unsigned int option);
+static void set_option(unsigned long long *options, int optc);
 
 static void tryhelp_exit(const char *program, const int exit_status);
 static void usage_exit(const char *program, const int exit_status);
@@ -416,7 +445,7 @@ static char *protocol_name(int proto)
 
 static int
 parse_options(int argc, char **argv, struct ipvs_command_entry *ce,
-	      unsigned int *options, unsigned int *format)
+	      unsigned long long *options, unsigned int *format)
 {
 	int c, parse;
 	poptContext context;
@@ -575,7 +604,7 @@ parse_options(int argc, char **argv, struct ipvs_command_entry *ce,
 		case 't':
 		case 'u':
 		case TAG_SCTP_SERVICE:
-			set_option(options, OPT_SERVICE);
+			set_option(options, OPTC_SERVICE);
 			ce->svc.protocol = option_to_protocol(c);
 			parse = parse_service(optarg, &ce->svc);
 			if (!(parse & SERVICE_ADDR))
@@ -583,7 +612,7 @@ parse_options(int argc, char **argv, struct ipvs_command_entry *ce,
 				     "address[:port] specified");
 			break;
 		case 'f':
-			set_option(options, OPT_SERVICE);
+			set_option(options, OPTC_SERVICE);
 			/*
 			 * Set protocol to a sane values, even
 			 * though it is not used
@@ -593,18 +622,18 @@ parse_options(int argc, char **argv, struct ipvs_command_entry *ce,
 			ce->svc.fwmark = parse_fwmark(optarg);
 			break;
 		case 's':
-			set_option(options, OPT_SCHEDULER);
+			set_option(options, OPTC_SCHEDULER);
 			strncpy(ce->svc.sched_name,
 				optarg, IP_VS_SCHEDNAME_MAXLEN - 1);
 			break;
 		case 'p':
-			set_option(options, OPT_PERSISTENT);
+			set_option(options, OPTC_PERSISTENT);
 			ce->svc.flags |= IP_VS_SVC_F_PERSISTENT;
 			ce->svc.timeout =
 				parse_timeout(optarg, 1, MAX_TIMEOUT);
 			break;
 		case 'M':
-			set_option(options, OPT_NETMASK);
+			set_option(options, OPTC_NETMASK);
 			if (ce->svc.af != AF_INET6) {
 				parse = parse_netmask(optarg, &ce->svc.netmask);
 				if (parse != 1)
@@ -617,7 +646,7 @@ parse_options(int argc, char **argv, struct ipvs_command_entry *ce,
 			}
 			break;
 		case 'r':
-			set_option(options, OPT_SERVER);
+			set_option(options, OPTC_SERVER);
 			ipvs_service_t t_dest = ce->svc;
 			parse = parse_service(optarg, &t_dest);
 			ce->dest.af = t_dest.af;
@@ -631,84 +660,84 @@ parse_options(int argc, char **argv, struct ipvs_command_entry *ce,
 				ce->dest.port = ce->svc.port;
 			break;
 		case 'i':
-			set_option(options, OPT_FORWARD);
+			set_option(options, OPTC_FORWARD);
 			ce->dest.conn_flags = IP_VS_CONN_F_TUNNEL;
 			break;
 		case 'g':
-			set_option(options, OPT_FORWARD);
+			set_option(options, OPTC_FORWARD);
 			ce->dest.conn_flags = IP_VS_CONN_F_DROUTE;
 			break;
 		case 'm':
-			set_option(options, OPT_FORWARD);
+			set_option(options, OPTC_FORWARD);
 			ce->dest.conn_flags = IP_VS_CONN_F_MASQ;
 			break;
 		case 'w':
-			set_option(options, OPT_WEIGHT);
+			set_option(options, OPTC_WEIGHT);
 			if ((ce->dest.weight =
 			     string_to_number(optarg, 0, 65535)) == -1)
 				fail(2, "illegal weight specified");
 			break;
 		case 'x':
-			set_option(options, OPT_UTHRESHOLD);
+			set_option(options, OPTC_UTHRESHOLD);
 			if ((ce->dest.u_threshold =
 			     string_to_number(optarg, 0, INT_MAX)) == -1)
 				fail(2, "illegal u_threshold specified");
 			break;
 		case 'y':
-			set_option(options, OPT_LTHRESHOLD);
+			set_option(options, OPTC_LTHRESHOLD);
 			if ((ce->dest.l_threshold =
 			     string_to_number(optarg, 0, INT_MAX)) == -1)
 				fail(2, "illegal l_threshold specified");
 			break;
 		case 'c':
-			set_option(options, OPT_CONNECTION);
+			set_option(options, OPTC_CONNECTION);
 			break;
 		case 'n':
-			set_option(options, OPT_NUMERIC);
+			set_option(options, OPTC_NUMERIC);
 			*format |= FMT_NUMERIC;
 			break;
 		case TAG_MCAST_INTERFACE:
-			set_option(options, OPT_MCAST);
+			set_option(options, OPTC_MCAST);
 			strncpy(ce->daemon.mcast_ifn,
 				optarg, IP_VS_IFNAME_MAXLEN - 1);
 			break;
 		case 'I':
-			set_option(options, OPT_SYNCID);
+			set_option(options, OPTC_SYNCID);
 			if ((ce->daemon.syncid =
 			     string_to_number(optarg, 0, 255)) == -1)
 				fail(2, "illegal syncid specified");
 			break;
 		case TAG_TIMEOUT:
-			set_option(options, OPT_TIMEOUT);
+			set_option(options, OPTC_TIMEOUT);
 			break;
 		case TAG_DAEMON:
-			set_option(options, OPT_DAEMON);
+			set_option(options, OPTC_DAEMON);
 			break;
 		case TAG_STATS:
-			set_option(options, OPT_STATS);
+			set_option(options, OPTC_STATS);
 			*format |= FMT_STATS;
 			break;
 		case TAG_RATE:
-			set_option(options, OPT_RATE);
+			set_option(options, OPTC_RATE);
 			*format |= FMT_RATE;
 			break;
 		case TAG_THRESHOLDS:
-			set_option(options, OPT_THRESHOLDS);
+			set_option(options, OPTC_THRESHOLDS);
 			*format |= FMT_THRESHOLDS;
 			break;
 		case TAG_PERSISTENTCONN:
-			set_option(options, OPT_PERSISTENTCONN);
+			set_option(options, OPTC_PERSISTENTCONN);
 			*format |= FMT_PERSISTENTCONN;
 			break;
 		case TAG_NO_SORT:
-			set_option(options, OPT_NOSORT	);
+			set_option(options, OPTC_NOSORT);
 			*format |= FMT_NOSORT;
 			break;
 		case TAG_SORT:
 			/* Sort is the default, this is a no-op for compatibility */
 			break;
 		case 'X':
-			set_option(options, OPT_EXACT);
+			set_option(options, OPTC_EXACT);
 			*format |= FMT_EXACT;
 			break;
 		case '6':
@@ -720,20 +749,20 @@ parse_options(int argc, char **argv, struct ipvs_command_entry *ce,
 			}
 			break;
 		case 'o':
-			set_option(options, OPT_ONEPACKET);
+			set_option(options, OPTC_ONEPACKET);
 			ce->svc.flags |= IP_VS_SVC_F_ONEPACKET;
 			break;
 		case TAG_PERSISTENCE_ENGINE:
-			set_option(options, OPT_PERSISTENCE_ENGINE);
+			set_option(options, OPTC_PERSISTENCE_ENGINE);
 			strncpy(ce->svc.pe_name, optarg, IP_VS_PENAME_MAXLEN);
 			break;
 		case 'b':
-			set_option(options, OPT_SCHED_FLAGS);
+			set_option(options, OPTC_SCHED_FLAGS);
 			snprintf(sched_flags_arg, sizeof(sched_flags_arg),
 				"%s", optarg);
 			break;
 		case TAG_MCAST_GROUP:
-			set_option(options, OPT_MCAST_GROUP);
+			set_option(options, OPTC_MCAST_GROUP);
 			if (strchr(optarg, ':')) {
 				if (inet_pton(AF_INET6, optarg,
 					      &ce->daemon.mcast_group) <= 0 ||
@@ -753,21 +782,21 @@ parse_options(int argc, char **argv, struct ipvs_command_entry *ce,
 			}
 			break;
 		case TAG_MCAST_PORT:
-			set_option(options, OPT_MCAST_PORT);
+			set_option(options, OPTC_MCAST_PORT);
 			parse = string_to_number(optarg, 1, 65535);
 			if (parse == -1)
 				fail(2, "illegal mcast-port specified");
 			ce->daemon.mcast_port = parse;
 			break;
 		case TAG_MCAST_TTL:
-			set_option(options, OPT_MCAST_TTL);
+			set_option(options, OPTC_MCAST_TTL);
 			parse = string_to_number(optarg, 1, 255);
 			if (parse == -1)
 				fail(2, "illegal mcast-ttl specified");
 			ce->daemon.mcast_ttl = parse;
 			break;
 		case TAG_SYNC_MAXLEN:
-			set_option(options, OPT_SYNC_MAXLEN);
+			set_option(options, OPTC_SYNC_MAXLEN);
 			parse = string_to_number(optarg, 1, 65535 - 20 - 8);
 			if (parse == -1)
 				fail(2, "illegal sync-maxlen specified");
@@ -845,7 +874,7 @@ static int restore_table(int argc, char **argv, int reading_stdin)
 static int process_options(int argc, char **argv, int reading_stdin)
 {
 	struct ipvs_command_entry ce;
-	unsigned int options = OPT_NONE;
+	unsigned long long options = OPT_NONE;
 	unsigned int format = FMT_NONE;
 	int result = 0;
 
@@ -1164,7 +1193,7 @@ static unsigned int parse_sched_flags(const char *sched, char *optarg)
 }
 
 static void
-generic_opt_check(int command, int options)
+generic_opt_check(int command, unsigned long long options)
 {
 	int i, j;
 	int last = 0, count = 0;
@@ -1173,7 +1202,7 @@ generic_opt_check(int command, int options)
 	i = command - CMD_NONE -1;
 
 	for (j = 0; j < NUMBER_OF_OPT; j++) {
-		if (!(options & (1<<j))) {
+		if (!(options & (1ULL<<j))) {
 			if (commands_v_options[i][j] == '+')
 				fail(2, "You need to supply the '%s' "
 				     "option for the '%s' command",
@@ -1197,15 +1226,6 @@ generic_opt_check(int command, int options)
 	}
 }
 
-static inline const char *
-opt2name(int option)
-{
-	const char **ptr;
-	for (ptr = optnames; option > 1; option >>= 1, ptr++);
-
-	return *ptr;
-}
-
 static void
 set_command(int *cmd, const int newcmd)
 {
@@ -1215,10 +1235,11 @@ set_command(int *cmd, const int newcmd)
 }
 
 static void
-set_option(unsigned int *options, unsigned int option)
+set_option(unsigned long long *options, int optc)
 {
+	unsigned long long option = 1ULL<<optc;
 	if (*options & option)
-		fail(2, "multiple '%s' options specified", opt2name(option));
+		fail(2, "multiple '%s' options specified", optnames[optc]);
 	*options |= option;
 }
 
Signature · 1 line
2.21.0
author
#2 lore raw

PATCH v7 2/2 ipvsadm: allow tunneling with gue encapsulation

In reply to Jacky Hu

Added the following options with adding and editing destinations for tunneling servers:
--tun-type
--tun-port
--tun-nocsum
--tun-csum
--tun-remcsum

Added the following options with listing services for tunneling servers:
--tun-info

---
 ipvsadm.8         |  72 +++++++++++
 ipvsadm.c         | 318 ++++++++++++++++++++++++++++++++++++++++++----
 libipvs/ip_vs.h   |  28 ++++
 libipvs/libipvs.c |  15 +++
 4 files changed, 411 insertions(+), 22 deletions(-)
ipvsadm.8 +72 -0
index 1b25888..92326e1 100644
@@ -339,6 +339,36 @@ the request sent to the virtual service.
 .sp
 \fB-i, --ipip\fR  Use ipip encapsulation (tunneling).
 .sp
+.ti +8
+.B --tun-type \fItun-type\fP
+.ti +16
+\fItun-type\fP is one of \fIipip\fP|\fIgue\fP.
+The default value of \fItun-type\fP is \fIipip\fP.
+.sp
+.ti +8
+.B --tun-port \fItun-port\fP
+.ti +16
+\fItun-port\fP is an integer specifying the destination port.
+Only valid for \fItun-type\fP \fIgue\fP.
+.sp
+.ti +8
+.B --tun-nocsum
+.ti +16
+Specify that UDP checksums are disabled. This is the default.
+Only valid for \fItun-type\fP \fIgue\fP.
+.sp
+.ti +8
+.B --tun-csum
+.ti +16
+Specify that UDP checksums are enabled.
+Only valid for \fItun-type\fP \fIgue\fP.
+.sp
+.ti +8
+.B --tun-remcsum
+.ti +16
+Specify that Remote Checksum Offload is enabled.
+Only valid for \fItun-type\fP \fIgue\fP.
+.sp
 \fB-m, --masquerading\fR  Use masquerading (network access translation, or NAT).
 .sp
 \fBNote:\fR  Regardless of the packet-forwarding mechanism specified,
@@ -416,6 +446,11 @@ The \fIlist\fP command with the -c, --connection option and this option
 will include persistence engine data, if any is present, when listing
 connections.
 .TP
+.B --tun-info
+Output of tunneling information. The \fIlist\fP command with this
+option will display the tunneling information of services and their
+servers.
+.TP
 .B --sort
 Sort the list of virtual services and real servers. The virtual
 service entries are sorted in ascending order by <protocol, address,
@@ -553,6 +588,43 @@ modprobe ip_tables
 iptables  -A PREROUTING -t mangle -d 207.175.44.110/31 -j MARK --set-mark 1
 modprobe ip_vs_ftp
 .fi
+.SH EXAMPLE 3 - Virtual Service with GUE Tunneling
+The following commands configure a Linux Director to distribute
+incoming requests addressed to port 80 on 207.175.44.110 equally to
+port 80 on five real servers. The forwarding method used in this
+example is tunneling with gue encapsulation.
+.PP
+.nf
+ipvsadm -A -t 207.175.44.110:80 -s rr
+ipvsadm -a -t 207.175.44.110:80 -r 192.168.10.1:80 -i --tun-type gue \
+--tun-port 6080 --tun-csum
+ipvsadm -a -t 207.175.44.110:80 -r 192.168.10.2:80 -i --tun-type gue \
+--tun-port 6080 --tun-csum
+ipvsadm -a -t 207.175.44.110:80 -r 192.168.10.3:80 -i --tun-type gue \
+--tun-port 6080 --tun-csum
+ipvsadm -a -t 207.175.44.110:80 -r 192.168.10.4:80 -i --tun-type gue \
+--tun-port 6080 --tun-csum
+ipvsadm -a -t 207.175.44.110:80 -r 192.168.10.5:80 -i --tun-type gue \
+--tun-port 6080 --tun-csum
+.fi
+.PP
+Alternatively, this could be achieved in a single ipvsadm command.
+.PP
+.nf
+echo "
+-A -t 207.175.44.110:80 -s rr
+-a -t 207.175.44.110:80 -r 192.168.10.1:80 -i --tun-type gue --tun-port 6080 \
+--tun-csum
+-a -t 207.175.44.110:80 -r 192.168.10.2:80 -i --tun-type gue --tun-port 6080 \
+--tun-csum
+-a -t 207.175.44.110:80 -r 192.168.10.3:80 -i --tun-type gue --tun-port 6080 \
+--tun-csum
+-a -t 207.175.44.110:80 -r 192.168.10.4:80 -i --tun-type gue --tun-port 6080 \
+--tun-csum
+-a -t 207.175.44.110:80 -r 192.168.10.5:80 -i --tun-type gue --tun-port 6080 \
+--tun-csum
+" | ipvsadm -R
+.fi
 .SH IPv6
 IPv6 addresses should be surrounded by square brackets ([ and ]).
 .PP
ipvsadm.c +296 -22

479 lines not on this page · raw message

libipvs/ip_vs.h +28 -0
index ad0141c..ef9e0a7 100644
@@ -107,6 +107,18 @@
 
 #define IP_VS_PEDATA_MAXLEN	255
 
+/* Tunnel types */
+enum {
+	IP_VS_CONN_F_TUNNEL_TYPE_IPIP = 0,	/* IPIP */
+	IP_VS_CONN_F_TUNNEL_TYPE_GUE,		/* GUE */
+	IP_VS_CONN_F_TUNNEL_TYPE_MAX,
+};
+
+/* Tunnel encapsulation flags */
+#define IP_VS_TUNNEL_ENCAP_FLAG_NOCSUM		(0)
+#define IP_VS_TUNNEL_ENCAP_FLAG_CSUM		(1<<0)
+#define IP_VS_TUNNEL_ENCAP_FLAG_REMCSUM		(1<<1)
+
 union nf_inet_addr {
         __u32           all[4];
         __be32          ip;
@@ -178,6 +190,11 @@ struct ip_vs_dest_user {
 	u_int32_t		l_threshold;	/* lower threshold */
 	u_int16_t		af;
 	union nf_inet_addr	addr;
+
+	/* tunnel info */
+	u_int16_t		tun_type;	/* tunnel type */
+	__be16			tun_port;	/* tunnel port */
+	u_int16_t		tun_flags;	/* tunnel flags */
 };
 
 /*
@@ -313,6 +330,11 @@ struct ip_vs_dest_entry {
 
 	/* statistics, 64-bit */
 	struct ip_vs_stats64	stats64;
+
+	/* tunnel info */
+	u_int16_t		tun_type;	/* tunnel type */
+	__be16			tun_port;	/* tunnel port */
+	u_int16_t		tun_flags;	/* tunnel flags */
 };
 
 /* The argument to IP_VS_SO_GET_DESTS */
@@ -527,6 +549,12 @@ enum {
 
 	IPVS_DEST_ATTR_STATS64,		/* nested attribute for dest stats */
 
+	IPVS_DEST_ATTR_TUN_TYPE,	/* tunnel type */
+
+	IPVS_DEST_ATTR_TUN_PORT,	/* tunnel port */
+
+	IPVS_DEST_ATTR_TUN_FLAGS,	/* tunnel flags */
+
 	__IPVS_DEST_ATTR_MAX,
 };
 
libipvs/libipvs.c +15 -0
index 9be7700..067306a 100644
@@ -390,6 +390,9 @@ static int ipvs_nl_fill_dest_attr(struct nl_msg *msg, ipvs_dest_t *dst)
 	NLA_PUT_U16(msg, IPVS_DEST_ATTR_PORT, dst->port);
 	NLA_PUT_U32(msg, IPVS_DEST_ATTR_FWD_METHOD, dst->conn_flags & IP_VS_CONN_F_FWD_MASK);
 	NLA_PUT_U32(msg, IPVS_DEST_ATTR_WEIGHT, dst->weight);
+	NLA_PUT_U8(msg, IPVS_DEST_ATTR_TUN_TYPE, dst->tun_type);
+	NLA_PUT_U16(msg, IPVS_DEST_ATTR_TUN_PORT, dst->tun_port);
+	NLA_PUT_U16(msg, IPVS_DEST_ATTR_TUN_FLAGS, dst->tun_flags);
 	NLA_PUT_U32(msg, IPVS_DEST_ATTR_U_THRESH, dst->u_threshold);
 	NLA_PUT_U32(msg, IPVS_DEST_ATTR_L_THRESH, dst->l_threshold);
 
@@ -856,6 +859,9 @@ static int ipvs_dests_parse_cb(struct nl_msg *msg, void *arg)
 	struct nlattr *attrs[IPVS_CMD_ATTR_MAX + 1];
 	struct nlattr *dest_attrs[IPVS_DEST_ATTR_MAX + 1];
 	struct nlattr *attr_addr_family = NULL;
+	struct nlattr *attr_tun_type = NULL;
+	struct nlattr *attr_tun_port = NULL;
+	struct nlattr *attr_tun_flags = NULL;
 	struct ip_vs_get_dests **dp = (struct ip_vs_get_dests **)arg;
 	struct ip_vs_get_dests *d = (struct ip_vs_get_dests *)*dp;
 	int i = d->num_dests;
@@ -888,6 +894,15 @@ static int ipvs_dests_parse_cb(struct nl_msg *msg, void *arg)
 	d->entrytable[i].port = nla_get_u16(dest_attrs[IPVS_DEST_ATTR_PORT]);
 	d->entrytable[i].conn_flags = nla_get_u32(dest_attrs[IPVS_DEST_ATTR_FWD_METHOD]);
 	d->entrytable[i].weight = nla_get_u32(dest_attrs[IPVS_DEST_ATTR_WEIGHT]);
+	attr_tun_type = dest_attrs[IPVS_DEST_ATTR_TUN_TYPE];
+	if (attr_tun_type)
+		d->entrytable[i].tun_type = nla_get_u8(attr_tun_type);
+	attr_tun_port = dest_attrs[IPVS_DEST_ATTR_TUN_PORT];
+	if (attr_tun_port)
+		d->entrytable[i].tun_port = nla_get_u16(attr_tun_port);
+	attr_tun_flags = dest_attrs[IPVS_DEST_ATTR_TUN_FLAGS];
+	if (attr_tun_flags)
+		d->entrytable[i].tun_flags = nla_get_u16(attr_tun_flags);
 	d->entrytable[i].u_threshold = nla_get_u32(dest_attrs[IPVS_DEST_ATTR_U_THRESH]);
 	d->entrytable[i].l_threshold = nla_get_u32(dest_attrs[IPVS_DEST_ATTR_L_THRESH]);
 	d->entrytable[i].activeconns = nla_get_u32(dest_attrs[IPVS_DEST_ATTR_ACTIVE_CONNS]);
Signature · 1 line
2.21.0
maintainer
#3 lore raw
In reply to Jacky Hu

Hello,

Quoted 6 lines · Jacky Hu

This patchset allows tunneling with gue encapsulation.

v7->v6:
1) fix type of local variable in parse_tun_type
2) use up to 4 letters in the comments
3) document new options

May be we should fix some final styling problems:

scripts/checkpatch.pl --strict file.patch

For patch 1/2: all

For patch 2/2: some of them:

- "spaces preferred around" ...
- "Please don't use multiple blank lines"

Also, in the new examples multiple -a lines do not give
much information, one -a would be enough. Or may be we can add variations with the 3 csum options. If you prefer you can also use 10.0.0.1 as VIP.

Quoted 27 lines

v6->v5:
1) split the patch into two:
- ipvsadm: convert options to unsigned long long
- ipvsadm: allow tunneling with gue encapsulation
2) do not mix static and dynamic allocation in fwd_tun_info
3) use correct nla_get/put function for tun_flags
4) fixed || style
5) use correct return value for parse_tun_type

v5->v4:
1) add checksum support for gue encapsulation

v4->v3:
1) removed changes to setsockopt interface
2) use correct nla_get/put function for tun_port

v3->v2:
1) added missing break statements to a few switch cases

v2->v1:
1) pass tun_type and tun_port as new optional parameters instead of a few bits in existing conn_flags parameters

Jacky Hu (2):
ipvsadm: convert options to unsigned long long
ipvsadm: allow tunneling with gue encapsulation

Quoted 8 lines
 ipvsadm.8         |  72 ++++++++
 ipvsadm.c         | 427 +++++++++++++++++++++++++++++++++++++++-------
 libipvs/ip_vs.h   |  28 +++
 libipvs/libipvs.c |  15 ++
 4 files changed, 476 insertions(+), 66 deletions(-)
Signature · 1 line
2.21.0

Regards

--
Julian Anastasov <[email protected]>