summaryrefslogtreecommitdiffstats
path: root/plugins-root/check_dhcp.c
diff options
context:
space:
mode:
authorLorenz Kästle <12514511+RincewindsHat@users.noreply.github.com>2023-10-01 12:46:13 (GMT)
committerLorenz Kästle <12514511+RincewindsHat@users.noreply.github.com>2023-10-03 10:14:06 (GMT)
commit2723d48d8474315c454e6d7577430b7839d3e196 (patch)
treed2d9d624e3ce2eafab1393dfc4b7ae0c5eb6f837 /plugins-root/check_dhcp.c
parent8b04f5e11d77a9668fb83bc88d507e291996514e (diff)
downloadmonitoring-plugins-2723d48d8474315c454e6d7577430b7839d3e196.tar.gz
New variable is actually a boolean
Diffstat (limited to 'plugins-root/check_dhcp.c')
-rw-r--r--plugins-root/check_dhcp.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/plugins-root/check_dhcp.c b/plugins-root/check_dhcp.c
index 8b8bb98..049268f 100644
--- a/plugins-root/check_dhcp.c
+++ b/plugins-root/check_dhcp.c
@@ -150,7 +150,7 @@ typedef struct dhcp_offer_struct{
150 uint32_t lease_time; /* lease time in seconds */ 150 uint32_t lease_time; /* lease time in seconds */
151 uint32_t renewal_time; /* renewal time in seconds */ 151 uint32_t renewal_time; /* renewal time in seconds */
152 uint32_t rebinding_time; /* rebinding time in seconds */ 152 uint32_t rebinding_time; /* rebinding time in seconds */
153 u_int8_t desired; /* is this offer desired (necessary in exclusive mode) */ 153 bool desired; /* is this offer desired (necessary in exclusive mode) */
154 struct dhcp_offer_struct *next; 154 struct dhcp_offer_struct *next;
155}dhcp_offer; 155}dhcp_offer;
156 156
@@ -193,8 +193,8 @@ typedef struct requested_server_struct{
193#define ETHERNET_HARDWARE_ADDRESS 1 /* used in htype field of dhcp packet */ 193#define ETHERNET_HARDWARE_ADDRESS 1 /* used in htype field of dhcp packet */
194#define ETHERNET_HARDWARE_ADDRESS_LENGTH 6 /* length of Ethernet hardware addresses */ 194#define ETHERNET_HARDWARE_ADDRESS_LENGTH 6 /* length of Ethernet hardware addresses */
195 195
196uint8_t unicast = 0; /* unicast mode: mimic a DHCP relay */ 196bool unicast = 0; /* unicast mode: mimic a DHCP relay */
197u_int8_t exclusive = 0; /* exclusive mode aka "rogue DHCP server detection" */ 197bool exclusive = 0; /* exclusive mode aka "rogue DHCP server detection" */
198struct in_addr my_ip; /* our address (required for relay) */ 198struct in_addr my_ip; /* our address (required for relay) */
199struct in_addr dhcp_ip; /* server to query (if in unicast mode) */ 199struct in_addr dhcp_ip; /* server to query (if in unicast mode) */
200unsigned char client_hardware_address[MAX_DHCP_CHADDR_LENGTH]=""; 200unsigned char client_hardware_address[MAX_DHCP_CHADDR_LENGTH]="";
@@ -896,7 +896,7 @@ int add_dhcp_offer(struct in_addr source,dhcp_packet *offer_packet){
896 new_offer->lease_time=dhcp_lease_time; 896 new_offer->lease_time=dhcp_lease_time;
897 new_offer->renewal_time=dhcp_renewal_time; 897 new_offer->renewal_time=dhcp_renewal_time;
898 new_offer->rebinding_time=dhcp_rebinding_time; 898 new_offer->rebinding_time=dhcp_rebinding_time;
899 new_offer->desired=FALSE; /* exclusive mode: we'll check that in get_results */ 899 new_offer->desired=false; /* exclusive mode: we'll check that in get_results */
900 900
901 901
902 if(verbose){ 902 if(verbose){
@@ -977,6 +977,7 @@ int get_results(void){
977 if(!temp_server->answered){ 977 if(!temp_server->answered){
978 requested_responses++; 978 requested_responses++;
979 temp_server->answered=true; 979 temp_server->answered=true;
980 temp_offer->desired=true;
980 } 981 }
981 } 982 }
982 } 983 }
@@ -984,7 +985,7 @@ int get_results(void){
984 985
985 /* exclusive mode: check for undesired offers */ 986 /* exclusive mode: check for undesired offers */
986 for(temp_offer=dhcp_offer_list;temp_offer!=NULL;temp_offer=temp_offer->next) { 987 for(temp_offer=dhcp_offer_list;temp_offer!=NULL;temp_offer=temp_offer->next) {
987 if (temp_offer->desired == FALSE) { 988 if (!temp_offer->desired) {
988 undesired_offer=temp_offer; /* Checks only for the first undesired offer */ 989 undesired_offer=temp_offer; /* Checks only for the first undesired offer */
989 break; /* no further checks needed */ 990 break; /* no further checks needed */
990 } 991 }
@@ -1141,10 +1142,10 @@ int call_getopt(int argc, char **argv){
1141 break; 1142 break;
1142 1143
1143 case 'u': /* unicast testing */ 1144 case 'u': /* unicast testing */
1144 unicast=1; 1145 unicast=true;
1145 break; 1146 break;
1146 case 'x': /* exclusive testing aka "rogue DHCP server detection" */ 1147 case 'x': /* exclusive testing aka "rogue DHCP server detection" */
1147 exclusive=1; 1148 exclusive=true;
1148 break; 1149 break;
1149 1150
1150 case 'V': /* version */ 1151 case 'V': /* version */