netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCHv6 0/3] Interface group patches
@ 2007-11-20 13:14 Laszlo Attila Toth
  2007-11-20 13:26 ` Jan Engelhardt
  0 siblings, 1 reply; 13+ messages in thread
From: Laszlo Attila Toth @ 2007-11-20 13:14 UTC (permalink / raw)
  To: David Miller, Patrick McHardy; +Cc: netdev, netfilter-devel, Laszlo Attila Toth

Hi Dave,

This is the 6th version of our interface group patches.

The interface group value can be used to manage different interfaces
at the same time such as in netfilter/iptables. The netfilter patch
is ready but future plan is the same for ip/tc commands (except
the ifgroup value change which happens via "ip link set" command).

The first patch is a fix in the rtnl socket interface.

An u_int32_t member was added to net devices indicating the interface
group number of the device which can be get/set via netlink.

The xt_ifgroup netfilter match is for checking this value with an
optional mask.

Other patches are for userpace programs:
 * iptables
 
 * iproute2. Because kernel 2.6.24-rc1 introduced a new enum value,
   IFLA_NET_NS_PID, and it wasn't in the iproute2 code, the first
   patch simply adds this value. The second patch adds support of
   interface group.

Usage:
 ip link set eth0 group 4    # set
 ip link set eth0 group 0    # unset
 iptables -A INPUT -m ifgroup --ifgroup-in 4/0xf -j ACCEPT
 iptables -A FORWARD -m ifgroup --ifgroup-in 4  ! --ifgroup-out 5 -j DROP

Patches:
 [1/3] rtnetlink: setlink changes are unprotected; with single notification
 [2/3] Interface group: core (netlink) part
 [3/3] Netfilter Interface group match
 [iptables]Interface group match
 [iproute 1/2] Added IFLA_NET_NS_PID as in kernel v2.6.24-rc1
 [iproute 2/2] Interface group as new ip link optio
--
Laszlo Attila Toth

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

* Re: [PATCHv6 0/3] Interface group patches
  2007-11-20 13:14 Laszlo Attila Toth
@ 2007-11-20 13:26 ` Jan Engelhardt
  2007-11-20 13:52   ` Laszlo Attila Toth
  0 siblings, 1 reply; 13+ messages in thread
From: Jan Engelhardt @ 2007-11-20 13:26 UTC (permalink / raw)
  To: Laszlo Attila Toth; +Cc: David Miller, Patrick McHardy, netdev, netfilter-devel


On Nov 20 2007 14:14, Laszlo Attila Toth wrote:
>
>This is the 6th version of our interface group patches.
>
>The interface group value can be used to manage different interfaces
>at the same time such as in netfilter/iptables.

I take it you could not use...?
	iptables -i iif1 -j dosomething
	iptables -i iif2 -j dosomething

>The netfilter patch
>is ready but future plan is the same for ip/tc commands (except
>the ifgroup value change which happens via "ip link set" command).

How can it be useful in conjunction with tc?


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

* Re: [PATCHv6 0/3] Interface group patches
  2007-11-20 13:26 ` Jan Engelhardt
@ 2007-11-20 13:52   ` Laszlo Attila Toth
  2007-11-20 21:42     ` David Miller
  0 siblings, 1 reply; 13+ messages in thread
From: Laszlo Attila Toth @ 2007-11-20 13:52 UTC (permalink / raw)
  To: Jan Engelhardt; +Cc: David Miller, Patrick McHardy, netdev, netfilter-devel

Jan Engelhardt írta:
> On Nov 20 2007 14:14, Laszlo Attila Toth wrote:
>> This is the 6th version of our interface group patches.
>>
>> The interface group value can be used to manage different interfaces
>> at the same time such as in netfilter/iptables.
> 
> I take it you could not use...?
> 	iptables -i iif1 -j dosomething
> 	iptables -i iif2 -j dosomething

This kind of usage requires static interface names. But there are 
dynamic interfaces such as ppp, where the actual name is not always 
known or sometimes they exist sometimes not. It is difficult to use 
iptables this way, and every ifup/ifdown requires change in the iptables 
ruleset (donwload it, modify and upload to the kernel). It may be too slow.

> 
>> The netfilter patch
>> is ready but future plan is the same for ip/tc commands (except
>> the ifgroup value change which happens via "ip link set" command).
> 
> How can it be useful in conjunction with tc?

jamal wrote it previously:
http://marc.info/?l=linux-netdev&m=119253403415810&w=2

-- 
Attila
-
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCHv6 0/3] Interface group patches
  2007-11-20 13:52   ` Laszlo Attila Toth
@ 2007-11-20 21:42     ` David Miller
  2007-11-21  0:25       ` Patrick McHardy
  0 siblings, 1 reply; 13+ messages in thread
From: David Miller @ 2007-11-20 21:42 UTC (permalink / raw)
  To: panther; +Cc: jengelh, kaber, netdev, netfilter-devel

From: Laszlo Attila Toth <panther@balabit.hu>
Date: Tue, 20 Nov 2007 14:52:12 +0100

> Jan Engelhardt írta:
> > On Nov 20 2007 14:14, Laszlo Attila Toth wrote:
> >> This is the 6th version of our interface group patches.
> >>
> >> The interface group value can be used to manage different interfaces
> >> at the same time such as in netfilter/iptables.
> > 
> > I take it you could not use...?
> > 	iptables -i iif1 -j dosomething
> > 	iptables -i iif2 -j dosomething
> 
> This kind of usage requires static interface names. But there are 
> dynamic interfaces such as ppp, where the actual name is not always 
> known or sometimes they exist sometimes not. It is difficult to use 
> iptables this way, and every ifup/ifdown requires change in the iptables 
> ruleset (donwload it, modify and upload to the kernel). It may be too slow.

This is actually not true these days.

When network devices are created user events are generated and the
user can rename the device however they like using a mapping table of
any kind.

And at such point the problem you present doesn't actually exist, you
can know what the device will be named.

And if rule loading dynamically is slow, we should fix that instead of
creating infrastructure and interfaces we don't actually need.
-
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCHv6 0/3] Interface group patches
  2007-11-20 21:42     ` David Miller
@ 2007-11-21  0:25       ` Patrick McHardy
  2007-11-21  1:17         ` David Miller
  2007-11-21 15:56         ` Balazs Scheidler
  0 siblings, 2 replies; 13+ messages in thread
From: Patrick McHardy @ 2007-11-21  0:25 UTC (permalink / raw)
  To: David Miller; +Cc: panther, jengelh, netdev, netfilter-devel

David Miller wrote:
> From: Laszlo Attila Toth <panther@balabit.hu>
> Date: Tue, 20 Nov 2007 14:52:12 +0100
> 
>> Jan Engelhardt írta:
>>> On Nov 20 2007 14:14, Laszlo Attila Toth wrote:
>>>> This is the 6th version of our interface group patches.
>>>>
>>>> The interface group value can be used to manage different interfaces
>>>> at the same time such as in netfilter/iptables.
>>> I take it you could not use...?
>>> 	iptables -i iif1 -j dosomething
>>> 	iptables -i iif2 -j dosomething
>> This kind of usage requires static interface names. But there are 
>> dynamic interfaces such as ppp, where the actual name is not always 
>> known or sometimes they exist sometimes not. It is difficult to use 
>> iptables this way, and every ifup/ifdown requires change in the iptables 
>> ruleset (donwload it, modify and upload to the kernel). It may be too slow.
> 
> This is actually not true these days.
> 
> When network devices are created user events are generated and the
> user can rename the device however they like using a mapping table of
> any kind.
> 
> And at such point the problem you present doesn't actually exist, you
> can know what the device will be named.
> 
> And if rule loading dynamically is slow, we should fix that instead of
> creating infrastructure and interfaces we don't actually need.


I actually like this feature. Matching on names in iptables
has always been one of the major bottlenecks, taking
(according to my last measurement, which is some time ago)
about 1-2% of the total performance. This is of course in
large parts because the interface match is present on *every*
rule, but still some way to logically group interfaces seems
useful to me, not only for iptables, but also for routing rules,
traffic classifiers, af_packet sockets etc.

I'm working on the incremental ruleset changing API BTW :)
One of the changes will be that interface matching is not
a default part of every rule, and without wildcards it will
use the ifindex. But since the cost of this feature seems
pretty low, I don't see a compelling reason against it.


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

* Re: [PATCHv6 0/3] Interface group patches
  2007-11-21  0:25       ` Patrick McHardy
@ 2007-11-21  1:17         ` David Miller
  2007-11-22  9:05           ` Laszlo Attila Toth
  2007-11-21 15:56         ` Balazs Scheidler
  1 sibling, 1 reply; 13+ messages in thread
From: David Miller @ 2007-11-21  1:17 UTC (permalink / raw)
  To: kaber; +Cc: panther, jengelh, netdev, netfilter-devel

From: Patrick McHardy <kaber@trash.net>
Date: Wed, 21 Nov 2007 01:25:54 +0100

> I'm working on the incremental ruleset changing API BTW :)
> One of the changes will be that interface matching is not
> a default part of every rule, and without wildcards it will
> use the ifindex. But since the cost of this feature seems
> pretty low, I don't see a compelling reason against it.

Fair enough :)

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

* Re: [PATCHv6 0/3] Interface group patches
  2007-11-21  0:25       ` Patrick McHardy
  2007-11-21  1:17         ` David Miller
@ 2007-11-21 15:56         ` Balazs Scheidler
  1 sibling, 0 replies; 13+ messages in thread
From: Balazs Scheidler @ 2007-11-21 15:56 UTC (permalink / raw)
  To: Patrick McHardy; +Cc: David Miller, panther, jengelh, netdev, netfilter-devel


On Wed, 2007-11-21 at 01:25 +0100, Patrick McHardy wrote:
> David Miller wrote:
> > From: Laszlo Attila Toth <panther@balabit.hu>
> > Date: Tue, 20 Nov 2007 14:52:12 +0100
> > 
> >> Jan Engelhardt írta:
> >>> On Nov 20 2007 14:14, Laszlo Attila Toth wrote:
> >>>> This is the 6th version of our interface group patches.
> >>>>
> >>>> The interface group value can be used to manage different interfaces
> >>>> at the same time such as in netfilter/iptables.
> >>> I take it you could not use...?
> >>> 	iptables -i iif1 -j dosomething
> >>> 	iptables -i iif2 -j dosomething
> >> This kind of usage requires static interface names. But there are 
> >> dynamic interfaces such as ppp, where the actual name is not always 
> >> known or sometimes they exist sometimes not. It is difficult to use 
> >> iptables this way, and every ifup/ifdown requires change in the iptables 
> >> ruleset (donwload it, modify and upload to the kernel). It may be too slow.
> > 
> > This is actually not true these days.
> > 
> > When network devices are created user events are generated and the
> > user can rename the device however they like using a mapping table of
> > any kind.
> > 
> > And at such point the problem you present doesn't actually exist, you
> > can know what the device will be named.
> > 
> > And if rule loading dynamically is slow, we should fix that instead of
> > creating infrastructure and interfaces we don't actually need.
> 
> 
> I actually like this feature. Matching on names in iptables
> has always been one of the major bottlenecks, taking
> (according to my last measurement, which is some time ago)
> about 1-2% of the total performance. This is of course in
> large parts because the interface match is present on *every*
> rule, but still some way to logically group interfaces seems
> useful to me, not only for iptables, but also for routing rules,
> traffic classifiers, af_packet sockets etc.
> 
> I'm working on the incremental ruleset changing API BTW :)
> One of the changes will be that interface matching is not
> a default part of every rule, and without wildcards it will
> use the ifindex. But since the cost of this feature seems
> pretty low, I don't see a compelling reason against it.

We are also using interface groups from userspace applications (hence
the netlink notification). 

ppp comes up, an interface is created according to the pppd
configuration, which then assigns the interface to the given group.
another application (a proxy based firewall in our example) listens to
this notification and binds to the new interface as well.

-- 
Bazsi

-
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCHv6 0/3] Interface group patches
  2007-11-21  1:17         ` David Miller
@ 2007-11-22  9:05           ` Laszlo Attila Toth
  0 siblings, 0 replies; 13+ messages in thread
From: Laszlo Attila Toth @ 2007-11-22  9:05 UTC (permalink / raw)
  To: David Miller; +Cc: kaber, jengelh, netdev, netfilter-devel

David Miller írta:
> From: Patrick McHardy <kaber@trash.net>
> Date: Wed, 21 Nov 2007 01:25:54 +0100
> 
>> I'm working on the incremental ruleset changing API BTW :)
>> One of the changes will be that interface matching is not
>> a default part of every rule, and without wildcards it will
>> use the ifindex. But since the cost of this feature seems
>> pretty low, I don't see a compelling reason against it.
> 
> Fair enough :)
> 

If this means the patch is ok, please apply it. Thanks.

--
Attila
-
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCHv6 0/3] Interface group patches
@ 2007-11-22 14:37 Wolfgang Walter
  2007-11-23  0:10 ` Patrick McHardy
  0 siblings, 1 reply; 13+ messages in thread
From: Wolfgang Walter @ 2007-11-22 14:37 UTC (permalink / raw)
  To: netfilter-devel; +Cc: linux-netdev, Patrick McHardy

From: Patrick McHardy
> I'm working on the incremental ruleset changing API BTW :)
> One of the changes will be that interface matching is not
> a default part of every rule, and without wildcards it will
> use the ifindex. But since the cost of this feature seems
> pretty low, I don't see a compelling reason against it.

Using ifindex instead of string matching the interface name in -i and -o would 
be a serious problem as it changes the semantics.

1) Now you can match a non existing interface. This is certainly used. I.e. 
with vlan interfaces, ppp etc.
2) Now your rule will match an interface even if the ifindex of the interface 
changes. This is used (i.e. you activate a backup interface and rename it, 
build new bridges etc.).

If one wants to use the ifindex instead of a string match on the name one 
should explicitly request that (i.e. by using "-i =eth0" or something like 
that).

Regards,
-- 
Wolfgang Walter
Studentenwerk München
Anstalt des öffentlichen Rechts
-
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCHv6 0/3] Interface group patches
  2007-11-22 14:37 [PATCHv6 0/3] Interface group patches Wolfgang Walter
@ 2007-11-23  0:10 ` Patrick McHardy
  2007-11-23  0:21   ` Krzysztof Oledzki
  0 siblings, 1 reply; 13+ messages in thread
From: Patrick McHardy @ 2007-11-23  0:10 UTC (permalink / raw)
  To: Wolfgang Walter; +Cc: netfilter-devel, linux-netdev

Wolfgang Walter wrote:
> From: Patrick McHardy
>> I'm working on the incremental ruleset changing API BTW :)
>> One of the changes will be that interface matching is not
>> a default part of every rule, and without wildcards it will
>> use the ifindex. But since the cost of this feature seems
>> pretty low, I don't see a compelling reason against it.
> 
> Using ifindex instead of string matching the interface name in -i and -o would 
> be a serious problem as it changes the semantics.
> 
> 1) Now you can match a non existing interface. This is certainly used. I.e. 
> with vlan interfaces, ppp etc.
> 2) Now your rule will match an interface even if the ifindex of the interface 
> changes. This is used (i.e. you activate a backup interface and rename it, 
> build new bridges etc.).
> 
> If one wants to use the ifindex instead of a string match on the name one 
> should explicitly request that (i.e. by using "-i =eth0" or something like 
> that).


Don't worry, it will subscribe to netdevice events and adjust the
ifindex when necessary. For userspace its still a device name match.

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

* Re: [PATCHv6 0/3] Interface group patches
  2007-11-23  0:10 ` Patrick McHardy
@ 2007-11-23  0:21   ` Krzysztof Oledzki
  2007-11-23  0:41     ` Patrick McHardy
  0 siblings, 1 reply; 13+ messages in thread
From: Krzysztof Oledzki @ 2007-11-23  0:21 UTC (permalink / raw)
  To: Patrick McHardy; +Cc: Wolfgang Walter, netfilter-devel, linux-netdev

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1261 bytes --]



On Fri, 23 Nov 2007, Patrick McHardy wrote:

> Wolfgang Walter wrote:
>> From: Patrick McHardy
>>> I'm working on the incremental ruleset changing API BTW :)
>>> One of the changes will be that interface matching is not
>>> a default part of every rule, and without wildcards it will
>>> use the ifindex. But since the cost of this feature seems
>>> pretty low, I don't see a compelling reason against it.
>> 
>> Using ifindex instead of string matching the interface name in -i and -o 
>> would be a serious problem as it changes the semantics.
>> 
>> 1) Now you can match a non existing interface. This is certainly used. I.e. 
>> with vlan interfaces, ppp etc.
>> 2) Now your rule will match an interface even if the ifindex of the 
>> interface changes. This is used (i.e. you activate a backup interface and 
>> rename it, build new bridges etc.).
>> 
>> If one wants to use the ifindex instead of a string match on the name one 
>> should explicitly request that (i.e. by using "-i =eth0" or something like 
>> that).
>
>
> Don't worry, it will subscribe to netdevice events and adjust the
> ifindex when necessary. For userspace its still a device name match.

Also for "-i ppp+"?

Best regards,

 				Krzysztof Olędzki

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

* Re: [PATCHv6 0/3] Interface group patches
  2007-11-23  0:21   ` Krzysztof Oledzki
@ 2007-11-23  0:41     ` Patrick McHardy
  2007-11-23  0:56       ` Krzysztof Oledzki
  0 siblings, 1 reply; 13+ messages in thread
From: Patrick McHardy @ 2007-11-23  0:41 UTC (permalink / raw)
  To: Krzysztof Oledzki; +Cc: Wolfgang Walter, netfilter-devel, linux-netdev

Krzysztof Oledzki wrote:
> 
> 
> On Fri, 23 Nov 2007, Patrick McHardy wrote:
> 
>> Wolfgang Walter wrote:
>>> From: Patrick McHardy
>>>> I'm working on the incremental ruleset changing API BTW :)
>>>> One of the changes will be that interface matching is not
>>>> a default part of every rule, and without wildcards it will
>>>> use the ifindex. But since the cost of this feature seems
>>>> pretty low, I don't see a compelling reason against it.
>>>
>>> Using ifindex instead of string matching the interface name in -i and 
>>> -o would be a serious problem as it changes the semantics.
>>>
>>> 1) Now you can match a non existing interface. This is certainly 
>>> used. I.e. with vlan interfaces, ppp etc.
>>> 2) Now your rule will match an interface even if the ifindex of the 
>>> interface changes. This is used (i.e. you activate a backup interface 
>>> and rename it, build new bridges etc.).
>>>
>>> If one wants to use the ifindex instead of a string match on the name 
>>> one should explicitly request that (i.e. by using "-i =eth0" or 
>>> something like that).
>>
>>
>> Don't worry, it will subscribe to netdevice events and adjust the
>> ifindex when necessary. For userspace its still a device name match.
> 
> Also for "-i ppp+"?


No, see above :) Its a single device match, for wildcards it will
still use the pattern-based matching.

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

* Re: [PATCHv6 0/3] Interface group patches
  2007-11-23  0:41     ` Patrick McHardy
@ 2007-11-23  0:56       ` Krzysztof Oledzki
  0 siblings, 0 replies; 13+ messages in thread
From: Krzysztof Oledzki @ 2007-11-23  0:56 UTC (permalink / raw)
  To: Patrick McHardy; +Cc: Wolfgang Walter, netfilter-devel, linux-netdev

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1591 bytes --]



On Fri, 23 Nov 2007, Patrick McHardy wrote:

> Krzysztof Oledzki wrote:
>> 
>> 
>> On Fri, 23 Nov 2007, Patrick McHardy wrote:
>> 
>>> Wolfgang Walter wrote:
>>>> From: Patrick McHardy
>>>>> I'm working on the incremental ruleset changing API BTW :)
>>>>> One of the changes will be that interface matching is not
>>>>> a default part of every rule, and without wildcards it will
>>>>> use the ifindex. But since the cost of this feature seems
>>>>> pretty low, I don't see a compelling reason against it.
>>>> 
>>>> Using ifindex instead of string matching the interface name in -i and -o 
>>>> would be a serious problem as it changes the semantics.
>>>> 
>>>> 1) Now you can match a non existing interface. This is certainly used. 
>>>> I.e. with vlan interfaces, ppp etc.
>>>> 2) Now your rule will match an interface even if the ifindex of the 
>>>> interface changes. This is used (i.e. you activate a backup interface and 
>>>> rename it, build new bridges etc.).
>>>> 
>>>> If one wants to use the ifindex instead of a string match on the name one 
>>>> should explicitly request that (i.e. by using "-i =eth0" or something 
>>>> like that).
>>> 
>>> 
>>> Don't worry, it will subscribe to netdevice events and adjust the
>>> ifindex when necessary. For userspace its still a device name match.
>> 
>> Also for "-i ppp+"?
>
>
> No, see above :) Its a single device match, for wildcards it will
> still use the pattern-based matching.

Right, sorry. It seems I overlooked the most important part. :(

Best regards,

 				Krzysztof Olędzki

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

end of thread, other threads:[~2007-11-23  1:03 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-22 14:37 [PATCHv6 0/3] Interface group patches Wolfgang Walter
2007-11-23  0:10 ` Patrick McHardy
2007-11-23  0:21   ` Krzysztof Oledzki
2007-11-23  0:41     ` Patrick McHardy
2007-11-23  0:56       ` Krzysztof Oledzki
  -- strict thread matches above, loose matches on Subject: below --
2007-11-20 13:14 Laszlo Attila Toth
2007-11-20 13:26 ` Jan Engelhardt
2007-11-20 13:52   ` Laszlo Attila Toth
2007-11-20 21:42     ` David Miller
2007-11-21  0:25       ` Patrick McHardy
2007-11-21  1:17         ` David Miller
2007-11-22  9:05           ` Laszlo Attila Toth
2007-11-21 15:56         ` Balazs Scheidler

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).