Thread (9 messages) 9 messages, 5 authors, 2006-04-30

Re: determine outgoing interface (eth0,eth1) for a packet according to the dest IP

From: Herbert Xu <herbert@gondor.apana.org.au>
Date: 2006-04-30 12:55:53

On Sun, Apr 30, 2006 at 11:17:11AM +0200, Lennert Buytenhek wrote:
A fragile and ugly but easier/shorter way of getting the source address
(which I've used a couple of times in the past) is to open a SOCK_DGRAM
socket, connect() it to the intended destination, and then do
getsockname().
Yes you're quite right that this would've been a much simpler solution.
I suppose I was quite fond of the netlink hammer at the time :)
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} [off-list ref]
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help