aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/fib_semantics.c
diff options
context:
space:
mode:
authorDavid Ahern <dsahern@gmail.com>2019-04-02 17:11:58 -0400
committerDavid S. Miller <davem@davemloft.net>2019-04-04 00:50:20 -0400
commitc0a720770c01e67374b15f348f17a52409f6545c (patch)
tree8443d516118be1f5b675e0f21ff8ec648a9cbcb8 /net/ipv4/fib_semantics.c
parentc236419981224d37a5d0a6e7781f73479d4a030e (diff)
ipv6: Flip to fib_nexthop_info
Export fib_nexthop_info and fib_add_nexthop for use by IPv6 code. Remove rt6_nexthop_info and rt6_add_nexthop in favor of the IPv4 versions. Update fib_nexthop_info for IPv6 linkdown check and RTA_GATEWAY for AF_INET6. Signed-off-by: David Ahern <dsahern@gmail.com> Acked-by: Martin KaFai Lau <kafai@fb.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.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
index 33a43965a232..8e0cb1687a74 100644
--- a/net/ipv4/fib_semantics.c
+++ b/net/ipv4/fib_semantics.c
@@ -45,6 +45,7 @@
45#include <net/nexthop.h> 45#include <net/nexthop.h>
46#include <net/lwtunnel.h> 46#include <net/lwtunnel.h>
47#include <net/fib_notifier.h> 47#include <net/fib_notifier.h>
48#include <net/addrconf.h>
48 49
49#include "fib_lookup.h" 50#include "fib_lookup.h"
50 51
@@ -1317,8 +1318,8 @@ failure:
1317 return ERR_PTR(err); 1318 return ERR_PTR(err);
1318} 1319}
1319 1320
1320static int fib_nexthop_info(struct sk_buff *skb, const struct fib_nh_common *nhc, 1321int fib_nexthop_info(struct sk_buff *skb, const struct fib_nh_common *nhc,
1321 unsigned int *flags, bool skip_oif) 1322 unsigned int *flags, bool skip_oif)
1322{ 1323{
1323 if (nhc->nhc_flags & RTNH_F_DEAD) 1324 if (nhc->nhc_flags & RTNH_F_DEAD)
1324 *flags |= RTNH_F_DEAD; 1325 *flags |= RTNH_F_DEAD;
@@ -1332,6 +1333,10 @@ static int fib_nexthop_info(struct sk_buff *skb, const struct fib_nh_common *nhc
1332 if (ip_ignore_linkdown(nhc->nhc_dev)) 1333 if (ip_ignore_linkdown(nhc->nhc_dev))
1333 *flags |= RTNH_F_DEAD; 1334 *flags |= RTNH_F_DEAD;
1334 break; 1335 break;
1336 case AF_INET6:
1337 if (ip6_ignore_linkdown(nhc->nhc_dev))
1338 *flags |= RTNH_F_DEAD;
1339 break;
1335 } 1340 }
1336 rcu_read_unlock(); 1341 rcu_read_unlock();
1337 } 1342 }
@@ -1342,6 +1347,11 @@ static int fib_nexthop_info(struct sk_buff *skb, const struct fib_nh_common *nhc
1342 if (nla_put_in_addr(skb, RTA_GATEWAY, nhc->nhc_gw.ipv4)) 1347 if (nla_put_in_addr(skb, RTA_GATEWAY, nhc->nhc_gw.ipv4))
1343 goto nla_put_failure; 1348 goto nla_put_failure;
1344 break; 1349 break;
1350 case AF_INET6:
1351 if (nla_put_in6_addr(skb, RTA_GATEWAY,
1352 &nhc->nhc_gw.ipv6) < 0)
1353 goto nla_put_failure;
1354 break;
1345 } 1355 }
1346 } 1356 }
1347 1357
@@ -1362,10 +1372,11 @@ static int fib_nexthop_info(struct sk_buff *skb, const struct fib_nh_common *nhc
1362nla_put_failure: 1372nla_put_failure:
1363 return -EMSGSIZE; 1373 return -EMSGSIZE;
1364} 1374}
1375EXPORT_SYMBOL_GPL(fib_nexthop_info);
1365 1376
1366#ifdef CONFIG_IP_ROUTE_MULTIPATH 1377#if IS_ENABLED(CONFIG_IP_ROUTE_MULTIPATH) || IS_ENABLED(CONFIG_IPV6)
1367static int fib_add_nexthop(struct sk_buff *skb, const struct fib_nh_common *nhc, 1378int fib_add_nexthop(struct sk_buff *skb, const struct fib_nh_common *nhc,
1368 int nh_weight) 1379 int nh_weight)
1369{ 1380{
1370 const struct net_device *dev = nhc->nhc_dev; 1381 const struct net_device *dev = nhc->nhc_dev;
1371 struct rtnexthop *rtnh; 1382 struct rtnexthop *rtnh;
@@ -1391,6 +1402,7 @@ static int fib_add_nexthop(struct sk_buff *skb, const struct fib_nh_common *nhc,
1391nla_put_failure: 1402nla_put_failure:
1392 return -EMSGSIZE; 1403 return -EMSGSIZE;
1393} 1404}
1405EXPORT_SYMBOL_GPL(fib_add_nexthop);
1394#endif 1406#endif
1395 1407
1396#ifdef CONFIG_IP_ROUTE_MULTIPATH 1408#ifdef CONFIG_IP_ROUTE_MULTIPATH