Re: [PATCH v8 3/3] geneve: add IPv6 bits to geneve_fill_metadata_dst

2015-10-29 Thread David Miller
From: "John W. Linville" 
Date: Tue, 27 Oct 2015 09:49:00 -0400

> Signed-off-by: John W. Linville 

Applied.
--
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


Re: [PATCH v8 3/3] geneve: add IPv6 bits to geneve_fill_metadata_dst

2015-10-27 Thread Jesse Gross
On Tue, Oct 27, 2015 at 9:49 PM, John W. Linville
 wrote:
> Signed-off-by: John W. Linville 
> ---
> v7 -- initial version (numbered to match earlier patches in series)
> v8 -- fixup of bracing on an "else { return -EINVAL; }"

Reviewed-by: Jesse Gross 
--
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


[PATCH v8 3/3] geneve: add IPv6 bits to geneve_fill_metadata_dst

2015-10-27 Thread John W. Linville
Signed-off-by: John W. Linville 
---
v7 -- initial version (numbered to match earlier patches in series)
v8 -- fixup of bracing on an "else { return -EINVAL; }"

 drivers/net/geneve.c | 29 ++---
 1 file changed, 22 insertions(+), 7 deletions(-)

diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c
index 44e724508c55..de5c30c9f059 100644
--- a/drivers/net/geneve.c
+++ b/drivers/net/geneve.c
@@ -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, , info);
+   if (IS_ERR(rt))
+   return PTR_ERR(rt);
 
-   rt = geneve_get_v4_rt(skb, dev, , 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, , 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;
-- 
2.4.3

--
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