[PATCH] Outbound connections from alternate interfaces

Sam Clippinger <[email protected]>
Newsgroups gmane.network.nagios.plugins.devel
Message-ID <[email protected]>
Hey, thanks for a great package!  It's been a lifesaver!

Most of my servers have multiple IP addresses and today I needed the ability to check outbound SMTP from those secondary addresses instead of always using the primary address.  (I use check_smtp to test if my mail servers are blocked by blacklists that can't be checked through DNS (e.g. AT&T) and some of my servers use alternate interfaces for delivery.)  So I came up with this patch.  It adds a "-I" argument to check_smtp that will accept a hostname, IP or IPv6 address.  If the argument is supplied and the address is bound to the local machine, it will use it for the outgoing connection.  If it can't bind to the address, it will print an error and exit with UNKNOWN status.  Since the meat of the changes are in netutils.[ch], it should be trivial to add a similar argument to other tests as well, if anyone wants to.

The patch is against version 1.4.16.  It compiles cleanly and works on CentOS 5.9.

-- Sam Clippinger

------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013 
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb

_______________________________________________________
Nagios Plugin Development Mailing List Nagiosplug-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Unsubscribe at https://lists.sourceforge.net/lists/listinfo/nagiosplug-devel
::: Please include plugins version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.