summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorDavid Ahern <dsahern@gmail.com>2019-03-28 04:53:57 +0100
committerDavid S. Miller <davem@davemloft.net>2019-03-29 18:48:04 +0100
commitf1741730dd18828fe3ea5fa91c22f41cf001c625 (patch)
treed3491ccb4fd5129cc45d364fda8b67f3e056c366 /net
parentipv6: Rename fib6_nh entries (diff)
downloadlinux-f1741730dd18828fe3ea5fa91c22f41cf001c625.tar.xz
linux-f1741730dd18828fe3ea5fa91c22f41cf001c625.zip
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')
-rw-r--r--net/ipv4/fib_semantics.c7
-rw-r--r--net/ipv6/route.c3
2 files changed, 9 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
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index e4c2f8e43405..79ef590b7bc5 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -2906,6 +2906,8 @@ int fib6_nh_init(struct net *net, struct fib6_nh *fib6_nh,
int addr_type;
int err;
+ fib6_nh->fib_nh_family = AF_INET6;
+
err = -ENODEV;
if (cfg->fc_ifindex) {
dev = dev_get_by_index(net, cfg->fc_ifindex);
@@ -2999,6 +3001,7 @@ int fib6_nh_init(struct net *net, struct fib6_nh *fib6_nh,
set_dev:
fib6_nh->fib_nh_dev = dev;
+ fib6_nh->fib_nh_oif = dev->ifindex;
err = 0;
out:
if (idev)