mirror of
				https://git.proxmox.com/git/mirror_iproute2
				synced 2025-11-04 06:22:48 +00:00 
			
		
		
		
	vxlan: add support to set flow label
Follow-up for kernel commit e7f70af111f0 ("vxlan: support setting
IPv6 flow label") to allow setting the label for the device config.
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
			
			
This commit is contained in:
		
							parent
							
								
									a3c4b484a1
								
							
						
					
					
						commit
						f8eb79a624
					
				@ -92,3 +92,7 @@ void br_dump_bridge_id(const struct ifla_bridge_id *id, char *buf, size_t len);
 | 
			
		||||
#ifndef	INFINITY_LIFE_TIME
 | 
			
		||||
#define     INFINITY_LIFE_TIME      0xFFFFFFFFU
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef LABEL_MAX_MASK
 | 
			
		||||
#define     LABEL_MAX_MASK          0xFFFFFU
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
@ -24,7 +24,7 @@
 | 
			
		||||
static void print_explain(FILE *f)
 | 
			
		||||
{
 | 
			
		||||
	fprintf(f, "Usage: ... vxlan id VNI [ { group | remote } IP_ADDRESS ] [ local ADDR ]\n");
 | 
			
		||||
	fprintf(f, "                 [ ttl TTL ] [ tos TOS ] [ dev PHYS_DEV ]\n");
 | 
			
		||||
	fprintf(f, "                 [ ttl TTL ] [ tos TOS ] [ flowlabel LABEL ] [ dev PHYS_DEV ]\n");
 | 
			
		||||
	fprintf(f, "                 [ dstport PORT ] [ srcport MIN MAX ]\n");
 | 
			
		||||
	fprintf(f, "                 [ [no]learning ] [ [no]proxy ] [ [no]rsc ]\n");
 | 
			
		||||
	fprintf(f, "                 [ [no]l2miss ] [ [no]l3miss ]\n");
 | 
			
		||||
@ -33,10 +33,11 @@ static void print_explain(FILE *f)
 | 
			
		||||
	fprintf(f, "                 [ [no]remcsumtx ] [ [no]remcsumrx ]\n");
 | 
			
		||||
	fprintf(f, "                 [ [no]external ] [ gbp ]\n");
 | 
			
		||||
	fprintf(f, "\n");
 | 
			
		||||
	fprintf(f, "Where: VNI := 0-16777215\n");
 | 
			
		||||
	fprintf(f, "       ADDR := { IP_ADDRESS | any }\n");
 | 
			
		||||
	fprintf(f, "       TOS  := { NUMBER | inherit }\n");
 | 
			
		||||
	fprintf(f, "       TTL  := { 1..255 | inherit }\n");
 | 
			
		||||
	fprintf(f, "Where: VNI   := 0-16777215\n");
 | 
			
		||||
	fprintf(f, "       ADDR  := { IP_ADDRESS | any }\n");
 | 
			
		||||
	fprintf(f, "       TOS   := { NUMBER | inherit }\n");
 | 
			
		||||
	fprintf(f, "       TTL   := { 1..255 | inherit }\n");
 | 
			
		||||
	fprintf(f, "       LABEL := 0-1048575\n");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void explain(void)
 | 
			
		||||
@ -58,6 +59,7 @@ static int vxlan_parse_opt(struct link_util *lu, int argc, char **argv,
 | 
			
		||||
	unsigned int link = 0;
 | 
			
		||||
	__u8 tos = 0;
 | 
			
		||||
	__u8 ttl = 0;
 | 
			
		||||
	__u32 label = 0;
 | 
			
		||||
	__u8 learning = 1;
 | 
			
		||||
	__u8 proxy = 0;
 | 
			
		||||
	__u8 rsc = 0;
 | 
			
		||||
@ -146,6 +148,15 @@ static int vxlan_parse_opt(struct link_util *lu, int argc, char **argv,
 | 
			
		||||
				tos = uval;
 | 
			
		||||
			} else
 | 
			
		||||
				tos = 1;
 | 
			
		||||
		} else if (!matches(*argv, "label") ||
 | 
			
		||||
			   !matches(*argv, "flowlabel")) {
 | 
			
		||||
			__u32 uval;
 | 
			
		||||
 | 
			
		||||
			NEXT_ARG();
 | 
			
		||||
			if (get_u32(&uval, *argv, 0) ||
 | 
			
		||||
			    (uval & ~LABEL_MAX_MASK))
 | 
			
		||||
				invarg("invalid flowlabel", *argv);
 | 
			
		||||
			label = htonl(uval);
 | 
			
		||||
		} else if (!matches(*argv, "ageing")) {
 | 
			
		||||
			NEXT_ARG();
 | 
			
		||||
			if (strcmp(*argv, "none") == 0)
 | 
			
		||||
@ -280,6 +291,7 @@ static int vxlan_parse_opt(struct link_util *lu, int argc, char **argv,
 | 
			
		||||
 | 
			
		||||
	if (link)
 | 
			
		||||
		addattr32(n, 1024, IFLA_VXLAN_LINK, link);
 | 
			
		||||
	addattr32(n, 1024, IFLA_VXLAN_LABEL, label);
 | 
			
		||||
	addattr8(n, 1024, IFLA_VXLAN_TTL, ttl);
 | 
			
		||||
	addattr8(n, 1024, IFLA_VXLAN_TOS, tos);
 | 
			
		||||
	addattr8(n, 1024, IFLA_VXLAN_LEARNING, learning);
 | 
			
		||||
@ -425,6 +437,13 @@ static void vxlan_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
 | 
			
		||||
			fprintf(f, "ttl %d ", ttl);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (tb[IFLA_VXLAN_LABEL]) {
 | 
			
		||||
		__u32 label = rta_getattr_u32(tb[IFLA_VXLAN_LABEL]);
 | 
			
		||||
 | 
			
		||||
		if (label)
 | 
			
		||||
			fprintf(f, "flowlabel %#x ", ntohl(label));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (tb[IFLA_VXLAN_AGEING]) {
 | 
			
		||||
		__u32 age = rta_getattr_u32(tb[IFLA_VXLAN_AGEING]);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -396,6 +396,8 @@ the following additional arguments are supported:
 | 
			
		||||
] [
 | 
			
		||||
.BI tos " TOS "
 | 
			
		||||
] [
 | 
			
		||||
.BI flowlabel " FLOWLABEL "
 | 
			
		||||
] [
 | 
			
		||||
.BI dstport " PORT "
 | 
			
		||||
] [
 | 
			
		||||
.BI srcport " MIN MAX "
 | 
			
		||||
@ -459,6 +461,10 @@ parameter.
 | 
			
		||||
.BI tos " TOS"
 | 
			
		||||
- specifies the TOS value to use in outgoing packets.
 | 
			
		||||
 | 
			
		||||
.sp
 | 
			
		||||
.BI flowlabel " FLOWLABEL"
 | 
			
		||||
- specifies the flow label to use in outgoing packets.
 | 
			
		||||
 | 
			
		||||
.sp
 | 
			
		||||
.BI dstport " PORT"
 | 
			
		||||
- specifies the UDP destination port to communicate to the remote VXLAN tunnel endpoint.
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user