[Nagiosplug-devel] [ nagiosplug-Patches-1218235 ] unicast support for check_dhcp
SourceForge.net
noreply at sourceforge.net
Thu Jul 26 02:14:32 CEST 2007
Patches item #1218235, was opened at 2005-06-10 15:49
Message generated for change (Comment added) made by hweiss
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=397599&aid=1218235&group_id=29880
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Enhancement
Group: None
>Status: Closed
>Resolution: Accepted
Priority: 5
Private: No
Submitted By: Andreas Ericsson (ageric)
Assigned to: Holger Weiss (hweiss)
Summary: unicast support for check_dhcp
Initial Comment:
Heiti Ernits, an employee at Boras Kommun has added
unicast support to the check_dchp plugin. I reworked it
a bit to be more general and removed the hardcoded
stuff. I also added detection of ones own IP-address to
use for the return route.
It gives check_dhcp the ability to mimic a dhcp-relay
server, which use unicast when talking to the server
and therefore can be used to query dhcp-servers on
separate and even remote subnets. There are routing
rules ofcourse. Querying a dhcp-server with ip
192.168.0.4 on subnet A from 192.168.0.3 on subnet B
won't work, as the dhcp-server then will redirect its
responses to a host on the same subnet (which may or
may not exist) rather than the correct server. Sane
networks probably won't suffer from it, and it may be
possible to work around it (although I can't imagine how).
Apply with patch -p1 < nagiosplug-check_dhcp-unicast.diff
----------------------------------------------------------------------
>Comment By: Holger Weiss (hweiss)
Date: 2007-07-26 02:14
Message:
Logged In: YES
user_id=759506
Originator: NO
I reviewed the code, updated the patch for the current revision of
check_dhcp.c, tested the functionality and committed it with the
following changes:
1) The patch included a *huge* amount of white-space changes and other
unrelated, purely cosmetic stuff. I went through the patch line by
line and backed out all that stuff before committing, otherwise the
commit diff would've been pretty unreadable. This reduced the size
of the unidiff from about 1900 to 220 lines (with my additional
changes, it's now about 280 lines). *If* we change white-space, we
should do so in one big seperate commit which cleans things up
(though I still don't really like the idea of making diffs crossing
such a commit unreadable). Must be discussed on the list, somewhere
along the way ...
2) The patch required the user to specify the value to use for the
'hops' field of the DHCP packet as an argument to the new "-u,
--unicast" flag. The 'hops' field is a count of the number of DHCP
relay agents which have seen the packet so far, each agent must
increment the value of this field if forwarding the packet (see RFC
1542, 4.1.1). I guess having to specify such a value might be
confusing for users and I don't see how using a value != 1 could be
useful. So, I changed "--unicast" to not take an argument and
hardcoded a 'hops' value of 1 for unicast requests.
3) The patch uses an ioctl(2) call to detect the IP address of the
client's interface. This call was only done if __linux__ is
#defined (unicast requests wouldn't have worked on other platforms),
though the call is actually quite portable. So now, the call will
be done on all platforms which define the request macro used by the
call (SIOCGIFADDR). This works on all platforms I tested (though I
had to include <sys/sockio.h> for Solaris). On platforms which don't
#define SIOCGIFADDR, "--unicast" will spit out an error.
4) I moved the IP address detection out of get_hardware_address() into
a seperate get_ip_address() function.
5) Various minor cleanups.
I'll also add an option to specify the MAC address to use on the command
line, but that's not really related to this patch.
Thank you, Holger
----------------------------------------------------------------------
Comment By: Holger Weiss (hweiss)
Date: 2007-07-11 17:38
Message:
Logged In: YES
user_id=759506
Originator: NO
Thank you very much. I hope I'll find the time to look into the patch and
test it Really Soon Now[tm].
Holger
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=397599&aid=1218235&group_id=29880
More information about the Devel
mailing list