netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Laszlo Attila Toth <panther@balabit.hu>
To: netdev@vger.kernel.org, netfilter-devel@vger.kernel.org
Cc: Laszlo Attila Toth <panther@balabit.hu>
Subject: [PATCH 1/2] Interface group: core (netlink) part
Date: Tue, 16 Oct 2007 10:01:41 +0200	[thread overview]
Message-ID: <11925217031287-git-send-email-panther@balabit.hu> (raw)
Message-ID: <1824b3d462b1d85aaf33941cf082c4e018d5bff7.1192460167.git.panther@balabit.hu> (raw)
In-Reply-To: <1192521703479-git-send-email-panther@balabit.hu>
In-Reply-To: <ifgroup.20071015.1192520046.panther@balabit.hu>

 Interface groups let handle different interfaces with one (netfilter) rule.
 Modified net device structure and netlink interface.

Signed-off-by: Laszlo Attila Toth <panther@balabit.hu>
---
 include/linux/if_link.h   |    2 ++
 include/linux/netdevice.h |    2 ++
 net/core/rtnetlink.c      |    8 ++++++++
 3 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/include/linux/if_link.h b/include/linux/if_link.h
index 422084d..d9f1726 100644
--- a/include/linux/if_link.h
+++ b/include/linux/if_link.h
@@ -78,6 +78,8 @@ enum
 	IFLA_LINKMODE,
 	IFLA_LINKINFO,
 #define IFLA_LINKINFO IFLA_LINKINFO
+	IFLA_IFGROUP,
+#define IFLA_IFGROUP IFLA_IFGROUP
 	__IFLA_MAX
 };
 
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index e679b27..4cfc697 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -365,6 +365,8 @@ struct net_device
 	/* Interface index. Unique device identifier	*/
 	int			ifindex;
 	int			iflink;
+	/* interface group this interface belongs to */
+	int			ifgroup;
 
 
 	struct net_device_stats* (*get_stats)(struct net_device *dev);
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 4756d58..18ff3c5 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -646,6 +646,9 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb, struct net_device *dev,
 	if (dev->master)
 		NLA_PUT_U32(skb, IFLA_MASTER, dev->master->ifindex);
 
+	if (dev->ifgroup)
+		NLA_PUT_U32(skb, IFLA_IFGROUP, dev->ifgroup);
+
 	if (dev->qdisc_sleeping)
 		NLA_PUT_STRING(skb, IFLA_QDISC, dev->qdisc_sleeping->ops->id);
 
@@ -846,6 +849,11 @@ static int do_setlink(struct net_device *dev, struct ifinfomsg *ifm,
 		write_unlock_bh(&dev_base_lock);
 	}
 
+	if (tb[IFLA_IFGROUP]) {
+		dev->ifgroup = nla_get_u32(tb[IFLA_IFGROUP ]);
+		rtmsg_ifinfo(RTM_NEWLINK, dev, 0);
+	}
+
 	err = 0;
 
 errout:
-- 
1.5.2.5


  parent reply	other threads:[~2007-10-16  8:01 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <ifgroup.20071015.1192520046.panther@balabit.hu>
2007-10-16  8:01 ` [PATCH 0/2] Interface groups Laszlo Attila Toth
2007-10-16  8:50   ` Philip Craig
2007-10-16  9:47     ` Laszlo Attila Toth
2007-10-16  8:01 ` Laszlo Attila Toth
     [not found] ` <1824b3d462b1d85aaf33941cf082c4e018d5bff7.1192460167.git.panther@balabit.hu>
2007-10-16  8:01   ` [PATCH 1/2] Interface group: core (netlink) part Laszlo Attila Toth
2007-10-16  8:01   ` Laszlo Attila Toth [this message]
2007-10-16  8:34     ` Patrick McHardy
     [not found]   ` <661f8f2fdb86cc70bdefd12403ecb0eaa7cfadd6.1192460168.git.panther@balabit.hu>
2007-10-16  8:01     ` [PATCH 2/2] Interface group match - netfilter part Laszlo Attila Toth
2007-10-16  8:01     ` Laszlo Attila Toth
2007-10-16  8:30       ` Patrick McHardy
2007-10-16  9:46         ` Laszlo Attila Toth
2007-10-16 14:46         ` Jan Engelhardt
2007-10-17  9:08         ` Laszlo Attila Toth
2007-10-17  9:11           ` Patrick McHardy
     [not found] ` <a6713ba13c49b7fa20073d8abf1862480c2799e0.1192457385.git.panther@balabit.hu>
2007-10-16  8:01   ` [IPROUTE2 PATCH] Interface group as new ip link option Laszlo Attila Toth
2007-10-16  8:38     ` Patrick McHardy
2007-10-16  9:33       ` Laszlo Attila Toth
2007-10-16  8:01   ` Laszlo Attila Toth
2007-10-16  9:03   ` Resend: " Laszlo Attila Toth
2007-10-16  9:03   ` Laszlo Attila Toth
2007-10-16  9:11     ` Patrick McHardy
2007-10-16 10:45   ` jamal
2007-10-16 11:05     ` Laszlo Attila Toth
2007-10-16 11:26       ` jamal
2007-10-16 11:47         ` Laszlo Attila Toth
2007-10-16 12:08           ` jamal
2007-10-18 10:13 [PATCH 0/2] Interface groups, round two Laszlo Attila Toth
     [not found] ` <ifgroup-20071018-120757-1192702077-panther@balabit.hu>
     [not found]   ` <4e88bea1c0065fada9181e9b668a91c6c3fd8796.1192695706.git.panther@balabit.hu>
2007-10-18 10:13     ` [PATCH 1/2] Interface group: core (netlink) part Laszlo Attila Toth
2007-10-18 10:15     ` Laszlo Attila Toth
2007-10-18 10:15     ` Laszlo Attila Toth
2007-10-18 10:22       ` Patrick McHardy
2007-10-19  8:57         ` Laszlo Attila Toth
  -- strict thread matches above, loose matches on Subject: below --
2007-10-18 10:15 [PATCH 0/2] Interface groups, round two Laszlo Attila Toth

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=11925217031287-git-send-email-panther@balabit.hu \
    --to=panther@balabit.hu \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).