[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <663e0441-cd19-abb3-cfd9-8663e0462863@gmail.com>
Date: Wed, 10 Apr 2019 08:44:28 -0700
From: David Ahern <dsahern@...il.com>
To: Govindarajulu Varadarajan <govind.varadar@...il.com>
Cc: David Ahern <dsahern@...nel.org>, davem@...emloft.net,
netdev@...r.kernel.org, idosch@...lanox.com, jiri@...lanox.com,
benve@...co.com
Subject: Re: [PATCH v2 net-next 08/18] ipv4: Refactor fib_check_nh
On 4/9/19 10:31 PM, Govindarajulu Varadarajan wrote:
> However this worked
>
> @@ -1096,7 +1096,7 @@ static int fib_check_nh(struct fib_config *cfg,
> struct fib_nh *nh,
> u32 table = cfg->fc_table;
> int err;
>
> - if (nh->fib_nh_gw_family == AF_INET)
> + if (nh->fib_nh_gw4)
> err = fib_check_nh_v4_gw(net, nh, table, cfg->fc_scope, extack);
> else if (nh->fib_nh_gw_family == AF_INET6)
> err = fib_check_nh_v6_gw(net, nh, table, extack);
>
since fib_nh_gw4 is a union that cannot be used without checking the
family first. You need this part as well (previous hunk was for mpath
routes):
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;
Powered by blists - more mailing lists