* [PATCH] [BRIDGE-NETFILTER] make IP DNAT work on bridged vlan/pppoe packets
@ 2009-10-24 11:45 Bart De Schuymer
2009-10-28 15:50 ` Patrick McHardy
0 siblings, 1 reply; 3+ messages in thread
From: Bart De Schuymer @ 2009-10-24 11:45 UTC (permalink / raw)
To: Netfilter Developer Mailing List
[-- Attachment #1: Type: text/plain, Size: 657 bytes --]
Hi,
The attached patch makes IP DNAT work on bridged IP packets encapsulated
in a VLAN/PPoE packet. I only tested that it works for VLAN, but the
PPoE case should be fixed too.
This bug was introduced by commit
2948d2ebbb98747b912ac6d0c864b4d02be8a6f5 on January 12, 2008.
The patch also makes IP DNATing more transparent on a bridge: for
bridged-and-dnated traffic, the source MAC address is no longer changed
to the MAC address of the bridge port. If one wants, ebtables snat can
be used to change the source MAC address in the POSTROUTING chain.
Signed-off-by: Bart De Schuymer <bdschuym@pandora.be>
--
Bart De Schuymer
www.artinalgorithms.be
[-- Attachment #2: vlan_nat_filtering.diff --]
[-- Type: text/plain, Size: 925 bytes --]
--- linux-2.6.31-uml/net/bridge/br_netfilter.c.ori 2009-10-03 17:17:37.000000000 +0200
+++ linux-2.6.31-uml/net/bridge/br_netfilter.c 2009-10-04 17:28:40.000000000 +0200
@@ -324,7 +324,10 @@ static int br_nf_pre_routing_finish_brid
if (skb->dev) {
struct dst_entry *dst = skb_dst(skb);
- nf_bridge_pull_encap_header(skb);
+ /* the neigh functions below overwrite the MAC header, so we
+ * save the Ethernet source address and protocol number */
+ skb_copy_from_linear_data_offset(skb, -8,
+ skb->nf_bridge->data, 8);
if (dst->hh)
return neigh_hh_output(dst->hh, skb);
@@ -784,7 +787,7 @@ static unsigned int br_nf_local_out(unsi
skb->pkt_type = PACKET_OTHERHOST;
nf_bridge->mask ^= BRNF_PKT_TYPE;
}
- nf_bridge_push_encap_header(skb);
+ skb_copy_to_linear_data_offset(skb, -8, skb->nf_bridge->data, 8);
NF_HOOK(PF_BRIDGE, NF_BR_FORWARD, skb, realindev, skb->dev,
br_forward_finish);
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] [BRIDGE-NETFILTER] make IP DNAT work on bridged vlan/pppoe packets
2009-10-24 11:45 [PATCH] [BRIDGE-NETFILTER] make IP DNAT work on bridged vlan/pppoe packets Bart De Schuymer
@ 2009-10-28 15:50 ` Patrick McHardy
2010-03-09 16:22 ` Bart De Schuymer
0 siblings, 1 reply; 3+ messages in thread
From: Patrick McHardy @ 2009-10-28 15:50 UTC (permalink / raw)
To: Bart De Schuymer; +Cc: Netfilter Developer Mailing List
Bart De Schuymer wrote:
> Hi,
>
> The attached patch makes IP DNAT work on bridged IP packets encapsulated
> in a VLAN/PPoE packet. I only tested that it works for VLAN, but the
> PPoE case should be fixed too.
> This bug was introduced by commit
> 2948d2ebbb98747b912ac6d0c864b4d02be8a6f5 on January 12, 2008.
> The patch also makes IP DNATing more transparent on a bridge: for
> bridged-and-dnated traffic, the source MAC address is no longer changed
> to the MAC address of the bridge port. If one wants, ebtables snat can
> be used to change the source MAC address in the POSTROUTING chain.
Applied, thanks Bart.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] [BRIDGE-NETFILTER] make IP DNAT work on bridged vlan/pppoe packets
2009-10-28 15:50 ` Patrick McHardy
@ 2010-03-09 16:22 ` Bart De Schuymer
0 siblings, 0 replies; 3+ messages in thread
From: Bart De Schuymer @ 2010-03-09 16:22 UTC (permalink / raw)
To: Patrick McHardy; +Cc: Netfilter Developer Mailing List
Patrick McHardy wrote:
> Bart De Schuymer wrote:
>> Hi,
>>
>> The attached patch makes IP DNAT work on bridged IP packets encapsulated
>> in a VLAN/PPoE packet. I only tested that it works for VLAN, but the
>> PPoE case should be fixed too.
>> This bug was introduced by commit
>> 2948d2ebbb98747b912ac6d0c864b4d02be8a6f5 on January 12, 2008.
>> The patch also makes IP DNATing more transparent on a bridge: for
>> bridged-and-dnated traffic, the source MAC address is no longer changed
>> to the MAC address of the bridge port. If one wants, ebtables snat can
>> be used to change the source MAC address in the POSTROUTING chain.
>
> Applied, thanks Bart.
Hello Patrick,
I just noticed the above mentioned patch isn't yet in the standard
kernel. It was sent on October 24, 2009. Was there a problem with the patch?
cheers,
Bart
--
Bart De Schuymer
www.artinalgorithms.be
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-03-09 16:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-24 11:45 [PATCH] [BRIDGE-NETFILTER] make IP DNAT work on bridged vlan/pppoe packets Bart De Schuymer
2009-10-28 15:50 ` Patrick McHardy
2010-03-09 16:22 ` Bart De Schuymer
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).