summaryrefslogtreecommitdiff
path: root/backport-include/net/ip6_fib.h
diff options
context:
space:
mode:
authorDominik Sliwa <dominik.sliwa@toradex.com>2019-03-04 12:01:54 +0100
committerDominik Sliwa <dominik.sliwa@toradex.com>2019-03-04 12:01:54 +0100
commit348fa3f6871f56a37dcd16c99ca98118c6d79a38 (patch)
tree6fcae7785bae4ffb838fd6549f7d01ba6abf0763 /backport-include/net/ip6_fib.h
Backports v4.19.24
Backports generated by toradex backports 515a1fa55cda2b1d952872e1786857481bd54fcc against mainline kernel tag v4.19.24 Signed-off-by: Dominik Sliwa <dominik.sliwa@toradex.com>
Diffstat (limited to 'backport-include/net/ip6_fib.h')
-rw-r--r--backport-include/net/ip6_fib.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/backport-include/net/ip6_fib.h b/backport-include/net/ip6_fib.h
new file mode 100644
index 0000000..2f21163
--- /dev/null
+++ b/backport-include/net/ip6_fib.h
@@ -0,0 +1,26 @@
+#ifndef __BACKPORT_NET_IP6_ROUTE_H
+#define __BACKPORT_NET_IP6_ROUTE_H
+#include_next <net/ip6_fib.h>
+#include <net/ip6_route.h>
+#include <linux/route.h>
+#include <linux/version.h>
+
+/*
+ * This function is avaliable with one argument since kernel 3.10, but the
+ * secound one was added in 4.2.
+ */
+#if LINUX_VERSION_IS_LESS(4,2,0)
+#define rt6_nexthop LINUX_BACKPORT(rt6_nexthop)
+static inline struct in6_addr *rt6_nexthop(struct rt6_info *rt,
+ struct in6_addr *daddr)
+{
+ if (rt->rt6i_flags & RTF_GATEWAY)
+ return &rt->rt6i_gateway;
+ else if (rt->rt6i_flags & RTF_CACHE)
+ return &rt->rt6i_dst.addr;
+ else
+ return daddr;
+}
+#endif /* LINUX_VERSION_IS_LESS(4,2,0) */
+
+#endif /* __BACKPORT_NET_IP6_ROUTE_H */