mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 07:12:09 +00:00
ipv4: Adjust semantics of rt->rt_gateway.
In order to allow prefixed routes, we have to adjust how rt_gateway is set and interpreted. The new interpretation is: 1) rt_gateway == 0, destination is on-link, nexthop is iph->daddr 2) rt_gateway != 0, destination requires a nexthop gateway Abstract the fetching of the proper nexthop value using a new inline helper, rt_nexthop(), as suggested by Joe Perches. Signed-off-by: David S. Miller <davem@davemloft.net> Tested-by: Vijay Subramanian <subramanian.vijay@gmail.com>
This commit is contained in:
parent
f1ce3062c5
commit
f8126f1d51
8 changed files with 25 additions and 17 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue