Subject: Re: net-next: broken IP_PKTINFO

From: Eric Dumazet <[email-masked]>
Date: Thu, 18 Dec 2008 06:59:26 +0100

David Miller a écrit :
> From: Mark McLoughlin <[email-masked]>
> Date: Wed, 17 Dec 2008 11:25:01 +0000
> 
>> On Wed, 2008-11-26 at 01:00 +0100, Eric Dumazet wrote:
>>
>>> [PATCH] net: release skb->dst in sock_queue_rcv_skb()
>  ...
>> IP_PKTINFO cmsg data is one post-queueing user:
> 
> Eric, we'll need to rever this change I think.

I am afraid we have to revert it, yes.

META_COLLECTOR(int_rtiif) & META_COLLECTOR(int_rtclassid) 
in net/sched/em_meta.c also need rtable, I am not sure how it is used.

About ip_cmsg_recv_pktinfo() :

iif can be found in skb->iif instead of rt->rt_iif, but I am not sure
about rt_spec_dst : Shouldnt we find it in ip_hdr(skb)->saddr ?
 
Do you know if we really need rtable in ip_cmsg_recv_pktinfo() ?

diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c
index 43c0585..e854893 100644
--- a/net/ipv4/ip_sockglue.c
+++ b/net/ipv4/ip_sockglue.c
@@ -64,8 +64,8 @@ static void ip_cmsg_recv_pktinfo(struct msghdr *msg, struct sk_buff *skb)
 		info.ipi_ifindex = rt->rt_iif;
 		info.ipi_spec_dst.s_addr = rt->rt_spec_dst;
 	} else {
-		info.ipi_ifindex = 0;
-		info.ipi_spec_dst.s_addr = 0;
+		info.ipi_ifindex = skb->iif;
+		info.ipi_spec_dst.s_addr = ip_hdr(skb)->saddr;
 	}
 
 	put_cmsg(msg, SOL_IP, IP_PKTINFO, sizeof(info), &info);