Skip to contentSkip to conversation

bridge+netfilter+libipq questions

DISCUSSION Yong Li 3 participants 4 messages Jul 8, 2003 – Jul 14, 2003 1 message not in the archive netfilter

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 20030707222621.16976.2349.Mailman@kashyyyk

Yong Li

author
#1 lore raw

Hello All,

I have set up a bridge+Iptables on Linux. I use this rule:

iptables -A FORWARD ... -j QUEUE

I found the packet IN/OUT device are the same: our bridge port br0. I want to recognize the IN and OUT packet in the userspace application using the IN/OUT device in libipq, how to set the iptables rule?

Thank you!

author
#2 lore raw

indev_name in bridge+iptables?

In reply to a message not in the archive

Hello All,

I have a question about the ipq_packet_msg_t struct in bridge+iptables environment.

In the forward chain, the indev and outdev name are the same: br0(my bridge port).

In the mangle prerouting chain, the indev is br0, the outdev is null.

How to get the real in/out device(it is eth0 and eth1)?

Thanks in advance!

#3 lore raw

Re: indev_name in bridge+iptables?

Hi, I had the exact same thing. The physical name is not passed up in the message, sucks huh?

What I resorted to was to alter the kernel code for the QUEUE messages. The low level structure has the physical device names in it, but are not passed up. I altered it so if there was a physical device name for in & out, it copied those values over the existing indev and outdev names (since 'br0' is pretty useless). There is only 1 file to change, but can't remember it off the top of my head. The 'real' method would be to alter the _msg structure to include the physdev names in it, but I was lazy :P

-Scott

Quoted 8 lines · --- Yong

Hello All,

I have a question about the ipq_packet_msg_t struct in bridge+iptables environment.

In the forward chain, the indev and outdev name are the same: br0(my bridge port).

Quoted 7 lines

In the mangle prerouting chain, the indev is br0,
the outdev is null.

How to get the real in/out device(it is eth0 and
eth1)?

Thanks in advance!

__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

#4 lore raw

Re: indev_name in bridge+iptables?

Quoted 13 lines · Scott MacKay

Hi, I had the exact same thing. The physical name is not passed up in the message, sucks huh?

What I resorted to was to alter the kernel code for the QUEUE messages. The low level structure has the physical device names in it, but are not passed up. I altered it so if there was a physical device name for in & out, it copied those values over the existing indev and outdev names (since 'br0' is pretty useless). There is only 1 file to change, but can't remember it off the top of my head. The 'real' method would be to alter the _msg structure to include the physdev names in it, but I was lazy :P

The reason for this dilemma is historical:

- ip_queue was in the kernel first (since pre 2.4.0)
- support for bridging firewalls was added later
- real support for physdev matching in iptables is only available for kernel 2.5.x
- changing the ipq_msg structure would render all previous versions of libipq (and existing ip_queue using applications) incompatible with new kernels

Combined with the fact that bridging firewalls still seem very rare, we'd rather stick with compatibility instead of adding that feature...

... however, a patch is always welcome and we'd put it into patch-o-matic 'experimental' or something.

Quoted 1 line

-Scott

Signature · 5 lines
- Harald Welte <[email protected]>             http://www.netfilter.org/
============================================================================
  "Fragmentation is like classful addressing -- an interesting early
   architectural error that shows how much experimentation was going
   on while IP was being designed."                    -- Paul Vixie