SF.net SVN: nagiosplug: [2018] nagiosplug/trunk/plugins-root/check_dhcp.c

[email protected]
Newsgroups gmane.network.nagios.plugins.cvs
Message-ID <[email protected]>
Revision: 2018
          http://nagiosplug.svn.sourceforge.net/nagiosplug/?rev=2018&view=rev
Author:   hweiss
Date:     2008-07-06 05:57:11 -0700 (Sun, 06 Jul 2008)

Log Message:
-----------
Don't try to set the "SO_BROADCAST" socket option for unicast requests.
(Also, removed the unused "DHCP_UNICAST_FLAG" macro.)

Modified Paths:
--------------
    nagiosplug/trunk/plugins-root/check_dhcp.c

Modified: nagiosplug/trunk/plugins-root/check_dhcp.c
===================================================================
--- nagiosplug/trunk/plugins-root/check_dhcp.c	2008-07-02 20:07:00 UTC (rev 2017)
+++ nagiosplug/trunk/plugins-root/check_dhcp.c	2008-07-06 12:57:11 UTC (rev 2018)
@@ -195,7 +195,6 @@
 #define DHCP_INFINITE_TIME              0xFFFFFFFF
 
 #define DHCP_BROADCAST_FLAG 32768
-#define DHCP_UNICAST_FLAG   0
 
 #define DHCP_SERVER_PORT   67
 #define DHCP_CLIENT_PORT   68
@@ -767,7 +766,7 @@
 	        }
 
         /* set the broadcast option - we need this to listen to DHCP broadcast messages */
-        if(setsockopt(sock,SOL_SOCKET,SO_BROADCAST,(char *)&flag,sizeof flag)<0){
+        if(!unicast && setsockopt(sock,SOL_SOCKET,SO_BROADCAST,(char *)&flag,sizeof flag)<0){
 		printf(_("Error: Could not set broadcast option on DHCP socket!\n"));
 		exit(STATE_UNKNOWN);
 	        }


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
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.