Subject: Re: [PATCH iproute2 1/3] vxlan: add support for collect metadata flag

From: Jiri Benc <[email-masked]>
Date: Wed, 16 Dec 2015 11:56:26 +0100

On Wed, 16 Dec 2015 11:50:53 +0100, Jiri Benc wrote:
> Also, as a related remark, please note that IFLA_VXLAN_COLLECT_METADATA
> is mutually exclusive with many other flags. It's currently not
> enforced correctly at the kernel level (instead, you get weird
> behavior). I'll fix this on the kernel side but we may want to enforce
> this on the iproute2 side, too, to get a better error message. This is
> not to be addressed by this patch, though.

Actually, there's one thing this patch must do. Currently, vxlan
enforces vni to be specified. This is not required for metadata based
tunneling. It's actually not permitted.

You'll need to add a hunk similar to this:

--- a/ip/iplink_vxlan.c
+++ b/ip/iplink_vxlan.c
@@ -215,7 +215,12 @@ static int vxlan_parse_opt(struct link_util *lu, int argc, char **argv,
 		argc--, argv++;
 	}
 
-	if (!vni_set) {
+	if (metadata && vni_set) {
+		fprintf(stderr, "vxlan: both metadata and vni cannot be specified\n");
+		return -1;
+	}
+
+	if (!metadata && !vni_set) {
 		fprintf(stderr, "vxlan: missing virtual network identifier\n");
 		return -1;
 	}

-- 
Jiri Benc