[ovs-dev] [PATCH 07/13] Upstream VXLAN: use IP Tunnel protocol handler.

Jesse Gross jesse at nicira.com
Mon Dec 17 22:53:50 UTC 2012


On Thu, Nov 22, 2012 at 7:57 AM, Pravin B Shelar <pshelar at nicira.com> wrote:
> @@ -561,14 +562,40 @@ static int vxlan_udp_encap_recv(struct sock *sk, struct sk_buff *skb)
>         }
>
>         __skb_pull(skb, sizeof(struct vxlanhdr));
> +       tpi.key = vxh->vx_vni;

Don't we have to either fill in or zero out the rest of tpi?

> +       head = ipt_hash_bucket(IPT_VXLAN, inet->inet_num);
> +       hlist_for_each_entry_rcu(proto, n, head, node) {
> +               int ret;
> +
> +               if (proto->type != IPT_VXLAN || proto->portno != inet->inet_num)

It might be a little clearer if you pull the dest port directly from
the packet using udp_hdr().

> +/* Callback from net/ipv4/udp.c to receive packets */
> +static int vxlan_rcv(struct sk_buff *skb, const struct tnl_ptk_info *tpi)

I think this comment should be on the other function now.

> +{
> +       struct vxlan_dev *vxlan;
> +       struct net *net = dev_net(skb->dev);
> +       struct iphdr *oip;
> +       struct pcpu_tstats *stats;
> +       int err;
> +
> +       /* Is this VNI defined? */
> +       vxlan = vxlan_find_vni(net, tpi->key);
> +       if (!vxlan)
> +               return 1;

I think this will potentially result in returning packets back to the
UDP stack with no header in the event that this is no later handler.

> @@ -1436,8 +1463,16 @@ static int __init vxlan_init_module(void)
>         if (rc)
>                 goto out2;
>
> +       vxlan_protocol.portno = vxlan_port;

Doesn't this have to be byte swapped?



More information about the dev mailing list