Skip to contentSkip to conversation

geneve: only configure or fill UDP_ZERO_CSUM6_RX/TX info when CONFIG_IPV6

PATCH Applied Hangbin Liu 3 participants 4 messages Nov 23, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 geneve: only configure or fill UDP_ZERO_CSUM6_RX/TX info when CONFIG_IPV6

Stefano pointed that configure or show UDP_ZERO_CSUM6_RX/TX info doesn't make sense if we haven't enabled CONFIG_IPV6. Fix it by adding if IS_ENABLED(CONFIG_IPV6) check.

---
 drivers/net/geneve.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
drivers/net/geneve.c +15 -1
index 4e16d83..b718a02 100644
@@ -1337,21 +1337,33 @@ static int geneve_nl2info(struct nlattr *tb[], struct nlattr *data[],
 	}
 
 	if (data[IFLA_GENEVE_UDP_ZERO_CSUM6_TX]) {
+#if IS_ENABLED(CONFIG_IPV6)
 		if (changelink) {
 			attrtype = IFLA_GENEVE_UDP_ZERO_CSUM6_TX;
 			goto change_notsup;
 		}
 		if (nla_get_u8(data[IFLA_GENEVE_UDP_ZERO_CSUM6_TX]))
 			info->key.tun_flags &= ~TUNNEL_CSUM;
+#else
+		NL_SET_ERR_MSG_ATTR(extack, data[IFLA_GENEVE_UDP_ZERO_CSUM6_TX],
+				    "IPv6 support not enabled in the kernel");
+		return -EPFNOSUPPORT;
+#endif
 	}
 
 	if (data[IFLA_GENEVE_UDP_ZERO_CSUM6_RX]) {
+#if IS_ENABLED(CONFIG_IPV6)
 		if (changelink) {
 			attrtype = IFLA_GENEVE_UDP_ZERO_CSUM6_RX;
 			goto change_notsup;
 		}
 		if (nla_get_u8(data[IFLA_GENEVE_UDP_ZERO_CSUM6_RX]))
 			*use_udp6_rx_checksums = false;
+#else
+		NL_SET_ERR_MSG_ATTR(extack, data[IFLA_GENEVE_UDP_ZERO_CSUM6_RX],
+				    "IPv6 support not enabled in the kernel");
+		return -EPFNOSUPPORT;
+#endif
 	}
 
 	return 0;
@@ -1527,11 +1539,13 @@ static int geneve_fill_info(struct sk_buff *skb, const struct net_device *dev)
 		goto nla_put_failure;
 
 	if (metadata && nla_put_flag(skb, IFLA_GENEVE_COLLECT_METADATA))
-			goto nla_put_failure;
+		goto nla_put_failure;
 
+#if IS_ENABLED(CONFIG_IPV6)
 	if (nla_put_u8(skb, IFLA_GENEVE_UDP_ZERO_CSUM6_RX,
 		       !geneve->use_udp6_rx_checksums))
 		goto nla_put_failure;
+#endif
 
 	return 0;
 
Signature · 1 line
2.5.5
Reviewed-by on v1 1/1
#1 lore raw
Quoted 3 lines · On Thu, 23 Nov 2017 11:27:24 +0800 Hangbin Liu <[email protected]> wrote:

Stefano pointed that configure or show UDP_ZERO_CSUM6_RX/TX info doesn't make sense if we haven't enabled CONFIG_IPV6. Fix it by adding if IS_ENABLED(CONFIG_IPV6) check.

Thanks for fixing this. I would add:

Fixes abe492b4f50c ("geneve: UDP checksum configuration via netlink")
Fixes fd7eafd02121 ("geneve: fix fill_info when link down")
Quoted 1 line
Signature · 1 line
Stefano
#2 lore raw
Quoted 7 lines · Stefano Brivio
Quoted 3 lines · On Thu, 23 Nov 2017 11:27:24 +0800 Hangbin Liu <[email protected]> wrote:

Stefano pointed that configure or show UDP_ZERO_CSUM6_RX/TX info doesn't make sense if we haven't enabled CONFIG_IPV6. Fix it by adding if IS_ENABLED(CONFIG_IPV6) check.

Quoted 5 lines

Thanks for fixing this. I would add:

Fixes abe492b4f50c ("geneve: UDP checksum configuration via netlink")
Fixes fd7eafd02121 ("geneve: fix fill_info when link down")

Thanks Stefano for help adding these.

Quoted 5 lines
Quoted 2 lines

Regards
Hangbin