ipv4: Adjust semantics of rt->rt_gateway.
[firefly-linux-kernel-4.4.55.git] / include / net / route.h
index 6d111bceb1605e8f470424360784a2ef8ad5c154..3c1eeab9749b6e29c8064d3873c1293c5b744c2d 100644 (file)
@@ -70,6 +70,13 @@ static inline bool rt_is_output_route(const struct rtable *rt)
        return rt->rt_route_iif == 0;
 }
 
+static inline __be32 rt_nexthop(const struct rtable *rt, __be32 daddr)
+{
+       if (rt->rt_gateway)
+               return rt->rt_gateway;
+       return daddr;
+}
+
 struct ip_rt_acct {
        __u32   o_bytes;
        __u32   o_packets;