summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins-root/check_dhcp.c36
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
105static int get_msg(int); 101static int get_msg(int);
106static int check_ctrl(int); 102static int check_ctrl(int);
107static int put_ctrl(int, int, int); 103static int put_ctrl(int, int, int);
@@ -132,13 +128,13 @@ long mac_addr_dlpi( const char *, int, u_char *);
132 128
133 129
134typedef struct dhcp_packet_struct{ 130typedef 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{
153typedef struct dhcp_offer_struct{ 149typedef 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
201u_int8_t unicast = 0; /* unicast mode: mimic a DHCP relay */ 197uint8_t unicast = 0; /* unicast mode: mimic a DHCP relay */
202struct in_addr my_ip; /* our address (required for relay) */ 198struct in_addr my_ip; /* our address (required for relay) */
203struct in_addr dhcp_ip; /* server to query (if in unicast mode) */ 199struct in_addr dhcp_ip; /* server to query (if in unicast mode) */
204unsigned char client_hardware_address[MAX_DHCP_CHADDR_LENGTH]=""; 200unsigned char client_hardware_address[MAX_DHCP_CHADDR_LENGTH]="";
@@ -206,11 +202,11 @@ unsigned char *user_specified_mac=NULL;
206 202
207char network_interface_name[IFNAMSIZ]="eth0"; 203char network_interface_name[IFNAMSIZ]="eth0";
208 204
209u_int32_t packet_xid=0; 205uint32_t packet_xid=0;
210 206
211u_int32_t dhcp_lease_time=0; 207uint32_t dhcp_lease_time=0;
212u_int32_t dhcp_renewal_time=0; 208uint32_t dhcp_renewal_time=0;
213u_int32_t dhcp_rebinding_time=0; 209uint32_t dhcp_rebinding_time=0;
214 210
215int dhcpoffer_timeout=2; 211int 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