Skip to content

Commit c09c8a2

Browse files
floklikuba-moo
authored andcommitted
ipv4: use IS_ENABLED instead of ifdef
Checking for ifdef CONFIG_x fails if CONFIG_x=m. Use IS_ENABLED instead, which is true for both built-ins and modules. Otherwise, a > ip -4 route add 1.2.3.4/32 via inet6 fe80::2 dev eth1 fails with the message "Error: IPv6 support not enabled in kernel." if CONFIG_IPV6 is `m`. In the spirit of b812711. Fixes: d156626 ("ipv4: Allow ipv6 gateway with ipv4 routes") Cc: Kim Phillips <kim.phillips@arm.com> Signed-off-by: Florian Klink <flokli@flokli.de> Reviewed-by: David Ahern <dsahern@kernel.org> Link: https://lore.kernel.org/r/20201115224509.2020651-1-flokli@flokli.de Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 93be526 commit c09c8a2

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

net/ipv4/fib_frontend.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -696,7 +696,7 @@ int fib_gw_from_via(struct fib_config *cfg, struct nlattr *nla,
696696
cfg->fc_gw4 = *((__be32 *)via->rtvia_addr);
697697
break;
698698
case AF_INET6:
699-
#ifdef CONFIG_IPV6
699+
#if IS_ENABLED(CONFIG_IPV6)
700700
if (alen != sizeof(struct in6_addr)) {
701701
NL_SET_ERR_MSG(extack, "Invalid IPv6 address in RTA_VIA");
702702
return -EINVAL;

0 commit comments

Comments
 (0)