lhecking at users.sourceforge.net wrote: >>According to the Linux bonding docs, xmit_hash_policy=layer3+4 uses: >> >> ((source port XOR dest port) XOR >> ((source IP XOR dest IP) AND 0xffff) >> modulo slave count >> >>So I guess you could plug in in the above IP addresses and port numbers >>and see if you get 3 unique results? > > > That's an interesting point - how exactly do you XOR these numbers? > Bit by bit? And does 0xffff really mean 0xffffffff in this context? I guess you need to look at the bonding src code - looks like it is in drivers/net/bonding/bond_main.c - for CentOS 5 it is: /* * Hash for the output device based upon layer 3 and layer 4 data. If * the packet is a frag or not TCP or UDP, just use layer 3 data. If it is * altogether not IP, mimic bond_xmit_hash_policy_l2() */ static int bond_xmit_hash_policy_l34(struct sk_buff *skb, struct net_device *bond_dev, int count) { struct ethhdr *data = (struct ethhdr *)skb->data; struct iphdr *iph = ip_hdr(skb); __be16 *layer4hdr = (__be16 *)((u32 *)iph + iph->ihl); int layer4_xor = 0; if (skb->protocol == htons(ETH_P_IP)) { if (!(iph->frag_off & htons(IP_MF|IP_OFFSET)) && (iph->protocol == IPPROTO_TCP || iph->protocol == IPPROTO_UDP)) { layer4_xor = ntohs((*layer4hdr ^ *(layer4hdr + 1))); } return (layer4_xor ^ ((ntohl(iph->saddr ^ iph->daddr)) & 0xffff)) % count; } return (data->h_dest[5] ^ bond_dev->dev_addr[5]) % count; } James Pearson