Subject: Re: Q: bad routing table cache entries

From: Stas Sergeev <[email-masked]>
Date: Tue, 29 Dec 2015 15:06:49 +0300

29.12.2015 14:58, Sowmini Varadhan пишет:
> On (12/29/15 13:54), Stas Sergeev wrote:
>>
>> ip route get 91.189.89.238
>> 91.189.89.238 via 192.168.0.1 dev eth0  src 192.168.10.202
>>     cache <redirected>
>          :
>> Now, 192.168.0.1 is also a valid gateway, but it is outside
>> of the network mask for the eth0 interface:
>          :
>> So my question is: why does linux allow an invalid redirect
>> entries? Is it a problem with my setup, or some kernel bug,
>> or some router setup problem? Where should I look into, to
>> nail this down?
> 
> Seems like the problem is in the router that is sending
> the bad redirect. You would have to check into the configuration
> and/or implementation of the router- it should not be sending
> back a redirect in the above case (different netmasks) even
> if the ingress and egress physical interfaces are the same.
Router on 192.168.8.1 is just a PC with ubuntu, w/o any special
software. I'd be very surprised if it does so. As I understand,
linux would accept such ICMP redirect only from the router, or
could someone else also send them?

But what worries me more, is the question:
Should the linux kernel really silently accept those, breaking
the routing in a completely unexpected ways? Isn't it a bug?
The sanity check against netmask looks trivial, so why it is not there?