Re: [PATCH] net: Fix sk_dst_check() to reset the obsolete dst_entryof a socket.

From: Chung-Yih Wang (çåæ)
Date: Wed Oct 06 2010 - 05:47:45 EST


I did not pay attention to the CL, actually that did not fix the issue
I encountered. I have a connected UDP socket which will not escape
from the "blackhole" since it will never enter the ipv4_blackhole
function.

In udp_sendmsg(), if the socket is connected one and the dst entry is
obsolete, you will never have a chance to reset the socket's dst entry
since rt will not be NULL.

udp_sendmsg() {
....
if (connected)
rt = (struct rtable *)sk_dst_check(sk, 0);
if (rt == NULL) {
... blackhole_function_will_be_executed_here?
}
...
}

On Wed, Oct 6, 2010 at 12:47 AM, Chung-Yih Wang (çåæ) <cywang@xxxxxxxxxx> wrote:
> In fact, that is what I intent to change originally. However, consider
> Timo's issue, I intent to submit this patch instead.
>
> On Wed, Oct 6, 2010 at 12:35 AM, David Miller <davem@xxxxxxxxxxxxx> wrote:
>>
>> This should have been fixed by:
>>
>> --------------------
>> commit ae2688d59b5f861dc70a091d003773975d2ae7fb
>> Author: Jianzhao Wang <jianzhao.wang@xxxxxxxxx>
>> Date: Â Wed Sep 8 14:35:43 2010 -0700
>>
>> Â Ânet: blackhole route should always be recalculated
>>
>> Â ÂBlackhole routes are used when xfrm_lookup() returns -EREMOTE (error
>> Â Âtriggered by IKE for example), hence this kind of route is always
>> Â Âtemporary and so we should check if a better route exists for next
>> Â Âpackets.
>> Â ÂBug has been introduced by commit d11a4dc18bf41719c9f0d7ed494d295dd2973b92.
>>
>> Â ÂSigned-off-by: Jianzhao Wang <jianzhao.wang@xxxxxxxxx>
>> Â ÂSigned-off-by: Nicolas Dichtel <nicolas.dichtel@xxxxxxxxx>
>> Â ÂSigned-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
>>
>> diff --git a/net/ipv4/route.c b/net/ipv4/route.c
>> index 3f56b6e..6298f75 100644
>> --- a/net/ipv4/route.c
>> +++ b/net/ipv4/route.c
>> @@ -2738,6 +2738,11 @@ slow_output:
>> Â}
>> ÂEXPORT_SYMBOL_GPL(__ip_route_output_key);
>>
>> +static struct dst_entry *ipv4_blackhole_dst_check(struct dst_entry *dst, u32 cookie)
>> +{
>> + Â Â Â return NULL;
>> +}
>> +
>> Âstatic void ipv4_rt_blackhole_update_pmtu(struct dst_entry *dst, u32 mtu)
>> Â{
>> Â}
>> @@ -2746,7 +2751,7 @@ static struct dst_ops ipv4_dst_blackhole_ops = {
>>    Â.family         =    AF_INET,
>>    Â.protocol        =    cpu_to_be16(ETH_P_IP),
>>    Â.destroy        Â=    ipv4_dst_destroy,
>> -    .check         Â=    ipv4_dst_check,
>> +    .check         Â=    ipv4_blackhole_dst_check,
>>    Â.update_pmtu      Â=    ipv4_rt_blackhole_update_pmtu,
>>    Â.entries        Â=    ATOMIC_INIT(0),
>> Â};
>>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/