return (struct vxlanhdr *)(udp_hdr(skb) + 1);
}
-/* Compute source port for outgoing packet.
- * Currently we use the flow hash.
- */
-static u16 get_src_port(struct sk_buff *skb)
-{
- int low;
- int high;
- unsigned int range;
- u32 hash = OVS_CB(skb)->flow->hash;
-
- inet_get_local_port_range(&low, &high);
- range = (high - low) + 1;
- return (((u64) hash * range) >> 32) + low;
-}
-
static struct sk_buff *vxlan_build_header(const struct vport *vport,
const struct tnl_mutable_config *mutable,
struct dst_entry *dst,
tnl_get_param(mutable, tun_key, &flags, &out_key);
udph->dest = mutable->dst_port;
- udph->source = htons(get_src_port(skb));
+ udph->source = htons(ovs_tnl_get_src_port(skb));
udph->check = 0;
udph->len = htons(skb->len - skb_transport_offset(skb));
iph = ip_hdr(skb);
vport = ovs_tnl_find_port(dev_net(skb->dev), iph->daddr, iph->saddr,
key, TNL_T_PROTO_VXLAN, &mutable);
- if (unlikely(!vport)) {
- icmp_send(skb, ICMP_DEST_UNREACH, ICMP_PORT_UNREACH, 0);
+ if (unlikely(!vport))
goto error;
- }
if (mutable->flags & TNL_F_IN_KEY_MATCH || !mutable->key.daddr)
tunnel_flags = OVS_TNL_F_KEY;
if (vxlan_port) {
vxlan_port->count++;
err = 0;
+ *vxport = vxlan_port;
goto out;
}
.flags = VPORT_F_TUN_ID,
.create = vxlan_tnl_create,
.destroy = vxlan_tnl_destroy,
- .set_addr = ovs_tnl_set_addr,
.get_name = ovs_tnl_get_name,
- .get_addr = ovs_tnl_get_addr,
.get_options = ovs_tnl_get_options,
.set_options = vxlan_set_options,
.send = ovs_tnl_send,