Currently multicast and unicast tunnel ports share port pools but
there's no overlap between the two in the lookup, which means that
we can do a lookup that has no chance of ever finding a port. This
separates them out.
Suggested-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
*/
static unsigned int key_local_remote_ports __read_mostly;
static unsigned int key_remote_ports __read_mostly;
*/
static unsigned int key_local_remote_ports __read_mostly;
static unsigned int key_remote_ports __read_mostly;
+static unsigned int key_multicast_ports __read_mostly;
static unsigned int local_remote_ports __read_mostly;
static unsigned int remote_ports __read_mostly;
static unsigned int local_remote_ports __read_mostly;
static unsigned int remote_ports __read_mostly;
+static unsigned int multicast_ports __read_mostly;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)
#define rt_dst(rt) (rt->dst)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)
#define rt_dst(rt) (rt->dst)
static unsigned int *find_port_pool(const struct tnl_mutable_config *mutable)
{
static unsigned int *find_port_pool(const struct tnl_mutable_config *mutable)
{
+ bool is_multicast = ipv4_is_multicast(mutable->key.daddr);
+
if (mutable->flags & TNL_F_IN_KEY_MATCH) {
if (mutable->key.saddr)
return &local_remote_ports;
if (mutable->flags & TNL_F_IN_KEY_MATCH) {
if (mutable->key.saddr)
return &local_remote_ports;
+ else if (is_multicast)
+ return &multicast_ports;
else
return &remote_ports;
} else {
if (mutable->key.saddr)
return &key_local_remote_ports;
else
return &remote_ports;
} else {
if (mutable->key.saddr)
return &key_local_remote_ports;
+ else if (is_multicast)
+ return &key_multicast_ports;
else
return &key_remote_ports;
}
else
return &key_remote_ports;
}
if (is_multicast) {
lookup.saddr = 0;
lookup.daddr = saddr;
if (is_multicast) {
lookup.saddr = 0;
lookup.daddr = saddr;
- if (key_remote_ports) {
+ if (key_multicast_ports) {
lookup.tunnel_type = tunnel_type | TNL_T_KEY_EXACT;
lookup.in_key = key;
vport = port_table_lookup(&lookup, mutable);
if (vport)
return vport;
}
lookup.tunnel_type = tunnel_type | TNL_T_KEY_EXACT;
lookup.in_key = key;
vport = port_table_lookup(&lookup, mutable);
if (vport)
return vport;
}
lookup.tunnel_type = tunnel_type | TNL_T_KEY_MATCH;
lookup.in_key = 0;
vport = port_table_lookup(&lookup, mutable);
lookup.tunnel_type = tunnel_type | TNL_T_KEY_MATCH;
lookup.in_key = 0;
vport = port_table_lookup(&lookup, mutable);