Subject: Re: [RFT] geneve: implement support for IPv6-based tunnels

From: Jiri Benc <[email-masked]>
Date: Fri, 25 Sep 2015 14:08:44 +0200

On Thu, 24 Sep 2015 14:34:42 -0400, John W. Linville wrote:
> +#if IS_ENABLED(CONFIG_IPV6)
> +static netdev_tx_t geneve6_xmit_skb(struct sk_buff *skb, struct net_device *dev)
> +{
> +	struct geneve_dev *geneve = netdev_priv(dev);
> +	struct geneve_sock *gs = geneve->sock;
> +	struct ip_tunnel_info *info = NULL;
> +	struct dst_entry *dst = NULL;
> +	struct flowi6 fl6;
> +	__u8 ttl;
> +	__be16 sport;
> +	bool udp_csum;
> +	int err;
> +	bool xnet = !net_eq(geneve->net, dev_net(geneve->dev));
> +
> +	if (geneve->collect_md) {
> +		info = skb_tunnel_info(skb);
> +		if (unlikely(info && info->mode != IP_TUNNEL_INFO_TX)) {
> +			netdev_dbg(dev, "no tunnel metadata\n");
> +			goto tx_error;
> +		}
> +	}

You may get IPv4 tunnel info here. Either a check whether it's really
IPv6 is needed or, better, decide whether to use IPv4 or IPv6 for xmit
based on the tunnel info. See below.

> +static netdev_tx_t geneve_xmit(struct sk_buff *skb, struct net_device *dev)
> +{
> +#if IS_ENABLED(CONFIG_IPV6)
> +	struct geneve_dev *geneve = netdev_priv(dev);
> +
> +	if (geneve->remote.sa.sa_family == AF_INET6)
> +		return geneve6_xmit_skb(skb, dev);
> +#endif
> +	return geneve_xmit_skb(skb, dev);
> +}

For metadata based tunnels, there should be no requirement for the
remote to be specified. As the consequence, you cannot decide based on
the remote type.

To be really useful, geneve should open both IPv4 and IPv6 socket when
it's metadata based. Take a look at my recent patchset that does this
for vxlan: http://thread.gmane.org/gmane.linux.network/379282

 Jiri

-- 
Jiri Benc