From mboxrd@z Thu Jan 1 00:00:00 1970 From: robertshearman@gmail.com Subject: [PATCH iproute2] vxlan: Make id optional when modifying a link Date: Tue, 28 Nov 2017 11:16:50 +0000 Message-ID: <1511867810-11655-1-git-send-email-robertshearman@gmail.com> Cc: Robert Shearman To: stephen@networkplumber.org, netdev@vger.kernel.org Return-path: Received: from mail-yw0-f193.google.com ([209.85.161.193]:42008 "EHLO mail-yw0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753189AbdK1LRE (ORCPT ); Tue, 28 Nov 2017 06:17:04 -0500 Received: by mail-yw0-f193.google.com with SMTP id j198so13086885ywg.9 for ; Tue, 28 Nov 2017 03:17:04 -0800 (PST) Sender: netdev-owner@vger.kernel.org List-ID: From: Robert Shearman 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 --- ip/iplink_vxlan.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ip/iplink_vxlan.c b/ip/iplink_vxlan.c index a0530dda9d1b..661eaa796acc 100644 --- a/ip/iplink_vxlan.c +++ b/ip/iplink_vxlan.c @@ -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) -- 2.1.4