[Nagiosplug-devel] [PATCH] Outbound connections from alternate interfaces

Holger Weiß holger at cis.fu-berlin.de
Sat Aug 17 17:27:39 UTC 2013

* Sam Clippinger <samc at silence.org> [2013-02-05 12:25]:
> 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.

Looks fine to me.  Just a stylistic note: I wouldn't name the function
"np_net_connect_inner", as the caller isn't interested in whether or not
it's wrapped by some other function within netutils.c.  Maybe call it
"np_net_connect_from" instead?

Could you change the name and then create a pull request on GitHub (or
via email)?  If you could also add a test case for the new option, that
would be awesome.

> 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.


Thank you for your contribution, and sorry for the late reply.


More information about the Nagiosplugin-devel mailing list