From: Ben Pfaff Date: Tue, 11 Nov 2008 21:57:07 +0000 (-0800) Subject: When a packet arrives via bridging, clone it if it is shared. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cdbc9a4a817238ae484066d43eb6a0a322e31866;p=openvswitch 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). --- 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)) {