@@ -169,7 +169,7 @@ struct nf_bridge_info {
unsigned int mask;
struct net_device *physindev;
struct net_device *physoutdev;
- unsigned long data[32 / sizeof(unsigned long)];
+ char dnat_orig_mac[8]; /* mac src + type */
};
#endif
@@ -43,7 +43,8 @@ static void br_nf_pre_routing_finish_bridge_slow(struct sk_buff *skb)
nf_bridge->mask &= ~BRNF_BRIDGED_DNAT;
skb_copy_to_linear_data_offset(skb, -(ETH_HLEN-ETH_ALEN),
- skb->nf_bridge->data, ETH_HLEN-ETH_ALEN);
+ skb->nf_bridge->dnat_orig_mac,
+ ETH_HLEN-ETH_ALEN);
skb->dev = nf_bridge->physindev;
br_handle_frame_finish(skb);
}
@@ -305,17 +305,18 @@ static int br_nf_pre_routing_finish_bridge(struct sk_buff *skb)
skb->dev = nf_bridge->physindev;
ret = br_handle_frame_finish(skb);
} else {
+ BUILD_BUG_ON(sizeof(nf_bridge->dnat_orig_mac) != (ETH_HLEN-ETH_ALEN));
+
/* the neighbour function below overwrites the complete
* MAC header, so we save the Ethernet source address and
* protocol number.
*/
skb_copy_from_linear_data_offset(skb,
-(ETH_HLEN-ETH_ALEN),
- skb->nf_bridge->data,
+ nf_bridge->dnat_orig_mac,
ETH_HLEN-ETH_ALEN);
/* tell br_dev_xmit to continue with forwarding */
nf_bridge->mask |= BRNF_BRIDGED_DNAT;
- /* FIXME Need to refragment */
ret = neigh->output(neigh, skb);
}
neigh_release(neigh);
This is no generic scratch space anymore, we removed all users so far except the rare case of DNAT-ON-BRIDE. That one is not trivial to remove, neigh->output queues skb and eventually invokes dev_queue_xmit and we only get the packet back into the bridge via bride_devices' ndo_start_xmit function. The packet will re-enter bridge stack via br_dev_xmit(), and we pretend it entered bridge forward logic (we inject it back into stack right after br_netfilter invoked iptables PREROUTING). This also means we don't need to care about fragmentation here -- it will be fragmented later when br_netfilter has finished with POST_ROUTING traversal. Signed-off-by: Florian Westphal <fw@strlen.de> --- include/linux/skbuff.h | 2 +- net/bridge/br_device.c | 3 ++- net/bridge/br_netfilter.c | 5 +++-- 3 files changed, 6 insertions(+), 4 deletions(-)