When a packet arrives via bridging, clone it if it is shared.
authorBen Pfaff <blp@nicira.com>
Tue, 11 Nov 2008 21:57:07 +0000 (13:57 -0800)
committerBen Pfaff <blp@nicira.com>
Thu, 13 Nov 2008 20:44:04 +0000 (12:44 -0800)
Otherwise we will mangle the packet for anyone who came before us
(e.g. tcpdump via AF_PACKET).

datapath/datapath.c

index d27a9bc12e127c8264833f6f90e5a8605e70adfc..e9d51a8d5b907aecea0d64729b4f76c2bb96b005 100644 (file)
@@ -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)) {