Netdev List
 help / color / mirror / Atom feed
From: Vlad Dogaru <ddvlad@rosedu.org>
To: netdev@vger.kernel.org
To: netdev@vger.kernel.org
Cc: Vlad Dogaru <ddvlad@rosedu.org>, jamal <hadi@cyberus.ca>,
	Octavian Purdila <opurdila@ixiacom.com>
Subject: [PATCH v2 iproute2 1/3] ip link: add support for setting device groups
Date: Tue, 11 Jan 2011 18:35:47 +0200	[thread overview]
Message-ID: <1294763749-9997-2-git-send-email-ddvlad@rosedu.org> (raw)
In-Reply-To: <1294763749-9997-1-git-send-email-ddvlad@rosedu.org>

Use the group keyword to specify what group the device should belong to:

  ip link set dev eth0 group 1

Signed-off-by: Vlad Dogaru <ddvlad@rosedu.org>
---
 include/linux/if_link.h |    2 ++
 ip/iplink.c             |    8 ++++++++
 2 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/include/linux/if_link.h b/include/linux/if_link.h
index f5bb2dc..1d789dd 100644
--- a/include/linux/if_link.h
+++ b/include/linux/if_link.h
@@ -116,6 +116,8 @@ enum {
 	IFLA_STATS64,
 	IFLA_VF_PORTS,
 	IFLA_PORT_SELF,
+	IFLA_AF_SPEC,
+	IFLA_GROUP,
 	__IFLA_MAX
 };
 
diff --git a/ip/iplink.c b/ip/iplink.c
index cb2c4f5..a7bad2c 100644
--- a/ip/iplink.c
+++ b/ip/iplink.c
@@ -252,6 +252,7 @@ int iplink_parse(int argc, char **argv, struct iplink_req *req,
 	int mtu = -1;
 	int netns = -1;
 	int vf = -1;
+	int group = -1;
 
 	ret = argc;
 
@@ -297,6 +298,13 @@ int iplink_parse(int argc, char **argv, struct iplink_req *req,
 			if (get_integer(&mtu, *argv, 0))
 				invarg("Invalid \"mtu\" value\n", *argv);
 			addattr_l(&req->n, sizeof(*req), IFLA_MTU, &mtu, 4);
+		} else if (strcmp(*argv, "group") == 0) {
+			NEXT_ARG();
+			if (mtu != -1)
+				duparg("group", *argv);
+			if (get_integer(&group, *argv, 0))
+				invarg("Invalid \"group\" value\n", *argv);
+			addattr_l(&req->n, sizeof(*req), IFLA_GROUP, &group, 4);
                 } else if (strcmp(*argv, "netns") == 0) {
                         NEXT_ARG();
                         if (netns != -1)
-- 
1.7.1


  reply	other threads:[~2011-01-11 16:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-11 16:35 [PATCH v2 iproute2 0/3] ip link: add support for network device groups Vlad Dogaru
2011-01-11 16:35 ` Vlad Dogaru [this message]
2011-01-11 16:35 ` [PATCH v2 iproute2 2/3] ip link: support listing devices by group Vlad Dogaru
2011-01-11 16:35 ` [PATCH v2 iproute2 3/3] ip link: support setting device parameters " Vlad Dogaru

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1294763749-9997-2-git-send-email-ddvlad@rosedu.org \
    --to=ddvlad@rosedu.org \
    --cc=hadi@cyberus.ca \
    --cc=netdev@vger.kernel.org \
    --cc=opurdila@ixiacom.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox