Re: [PATCH] Outbound connections from alternate interfaces

Holger Weiß <[email protected]>
Newsgroups gmane.network.nagios.plugins.devel
Organization Freie Universität Berlin
Message-ID <[email protected]>
* Sam Clippinger <[email protected]> [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.

Indeed.

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

Holger

------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
_______________________________________________________
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.