On Fri, Sep 25, 2015 at 02:08:44PM +0200, Jiri Benc wrote:
> 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.

Sure, that makes sense.  I'm testing something now...

> 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

OK, that seems simple enough.  So we should just assume that a metadata
tunnel could do either protocol at any time?  Or are there more rules
than that?

John
-- 
John W. Linville                Someday the world will need a hero, and you
linvi...@tuxdriver.com                  might be all we have.  Be ready.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to