Hello,
Should "route -C" show the RTCF_REDIRECTED flag ? (0x00040000). I
had
searched in the code and it seems that it should show this flag by
"r".
However, I could not show this flag by "route -c " even that it
should have been there.
I have the following scenario where I have this flag set. I see it in
cat /proc/net/rt_cache but **not** in route -C.
(BTW, "ip route show table cache" does not show flags at all).
Here is what I do:
We have machine A with ip 192.168.0.121.
We have machine B with ip 192.168.0.10.
On a machine A (192.168.0.121) I ran:
route add -net 192.168.0.10 netmask 255.255.255.255 gw 192.168.0.189
The 192.168.0.189 machine, has forwarding and send_redirect set to 1.
machine A (192.168.0.121) has accept_redirects set to 1.
Now I run "ping 192.168.0.10".
I get a redirect: (as should indded be the case under these circumstances):
PING 192.168.0.10 (192.168.0.10) 56(84) bytes of data.
64 bytes from 192.168.0.10: icmp_seq=1 ttl=64 time=0.194
ms>From 192.168.0.189: icmp_seq=2 Redirect Host(New nexthop: 192.168.0.10
Now , as far as I understand from the kernel code, this sets the
RTCF_REDIRECTED in the route cache.
And indeed,
cat /proc/net/rt_cache | grep 0A00A8C0
shows:
eth0 0A00A8C0 0A00A8C0 40000 0 1
0 7900A8C0 1500 0 0 00 -1 0
7900A8C0
(0A00A8C0 is 192.168.0.10 in HEX.)
We see here the fourth field, which is 40000 (RTCF_REDIRECTED).
**But**,
route -Cn | grep 192.168.0.10 shows:
192.168.0.121 192.168.0.10 192.168.0.189 0 0 2 eth0
192.168.0.10 192.168.0.121 192.168.0.121 l 0 0 1 lo
We don''t see here the RTCF_REDIRECTED flag ! (the "l" is for
RTCF_LOCAL).
I had looked in the sources for "route" command ; "route"
belongs to the
net-tools package ; and parsing of flags is done in lib/netinet_gr.c,
in the rprint_cache() method; According to the code there, this flag
shoulf have been "r":
...
...
if (iflags & RTCF_DOREDIRECT)
strcat(flags, "r");
...
...
Any ideas?
Regards,
Ian