* [Bridge] Help needed about IP class finding in a bridge netfilter module
@ 2006-12-07 17:18 Louis Croisez
2006-12-07 19:33 ` Eric Brower
0 siblings, 1 reply; 6+ messages in thread
From: Louis Croisez @ 2006-12-07 17:18 UTC (permalink / raw)
To: bridge
Hi,
i am currently trying to code a little netfilter plugin, to be placed
into the bridge forwarding path.
In such plugin, i would like to test if a packet is:
- unicast
- multicast
- broadcast
The starting condition is that the bridge has no knowledge of the IP
configuration of the sending and receiving stations. It does not know
about their netmask e.g.
I have tried the following function (from 2.6 kernel):
inet_addr_type(u32 addr), but it always return RTN_UNICAST, and never
RTN_MULTICAST, RTN_BROADCAST.
For example, for this address: 10.255.255.255 it returns RTN_UNICAST.
How could the bridge decide in which class is the destination IP of a
skb, and what is my error?
Thx in advance.
LOUIS
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Bridge] Help needed about IP class finding in a bridge netfilter module
2006-12-07 17:18 [Bridge] Help needed about IP class finding in a bridge netfilter module Louis Croisez
@ 2006-12-07 19:33 ` Eric Brower
2006-12-08 2:31 ` Eric Brower
0 siblings, 1 reply; 6+ messages in thread
From: Eric Brower @ 2006-12-07 19:33 UTC (permalink / raw)
To: Louis Croisez; +Cc: bridge
On 12/7/06, Louis Croisez <louis.croisez@gmail.com> wrote:
> Hi,
> i am currently trying to code a little netfilter plugin, to be placed
> into the bridge forwarding path.
> In such plugin, i would like to test if a packet is:
> - unicast
> - multicast
> - broadcast
>
> The starting condition is that the bridge has no knowledge of the IP
> configuration of the sending and receiving stations. It does not know
> about their netmask e.g.
>
> I have tried the following function (from 2.6 kernel):
> inet_addr_type(u32 addr), but it always return RTN_UNICAST, and never
> RTN_MULTICAST, RTN_BROADCAST.
> For example, for this address: 10.255.255.255 it returns RTN_UNICAST.
>
> How could the bridge decide in which class is the destination IP of a
> skb, and what is my error?
The bridge can't discriminate between broadcast and unicast because
you have no routing table entries (netmasks) to associate with the
destination address. You could hack-in a class A/B/C match yourself,
but with CIDR (RFC 1519) the world does not work that way any longer.
Based on the code I would suggest multicast addresses would be matched
(have you tried to ping 224.0.0.1 [all hosts mcast] to see if it is
properly classified?). For the locally-destined packets you could
maintain static routing table entries on your system, if that is
tenable in your environment.
You might be able to obtain this information via RMON from your
routers, if this is not a science project.
--
E
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Bridge] Help needed about IP class finding in a bridge netfilter module
2006-12-07 19:33 ` Eric Brower
@ 2006-12-08 2:31 ` Eric Brower
2006-12-08 9:19 ` Louis Croisez
0 siblings, 1 reply; 6+ messages in thread
From: Eric Brower @ 2006-12-08 2:31 UTC (permalink / raw)
To: Louis Croisez; +Cc: bridge
On 12/7/06, Eric Brower <ebrower@gmail.com> wrote:
> On 12/7/06, Louis Croisez <louis.croisez@gmail.com> wrote:
> > Hi,
> > i am currently trying to code a little netfilter plugin, to be placed
> > into the bridge forwarding path.
> > In such plugin, i would like to test if a packet is:
> > - unicast
> > - multicast
> > - broadcast
> >
> > The starting condition is that the bridge has no knowledge of the IP
> > configuration of the sending and receiving stations. It does not know
> > about their netmask e.g.
> >
> > I have tried the following function (from 2.6 kernel):
> > inet_addr_type(u32 addr), but it always return RTN_UNICAST, and never
> > RTN_MULTICAST, RTN_BROADCAST.
> > For example, for this address: 10.255.255.255 it returns RTN_UNICAST.
> >
> > How could the bridge decide in which class is the destination IP of a
> > skb, and what is my error?
>
> The bridge can't discriminate between broadcast and unicast because
> you have no routing table entries (netmasks) to associate with the
> destination address. You could hack-in a class A/B/C match yourself,
> but with CIDR (RFC 1519) the world does not work that way any longer.
On further thought, you might be able to look at destination MACs
rather than IPs; for the ff:ff:ff:ff:ff:ff destination MAC on
broadcast packets, or multicast destination MACs. In any case, using
the kernel to lookup IP addresses just isn't going to do it without a
routing table.
HTH,
E
>
> Based on the code I would suggest multicast addresses would be matched
> (have you tried to ping 224.0.0.1 [all hosts mcast] to see if it is
> properly classified?). For the locally-destined packets you could
> maintain static routing table entries on your system, if that is
> tenable in your environment.
>
> You might be able to obtain this information via RMON from your
> routers, if this is not a science project.
>
> --
> E
>
--
E
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Bridge] Help needed about IP class finding in a bridge netfilter module
2006-12-08 2:31 ` Eric Brower
@ 2006-12-08 9:19 ` Louis Croisez
2006-12-08 15:17 ` Stephen Hemminger
0 siblings, 1 reply; 6+ messages in thread
From: Louis Croisez @ 2006-12-08 9:19 UTC (permalink / raw)
To: Eric Brower; +Cc: bridge
Hi Eric,
first, thx for your responses.
I have tried to hping on destination IP 239.255.255.250 (a Multicast
ip used for example in the uPnP discovery process).
The inet_addr_type() function detect multicast well.
For the question of the broadcast, your idea of using the mac dest
address is great. I will check this and give a feedback.
Cheers,
LOUIS
2006/12/8, Eric Brower <ebrower@gmail.com>:
> On 12/7/06, Eric Brower <ebrower@gmail.com> wrote:
> > On 12/7/06, Louis Croisez <louis.croisez@gmail.com> wrote:
> > > Hi,
> > > i am currently trying to code a little netfilter plugin, to be placed
> > > into the bridge forwarding path.
> > > In such plugin, i would like to test if a packet is:
> > > - unicast
> > > - multicast
> > > - broadcast
> > >
> > > The starting condition is that the bridge has no knowledge of the IP
> > > configuration of the sending and receiving stations. It does not know
> > > about their netmask e.g.
> > >
> > > I have tried the following function (from 2.6 kernel):
> > > inet_addr_type(u32 addr), but it always return RTN_UNICAST, and never
> > > RTN_MULTICAST, RTN_BROADCAST.
> > > For example, for this address: 10.255.255.255 it returns RTN_UNICAST.
> > >
> > > How could the bridge decide in which class is the destination IP of a
> > > skb, and what is my error?
> >
> > The bridge can't discriminate between broadcast and unicast because
> > you have no routing table entries (netmasks) to associate with the
> > destination address. You could hack-in a class A/B/C match yourself,
> > but with CIDR (RFC 1519) the world does not work that way any longer.
>
> On further thought, you might be able to look at destination MACs
> rather than IPs; for the ff:ff:ff:ff:ff:ff destination MAC on
> broadcast packets, or multicast destination MACs. In any case, using
> the kernel to lookup IP addresses just isn't going to do it without a
> routing table.
>
> HTH,
> E
>
> >
> > Based on the code I would suggest multicast addresses would be matched
> > (have you tried to ping 224.0.0.1 [all hosts mcast] to see if it is
> > properly classified?). For the locally-destined packets you could
> > maintain static routing table entries on your system, if that is
> > tenable in your environment.
> >
> > You might be able to obtain this information via RMON from your
> > routers, if this is not a science project.
> >
> > --
> > E
> >
>
>
> --
> E
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Bridge] Help needed about IP class finding in a bridge netfilter module
2006-12-08 9:19 ` Louis Croisez
@ 2006-12-08 15:17 ` Stephen Hemminger
2006-12-08 16:35 ` Louis Croisez
0 siblings, 1 reply; 6+ messages in thread
From: Stephen Hemminger @ 2006-12-08 15:17 UTC (permalink / raw)
To: Louis Croisez; +Cc: bridge
On Fri, 8 Dec 2006 10:19:57 +0100
"Louis Croisez" <louis.croisez@gmail.com> wrote:
> Hi Eric,
> first, thx for your responses.
> I have tried to hping on destination IP 239.255.255.250 (a Multicast
> ip used for example in the uPnP discovery process).
> The inet_addr_type() function detect multicast well.
>
> For the question of the broadcast, your idea of using the mac dest
> address is great. I will check this and give a feedback.
> Cheers,
> LOUIS
You could also look at the destination ethernet address using
is_multicast_ether_addr()
and is_broadcast_ether_addr()
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Bridge] Help needed about IP class finding in a bridge netfilter module
2006-12-08 15:17 ` Stephen Hemminger
@ 2006-12-08 16:35 ` Louis Croisez
0 siblings, 0 replies; 6+ messages in thread
From: Louis Croisez @ 2006-12-08 16:35 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: bridge
Thx a lot everybody.
It works as i want now.
inet_addr_type() gives me unicast/multicast information at bridge level.
is_broadcast_ether_addr() gives me broadcast information at bridge level.
Cheers.
LOUIS
2006/12/8, Stephen Hemminger <shemminger@osdl.org>:
> On Fri, 8 Dec 2006 10:19:57 +0100
> "Louis Croisez" <louis.croisez@gmail.com> wrote:
>
> > Hi Eric,
> > first, thx for your responses.
> > I have tried to hping on destination IP 239.255.255.250 (a Multicast
> > ip used for example in the uPnP discovery process).
> > The inet_addr_type() function detect multicast well.
> >
> > For the question of the broadcast, your idea of using the mac dest
> > address is great. I will check this and give a feedback.
> > Cheers,
> > LOUIS
>
> You could also look at the destination ethernet address using
> is_multicast_ether_addr()
> and is_broadcast_ether_addr()
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2006-12-08 16:35 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-12-07 17:18 [Bridge] Help needed about IP class finding in a bridge netfilter module Louis Croisez
2006-12-07 19:33 ` Eric Brower
2006-12-08 2:31 ` Eric Brower
2006-12-08 9:19 ` Louis Croisez
2006-12-08 15:17 ` Stephen Hemminger
2006-12-08 16:35 ` Louis Croisez
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox