[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [msmtp-users] PATCH: bind to source IP
I don't know what the "ideal" method of doing it is. The patch is a pretty much one-for-one copy of the same from the ssmtp project:
http://m.cr.uz/ssmtp-srchost/
I verified that the proper network device is bound by looking at tcpdump output (I set up a dummy0 device and bound to its IP)
The purpose is to do source based routing. For example, you want to route emails out your OpenVPN tunnel instead of your default route.
--G H
----- Original Message -----
From: Martin Lambers <marlam@...23...>
To: msmtp-users@lists.sourceforge.net
Cc: G H <uothrawn@...1...>
Sent: Monday, March 9, 2015 5:28 AM
Subject: Re: [msmtp-users] PATCH: bind to source IP
On Fri, 20 Feb 2015 14:12:51 +0000 (UTC), G H wrote:
> Patch is attached to cause msmtp to bind to a source IP address
> before connecting to the remote endpoint. This is useful for
> source-based routing. Note that DNS lookups will still be going out
> your default interface; use a local dnsmasq or IPtables SNATing to
> fix this.
I must admit I'm not familiar with the use case of source-based
routing. I once read that one should use SO_BINDTODEVICE if the packets
should go out a specific network interface; is this what you want to
do? If not, could you explain how binding to an IP address is useful;
if yes, could you explain the relation of your patch to SO_BINDTODEVICE?
For example, this article seems to hint at problems:
http://codingrelic.geekhold.com/2009/10/code-snippet-sobindtodevice.html
Regards,
Martin