@@ -107,6 +107,7 @@ struct rt_cache_stat {
extern struct ip_rt_acct __percpu *ip_rt_acct;
struct in_device;
+struct fib_result;
int ip_rt_init(void);
void rt_cache_flush(struct net *net);
@@ -114,6 +115,8 @@ void rt_flush_dev(struct net_device *dev);
struct rtable *ip_route_new_rtable(struct net_device *dev,
unsigned int flags, u16 type,
bool nopolicy, bool noxfrm, bool do_cache);
+void ip_route_set_nexthop(struct rtable *rt, __be32 daddr,
+ const struct fib_result *res);
struct rtable *__ip_route_output_key(struct net *, struct flowi4 *flp);
struct rtable *ip_route_output_flow(struct net *, struct flowi4 *flp,
struct sock *sk);
@@ -1537,6 +1537,16 @@ static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr,
return err;
}
+void ip_route_set_nexthop(struct rtable *rt, __be32 daddr,
+ const struct fib_result *res)
+{
+ struct fib_nh_exception *fnhe;
+
+ fnhe = find_exception(&FIB_RES_NH(*res), daddr);
+
+ rt_set_nexthop(rt, daddr, res, fnhe, res->fi, res->type, 0);
+}
+EXPORT_SYMBOL(ip_route_set_nexthop);
static void ip_handle_martian_source(struct net_device *dev,
struct in_device *in_dev,
Signed-off-by: David Ahern <dsa@cumulusnetworks.com> --- include/net/route.h | 3 +++ net/ipv4/route.c | 10 ++++++++++ 2 files changed, 13 insertions(+)