]> git.proxmox.com Git - mirror_iproute2.git/commitdiff
vxlan: Make id optional when modifying a link
authorRobert Shearman <rs823p@att.com>
Tue, 28 Nov 2017 11:16:50 +0000 (11:16 +0000)
committerStephen Hemminger <stephen@networkplumber.org>
Tue, 28 Nov 2017 17:48:26 +0000 (09:48 -0800)
Specifying the IFLA_VXLAN_LINK attribute on a vxlan link modify is
optional in the kernel, so make the id argument optional for "ip link
set ..." to avoid a user needing to specify it when changing another
attribute.

Signed-off-by: Robert Shearman <rs823p@att.com>
ip/iplink_vxlan.c

index a0530dda9d1bb81b927cf458a52af9fe76a818f1..661eaa796acc45dcf1942fc150dacbbeb3b8201f 100644 (file)
@@ -345,7 +345,7 @@ static int vxlan_parse_opt(struct link_util *lu, int argc, char **argv,
                return -1;
        }
 
-       if (!metadata && !VXLAN_ATTRSET(attrs, IFLA_VXLAN_ID)) {
+       if (!metadata && !VXLAN_ATTRSET(attrs, IFLA_VXLAN_ID) && !set_op) {
                fprintf(stderr, "vxlan: missing virtual network identifier\n");
                return -1;
        }
@@ -367,7 +367,8 @@ static int vxlan_parse_opt(struct link_util *lu, int argc, char **argv,
                        "Use 'dstport 0' to get default and quiet this message\n");
        }
 
-       addattr32(n, 1024, IFLA_VXLAN_ID, vni);
+       if (VXLAN_ATTRSET(attrs, IFLA_VXLAN_ID))
+               addattr32(n, 1024, IFLA_VXLAN_ID, vni);
        if (gaddr)
                addattr_l(n, 1024, IFLA_VXLAN_GROUP, &gaddr, 4);
        else if (daddr)