From patchwork Mon Jan 10 11:39:17 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vlad Dogaru X-Patchwork-Id: 78124 X-Patchwork-Delegate: shemminger@vyatta.com Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 7A621B70B3 for ; Mon, 10 Jan 2011 22:39:31 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753783Ab1AJLjZ (ORCPT ); Mon, 10 Jan 2011 06:39:25 -0500 Received: from [141.85.37.41] ([141.85.37.41]:33766 "EHLO swarm.cs.pub.ro" rhost-flags-FAIL-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1753747Ab1AJLjX (ORCPT ); Mon, 10 Jan 2011 06:39:23 -0500 Received: from localhost (unknown [10.38.144.207]) by swarm.cs.pub.ro (Postfix) with ESMTPSA id EC9CE10EA128; Mon, 10 Jan 2011 13:39:22 +0200 (EET) From: Vlad Dogaru To: netdev@vger.kernel.org Cc: Vlad Dogaru , jamal , Octavian Purdila Subject: [PATCH 1/3] ip link: add support for setting device groups Date: Mon, 10 Jan 2011 13:39:17 +0200 Message-Id: <1294659559-22648-2-git-send-email-ddvlad@rosedu.org> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1294659559-22648-1-git-send-email-ddvlad@rosedu.org> References: <1294659559-22648-1-git-send-email-ddvlad@rosedu.org> To: netdev@vger.kernel.org Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.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 --- 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)