aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>2004-01-30 23:45:53 +0000
committerandersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>2004-01-30 23:45:53 +0000
commit326358338adbde8a3ba6f1db5cc704db4b05a3b3 (patch)
tree59f5094313c8ee69e48f632a217835a8bb36bda6
parenteae2f616ef03261f065d10e2f1e50cae51baf2cb (diff)
downloadbusybox-w32-326358338adbde8a3ba6f1db5cc704db4b05a3b3.tar.gz
busybox-w32-326358338adbde8a3ba6f1db5cc704db4b05a3b3.tar.bz2
busybox-w32-326358338adbde8a3ba6f1db5cc704db4b05a3b3.zip
Use standard C99 types
git-svn-id: svn://busybox.net/trunk/busybox@8379 69ca8d6d-28ef-0310-b511-8ec308f3f277
-rw-r--r--networking/udhcp/arpping.c4
-rw-r--r--networking/udhcp/arpping.h22
-rw-r--r--networking/udhcp/clientpacket.c8
-rw-r--r--networking/udhcp/dhcpc.c2
-rw-r--r--networking/udhcp/dhcpc.h6
-rw-r--r--networking/udhcp/dhcpd.c6
-rw-r--r--networking/udhcp/dhcpd.h14
-rw-r--r--networking/udhcp/files.c6
-rw-r--r--networking/udhcp/leases.c16
-rw-r--r--networking/udhcp/leases.h18
-rw-r--r--networking/udhcp/options.c24
-rw-r--r--networking/udhcp/options.h10
-rw-r--r--networking/udhcp/packet.c18
-rw-r--r--networking/udhcp/packet.h42
-rw-r--r--networking/udhcp/script.c14
-rw-r--r--networking/udhcp/serverpacket.c14
-rw-r--r--networking/udhcp/serverpacket.h2
-rw-r--r--networking/udhcp/socket.c4
-rw-r--r--networking/udhcp/socket.h4
19 files changed, 117 insertions, 117 deletions
diff --git a/networking/udhcp/arpping.c b/networking/udhcp/arpping.c
index 363408d6e..f2e3768c5 100644
--- a/networking/udhcp/arpping.c
+++ b/networking/udhcp/arpping.c
@@ -29,7 +29,7 @@
29 */ 29 */
30 30
31/* FIXME: match response against chaddr */ 31/* FIXME: match response against chaddr */
32int arpping(u_int32_t yiaddr, u_int32_t ip, unsigned char *mac, char *interface) 32int arpping(uint32_t yiaddr, uint32_t ip, uint8_t *mac, char *interface)
33{ 33{
34 34
35 int timeout = 2; 35 int timeout = 2;
@@ -91,7 +91,7 @@ int arpping(u_int32_t yiaddr, u_int32_t ip, unsigned char *mac, char *interface)
91 if (recv(s, &arp, sizeof(arp), 0) < 0 ) rv = 0; 91 if (recv(s, &arp, sizeof(arp), 0) < 0 ) rv = 0;
92 if (arp.operation == htons(ARPOP_REPLY) && 92 if (arp.operation == htons(ARPOP_REPLY) &&
93 bcmp(arp.tHaddr, mac, 6) == 0 && 93 bcmp(arp.tHaddr, mac, 6) == 0 &&
94 *((u_int *) arp.sInaddr) == yiaddr) { 94 *((uint32_t *) arp.sInaddr) == yiaddr) {
95 DEBUG(LOG_INFO, "Valid arp reply receved for this address"); 95 DEBUG(LOG_INFO, "Valid arp reply receved for this address");
96 rv = 0; 96 rv = 0;
97 break; 97 break;
diff --git a/networking/udhcp/arpping.h b/networking/udhcp/arpping.h
index 92b828db5..99413aab6 100644
--- a/networking/udhcp/arpping.h
+++ b/networking/udhcp/arpping.h
@@ -12,19 +12,19 @@
12 12
13struct arpMsg { 13struct arpMsg {
14 struct ethhdr ethhdr; /* Ethernet header */ 14 struct ethhdr ethhdr; /* Ethernet header */
15 u_short htype; /* hardware type (must be ARPHRD_ETHER) */ 15 uint16_t htype; /* hardware type (must be ARPHRD_ETHER) */
16 u_short ptype; /* protocol type (must be ETH_P_IP) */ 16 uint16_t ptype; /* protocol type (must be ETH_P_IP) */
17 u_char hlen; /* hardware address length (must be 6) */ 17 uint8_t hlen; /* hardware address length (must be 6) */
18 u_char plen; /* protocol address length (must be 4) */ 18 uint8_t plen; /* protocol address length (must be 4) */
19 u_short operation; /* ARP opcode */ 19 uint16_t operation; /* ARP opcode */
20 u_char sHaddr[6]; /* sender's hardware address */ 20 uint8_t sHaddr[6]; /* sender's hardware address */
21 u_char sInaddr[4]; /* sender's IP address */ 21 uint8_t sInaddr[4]; /* sender's IP address */
22 u_char tHaddr[6]; /* target's hardware address */ 22 uint8_t tHaddr[6]; /* target's hardware address */
23 u_char tInaddr[4]; /* target's IP address */ 23 uint8_t tInaddr[4]; /* target's IP address */
24 u_char pad[18]; /* pad for min. Ethernet payload (60 bytes) */ 24 uint8_t pad[18]; /* pad for min. Ethernet payload (60 bytes) */
25}; 25};
26 26
27/* function prototypes */ 27/* function prototypes */
28int arpping(u_int32_t yiaddr, u_int32_t ip, unsigned char *arp, char *interface); 28int arpping(uint32_t yiaddr, uint32_t ip, uint8_t *arp, char *interface);
29 29
30#endif 30#endif
diff --git a/networking/udhcp/clientpacket.c b/networking/udhcp/clientpacket.c
index 5cbe79e7e..6838c07e8 100644
--- a/networking/udhcp/clientpacket.c
+++ b/networking/udhcp/clientpacket.c
@@ -78,7 +78,7 @@ static void init_packet(struct dhcpMessage *packet, char type)
78 memcpy(packet->chaddr, client_config.arp, 6); 78 memcpy(packet->chaddr, client_config.arp, 6);
79 add_option_string(packet->options, client_config.clientid); 79 add_option_string(packet->options, client_config.clientid);
80 if (client_config.hostname) add_option_string(packet->options, client_config.hostname); 80 if (client_config.hostname) add_option_string(packet->options, client_config.hostname);
81 add_option_string(packet->options, (unsigned char *) &vendor_id); 81 add_option_string(packet->options, (uint8_t *) &vendor_id);
82} 82}
83 83
84 84
@@ -179,8 +179,8 @@ int get_raw_packet(struct dhcpMessage *payload, int fd)
179{ 179{
180 int bytes; 180 int bytes;
181 struct udp_dhcp_packet packet; 181 struct udp_dhcp_packet packet;
182 u_int32_t source, dest; 182 uint32_t source, dest;
183 u_int16_t check; 183 uint16_t check;
184 184
185 memset(&packet, 0, sizeof(struct udp_dhcp_packet)); 185 memset(&packet, 0, sizeof(struct udp_dhcp_packet));
186 bytes = read(fd, &packet, sizeof(struct udp_dhcp_packet)); 186 bytes = read(fd, &packet, sizeof(struct udp_dhcp_packet));
@@ -207,7 +207,7 @@ int get_raw_packet(struct dhcpMessage *payload, int fd)
207 if (packet.ip.protocol != IPPROTO_UDP || packet.ip.version != IPVERSION || 207 if (packet.ip.protocol != IPPROTO_UDP || packet.ip.version != IPVERSION ||
208 packet.ip.ihl != sizeof(packet.ip) >> 2 || packet.udp.dest != htons(CLIENT_PORT) || 208 packet.ip.ihl != sizeof(packet.ip) >> 2 || packet.udp.dest != htons(CLIENT_PORT) ||
209 bytes > (int) sizeof(struct udp_dhcp_packet) || 209 bytes > (int) sizeof(struct udp_dhcp_packet) ||
210 ntohs(packet.udp.len) != (short) (bytes - sizeof(packet.ip))) { 210 ntohs(packet.udp.len) != (uint16_t) (bytes - sizeof(packet.ip))) {
211 DEBUG(LOG_INFO, "unrelated/bogus packet"); 211 DEBUG(LOG_INFO, "unrelated/bogus packet");
212 return -2; 212 return -2;
213 } 213 }
diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c
index a180cc514..2ba42d295 100644
--- a/networking/udhcp/dhcpc.c
+++ b/networking/udhcp/dhcpc.c
@@ -179,7 +179,7 @@ int udhcpc_main(int argc, char *argv[])
179int main(int argc, char *argv[]) 179int main(int argc, char *argv[])
180#endif 180#endif
181{ 181{
182 unsigned char *temp, *message; 182 uint8_t *temp, *message;
183 unsigned long t1 = 0, t2 = 0, xid = 0; 183 unsigned long t1 = 0, t2 = 0, xid = 0;
184 unsigned long start = 0, lease; 184 unsigned long start = 0, lease;
185 fd_set rfds; 185 fd_set rfds;
diff --git a/networking/udhcp/dhcpc.h b/networking/udhcp/dhcpc.h
index 7145cbd8b..9c4aa95f7 100644
--- a/networking/udhcp/dhcpc.h
+++ b/networking/udhcp/dhcpc.h
@@ -25,10 +25,10 @@ struct client_config_t {
25 char *interface; /* The name of the interface to use */ 25 char *interface; /* The name of the interface to use */
26 char *pidfile; /* Optionally store the process ID */ 26 char *pidfile; /* Optionally store the process ID */
27 char *script; /* User script to run at dhcp events */ 27 char *script; /* User script to run at dhcp events */
28 unsigned char *clientid; /* Optional client id to use */ 28 uint8_t *clientid; /* Optional client id to use */
29 unsigned char *hostname; /* Optional hostname to use */ 29 uint8_t *hostname; /* Optional hostname to use */
30 int ifindex; /* Index number of the interface to use */ 30 int ifindex; /* Index number of the interface to use */
31 unsigned char arp[6]; /* Our arp address */ 31 uint8_t arp[6]; /* Our arp address */
32}; 32};
33 33
34extern struct client_config_t client_config; 34extern struct client_config_t client_config;
diff --git a/networking/udhcp/dhcpd.c b/networking/udhcp/dhcpd.c
index aabab38b0..8c944f243 100644
--- a/networking/udhcp/dhcpd.c
+++ b/networking/udhcp/dhcpd.c
@@ -62,9 +62,9 @@ int main(int argc, char *argv[])
62 int server_socket = -1; 62 int server_socket = -1;
63 int bytes, retval; 63 int bytes, retval;
64 struct dhcpMessage packet; 64 struct dhcpMessage packet;
65 unsigned char *state; 65 uint8_t *state;
66 unsigned char *server_id, *requested; 66 uint8_t *server_id, *requested;
67 u_int32_t server_id_align, requested_align; 67 uint32_t server_id_align, requested_align;
68 unsigned long timeout_end; 68 unsigned long timeout_end;
69 struct option_set *option; 69 struct option_set *option;
70 struct dhcpOfferedAddr *lease; 70 struct dhcpOfferedAddr *lease;
diff --git a/networking/udhcp/dhcpd.h b/networking/udhcp/dhcpd.h
index d53a809ca..925634461 100644
--- a/networking/udhcp/dhcpd.h
+++ b/networking/udhcp/dhcpd.h
@@ -89,24 +89,24 @@
89#define SNAME_FIELD 2 89#define SNAME_FIELD 2
90 90
91/* miscellaneous defines */ 91/* miscellaneous defines */
92#define MAC_BCAST_ADDR (unsigned char *) "\xff\xff\xff\xff\xff\xff" 92#define MAC_BCAST_ADDR (uint8_t *) "\xff\xff\xff\xff\xff\xff"
93#define OPT_CODE 0 93#define OPT_CODE 0
94#define OPT_LEN 1 94#define OPT_LEN 1
95#define OPT_DATA 2 95#define OPT_DATA 2
96 96
97struct option_set { 97struct option_set {
98 unsigned char *data; 98 uint8_t *data;
99 struct option_set *next; 99 struct option_set *next;
100}; 100};
101 101
102struct server_config_t { 102struct server_config_t {
103 u_int32_t server; /* Our IP, in network order */ 103 uint32_t server; /* Our IP, in network order */
104 u_int32_t start; /* Start address of leases, network order */ 104 uint32_t start; /* Start address of leases, network order */
105 u_int32_t end; /* End of leases, network order */ 105 uint32_t end; /* End of leases, network order */
106 struct option_set *options; /* List of DHCP options loaded from the config file */ 106 struct option_set *options; /* List of DHCP options loaded from the config file */
107 char *interface; /* The name of the interface to use */ 107 char *interface; /* The name of the interface to use */
108 int ifindex; /* Index number of the interface to use */ 108 int ifindex; /* Index number of the interface to use */
109 unsigned char arp[6]; /* Our arp address */ 109 uint8_t arp[6]; /* Our arp address */
110 unsigned long lease; /* lease time in seconds (host order) */ 110 unsigned long lease; /* lease time in seconds (host order) */
111 unsigned long max_leases; /* maximum number of leases (including reserved address) */ 111 unsigned long max_leases; /* maximum number of leases (including reserved address) */
112 char remaining; /* should the lease file be interpreted as lease time remaining, or 112 char remaining; /* should the lease file be interpreted as lease time remaining, or
@@ -121,7 +121,7 @@ struct server_config_t {
121 char *lease_file; 121 char *lease_file;
122 char *pidfile; 122 char *pidfile;
123 char *notify_file; /* What to run whenever leases are written */ 123 char *notify_file; /* What to run whenever leases are written */
124 u_int32_t siaddr; /* next server bootp option */ 124 uint32_t siaddr; /* next server bootp option */
125 char *sname; /* bootp server name */ 125 char *sname; /* bootp server name */
126 char *boot_file; /* bootp boot file option */ 126 char *boot_file; /* bootp boot file option */
127}; 127};
diff --git a/networking/udhcp/files.c b/networking/udhcp/files.c
index 6d72863ee..0802bb316 100644
--- a/networking/udhcp/files.c
+++ b/networking/udhcp/files.c
@@ -52,7 +52,7 @@ static int read_str(const char *line, void *arg)
52 52
53static int read_u32(const char *line, void *arg) 53static int read_u32(const char *line, void *arg)
54{ 54{
55 u_int32_t *dest = arg; 55 uint32_t *dest = arg;
56 char *endptr; 56 char *endptr;
57 *dest = strtoul(line, &endptr, 0); 57 *dest = strtoul(line, &endptr, 0);
58 return endptr[0] == '\0'; 58 return endptr[0] == '\0';
@@ -83,8 +83,8 @@ static int read_opt(const char *const_line, void *arg)
83 int retval = 0, length; 83 int retval = 0, length;
84 char buffer[8]; 84 char buffer[8];
85 char *line; 85 char *line;
86 u_int16_t *result_u16 = (u_int16_t *) buffer; 86 uint16_t *result_u16 = (uint16_t *) buffer;
87 u_int32_t *result_u32 = (u_int32_t *) buffer; 87 uint32_t *result_u32 = (uint32_t *) buffer;
88 88
89 /* Cheat, the only const line we'll actually get is "" */ 89 /* Cheat, the only const line we'll actually get is "" */
90 line = (char *) const_line; 90 line = (char *) const_line;
diff --git a/networking/udhcp/leases.c b/networking/udhcp/leases.c
index add114f6c..dce056654 100644
--- a/networking/udhcp/leases.c
+++ b/networking/udhcp/leases.c
@@ -17,10 +17,10 @@
17#include "common.h" 17#include "common.h"
18 18
19 19
20unsigned char blank_chaddr[] = {[0 ... 15] = 0}; 20uint8_t blank_chaddr[] = {[0 ... 15] = 0};
21 21
22/* clear every lease out that chaddr OR yiaddr matches and is nonzero */ 22/* clear every lease out that chaddr OR yiaddr matches and is nonzero */
23void clear_lease(u_int8_t *chaddr, u_int32_t yiaddr) 23void clear_lease(uint8_t *chaddr, uint32_t yiaddr)
24{ 24{
25 unsigned int i, j; 25 unsigned int i, j;
26 26
@@ -35,7 +35,7 @@ void clear_lease(u_int8_t *chaddr, u_int32_t yiaddr)
35 35
36 36
37/* add a lease into the table, clearing out any old ones */ 37/* add a lease into the table, clearing out any old ones */
38struct dhcpOfferedAddr *add_lease(u_int8_t *chaddr, u_int32_t yiaddr, unsigned long lease) 38struct dhcpOfferedAddr *add_lease(uint8_t *chaddr, uint32_t yiaddr, unsigned long lease)
39{ 39{
40 struct dhcpOfferedAddr *oldest; 40 struct dhcpOfferedAddr *oldest;
41 41
@@ -80,7 +80,7 @@ struct dhcpOfferedAddr *oldest_expired_lease(void)
80 80
81 81
82/* Find the first lease that matches chaddr, NULL if no match */ 82/* Find the first lease that matches chaddr, NULL if no match */
83struct dhcpOfferedAddr *find_lease_by_chaddr(u_int8_t *chaddr) 83struct dhcpOfferedAddr *find_lease_by_chaddr(uint8_t *chaddr)
84{ 84{
85 unsigned int i; 85 unsigned int i;
86 86
@@ -92,7 +92,7 @@ struct dhcpOfferedAddr *find_lease_by_chaddr(u_int8_t *chaddr)
92 92
93 93
94/* Find the first lease that matches yiaddr, NULL is no match */ 94/* Find the first lease that matches yiaddr, NULL is no match */
95struct dhcpOfferedAddr *find_lease_by_yiaddr(u_int32_t yiaddr) 95struct dhcpOfferedAddr *find_lease_by_yiaddr(uint32_t yiaddr)
96{ 96{
97 unsigned int i; 97 unsigned int i;
98 98
@@ -104,7 +104,7 @@ struct dhcpOfferedAddr *find_lease_by_yiaddr(u_int32_t yiaddr)
104 104
105 105
106/* check is an IP is taken, if it is, add it to the lease table */ 106/* check is an IP is taken, if it is, add it to the lease table */
107static int check_ip(u_int32_t addr) 107static int check_ip(uint32_t addr)
108{ 108{
109 struct in_addr temp; 109 struct in_addr temp;
110 110
@@ -120,9 +120,9 @@ static int check_ip(u_int32_t addr)
120 120
121/* find an assignable address, it check_expired is true, we check all the expired leases as well. 121/* find an assignable address, it check_expired is true, we check all the expired leases as well.
122 * Maybe this should try expired leases by age... */ 122 * Maybe this should try expired leases by age... */
123u_int32_t find_address(int check_expired) 123uint32_t find_address(int check_expired)
124{ 124{
125 u_int32_t addr, ret; 125 uint32_t addr, ret;
126 struct dhcpOfferedAddr *lease = NULL; 126 struct dhcpOfferedAddr *lease = NULL;
127 127
128 addr = ntohl(server_config.start); /* addr is in host order here */ 128 addr = ntohl(server_config.start); /* addr is in host order here */
diff --git a/networking/udhcp/leases.h b/networking/udhcp/leases.h
index 24d860867..b13fa72d3 100644
--- a/networking/udhcp/leases.h
+++ b/networking/udhcp/leases.h
@@ -4,20 +4,20 @@
4 4
5 5
6struct dhcpOfferedAddr { 6struct dhcpOfferedAddr {
7 u_int8_t chaddr[16]; 7 uint8_t chaddr[16];
8 u_int32_t yiaddr; /* network order */ 8 uint32_t yiaddr; /* network order */
9 u_int32_t expires; /* host order */ 9 uint32_t expires; /* host order */
10}; 10};
11 11
12extern unsigned char blank_chaddr[]; 12extern uint8_t blank_chaddr[];
13 13
14void clear_lease(u_int8_t *chaddr, u_int32_t yiaddr); 14void clear_lease(uint8_t *chaddr, uint32_t yiaddr);
15struct dhcpOfferedAddr *add_lease(u_int8_t *chaddr, u_int32_t yiaddr, unsigned long lease); 15struct dhcpOfferedAddr *add_lease(uint8_t *chaddr, uint32_t yiaddr, unsigned long lease);
16int lease_expired(struct dhcpOfferedAddr *lease); 16int lease_expired(struct dhcpOfferedAddr *lease);
17struct dhcpOfferedAddr *oldest_expired_lease(void); 17struct dhcpOfferedAddr *oldest_expired_lease(void);
18struct dhcpOfferedAddr *find_lease_by_chaddr(u_int8_t *chaddr); 18struct dhcpOfferedAddr *find_lease_by_chaddr(uint8_t *chaddr);
19struct dhcpOfferedAddr *find_lease_by_yiaddr(u_int32_t yiaddr); 19struct dhcpOfferedAddr *find_lease_by_yiaddr(uint32_t yiaddr);
20u_int32_t find_address(int check_expired); 20uint32_t find_address(int check_expired);
21 21
22 22
23#endif 23#endif
diff --git a/networking/udhcp/options.c b/networking/udhcp/options.c
index 32deeabb3..1bdf25708 100644
--- a/networking/udhcp/options.c
+++ b/networking/udhcp/options.c
@@ -59,10 +59,10 @@ int option_lengths[] = {
59 59
60 60
61/* get an option with bounds checking (warning, not aligned). */ 61/* get an option with bounds checking (warning, not aligned). */
62unsigned char *get_option(struct dhcpMessage *packet, int code) 62uint8_t *get_option(struct dhcpMessage *packet, int code)
63{ 63{
64 int i, length; 64 int i, length;
65 unsigned char *optionptr; 65 uint8_t *optionptr;
66 int over = 0, done = 0, curr = OPTION_FIELD; 66 int over = 0, done = 0, curr = OPTION_FIELD;
67 67
68 optionptr = packet->options; 68 optionptr = packet->options;
@@ -114,7 +114,7 @@ unsigned char *get_option(struct dhcpMessage *packet, int code)
114 114
115 115
116/* return the position of the 'end' option (no bounds checking) */ 116/* return the position of the 'end' option (no bounds checking) */
117int end_option(unsigned char *optionptr) 117int end_option(uint8_t *optionptr)
118{ 118{
119 int i = 0; 119 int i = 0;
120 120
@@ -128,7 +128,7 @@ int end_option(unsigned char *optionptr)
128 128
129/* add an option string to the options (an option string contains an option code, 129/* add an option string to the options (an option string contains an option code,
130 * length, then data) */ 130 * length, then data) */
131int add_option_string(unsigned char *optionptr, unsigned char *string) 131int add_option_string(uint8_t *optionptr, uint8_t *string)
132{ 132{
133 int end = end_option(optionptr); 133 int end = end_option(optionptr);
134 134
@@ -145,17 +145,17 @@ int add_option_string(unsigned char *optionptr, unsigned char *string)
145 145
146 146
147/* add a one to four byte option to a packet */ 147/* add a one to four byte option to a packet */
148int add_simple_option(unsigned char *optionptr, unsigned char code, u_int32_t data) 148int add_simple_option(uint8_t *optionptr, uint8_t code, uint32_t data)
149{ 149{
150 char length = 0; 150 char length = 0;
151 int i; 151 int i;
152 unsigned char option[2 + 4]; 152 uint8_t option[2 + 4];
153 unsigned char *u8; 153 uint8_t *u8;
154 u_int16_t *u16; 154 uint16_t *u16;
155 u_int32_t *u32; 155 uint32_t *u32;
156 u_int32_t aligned; 156 uint32_t aligned;
157 u8 = (unsigned char *) &aligned; 157 u8 = (uint8_t *) &aligned;
158 u16 = (u_int16_t *) &aligned; 158 u16 = (uint16_t *) &aligned;
159 u32 = &aligned; 159 u32 = &aligned;
160 160
161 for (i = 0; dhcp_options[i].code; i++) 161 for (i = 0; dhcp_options[i].code; i++)
diff --git a/networking/udhcp/options.h b/networking/udhcp/options.h
index a62665801..fbe54c884 100644
--- a/networking/udhcp/options.h
+++ b/networking/udhcp/options.h
@@ -24,16 +24,16 @@ enum {
24struct dhcp_option { 24struct dhcp_option {
25 char name[10]; 25 char name[10];
26 char flags; 26 char flags;
27 unsigned char code; 27 uint8_t code;
28}; 28};
29 29
30extern struct dhcp_option dhcp_options[]; 30extern struct dhcp_option dhcp_options[];
31extern int option_lengths[]; 31extern int option_lengths[];
32 32
33unsigned char *get_option(struct dhcpMessage *packet, int code); 33uint8_t *get_option(struct dhcpMessage *packet, int code);
34int end_option(unsigned char *optionptr); 34int end_option(uint8_t *optionptr);
35int add_option_string(unsigned char *optionptr, unsigned char *string); 35int add_option_string(uint8_t *optionptr, uint8_t *string);
36int add_simple_option(unsigned char *optionptr, unsigned char code, u_int32_t data); 36int add_simple_option(uint8_t *optionptr, uint8_t code, uint32_t data);
37struct option_set *find_option(struct option_set *opt_list, char code); 37struct option_set *find_option(struct option_set *opt_list, char code);
38void attach_option(struct option_set **opt_list, struct dhcp_option *option, char *buffer, int length); 38void attach_option(struct option_set **opt_list, struct dhcp_option *option, char *buffer, int length);
39 39
diff --git a/networking/udhcp/packet.c b/networking/udhcp/packet.c
index 32b489476..a3c7ae153 100644
--- a/networking/udhcp/packet.c
+++ b/networking/udhcp/packet.c
@@ -69,7 +69,7 @@ int get_packet(struct dhcpMessage *packet, int fd)
69 69
70 if (packet->op == BOOTREQUEST && (vendor = get_option(packet, DHCP_VENDOR))) { 70 if (packet->op == BOOTREQUEST && (vendor = get_option(packet, DHCP_VENDOR))) {
71 for (i = 0; broken_vendors[i][0]; i++) { 71 for (i = 0; broken_vendors[i][0]; i++) {
72 if (vendor[OPT_LEN - 2] == (unsigned char) strlen(broken_vendors[i]) && 72 if (vendor[OPT_LEN - 2] == (uint8_t) strlen(broken_vendors[i]) &&
73 !strncmp(vendor, broken_vendors[i], vendor[OPT_LEN - 2])) { 73 !strncmp(vendor, broken_vendors[i], vendor[OPT_LEN - 2])) {
74 DEBUG(LOG_INFO, "broken client (%s), forcing broadcast", 74 DEBUG(LOG_INFO, "broken client (%s), forcing broadcast",
75 broken_vendors[i]); 75 broken_vendors[i]);
@@ -83,13 +83,13 @@ int get_packet(struct dhcpMessage *packet, int fd)
83} 83}
84 84
85 85
86u_int16_t checksum(void *addr, int count) 86uint16_t checksum(void *addr, int count)
87{ 87{
88 /* Compute Internet Checksum for "count" bytes 88 /* Compute Internet Checksum for "count" bytes
89 * beginning at location "addr". 89 * beginning at location "addr".
90 */ 90 */
91 register int32_t sum = 0; 91 register int32_t sum = 0;
92 u_int16_t *source = (u_int16_t *) addr; 92 uint16_t *source = (uint16_t *) addr;
93 93
94 while (count > 1) { 94 while (count > 1) {
95 /* This is the inner loop */ 95 /* This is the inner loop */
@@ -101,8 +101,8 @@ u_int16_t checksum(void *addr, int count)
101 if (count > 0) { 101 if (count > 0) {
102 /* Make sure that the left-over byte is added correctly both 102 /* Make sure that the left-over byte is added correctly both
103 * with little and big endian hosts */ 103 * with little and big endian hosts */
104 u_int16_t tmp = 0; 104 uint16_t tmp = 0;
105 *(unsigned char *) (&tmp) = * (unsigned char *) source; 105 *(uint8_t *) (&tmp) = * (uint8_t *) source;
106 sum += tmp; 106 sum += tmp;
107 } 107 }
108 /* Fold 32-bit sum to 16 bits */ 108 /* Fold 32-bit sum to 16 bits */
@@ -114,8 +114,8 @@ u_int16_t checksum(void *addr, int count)
114 114
115 115
116/* Constuct a ip/udp header for a packet, and specify the source and dest hardware address */ 116/* Constuct a ip/udp header for a packet, and specify the source and dest hardware address */
117int raw_packet(struct dhcpMessage *payload, u_int32_t source_ip, int source_port, 117int raw_packet(struct dhcpMessage *payload, uint32_t source_ip, int source_port,
118 u_int32_t dest_ip, int dest_port, unsigned char *dest_arp, int ifindex) 118 uint32_t dest_ip, int dest_port, uint8_t *dest_arp, int ifindex)
119{ 119{
120 int fd; 120 int fd;
121 int result; 121 int result;
@@ -167,8 +167,8 @@ int raw_packet(struct dhcpMessage *payload, u_int32_t source_ip, int source_port
167 167
168 168
169/* Let the kernel do all the work for packet generation */ 169/* Let the kernel do all the work for packet generation */
170int kernel_packet(struct dhcpMessage *payload, u_int32_t source_ip, int source_port, 170int kernel_packet(struct dhcpMessage *payload, uint32_t source_ip, int source_port,
171 u_int32_t dest_ip, int dest_port) 171 uint32_t dest_ip, int dest_port)
172{ 172{
173 int n = 1; 173 int n = 1;
174 int fd, result; 174 int fd, result;
diff --git a/networking/udhcp/packet.h b/networking/udhcp/packet.h
index 1a263ef8b..22c4d09c3 100644
--- a/networking/udhcp/packet.h
+++ b/networking/udhcp/packet.h
@@ -5,22 +5,22 @@
5#include <netinet/ip.h> 5#include <netinet/ip.h>
6 6
7struct dhcpMessage { 7struct dhcpMessage {
8 u_int8_t op; 8 uint8_t op;
9 u_int8_t htype; 9 uint8_t htype;
10 u_int8_t hlen; 10 uint8_t hlen;
11 u_int8_t hops; 11 uint8_t hops;
12 u_int32_t xid; 12 uint32_t xid;
13 u_int16_t secs; 13 uint16_t secs;
14 u_int16_t flags; 14 uint16_t flags;
15 u_int32_t ciaddr; 15 uint32_t ciaddr;
16 u_int32_t yiaddr; 16 uint32_t yiaddr;
17 u_int32_t siaddr; 17 uint32_t siaddr;
18 u_int32_t giaddr; 18 uint32_t giaddr;
19 u_int8_t chaddr[16]; 19 uint8_t chaddr[16];
20 u_int8_t sname[64]; 20 uint8_t sname[64];
21 u_int8_t file[128]; 21 uint8_t file[128];
22 u_int32_t cookie; 22 uint32_t cookie;
23 u_int8_t options[308]; /* 312 - cookie */ 23 uint8_t options[308]; /* 312 - cookie */
24}; 24};
25 25
26struct udp_dhcp_packet { 26struct udp_dhcp_packet {
@@ -31,11 +31,11 @@ struct udp_dhcp_packet {
31 31
32void init_header(struct dhcpMessage *packet, char type); 32void init_header(struct dhcpMessage *packet, char type);
33int get_packet(struct dhcpMessage *packet, int fd); 33int get_packet(struct dhcpMessage *packet, int fd);
34u_int16_t checksum(void *addr, int count); 34uint16_t checksum(void *addr, int count);
35int raw_packet(struct dhcpMessage *payload, u_int32_t source_ip, int source_port, 35int raw_packet(struct dhcpMessage *payload, uint32_t source_ip, int source_port,
36 u_int32_t dest_ip, int dest_port, unsigned char *dest_arp, int ifindex); 36 uint32_t dest_ip, int dest_port, uint8_t *dest_arp, int ifindex);
37int kernel_packet(struct dhcpMessage *payload, u_int32_t source_ip, int source_port, 37int kernel_packet(struct dhcpMessage *payload, uint32_t source_ip, int source_port,
38 u_int32_t dest_ip, int dest_port); 38 uint32_t dest_ip, int dest_port);
39 39
40 40
41#endif 41#endif
diff --git a/networking/udhcp/script.c b/networking/udhcp/script.c
index 24688b518..b7d78624c 100644
--- a/networking/udhcp/script.c
+++ b/networking/udhcp/script.c
@@ -55,7 +55,7 @@ static inline int upper_length(int length, int opt_index)
55} 55}
56 56
57 57
58static int sprintip(char *dest, char *pre, unsigned char *ip) 58static int sprintip(char *dest, char *pre, uint8_t *ip)
59{ 59{
60 return sprintf(dest, "%s%d.%d.%d.%d", pre, ip[0], ip[1], ip[2], ip[3]); 60 return sprintf(dest, "%s%d.%d.%d.%d", pre, ip[0], ip[1], ip[2], ip[3]);
61} 61}
@@ -74,12 +74,12 @@ static int mton(struct in_addr *mask)
74 74
75 75
76/* Fill dest with the text of option 'option'. */ 76/* Fill dest with the text of option 'option'. */
77static void fill_options(char *dest, unsigned char *option, struct dhcp_option *type_p) 77static void fill_options(char *dest, uint8_t *option, struct dhcp_option *type_p)
78{ 78{
79 int type, optlen; 79 int type, optlen;
80 u_int16_t val_u16; 80 uint16_t val_u16;
81 int16_t val_s16; 81 int16_t val_s16;
82 u_int32_t val_u32; 82 uint32_t val_u32;
83 int32_t val_s32; 83 int32_t val_s32;
84 int len = option[OPT_LEN - 2]; 84 int len = option[OPT_LEN - 2];
85 85
@@ -138,7 +138,7 @@ static char **fill_envp(struct dhcpMessage *packet)
138 int num_options = 0; 138 int num_options = 0;
139 int i, j; 139 int i, j;
140 char **envp; 140 char **envp;
141 unsigned char *temp; 141 uint8_t *temp;
142 struct in_addr subnet; 142 struct in_addr subnet;
143 char over = 0; 143 char over = 0;
144 144
@@ -168,7 +168,7 @@ static char **fill_envp(struct dhcpMessage *packet)
168 if (packet == NULL) return envp; 168 if (packet == NULL) return envp;
169 169
170 envp[j] = xmalloc(sizeof("ip=255.255.255.255")); 170 envp[j] = xmalloc(sizeof("ip=255.255.255.255"));
171 sprintip(envp[j++], "ip=", (unsigned char *) &packet->yiaddr); 171 sprintip(envp[j++], "ip=", (uint8_t *) &packet->yiaddr);
172 172
173 173
174 for (i = 0; dhcp_options[i].code; i++) { 174 for (i = 0; dhcp_options[i].code; i++) {
@@ -186,7 +186,7 @@ static char **fill_envp(struct dhcpMessage *packet)
186 } 186 }
187 if (packet->siaddr) { 187 if (packet->siaddr) {
188 envp[j] = xmalloc(sizeof("siaddr=255.255.255.255")); 188 envp[j] = xmalloc(sizeof("siaddr=255.255.255.255"));
189 sprintip(envp[j++], "siaddr=", (unsigned char *) &packet->siaddr); 189 sprintip(envp[j++], "siaddr=", (uint8_t *) &packet->siaddr);
190 } 190 }
191 if (!(over & FILE_FIELD) && packet->file[0]) { 191 if (!(over & FILE_FIELD) && packet->file[0]) {
192 /* watch out for invalid packets */ 192 /* watch out for invalid packets */
diff --git a/networking/udhcp/serverpacket.c b/networking/udhcp/serverpacket.c
index 32d3c8098..d39e6ba17 100644
--- a/networking/udhcp/serverpacket.c
+++ b/networking/udhcp/serverpacket.c
@@ -43,8 +43,8 @@ static int send_packet_to_relay(struct dhcpMessage *payload)
43/* send a packet to a specific arp address and ip address by creating our own ip packet */ 43/* send a packet to a specific arp address and ip address by creating our own ip packet */
44static int send_packet_to_client(struct dhcpMessage *payload, int force_broadcast) 44static int send_packet_to_client(struct dhcpMessage *payload, int force_broadcast)
45{ 45{
46 unsigned char *chaddr; 46 uint8_t *chaddr;
47 u_int32_t ciaddr; 47 uint32_t ciaddr;
48 48
49 if (force_broadcast) { 49 if (force_broadcast) {
50 DEBUG(LOG_INFO, "broadcasting packet to client (NAK)"); 50 DEBUG(LOG_INFO, "broadcasting packet to client (NAK)");
@@ -108,8 +108,8 @@ int sendOffer(struct dhcpMessage *oldpacket)
108{ 108{
109 struct dhcpMessage packet; 109 struct dhcpMessage packet;
110 struct dhcpOfferedAddr *lease = NULL; 110 struct dhcpOfferedAddr *lease = NULL;
111 u_int32_t req_align, lease_time_align = server_config.lease; 111 uint32_t req_align, lease_time_align = server_config.lease;
112 unsigned char *req, *lease_time; 112 uint8_t *req, *lease_time;
113 struct option_set *curr; 113 struct option_set *curr;
114 struct in_addr addr; 114 struct in_addr addr;
115 115
@@ -196,12 +196,12 @@ int sendNAK(struct dhcpMessage *oldpacket)
196} 196}
197 197
198 198
199int sendACK(struct dhcpMessage *oldpacket, u_int32_t yiaddr) 199int sendACK(struct dhcpMessage *oldpacket, uint32_t yiaddr)
200{ 200{
201 struct dhcpMessage packet; 201 struct dhcpMessage packet;
202 struct option_set *curr; 202 struct option_set *curr;
203 unsigned char *lease_time; 203 uint8_t *lease_time;
204 u_int32_t lease_time_align = server_config.lease; 204 uint32_t lease_time_align = server_config.lease;
205 struct in_addr addr; 205 struct in_addr addr;
206 206
207 init_packet(&packet, oldpacket, DHCPACK); 207 init_packet(&packet, oldpacket, DHCPACK);
diff --git a/networking/udhcp/serverpacket.h b/networking/udhcp/serverpacket.h
index 233d44911..902492895 100644
--- a/networking/udhcp/serverpacket.h
+++ b/networking/udhcp/serverpacket.h
@@ -5,7 +5,7 @@
5 5
6int sendOffer(struct dhcpMessage *oldpacket); 6int sendOffer(struct dhcpMessage *oldpacket);
7int sendNAK(struct dhcpMessage *oldpacket); 7int sendNAK(struct dhcpMessage *oldpacket);
8int sendACK(struct dhcpMessage *oldpacket, u_int32_t yiaddr); 8int sendACK(struct dhcpMessage *oldpacket, uint32_t yiaddr);
9int send_inform(struct dhcpMessage *oldpacket); 9int send_inform(struct dhcpMessage *oldpacket);
10 10
11 11
diff --git a/networking/udhcp/socket.c b/networking/udhcp/socket.c
index c19838a7b..582f0fce5 100644
--- a/networking/udhcp/socket.c
+++ b/networking/udhcp/socket.c
@@ -44,7 +44,7 @@
44#include "socket.h" 44#include "socket.h"
45#include "common.h" 45#include "common.h"
46 46
47int read_interface(char *interface, int *ifindex, u_int32_t *addr, unsigned char *arp) 47int read_interface(char *interface, int *ifindex, uint32_t *addr, uint8_t *arp)
48{ 48{
49 int fd; 49 int fd;
50 struct ifreq ifr; 50 struct ifreq ifr;
@@ -90,7 +90,7 @@ int read_interface(char *interface, int *ifindex, u_int32_t *addr, unsigned char
90} 90}
91 91
92 92
93int listen_socket(unsigned int ip, int port, char *inf) 93int listen_socket(uint32_t ip, int port, char *inf)
94{ 94{
95 struct ifreq interface; 95 struct ifreq interface;
96 int fd; 96 int fd;
diff --git a/networking/udhcp/socket.h b/networking/udhcp/socket.h
index d259ef770..66179d4f5 100644
--- a/networking/udhcp/socket.h
+++ b/networking/udhcp/socket.h
@@ -2,7 +2,7 @@
2#ifndef _SOCKET_H 2#ifndef _SOCKET_H
3#define _SOCKET_H 3#define _SOCKET_H
4 4
5int read_interface(char *interface, int *ifindex, u_int32_t *addr, unsigned char *arp); 5int read_interface(char *interface, int *ifindex, uint32_t *addr, uint8_t *arp);
6int listen_socket(unsigned int ip, int port, char *inf); 6int listen_socket(uint32_t ip, int port, char *inf);
7 7
8#endif 8#endif