netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH iproute2] vxlan: Make id optional when modifying a link
@ 2017-11-28 11:16 robertshearman
  2017-11-28 17:49 ` Stephen Hemminger
  0 siblings, 1 reply; 2+ messages in thread
From: robertshearman @ 2017-11-28 11:16 UTC (permalink / raw)
  To: stephen, netdev; +Cc: Robert Shearman

From: Robert Shearman <rs823p@att.com>

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 | 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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH iproute2] vxlan: Make id optional when modifying a link
  2017-11-28 11:16 [PATCH iproute2] vxlan: Make id optional when modifying a link robertshearman
@ 2017-11-28 17:49 ` Stephen Hemminger
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Hemminger @ 2017-11-28 17:49 UTC (permalink / raw)
  To: robertshearman; +Cc: netdev, Robert Shearman

On Tue, 28 Nov 2017 11:16:50 +0000
robertshearman@gmail.com wrote:

> From: Robert Shearman <rs823p@att.com>
> 
> 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>

Applied

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-11-28 17:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-28 11:16 [PATCH iproute2] vxlan: Make id optional when modifying a link robertshearman
2017-11-28 17:49 ` Stephen Hemminger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).