summaryrefslogtreecommitdiff
path: root/net/ipv4/fib_semantics.c
diff options
context:
space:
mode:
authorDavid Ahern <dsahern@gmail.com>2019-03-27 20:53:57 -0700
committerDavid S. Miller <davem@davemloft.net>2019-03-29 10:48:04 -0700
commitf1741730dd18828fe3ea5fa91c22f41cf001c625 (patch)
treed3491ccb4fd5129cc45d364fda8b67f3e056c366 /net/ipv4/fib_semantics.c
parentad1601ae0260551f85691ca1ac814773fdcec239 (diff)
net: Add fib_nh_common and update fib_nh and fib6_nh
Add fib_nh_common struct with common nexthop attributes. Convert fib_nh and fib6_nh to use it. Use macros to move existing fib_nh_* references to the new nh_common.nhc_*. Signed-off-by: David Ahern <dsahern@gmail.com> Reviewed-by: Ido Schimmel <idosch@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/fib_semantics.c')
-rw-r--r--net/ipv4/fib_semantics.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
index c1e16b52338b..e9992407863e 100644
--- a/net/ipv4/fib_semantics.c
+++ b/net/ipv4/fib_semantics.c
@@ -468,6 +468,8 @@ int fib_nh_init(struct net *net, struct fib_nh *nh,
{
int err = -ENOMEM;
+ nh->fib_nh_family = AF_INET;
+
nh->nh_pcpu_rth_output = alloc_percpu(struct rtable __rcu *);
if (!nh->nh_pcpu_rth_output)
goto err_out;
@@ -490,7 +492,10 @@ int fib_nh_init(struct net *net, struct fib_nh *nh,
}
nh->fib_nh_oif = cfg->fc_oif;
- nh->fib_nh_gw4 = cfg->fc_gw;
+ if (cfg->fc_gw) {
+ nh->fib_nh_gw4 = cfg->fc_gw;
+ nh->fib_nh_has_gw = 1;
+ }
nh->fib_nh_flags = cfg->fc_flags;
#ifdef CONFIG_IP_ROUTE_CLASSID