netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/2] Handle netdev group for veth peer too
       [not found] <cover.1386764590.git.popovich_sergei@mail.ru>
@ 2013-12-11 12:25 ` Sergey Popovich
  2013-12-11 12:25 ` [PATCH 1/2] Initialize arguments to iplink_parse() by default Sergey Popovich
  1 sibling, 0 replies; 3+ messages in thread
From: Sergey Popovich @ 2013-12-11 12:25 UTC (permalink / raw)
  To: netdev

Currently ip-link(8) parses, but ignores "group" argument to
peer interface on veth creation.

Insert IFLA_GROUP attribute for peer interface when present.

Signed-off-by: Sergey Popovich <popovich_sergei@mail.ru>
---
 ip/link_veth.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/ip/link_veth.c b/ip/link_veth.c
index 7730f39..98ff6a5 100644
--- a/ip/link_veth.c
+++ b/ip/link_veth.c
@@ -53,6 +53,9 @@ static int veth_parse_opt(struct link_util *lu, int argc, char **argv,
 		addattr_l(hdr, 1024, IFLA_IFNAME, name, len);
 	}
 
+	if (group != -1)
+		addattr32(hdr, 1024, IFLA_GROUP, group);
+
 	data->rta_len = (void *)NLMSG_TAIL(hdr) - (void *)data;
 	return argc - 1 - err;
 }
-- 
1.7.10.4

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

* [PATCH 1/2] Initialize arguments to iplink_parse() by default
       [not found] <cover.1386764590.git.popovich_sergei@mail.ru>
  2013-12-11 12:25 ` [PATCH 2/2] Handle netdev group for veth peer too Sergey Popovich
@ 2013-12-11 12:25 ` Sergey Popovich
  2013-12-20 16:27   ` Stephen Hemminger
  1 sibling, 1 reply; 3+ messages in thread
From: Sergey Popovich @ 2013-12-11 12:25 UTC (permalink / raw)
  To: netdev

Be consistent when dealing with arguments passed
to iplink_parse() by initializing to default values.

This fixes crash when ip-link(8) invoced with command:

  ip link add dev veth1a type veth peer

Signed-off-by: Sergey Popovich <popovich_sergei@mail.ru>
---
 ip/iplink.c |    9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/ip/iplink.c b/ip/iplink.c
index 58b6c20..9735c54 100644
--- a/ip/iplink.c
+++ b/ip/iplink.c
@@ -299,6 +299,7 @@ int iplink_parse(int argc, char **argv, struct iplink_req *req,
 	int numtxqueues = -1;
 	int numrxqueues = -1;
 
+	*name = *type = *link = *dev = NULL;
 	*group = -1;
 	ret = argc;
 
@@ -498,15 +499,11 @@ int iplink_parse(int argc, char **argv, struct iplink_req *req,
 
 static int iplink_modify(int cmd, unsigned int flags, int argc, char **argv)
 {
-	int len;
-	char *dev = NULL;
-	char *name = NULL;
-	char *link = NULL;
-	char *type = NULL;
+	char *name, *type, *link, *dev;
 	int group;
 	struct link_util *lu = NULL;
 	struct iplink_req req;
-	int ret;
+	int len, ret;
 
 	memset(&req, 0, sizeof(req));
 
-- 
1.7.10.4

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

* Re: [PATCH 1/2] Initialize arguments to iplink_parse() by default
  2013-12-11 12:25 ` [PATCH 1/2] Initialize arguments to iplink_parse() by default Sergey Popovich
@ 2013-12-20 16:27   ` Stephen Hemminger
  0 siblings, 0 replies; 3+ messages in thread
From: Stephen Hemminger @ 2013-12-20 16:27 UTC (permalink / raw)
  To: Sergey Popovich; +Cc: netdev

> Be consistent when dealing with arguments passed
> to iplink_parse() by initializing to default values.
> 
> This fixes crash when ip-link(8) invoced with command:
> 
>   ip link add dev veth1a type veth peer
> 
> Signed-off-by: Sergey Popovich <popovich_sergei@mail.ru>

Rather than modifying iplink_parse, I just fixed in veth code where the bug
was being caused.

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

end of thread, other threads:[~2013-12-20 16:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <cover.1386764590.git.popovich_sergei@mail.ru>
2013-12-11 12:25 ` [PATCH 2/2] Handle netdev group for veth peer too Sergey Popovich
2013-12-11 12:25 ` [PATCH 1/2] Initialize arguments to iplink_parse() by default Sergey Popovich
2013-12-20 16:27   ` 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).