diff options
author | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2023-10-01 14:46:13 +0200 |
---|---|---|
committer | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2023-10-01 14:56:46 +0200 |
commit | 316a3683d1e01675d59d2ee78bedc69e68347b95 (patch) | |
tree | af4711367bb924b5a73410b22d621f83d91828dd | |
parent | 39c5c73c41c85cdc2a5281b835f3bafd39353249 (diff) | |
download | monitoring-plugins-316a368.tar.gz |
New variable is actually a boolean
-rw-r--r-- | plugins-root/check_dhcp.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/plugins-root/check_dhcp.c b/plugins-root/check_dhcp.c index 9aeff2b0..bc010e16 100644 --- a/plugins-root/check_dhcp.c +++ b/plugins-root/check_dhcp.c | |||
@@ -156,7 +156,7 @@ typedef struct dhcp_offer_struct{ | |||
156 | u_int32_t lease_time; /* lease time in seconds */ | 156 | u_int32_t lease_time; /* lease time in seconds */ |
157 | u_int32_t renewal_time; /* renewal time in seconds */ | 157 | u_int32_t renewal_time; /* renewal time in seconds */ |
158 | u_int32_t rebinding_time; /* rebinding time in seconds */ | 158 | u_int32_t rebinding_time; /* rebinding time in seconds */ |
159 | u_int8_t desired; /* is this offer desired (necessary in exclusive mode) */ | 159 | bool desired; /* is this offer desired (necessary in exclusive mode) */ |
160 | struct dhcp_offer_struct *next; | 160 | struct dhcp_offer_struct *next; |
161 | }dhcp_offer; | 161 | }dhcp_offer; |
162 | 162 | ||
@@ -199,8 +199,8 @@ typedef struct requested_server_struct{ | |||
199 | #define ETHERNET_HARDWARE_ADDRESS 1 /* used in htype field of dhcp packet */ | 199 | #define ETHERNET_HARDWARE_ADDRESS 1 /* used in htype field of dhcp packet */ |
200 | #define ETHERNET_HARDWARE_ADDRESS_LENGTH 6 /* length of Ethernet hardware addresses */ | 200 | #define ETHERNET_HARDWARE_ADDRESS_LENGTH 6 /* length of Ethernet hardware addresses */ |
201 | 201 | ||
202 | u_int8_t unicast = 0; /* unicast mode: mimic a DHCP relay */ | 202 | bool unicast = 0; /* unicast mode: mimic a DHCP relay */ |
203 | u_int8_t exclusive = 0; /* exclusive mode aka "rogue DHCP server detection" */ | 203 | bool exclusive = 0; /* exclusive mode aka "rogue DHCP server detection" */ |
204 | struct in_addr my_ip; /* our address (required for relay) */ | 204 | struct in_addr my_ip; /* our address (required for relay) */ |
205 | struct in_addr dhcp_ip; /* server to query (if in unicast mode) */ | 205 | struct in_addr dhcp_ip; /* server to query (if in unicast mode) */ |
206 | unsigned char client_hardware_address[MAX_DHCP_CHADDR_LENGTH]=""; | 206 | unsigned char client_hardware_address[MAX_DHCP_CHADDR_LENGTH]=""; |
@@ -902,7 +902,7 @@ int add_dhcp_offer(struct in_addr source,dhcp_packet *offer_packet){ | |||
902 | new_offer->lease_time=dhcp_lease_time; | 902 | new_offer->lease_time=dhcp_lease_time; |
903 | new_offer->renewal_time=dhcp_renewal_time; | 903 | new_offer->renewal_time=dhcp_renewal_time; |
904 | new_offer->rebinding_time=dhcp_rebinding_time; | 904 | new_offer->rebinding_time=dhcp_rebinding_time; |
905 | new_offer->desired=FALSE; /* exclusive mode: we'll check that in get_results */ | 905 | new_offer->desired=false; /* exclusive mode: we'll check that in get_results */ |
906 | 906 | ||
907 | 907 | ||
908 | if(verbose){ | 908 | if(verbose){ |
@@ -983,7 +983,7 @@ int get_results(void){ | |||
983 | if(temp_server->answered == FALSE){ | 983 | if(temp_server->answered == FALSE){ |
984 | requested_responses++; | 984 | requested_responses++; |
985 | temp_server->answered=TRUE; | 985 | temp_server->answered=TRUE; |
986 | temp_offer->desired=TRUE; | 986 | temp_offer->desired=true; |
987 | } | 987 | } |
988 | } | 988 | } |
989 | } | 989 | } |
@@ -991,7 +991,7 @@ int get_results(void){ | |||
991 | 991 | ||
992 | /* exclusive mode: check for undesired offers */ | 992 | /* exclusive mode: check for undesired offers */ |
993 | for(temp_offer=dhcp_offer_list;temp_offer!=NULL;temp_offer=temp_offer->next) { | 993 | for(temp_offer=dhcp_offer_list;temp_offer!=NULL;temp_offer=temp_offer->next) { |
994 | if (temp_offer->desired == FALSE) { | 994 | if (!temp_offer->desired) { |
995 | undesired_offer=temp_offer; /* Checks only for the first undesired offer */ | 995 | undesired_offer=temp_offer; /* Checks only for the first undesired offer */ |
996 | break; /* no further checks needed */ | 996 | break; /* no further checks needed */ |
997 | } | 997 | } |
@@ -1148,10 +1148,10 @@ int call_getopt(int argc, char **argv){ | |||
1148 | break; | 1148 | break; |
1149 | 1149 | ||
1150 | case 'u': /* unicast testing */ | 1150 | case 'u': /* unicast testing */ |
1151 | unicast=1; | 1151 | unicast=true; |
1152 | break; | 1152 | break; |
1153 | case 'x': /* exclusive testing aka "rogue DHCP server detection" */ | 1153 | case 'x': /* exclusive testing aka "rogue DHCP server detection" */ |
1154 | exclusive=1; | 1154 | exclusive=true; |
1155 | break; | 1155 | break; |
1156 | 1156 | ||
1157 | case 'V': /* version */ | 1157 | case 'V': /* version */ |