netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Laszlo Attila Toth <panther@balabit.hu>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCHv8 1/2] Interface group: core and netlink part
Date: Fri, 07 Mar 2008 13:40:11 +0100	[thread overview]
Message-ID: <47D137AB.9040305@balabit.hu> (raw)
In-Reply-To: <20080306.111519.46454329.davem@davemloft.net>

David Miller írta:
> From: Laszlo Attila Toth <panther@balabit.hu>
> Date: Thu,  6 Mar 2008 15:03:58 +0100
> 
>> Interface groups let handle different interfaces together.
>> Modified net device structure and netlink interface.
>>
>> Signed-off-by: Laszlo Attila Toth <panther@balabit.hu>
> 
> I can't say whether this makes sense without seeing how
> it will actually be used.

The userspace has two parts, one is in iproute2:

  ip link set dev eth0 group 4

  ip link show dev eth0
3: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast 
group 0x04 qlen 1000
     link/ether 00:0c:29:97:52:99 brd ff:ff:ff:ff:ff:ff

This is still nothing special.

Where can it be used? The netfilter part is an ifgroup match:

  ifgroup -A INPUT -m ifgroup --ifgroup-in 4/0xf ...
  ifgroup -A OUTPUT -m ifgroup --ifgroup-out 4/0xf ...

Also multiple devices can be grouped and handled with one rule. Although 
  the interfaces can be named as the user wants, it is not always enough 
(I mean for instance:  iptables ... -i ppp+ ...).


Consider the following example (a bit complex, I think): a VPN server 
has many clients but not all services and networks has to be accessible 
for each clients, also an ACL is needed (Or the same situation on a 
router with several interfaces) The ifgroup value has 32 bits also 32 
different rule can be set up. The only necessary thing for the 
corresponding "if-up" scripts to calculate the value corresponding to 
the acl list and set this as an ifgroup value for the device. Next in 
the netfilter rules  access to unneeded services can be rejected with a 
single rule:

   iptables -A PREROUTING -m ifgroup --ifgroup-in 0/0x4 ... -j REJECT ...

Also the ifgroup match helps iptables rules to be simplier. Whithout it 
a new chain is necessary and on every interface change a new rule has to 
be added/removed. If two iptables commands are running, AFAIK a 
concurrency problem can be occured because two iptables command 
downloads the ruleset, change it and uploaded. But only one of them is 
taken into account.


Another possible use case is - I have no patch yet:
currently the ip command can access information of exactly one device or 
all of them, but only a few of them cannot be used. With ifgroup this 
problem can be solved, also instead of:

  ip link show dev eth0

use

   ip link show group 3

and so on.


> If that's all it is, userland can record such mappings
> in the filesystem or elsewhere such that multiple
> applications can work with and maintain the relationships.
> There is zero reason to add this bloat to the kernel in
> such a case.

Yeah, without the netfilter rules this would be unnecessary in the 
kernel but it depends on it.

--
Attila



  reply	other threads:[~2008-03-07 12:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-06 14:02 [PATCHv8 0/2] Interface group patches, take 8 Laszlo Attila Toth
2008-03-06 14:03 ` [PATCHv8 1/2] Interface group: core and netlink part Laszlo Attila Toth
2008-03-06 19:15   ` David Miller
2008-03-07 12:40     ` Laszlo Attila Toth [this message]
2008-04-03 20:35       ` David Miller
2008-03-06 14:03 ` [PATCHv8 2/2] Ifgroup read/write support in sysfs 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=47D137AB.9040305@balabit.hu \
    --to=panther@balabit.hu \
    --cc=davem@davemloft.net \
    --cc=netdev@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).