Thread (13 messages) 13 messages, 5 authors, 2012-10-10

Re: [PATCH 1/6] vxlan: minor output refactoring

flat view

From: Joe Perches <joe@perches.com>
Date: 2012-10-09 18:27:56

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;
}
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help