On Tue, 2012-10-09 at 10:56 -0700, Stephen Hemminger wrote:
This patch restricts the port range to the normal UDP local
ports, and allows overriding via configruation.
It also uses jhash of Ethernet header when looking at flows
with out know L3 header.
[...]
quoted hunk ↗ jump to hunk
+/* Compute source port for outgoing packet
+ * first choice to use L4 flow hash since it will spread
+ * better and maybe available from hardware
+ * secondary choice is to use jhash on the Ethernet header
+ */
+static u16 vxlan_src_port(const struct vxlan_dev *vxlan, struct sk_buff *skb)
+{
+ unsigned int range = (vxlan->port_max - vxlan->port_min) + 1;
+ u32 hash;
+
+ hash = skb_get_rxhash(skb);
+ if (!hash)
+ hash = jhash(skb->data, 2 * ETH_ALEN,
+ (__force u32) skb->protocol);
+
+ return (((u64) hash * range) >> 32) + vxlan->port_min;
+}
[...]
quoted hunk ↗ jump to hunk
@@ -1021,6 +1046,18 @@ static int vxlan_validate(struct nlattr
return -EADDRNOTAVAIL;
}
}
+
+ if (data[IFLA_VXLAN_PORT_RANGE]) {
+ const struct ifla_vxlan_port_range *p
+ = nla_data(data[IFLA_VXLAN_PORT_RANGE]);
+
+ if ((int)(ntohs(p->high) - ntohs(p->low)) < 1) {
[...]
This seems to be off-by-one - both bounds are inclusive so they can be
equal.
Ben.
--
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.