The following small patch enables PF_RING to work with bonding devices. 

The problem was, the ring is enabled on e.g. device bond0 but
the packet is received on a slave device, so the skb doesn't contain the
device name of the ring_netdev device. Therefore no packet was added to
the ring. The patch seems to work, packets are now captured with
pf_ring enabled tcpdump on device bond0. 
But i don't know if i missed something. 

Cheers,

Michael

--- ring_packet.c.orig  2007-01-25 14:24:18.000000000 +0100
+++ ring_packet.c       2007-01-25 14:33:11.000000000 +0100
@@ -778,14 +778,20 @@

     if((pfr != NULL)
        && (pfr->cluster_id == 0 /* No cluster */)
-       && (pfr->ring_slots != NULL)
-       && (pfr->ring_netdev == skb->dev)) {
-      /* We've found the ring where the packet can be stored */
-      read_lock(&ring_mgmt_lock);
-      add_skb_to_ring(skb, pfr, recv_packet, real_skb);
-      read_unlock(&ring_mgmt_lock);
+       && (pfr->ring_slots != NULL)) {
+           if (pfr->ring_netdev == skb->dev) {
+               read_lock(&ring_mgmt_lock);
+               add_skb_to_ring(skb, pfr, recv_packet, real_skb);
+               read_unlock(&ring_mgmt_lock);
+
+               rc = 1;
+           } else if ((skb->dev->flags & IFF_SLAVE) && skb->dev->master == 
pfr->ring_netdev) {
+               read_lock(&ring_mgmt_lock);
+               add_skb_to_ring(skb, pfr, recv_packet, real_skb);
+               read_unlock(&ring_mgmt_lock);

-      rc = 1; /* Ring found: we've done our job */
+               rc = 1;
+           }
     }
   }


_______________________________________________
Ntop-misc mailing list
[email protected]
http://listgateway.unipi.it/mailman/listinfo/ntop-misc

Reply via email to