diff options
-rw-r--r-- | plugins-root/check_dhcp.c | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/plugins-root/check_dhcp.c b/plugins-root/check_dhcp.c index 2d22619..312de54 100644 --- a/plugins-root/check_dhcp.c +++ b/plugins-root/check_dhcp.c | |||
@@ -98,10 +98,6 @@ static struct strbuf dat = {AREA_SZ, 0, (char *)dat_area}; | |||
98 | #define GOT_INTR 4 | 98 | #define GOT_INTR 4 |
99 | #define GOT_ERR 128 | 99 | #define GOT_ERR 128 |
100 | 100 | ||
101 | #define u_int8_t uint8_t | ||
102 | #define u_int16_t uint16_t | ||
103 | #define u_int32_t uint32_t | ||
104 | |||
105 | static int get_msg(int); | 101 | static int get_msg(int); |
106 | static int check_ctrl(int); | 102 | static int check_ctrl(int); |
107 | static int put_ctrl(int, int, int); | 103 | static int put_ctrl(int, int, int); |
@@ -132,13 +128,13 @@ long mac_addr_dlpi( const char *, int, u_char *); | |||
132 | 128 | ||
133 | 129 | ||
134 | typedef struct dhcp_packet_struct{ | 130 | typedef struct dhcp_packet_struct{ |
135 | u_int8_t op; /* packet type */ | 131 | uint8_t op; /* packet type */ |
136 | u_int8_t htype; /* type of hardware address for this machine (Ethernet, etc) */ | 132 | uint8_t htype; /* type of hardware address for this machine (Ethernet, etc) */ |
137 | u_int8_t hlen; /* length of hardware address (of this machine) */ | 133 | uint8_t hlen; /* length of hardware address (of this machine) */ |
138 | u_int8_t hops; /* hops */ | 134 | uint8_t hops; /* hops */ |
139 | u_int32_t xid; /* random transaction id number - chosen by this machine */ | 135 | uint32_t xid; /* random transaction id number - chosen by this machine */ |
140 | u_int16_t secs; /* seconds used in timing */ | 136 | uint16_t secs; /* seconds used in timing */ |
141 | u_int16_t flags; /* flags */ | 137 | uint16_t flags; /* flags */ |
142 | struct in_addr ciaddr; /* IP address of this machine (if we already have one) */ | 138 | struct in_addr ciaddr; /* IP address of this machine (if we already have one) */ |
143 | struct in_addr yiaddr; /* IP address of this machine (offered by the DHCP server) */ | 139 | struct in_addr yiaddr; /* IP address of this machine (offered by the DHCP server) */ |
144 | struct in_addr siaddr; /* IP address of next server */ | 140 | struct in_addr siaddr; /* IP address of next server */ |
@@ -153,9 +149,9 @@ typedef struct dhcp_packet_struct{ | |||
153 | typedef struct dhcp_offer_struct{ | 149 | typedef struct dhcp_offer_struct{ |
154 | struct in_addr server_address; /* address of DHCP server that sent this offer */ | 150 | struct in_addr server_address; /* address of DHCP server that sent this offer */ |
155 | struct in_addr offered_address; /* the IP address that was offered to us */ | 151 | struct in_addr offered_address; /* the IP address that was offered to us */ |
156 | u_int32_t lease_time; /* lease time in seconds */ | 152 | uint32_t lease_time; /* lease time in seconds */ |
157 | u_int32_t renewal_time; /* renewal time in seconds */ | 153 | uint32_t renewal_time; /* renewal time in seconds */ |
158 | u_int32_t rebinding_time; /* rebinding time in seconds */ | 154 | uint32_t rebinding_time; /* rebinding time in seconds */ |
159 | struct dhcp_offer_struct *next; | 155 | struct dhcp_offer_struct *next; |
160 | }dhcp_offer; | 156 | }dhcp_offer; |
161 | 157 | ||
@@ -198,7 +194,7 @@ typedef struct requested_server_struct{ | |||
198 | #define ETHERNET_HARDWARE_ADDRESS 1 /* used in htype field of dhcp packet */ | 194 | #define ETHERNET_HARDWARE_ADDRESS 1 /* used in htype field of dhcp packet */ |
199 | #define ETHERNET_HARDWARE_ADDRESS_LENGTH 6 /* length of Ethernet hardware addresses */ | 195 | #define ETHERNET_HARDWARE_ADDRESS_LENGTH 6 /* length of Ethernet hardware addresses */ |
200 | 196 | ||
201 | u_int8_t unicast = 0; /* unicast mode: mimic a DHCP relay */ | 197 | uint8_t unicast = 0; /* unicast mode: mimic a DHCP relay */ |
202 | struct in_addr my_ip; /* our address (required for relay) */ | 198 | struct in_addr my_ip; /* our address (required for relay) */ |
203 | struct in_addr dhcp_ip; /* server to query (if in unicast mode) */ | 199 | struct in_addr dhcp_ip; /* server to query (if in unicast mode) */ |
204 | unsigned char client_hardware_address[MAX_DHCP_CHADDR_LENGTH]=""; | 200 | unsigned char client_hardware_address[MAX_DHCP_CHADDR_LENGTH]=""; |
@@ -206,11 +202,11 @@ unsigned char *user_specified_mac=NULL; | |||
206 | 202 | ||
207 | char network_interface_name[IFNAMSIZ]="eth0"; | 203 | char network_interface_name[IFNAMSIZ]="eth0"; |
208 | 204 | ||
209 | u_int32_t packet_xid=0; | 205 | uint32_t packet_xid=0; |
210 | 206 | ||
211 | u_int32_t dhcp_lease_time=0; | 207 | uint32_t dhcp_lease_time=0; |
212 | u_int32_t dhcp_renewal_time=0; | 208 | uint32_t dhcp_renewal_time=0; |
213 | u_int32_t dhcp_rebinding_time=0; | 209 | uint32_t dhcp_rebinding_time=0; |
214 | 210 | ||
215 | int dhcpoffer_timeout=2; | 211 | int dhcpoffer_timeout=2; |
216 | 212 | ||
@@ -948,7 +944,7 @@ int get_results(void){ | |||
948 | dhcp_offer *temp_offer; | 944 | dhcp_offer *temp_offer; |
949 | requested_server *temp_server; | 945 | requested_server *temp_server; |
950 | int result; | 946 | int result; |
951 | u_int32_t max_lease_time=0; | 947 | uint32_t max_lease_time=0; |
952 | 948 | ||
953 | received_requested_address=FALSE; | 949 | received_requested_address=FALSE; |
954 | 950 | ||