On Tue, 2012-10-09 at 10:56 -0700, Stephen Hemminger wrote:
quoted hunk ↗ jump to hunk
+static __be32 vxlan_find_dst(struct vxlan_dev *vxlan, struct sk_buff *skb)
+{
+ const struct ethhdr *eth = (struct ethhdr *) skb->data;
+ struct vxlan_fdb *f;
+
+ if (is_multicast_ether_addr(eth->h_dest) ||
+ (f = vxlan_find_mac(vxlan, eth->h_dest)) == NULL)
+ return vxlan->gaddr;
+ else
+ return f->remote_ip;
+}
Bikeshedding:
This might be simpler to read with a few more lines like:
static __be32 vxlan_find_dst(struct vxlan_dev *vxlan, struct sk_buff *skb)
{
const struct ethhdr *eth = (const struct ethhdr *)skb->data;
struct vxlan_fdb *f;
if (is_multicast_ether_addr(eth->h_dest))
return vxlan->gaddr;
f = vxlan_find_mac(vxlan, eth->h_dest);
if (!f)
return vxlan->gaddr;
return f->remote_ip;
}