Skip to content

Commit f9094b7

Browse files
liuhangbindavem330
authored andcommitted
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. Fixes: abe492b ("geneve: UDP checksum configuration via netlink") Fixes: fd7eafd ("geneve: fix fill_info when link down") Signed-off-by: Hangbin Liu <liuhangbin@gmail.com> Reviewed-by: Stefano Brivio <sbrivio@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent d6efab6 commit f9094b7

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

drivers/net/geneve.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1337,21 +1337,33 @@ static int geneve_nl2info(struct nlattr *tb[], struct nlattr *data[],
13371337
}
13381338

13391339
if (data[IFLA_GENEVE_UDP_ZERO_CSUM6_TX]) {
1340+
#if IS_ENABLED(CONFIG_IPV6)
13401341
if (changelink) {
13411342
attrtype = IFLA_GENEVE_UDP_ZERO_CSUM6_TX;
13421343
goto change_notsup;
13431344
}
13441345
if (nla_get_u8(data[IFLA_GENEVE_UDP_ZERO_CSUM6_TX]))
13451346
info->key.tun_flags &= ~TUNNEL_CSUM;
1347+
#else
1348+
NL_SET_ERR_MSG_ATTR(extack, data[IFLA_GENEVE_UDP_ZERO_CSUM6_TX],
1349+
"IPv6 support not enabled in the kernel");
1350+
return -EPFNOSUPPORT;
1351+
#endif
13461352
}
13471353

13481354
if (data[IFLA_GENEVE_UDP_ZERO_CSUM6_RX]) {
1355+
#if IS_ENABLED(CONFIG_IPV6)
13491356
if (changelink) {
13501357
attrtype = IFLA_GENEVE_UDP_ZERO_CSUM6_RX;
13511358
goto change_notsup;
13521359
}
13531360
if (nla_get_u8(data[IFLA_GENEVE_UDP_ZERO_CSUM6_RX]))
13541361
*use_udp6_rx_checksums = false;
1362+
#else
1363+
NL_SET_ERR_MSG_ATTR(extack, data[IFLA_GENEVE_UDP_ZERO_CSUM6_RX],
1364+
"IPv6 support not enabled in the kernel");
1365+
return -EPFNOSUPPORT;
1366+
#endif
13551367
}
13561368

13571369
return 0;
@@ -1527,11 +1539,13 @@ static int geneve_fill_info(struct sk_buff *skb, const struct net_device *dev)
15271539
goto nla_put_failure;
15281540

15291541
if (metadata && nla_put_flag(skb, IFLA_GENEVE_COLLECT_METADATA))
1530-
goto nla_put_failure;
1542+
goto nla_put_failure;
15311543

1544+
#if IS_ENABLED(CONFIG_IPV6)
15321545
if (nla_put_u8(skb, IFLA_GENEVE_UDP_ZERO_CSUM6_RX,
15331546
!geneve->use_udp6_rx_checksums))
15341547
goto nla_put_failure;
1548+
#endif
15351549

15361550
return 0;
15371551

0 commit comments

Comments
 (0)