Skip to contentSkip to conversation

Bridge Netfilter question

Bridge Rajashekhar Mansanpally 2 participants 2 messages Jan 12, 2004 Ethernet bridge

lore
Share & tools
lore
#0 lore raw

Hi guyz,
Looks like Bart Schuymer is busy. I will appreciate if anyone else can help me.

I am using br_handle_frame_finish to implement my protocol which encapusulates and also decapsulates just like VLAN does. I made changes to br_netfilter.c similar to VLAN protocol and the IPTABLES seems to be working. But my ebtables INPUT chain does not see the frame early enough. ebtables INPUT chain is seeing frame after the decapsulation.

The remedy, Bart says:

Quoted 1 line

You should not add a new hook. What you need to do is register your

function

Quoted 1 line

on the existing NF_BR_PRE_ROUTING hook, with a priority number lower

than

Quoted 2 lines

that of the ebtables nat PREROUTING chain (prio=NF_BR_PRI_NAT_SRC). See f.e. net/bridge/netfilter/ebtable_nat.c, where the ebtables nat

chains are

Quoted 1 line

registered on the relevant netfilter hooks.

can I add the following:

{ { NULL, NULL }, br_handle_frame_finish, PF_BRIDGE, NF_BR_PRE_ROUTING,

           NF_BR_PRI_BRNF},

to ebtables_nat.c @ end of 'static struct nf_hook_ops ebt_ops_nat[] {' ?

Thanks in advance,
Raj

#1 lore raw

You shouldn't have to change an existing line of code to do what you want! Make your new filter a module.

In the routine called by module_init(), add a call to ebt_register_table() You need to setup an struct ebt_table to describe your new filter.

Look at source for exist ebtable modules to see how to do it.

Of course, make sure and unregister and cleanup on module removal.