[ovs-dev] [PATCH net-next 12/12] openvswitch: Add gre tunnel support.
Jesse Gross
jesse at nicira.com
Sat Jun 15 00:31:23 UTC 2013
On Thu, Jun 13, 2013 at 11:25 AM, Pravin B Shelar <pshelar at nicira.com> wrote:
> diff --git a/net/openvswitch/vport-gre.c b/net/openvswitch/vport-gre.c
> new file mode 100644
> index 0000000..0420237
> --- /dev/null
> +++ b/net/openvswitch/vport-gre.c
> +/* Called with rcu_read_lock and BH disabled. */
> +static int gre_rcv(struct sk_buff *skb,
> + const struct tnl_ptk_info *tpi)
> +{
> + struct ovs_key_ipv4_tunnel tun_key;
> + struct ovs_net *ovs_net;
> + struct vport *vport;
> + __be64 key;
> +
> + ovs_net = net_generic(dev_net(skb->dev), ovs_net_id);
> + vport = rcu_dereference(ovs_net->vport_net.gre_vport);
> + if (unlikely(!vport))
> + return PACKET_REJECT;
> +
> + key = key_to_tunnel_id(tpi->key, tpi->seq);
> + ovs_flow_tun_key_init(&tun_key, ip_hdr(skb), key, tpi->flags);
I would probably filter the flags coming in, just in case another
module adds a new flag that we're not expecting.
> +static int gre_tnl_send(struct vport *vport, struct sk_buff *skb)
> +{
[...]
> + /* Allow our local IP stack to fragment the outer packet even
> + * if the DF bit is set as a last resort. We also need to
> + * force selection of an IP ID here because Linux will
> + * otherwise leave it at 0 if the packet originally had DF set.
> + */
> +
> + skb->local_df = 1;
Are we actually doing the IP ID selection here that the comment is referring to?
> diff --git a/net/openvswitch/vport.c b/net/openvswitch/vport.c
> index ef0bb5f..286c12a 100644
> --- a/net/openvswitch/vport.c
> +++ b/net/openvswitch/vport.c
> @@ -38,6 +38,7 @@
> static const struct vport_ops *vport_ops_list[] = {
> &ovs_netdev_vport_ops,
> &ovs_internal_vport_ops,
> + &ovs_gre_vport_ops,
> };
I think we need some config guards to check that the GRE and IP tunnel
modules are available in the current kernel.
More information about the dev
mailing list