* [PATCH net-next] ipv4: Handle RTA_GATEWAY set to 0
@ 2019-04-10 17:05 David Ahern
2019-04-10 19:39 ` David Miller
2019-04-10 19:47 ` Govindarajulu Varadarajan
0 siblings, 2 replies; 3+ messages in thread
From: David Ahern @ 2019-04-10 17:05 UTC (permalink / raw)
To: davem; +Cc: netdev, David Ahern
From: David Ahern <dsahern@gmail.com>
Govindarajulu reported a regression with Network Manager which sends an
RTA_GATEWAY attribute with the address set to 0. Fixup the handling of
RTA_GATEWAY to only set fc_gw_family if the gateway address is actually
set.
Fixes: f35b794b3b405 ("ipv4: Prepare fib_config for IPv6 gateway")
Reported-by: Govindarajulu Varadarajan <govind.varadar@gmail.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
---
net/ipv4/fib_frontend.c | 3 ++-
net/ipv4/fib_semantics.c | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index 310060e67790..d4b63f94f7be 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -755,8 +755,9 @@ static int rtm_to_fib_config(struct net *net, struct sk_buff *skb,
break;
case RTA_GATEWAY:
has_gw = true;
- cfg->fc_gw_family = AF_INET;
cfg->fc_gw4 = nla_get_be32(attr);
+ if (cfg->fc_gw4)
+ cfg->fc_gw_family = AF_INET;
break;
case RTA_VIA:
has_via = true;
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
index 017273885eee..779d2be2b135 100644
--- a/net/ipv4/fib_semantics.c
+++ b/net/ipv4/fib_semantics.c
@@ -616,8 +616,9 @@ static int fib_get_nhs(struct fib_info *fi, struct rtnexthop *rtnh,
return -EINVAL;
}
if (nla) {
- fib_cfg.fc_gw_family = AF_INET;
fib_cfg.fc_gw4 = nla_get_in_addr(nla);
+ if (fib_cfg.fc_gw4)
+ fib_cfg.fc_gw_family = AF_INET;
} else if (nlav) {
ret = fib_gw_from_via(&fib_cfg, nlav, extack);
if (ret)
--
2.11.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH net-next] ipv4: Handle RTA_GATEWAY set to 0
2019-04-10 17:05 [PATCH net-next] ipv4: Handle RTA_GATEWAY set to 0 David Ahern
@ 2019-04-10 19:39 ` David Miller
2019-04-10 19:47 ` Govindarajulu Varadarajan
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2019-04-10 19:39 UTC (permalink / raw)
To: dsahern; +Cc: netdev, dsahern
From: David Ahern <dsahern@kernel.org>
Date: Wed, 10 Apr 2019 10:05:51 -0700
> From: David Ahern <dsahern@gmail.com>
>
> Govindarajulu reported a regression with Network Manager which sends an
> RTA_GATEWAY attribute with the address set to 0. Fixup the handling of
> RTA_GATEWAY to only set fc_gw_family if the gateway address is actually
> set.
>
> Fixes: f35b794b3b405 ("ipv4: Prepare fib_config for IPv6 gateway")
> Reported-by: Govindarajulu Varadarajan <govind.varadar@gmail.com>
> Signed-off-by: David Ahern <dsahern@gmail.com>
Applied, thanks for following up on this so quickly.
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH net-next] ipv4: Handle RTA_GATEWAY set to 0
2019-04-10 17:05 [PATCH net-next] ipv4: Handle RTA_GATEWAY set to 0 David Ahern
2019-04-10 19:39 ` David Miller
@ 2019-04-10 19:47 ` Govindarajulu Varadarajan
1 sibling, 0 replies; 3+ messages in thread
From: Govindarajulu Varadarajan @ 2019-04-10 19:47 UTC (permalink / raw)
To: David Ahern; +Cc: davem, netdev, David Ahern
On Wed, Apr 10, 2019 at 12:03 PM David Ahern <dsahern@kernel.org> wrote:
>
> From: David Ahern <dsahern@gmail.com>
>
> Govindarajulu reported a regression with Network Manager which sends an
> RTA_GATEWAY attribute with the address set to 0. Fixup the handling of
> RTA_GATEWAY to only set fc_gw_family if the gateway address is actually
> set.
>
> Fixes: f35b794b3b405 ("ipv4: Prepare fib_config for IPv6 gateway")
> Reported-by: Govindarajulu Varadarajan <govind.varadar@gmail.com>
> Signed-off-by: David Ahern <dsahern@gmail.com>
Tested-by: Govindarajulu Varadarajan <govind.varadar@gmail.com>
This fixes the issue I was facing.
Thanks David.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-04-10 19:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-10 17:05 [PATCH net-next] ipv4: Handle RTA_GATEWAY set to 0 David Ahern
2019-04-10 19:39 ` David Miller
2019-04-10 19:47 ` Govindarajulu Varadarajan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).