/* 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, int count)
/* 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, 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] ^ data->h_source[5]) % count;
}