Re: Do Routing-policies have effect on local-originated packets?

Andi Kleen (ak@muc.de)
23 Dec 1999 01:58:09 +0100


adsmail@htl.de (Andreas Scherbaum) writes:
>
> Here's a tcpdump (sending a nameserver request to the second ip ...)
> $ host 192.168.0.1 192.168.0.201
>
> # tcpdump -p -i eth1:
> 18:13:59.988575 192.168.0.15.1128 > 192.168.0.201.domain: 34740+ (28)
> 18:14:00.036535 192.168.0.15.1128 > 192.168.0.201.domain: 34741+ (28)
>
> # tcpdump -p -i eth0:
> 18:14:09.514938 192.168.0.201.domain > 192.168.0.15.1128: 16413 1/3/3
> (161)
> 18:14:09.570556 192.168.0.201.domain > 192.168.0.15.1128: 16414 0/1/0
> (81)
>
> Why is the kernel sending this packages trough the first interface and
> how can i change it to using the right interface?

Because the kernel does not know that the incoming packet and the outgoing
packet are in any way related (UDP has no connection between packets, it
is all in above layers if at all). The routing table doesn't say anything
about it. So the only way to get the semantics you want is to change bind
to receive the incoming interface with the IP_PKTINFO cmsg, look at the
ipi_ifindex and set it for outgoing packets on the same conversation to the
same interface.

-Andi

-- 
This is like TV. I don't like TV.

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/