Skip to contentSkip to conversation

ipv4: return valid RTA_IIF on ip route get

PATCH In review Julian Anastasov 2 participants 2 messages Apr 13, 2014 – Apr 14, 2014

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ipv4: return valid RTA_IIF on ip route get

Extend commit 13378cad02afc2adc6c0e07fca03903c7ada0b37 ("ipv4: Change rt->rt_iif encoding.") from 3.6 to return valid RTA_IIF on 'ip route get ... iif DEVICE' instead of rt_iif 0 which is displayed as 'iif *'.

inet_iif is not appropriate to use because skb_iif is not set. Use the skb->dev->ifindex instead.

---
 net/ipv4/route.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/route.c +1 -1
index 34d094c..20a59c3 100644
@@ -2357,7 +2357,7 @@ static int rt_fill_info(struct net *net,  __be32 dst, __be32 src,
 			}
 		} else
 #endif
-			if (nla_put_u32(skb, RTA_IIF, rt->rt_iif))
+			if (nla_put_u32(skb, RTA_IIF, skb->dev->ifindex))
 				goto nla_put_failure;
 	}
 
Signature · 1 line
1.8.5.3
maintainer
#1 lore raw

From: Julian Anastasov <[email protected]>
Date: Sun, 13 Apr 2014 18:08:02 +0300

Quoted 9 lines

Extend commit 13378cad02afc2adc6c0e07fca03903c7ada0b37 ("ipv4: Change rt->rt_iif encoding.") from 3.6 to return valid RTA_IIF on 'ip route get ... iif DEVICE' instead of rt_iif 0 which is displayed as 'iif *'.

inet_iif is not appropriate to use because skb_iif is not set. Use the skb->dev->ifindex instead.

Applied and queued up for -stable, thanks Julian.