Skip to content

Commit

Permalink
geneve: add IPv6 bits to geneve_fill_metadata_dst
Browse files Browse the repository at this point in the history
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Reviewed-by: Jesse Gross <jesse@nicira.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
John W. Linville authored and David S. Miller committed Oct 30, 2015
1 parent 3a56f86 commit b8812fa
Showing 1 changed file with 22 additions and 7 deletions.
29 changes: 22 additions & 7 deletions drivers/net/geneve.c
Original file line number Diff line number Diff line change
Expand Up @@ -1006,16 +1006,31 @@ static int geneve_fill_metadata_dst(struct net_device *dev, struct sk_buff *skb)
struct geneve_dev *geneve = netdev_priv(dev);
struct rtable *rt;
struct flowi4 fl4;
#if IS_ENABLED(CONFIG_IPV6)
struct dst_entry *dst;
struct flowi6 fl6;
#endif

if (ip_tunnel_info_af(info) != AF_INET)
return -EINVAL;
if (ip_tunnel_info_af(info) == AF_INET) {
rt = geneve_get_v4_rt(skb, dev, &fl4, info);
if (IS_ERR(rt))
return PTR_ERR(rt);

rt = geneve_get_v4_rt(skb, dev, &fl4, info);
if (IS_ERR(rt))
return PTR_ERR(rt);
ip_rt_put(rt);
info->key.u.ipv4.src = fl4.saddr;
#if IS_ENABLED(CONFIG_IPV6)
} else if (ip_tunnel_info_af(info) == AF_INET6) {
dst = geneve_get_v6_dst(skb, dev, &fl6, info);
if (IS_ERR(dst))
return PTR_ERR(dst);

dst_release(dst);
info->key.u.ipv6.src = fl6.saddr;
#endif
} else {
return -EINVAL;
}

ip_rt_put(rt);
info->key.u.ipv4.src = fl4.saddr;
info->key.tp_src = udp_flow_src_port(geneve->net, skb,
1, USHRT_MAX, true);
info->key.tp_dst = geneve->dst_port;
Expand Down

0 comments on commit b8812fa

Please sign in to comment.