summaryrefslogtreecommitdiffstats
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-01 13:17:43 (GMT)
commit14d63067c39cf0c9a59a33149284478b305ffde9 (patch)
tree4cb37056a5d9b3b7de51f29463f11ad1fd7bd695
parentc909b1a63efac08d066965496a757232c3193cc1 (diff)
downloadmonitoring-plugins-14d6306.tar.gz
New variable is actually a boolean
-rw-r--r--plugins-root/check_dhcp.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/plugins-root/check_dhcp.c b/plugins-root/check_dhcp.c
index 9aeff2b..bc010e1 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
202u_int8_t unicast = 0; /* unicast mode: mimic a DHCP relay */ 202bool unicast = 0; /* unicast mode: mimic a DHCP relay */
203u_int8_t exclusive = 0; /* exclusive mode aka "rogue DHCP server detection" */ 203bool exclusive = 0; /* exclusive mode aka "rogue DHCP server detection" */
204struct in_addr my_ip; /* our address (required for relay) */ 204struct in_addr my_ip; /* our address (required for relay) */
205struct in_addr dhcp_ip; /* server to query (if in unicast mode) */ 205struct in_addr dhcp_ip; /* server to query (if in unicast mode) */
206unsigned char client_hardware_address[MAX_DHCP_CHADDR_LENGTH]=""; 206unsigned 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 */