I just replicated your additions in ring_packet.c to the below section.
I have a few other changes, so my diff would look different enough to be
unhelpful.  Here's what the code ends up as, though:

/* [2] Check socket clusters */
  read_lock(&ring_mgmt_lock);
  cluster_ptr = ring_cluster_list;

  while(cluster_ptr != NULL) {
    struct ring_opt *pfr;

    if(cluster_ptr->num_cluster_elements > 0) {
      u_int skb_hash = hash_skb(cluster_ptr, skb, recv_packet);

      skElement = cluster_ptr->sk[skb_hash];

      if(skElement != NULL) {
        pfr = ring_sk(skElement);

        if((pfr != NULL)
          && (pfr->ring_slots != NULL)
          && (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 */
        }
      }
    }
    cluster_ptr = cluster_ptr->next;
  }
  read_unlock(&ring_mgmt_lock);

The clustering is an incredible feature that would allow multiple
processes to break up the traffic on a given link (or now bond!) into
manageable chunks based on the modulo of the source IP, dest IP, source
port, dest port, and protocol.  This allows stateful packet inspection,
even on part of the link because the sniffer is guaranteed to see all of
the packets for a given TCP connection.  Most load balancers will only
load on a very unhelpful round-robin or given-subnet basis.  The problem
with round-robin is the lack of stateful inspection, and the problem
with splitting based on IP or subnet is that if a certain host or subnet
has traffic spikes, the load cannot be distributed equally.
Additionally, it can be tedious finding the proper subnet splitting to
load balance.

However, I have not been able to get clustering to work properly as it
is fairly buggy in adding and removing rings from the cluster.  It also
has a tendency to crash the system.  I am wondering if anyone else has
been able to use or has attempted to use the clustering feature.

--Martin

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Michael
Stiller
Sent: Tuesday, January 30, 2007 1:56 AM
To: [email protected]
Subject: RE: [Ntop-misc] Get PF_RING to work with bonding?

Hi.
> 
> Many thanks for your patch.  I've been testing your first one
> successfully for a few days now, and the functionality you've added is
> most welcome.

Thanks ;) I just needed it by myself. 
> 
> I made the appropriate changes to the cluster code below the section
you
> changed, but ring clusters have been extremely crashy (with or without
> your code update), so I haven't had much success with it.  I have yet
to
> find a cost-effective load-balancer out there that will do the same
> hashing as PF_RING's clustering, so I'm very interested in getting it
> functional.  Is anybody else having any luck with the ring clusters?

What changes did you made? Could you please explain that load-balancer
issue?

-Michael

> 
> --Martin
> 
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Michael
> Stiller
> Sent: Monday, January 29, 2007 4:55 AM
> To: [email protected]
> Subject: Re: [Ntop-misc] Get PF_RING to work with bonding?
> 
> On Thu, 2007-01-25 at 14:59 +0100, Michael Stiller wrote:
> > The following small patch enables PF_RING to work with bonding
> devices.
> 
> I made a better looking patch. The first one was done in a hurry. 
> Sorry for that.
> 
> --- ring_packet.c.orig  2007-01-29 11:45:13.000000000 +0100
> +++ ring_packet.c       2007-01-26 10:49:16.000000000 +0100
> @@ -780,7 +779,7 @@
>      if((pfr != NULL)
>         && (pfr->cluster_id == 0 /* No cluster */)
>         && (pfr->ring_slots != NULL)
> -       && (pfr->ring_netdev == skb->dev)) {
> +       && ((pfr->ring_netdev == skb->dev) || ((skb->dev->flags &
> IFF_SLAVE) && pfr->ring_netdev == skb->dev->master))) {
>        /* 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);
> 
> 
> 
> 
> _______________________________________________
> Ntop-misc mailing list
> [email protected]
> http://listgateway.unipi.it/mailman/listinfo/ntop-misc
> _______________________________________________
> Ntop-misc mailing list
> [email protected]
> http://listgateway.unipi.it/mailman/listinfo/ntop-misc

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

Reply via email to