ipv4: Fix "Set rt->rt_iif more sanely on output routes."

Commit 1018b5c016 ("Set rt->rt_iif more
sanely on output routes.")  breaks rt_is_{output,input}_route.

This became the cause to return "IP_PKTINFO's ->ipi_ifindex == 0".

To fix it, this does:

1) Add "int rt_route_iif;" to struct rtable

2) For input routes, always set rt_route_iif to same value as rt_iif

3) For output routes, always set rt_route_iif to zero.  Set rt_iif
   as it is done currently.

4) Change rt_is_{output,input}_route() to test rt_route_iif

Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
OGAWA Hirofumi
2011-04-07 14:04:08 -07:00
committed by David S. Miller
parent 9b57e1a79e
commit 1b86a58f9d
3 changed files with 10 additions and 4 deletions

View File

@ -64,6 +64,7 @@ struct rtable {
__be32 rt_dst; /* Path destination */
__be32 rt_src; /* Path source */
int rt_route_iif;
int rt_iif;
int rt_oif;
__u32 rt_mark;
@ -80,12 +81,12 @@ struct rtable {
static inline bool rt_is_input_route(struct rtable *rt)
{
return rt->rt_iif != 0;
return rt->rt_route_iif != 0;
}
static inline bool rt_is_output_route(struct rtable *rt)
{
return rt->rt_iif == 0;
return rt->rt_route_iif == 0;
}
struct ip_rt_acct {