From cdbc9a4a817238ae484066d43eb6a0a322e31866 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Tue, 11 Nov 2008 13:57:07 -0800 Subject: [PATCH] When a packet arrives via bridging, clone it if it is shared. Otherwise we will mangle the packet for anyone who came before us (e.g. tcpdump via AF_PACKET). --- datapath/datapath.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/datapath/datapath.c b/datapath/datapath.c index d27a9bc1..e9d51a8d 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -455,6 +455,14 @@ static int dp_maint_func(void *data) static void do_port_input(struct net_bridge_port *p, struct sk_buff *skb) { + /* Make our own copy of the packet. Otherwise we will mangle the + * packet for anyone who came before us (e.g. tcpdump via AF_PACKET). + * (No one comes after us, since we tell handle_bridge() that we took + * the packet.) */ + skb = skb_share_check(skb, GFP_ATOMIC); + if (!skb) + return; + #ifdef SUPPORT_SNAT /* Check if this packet needs early SNAT processing. */ if (snat_pre_route(skb)) { -- 2.30.2