diff options
author | Eric Andersen <andersen@codepoet.org> | 2004-01-30 23:45:53 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2004-01-30 23:45:53 +0000 |
commit | ad95373efcd7eaa4d641a7a821e5b05fb2d31e1d (patch) | |
tree | 59f5094313c8ee69e48f632a217835a8bb36bda6 /networking | |
parent | 1a834be1ce792252d55b090ee806a466fe9ac4fa (diff) |
Use standard C99 types
Diffstat (limited to 'networking')
-rw-r--r-- | networking/udhcp/arpping.c | 4 | ||||
-rw-r--r-- | networking/udhcp/arpping.h | 22 | ||||
-rw-r--r-- | networking/udhcp/clientpacket.c | 8 | ||||
-rw-r--r-- | networking/udhcp/dhcpc.c | 2 | ||||
-rw-r--r-- | networking/udhcp/dhcpc.h | 6 | ||||
-rw-r--r-- | networking/udhcp/dhcpd.c | 6 | ||||
-rw-r--r-- | networking/udhcp/dhcpd.h | 14 | ||||
-rw-r--r-- | networking/udhcp/files.c | 6 | ||||
-rw-r--r-- | networking/udhcp/leases.c | 16 | ||||
-rw-r--r-- | networking/udhcp/leases.h | 18 | ||||
-rw-r--r-- | networking/udhcp/options.c | 24 | ||||
-rw-r--r-- | networking/udhcp/options.h | 10 | ||||
-rw-r--r-- | networking/udhcp/packet.c | 18 | ||||
-rw-r--r-- | networking/udhcp/packet.h | 42 | ||||
-rw-r--r-- | networking/udhcp/script.c | 14 | ||||
-rw-r--r-- | networking/udhcp/serverpacket.c | 14 | ||||
-rw-r--r-- | networking/udhcp/serverpacket.h | 2 | ||||
-rw-r--r-- | networking/udhcp/socket.c | 4 | ||||
-rw-r--r-- | networking/udhcp/socket.h | 4 |
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 @@ */ /* FIXME: match response against chaddr */ -int arpping(u_int32_t yiaddr, u_int32_t ip, unsigned char *mac, char *interface) +int arpping(uint32_t yiaddr, uint32_t ip, uint8_t *mac, char *interface) { int timeout = 2; @@ -91,7 +91,7 @@ int arpping(u_int32_t yiaddr, u_int32_t ip, unsigned char *mac, char *interface) if (recv(s, &arp, sizeof(arp), 0) < 0 ) rv = 0; if (arp.operation == htons(ARPOP_REPLY) && bcmp(arp.tHaddr, mac, 6) == 0 && - *((u_int *) arp.sInaddr) == yiaddr) { + *((uint32_t *) arp.sInaddr) == yiaddr) { DEBUG(LOG_INFO, "Valid arp reply receved for this address"); rv = 0; 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 @@ struct arpMsg { struct ethhdr ethhdr; /* Ethernet header */ - u_short htype; /* hardware type (must be ARPHRD_ETHER) */ - u_short ptype; /* protocol type (must be ETH_P_IP) */ - u_char hlen; /* hardware address length (must be 6) */ - u_char plen; /* protocol address length (must be 4) */ - u_short operation; /* ARP opcode */ - u_char sHaddr[6]; /* sender's hardware address */ - u_char sInaddr[4]; /* sender's IP address */ - u_char tHaddr[6]; /* target's hardware address */ - u_char tInaddr[4]; /* target's IP address */ - u_char pad[18]; /* pad for min. Ethernet payload (60 bytes) */ + uint16_t htype; /* hardware type (must be ARPHRD_ETHER) */ + uint16_t ptype; /* protocol type (must be ETH_P_IP) */ + uint8_t hlen; /* hardware address length (must be 6) */ + uint8_t plen; /* protocol address length (must be 4) */ + uint16_t operation; /* ARP opcode */ + uint8_t sHaddr[6]; /* sender's hardware address */ + uint8_t sInaddr[4]; /* sender's IP address */ + uint8_t tHaddr[6]; /* target's hardware address */ + uint8_t tInaddr[4]; /* target's IP address */ + uint8_t pad[18]; /* pad for min. Ethernet payload (60 bytes) */ }; /* function prototypes */ -int arpping(u_int32_t yiaddr, u_int32_t ip, unsigned char *arp, char *interface); +int arpping(uint32_t yiaddr, uint32_t ip, uint8_t *arp, char *interface); #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) memcpy(packet->chaddr, client_config.arp, 6); add_option_string(packet->options, client_config.clientid); if (client_config.hostname) add_option_string(packet->options, client_config.hostname); - add_option_string(packet->options, (unsigned char *) &vendor_id); + add_option_string(packet->options, (uint8_t *) &vendor_id); } @@ -179,8 +179,8 @@ int get_raw_packet(struct dhcpMessage *payload, int fd) { int bytes; struct udp_dhcp_packet packet; - u_int32_t source, dest; - u_int16_t check; + uint32_t source, dest; + uint16_t check; memset(&packet, 0, sizeof(struct udp_dhcp_packet)); bytes = read(fd, &packet, sizeof(struct udp_dhcp_packet)); @@ -207,7 +207,7 @@ int get_raw_packet(struct dhcpMessage *payload, int fd) if (packet.ip.protocol != IPPROTO_UDP || packet.ip.version != IPVERSION || packet.ip.ihl != sizeof(packet.ip) >> 2 || packet.udp.dest != htons(CLIENT_PORT) || bytes > (int) sizeof(struct udp_dhcp_packet) || - ntohs(packet.udp.len) != (short) (bytes - sizeof(packet.ip))) { + ntohs(packet.udp.len) != (uint16_t) (bytes - sizeof(packet.ip))) { DEBUG(LOG_INFO, "unrelated/bogus packet"); return -2; } 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[]) int main(int argc, char *argv[]) #endif { - unsigned char *temp, *message; + uint8_t *temp, *message; unsigned long t1 = 0, t2 = 0, xid = 0; unsigned long start = 0, lease; 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 { char *interface; /* The name of the interface to use */ char *pidfile; /* Optionally store the process ID */ char *script; /* User script to run at dhcp events */ - unsigned char *clientid; /* Optional client id to use */ - unsigned char *hostname; /* Optional hostname to use */ + uint8_t *clientid; /* Optional client id to use */ + uint8_t *hostname; /* Optional hostname to use */ int ifindex; /* Index number of the interface to use */ - unsigned char arp[6]; /* Our arp address */ + uint8_t arp[6]; /* Our arp address */ }; extern 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[]) int server_socket = -1; int bytes, retval; struct dhcpMessage packet; - unsigned char *state; - unsigned char *server_id, *requested; - u_int32_t server_id_align, requested_align; + uint8_t *state; + uint8_t *server_id, *requested; + uint32_t server_id_align, requested_align; unsigned long timeout_end; struct option_set *option; 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 @@ #define SNAME_FIELD 2 /* miscellaneous defines */ -#define MAC_BCAST_ADDR (unsigned char *) "\xff\xff\xff\xff\xff\xff" +#define MAC_BCAST_ADDR (uint8_t *) "\xff\xff\xff\xff\xff\xff" #define OPT_CODE 0 #define OPT_LEN 1 #define OPT_DATA 2 struct option_set { - unsigned char *data; + uint8_t *data; struct option_set *next; }; struct server_config_t { - u_int32_t server; /* Our IP, in network order */ - u_int32_t start; /* Start address of leases, network order */ - u_int32_t end; /* End of leases, network order */ + uint32_t server; /* Our IP, in network order */ + uint32_t start; /* Start address of leases, network order */ + uint32_t end; /* End of leases, network order */ struct option_set *options; /* List of DHCP options loaded from the config file */ char *interface; /* The name of the interface to use */ int ifindex; /* Index number of the interface to use */ - unsigned char arp[6]; /* Our arp address */ + uint8_t arp[6]; /* Our arp address */ unsigned long lease; /* lease time in seconds (host order) */ unsigned long max_leases; /* maximum number of leases (including reserved address) */ char remaining; /* should the lease file be interpreted as lease time remaining, or @@ -121,7 +121,7 @@ struct server_config_t { char *lease_file; char *pidfile; char *notify_file; /* What to run whenever leases are written */ - u_int32_t siaddr; /* next server bootp option */ + uint32_t siaddr; /* next server bootp option */ char *sname; /* bootp server name */ char *boot_file; /* bootp boot file option */ }; 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) static int read_u32(const char *line, void *arg) { - u_int32_t *dest = arg; + uint32_t *dest = arg; char *endptr; *dest = strtoul(line, &endptr, 0); return endptr[0] == '\0'; @@ -83,8 +83,8 @@ static int read_opt(const char *const_line, void *arg) int retval = 0, length; char buffer[8]; char *line; - u_int16_t *result_u16 = (u_int16_t *) buffer; - u_int32_t *result_u32 = (u_int32_t *) buffer; + uint16_t *result_u16 = (uint16_t *) buffer; + uint32_t *result_u32 = (uint32_t *) buffer; /* Cheat, the only const line we'll actually get is "" */ 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 @@ #include "common.h" -unsigned char blank_chaddr[] = {[0 ... 15] = 0}; +uint8_t blank_chaddr[] = {[0 ... 15] = 0}; /* clear every lease out that chaddr OR yiaddr matches and is nonzero */ -void clear_lease(u_int8_t *chaddr, u_int32_t yiaddr) +void clear_lease(uint8_t *chaddr, uint32_t yiaddr) { unsigned int i, j; @@ -35,7 +35,7 @@ void clear_lease(u_int8_t *chaddr, u_int32_t yiaddr) /* add a lease into the table, clearing out any old ones */ -struct dhcpOfferedAddr *add_lease(u_int8_t *chaddr, u_int32_t yiaddr, unsigned long lease) +struct dhcpOfferedAddr *add_lease(uint8_t *chaddr, uint32_t yiaddr, unsigned long lease) { struct dhcpOfferedAddr *oldest; @@ -80,7 +80,7 @@ struct dhcpOfferedAddr *oldest_expired_lease(void) /* Find the first lease that matches chaddr, NULL if no match */ -struct dhcpOfferedAddr *find_lease_by_chaddr(u_int8_t *chaddr) +struct dhcpOfferedAddr *find_lease_by_chaddr(uint8_t *chaddr) { unsigned int i; @@ -92,7 +92,7 @@ struct dhcpOfferedAddr *find_lease_by_chaddr(u_int8_t *chaddr) /* Find the first lease that matches yiaddr, NULL is no match */ -struct dhcpOfferedAddr *find_lease_by_yiaddr(u_int32_t yiaddr) +struct dhcpOfferedAddr *find_lease_by_yiaddr(uint32_t yiaddr) { unsigned int i; @@ -104,7 +104,7 @@ struct dhcpOfferedAddr *find_lease_by_yiaddr(u_int32_t yiaddr) /* check is an IP is taken, if it is, add it to the lease table */ -static int check_ip(u_int32_t addr) +static int check_ip(uint32_t addr) { struct in_addr temp; @@ -120,9 +120,9 @@ static int check_ip(u_int32_t addr) /* find an assignable address, it check_expired is true, we check all the expired leases as well. * Maybe this should try expired leases by age... */ -u_int32_t find_address(int check_expired) +uint32_t find_address(int check_expired) { - u_int32_t addr, ret; + uint32_t addr, ret; struct dhcpOfferedAddr *lease = NULL; 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 @@ struct dhcpOfferedAddr { - u_int8_t chaddr[16]; - u_int32_t yiaddr; /* network order */ - u_int32_t expires; /* host order */ + uint8_t chaddr[16]; + uint32_t yiaddr; /* network order */ + uint32_t expires; /* host order */ }; -extern unsigned char blank_chaddr[]; +extern uint8_t blank_chaddr[]; -void clear_lease(u_int8_t *chaddr, u_int32_t yiaddr); -struct dhcpOfferedAddr *add_lease(u_int8_t *chaddr, u_int32_t yiaddr, unsigned long lease); +void clear_lease(uint8_t *chaddr, uint32_t yiaddr); +struct dhcpOfferedAddr *add_lease(uint8_t *chaddr, uint32_t yiaddr, unsigned long lease); int lease_expired(struct dhcpOfferedAddr *lease); struct dhcpOfferedAddr *oldest_expired_lease(void); -struct dhcpOfferedAddr *find_lease_by_chaddr(u_int8_t *chaddr); -struct dhcpOfferedAddr *find_lease_by_yiaddr(u_int32_t yiaddr); -u_int32_t find_address(int check_expired); +struct dhcpOfferedAddr *find_lease_by_chaddr(uint8_t *chaddr); +struct dhcpOfferedAddr *find_lease_by_yiaddr(uint32_t yiaddr); +uint32_t find_address(int check_expired); #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[] = { /* get an option with bounds checking (warning, not aligned). */ -unsigned char *get_option(struct dhcpMessage *packet, int code) +uint8_t *get_option(struct dhcpMessage *packet, int code) { int i, length; - unsigned char *optionptr; + uint8_t *optionptr; int over = 0, done = 0, curr = OPTION_FIELD; optionptr = packet->options; @@ -114,7 +114,7 @@ unsigned char *get_option(struct dhcpMessage *packet, int code) /* return the position of the 'end' option (no bounds checking) */ -int end_option(unsigned char *optionptr) +int end_option(uint8_t *optionptr) { int i = 0; @@ -128,7 +128,7 @@ int end_option(unsigned char *optionptr) /* add an option string to the options (an option string contains an option code, * length, then data) */ -int add_option_string(unsigned char *optionptr, unsigned char *string) +int add_option_string(uint8_t *optionptr, uint8_t *string) { int end = end_option(optionptr); @@ -145,17 +145,17 @@ int add_option_string(unsigned char *optionptr, unsigned char *string) /* add a one to four byte option to a packet */ -int add_simple_option(unsigned char *optionptr, unsigned char code, u_int32_t data) +int add_simple_option(uint8_t *optionptr, uint8_t code, uint32_t data) { char length = 0; int i; - unsigned char option[2 + 4]; - unsigned char *u8; - u_int16_t *u16; - u_int32_t *u32; - u_int32_t aligned; - u8 = (unsigned char *) &aligned; - u16 = (u_int16_t *) &aligned; + uint8_t option[2 + 4]; + uint8_t *u8; + uint16_t *u16; + uint32_t *u32; + uint32_t aligned; + u8 = (uint8_t *) &aligned; + u16 = (uint16_t *) &aligned; u32 = &aligned; 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 { struct dhcp_option { char name[10]; char flags; - unsigned char code; + uint8_t code; }; extern struct dhcp_option dhcp_options[]; extern int option_lengths[]; -unsigned char *get_option(struct dhcpMessage *packet, int code); -int end_option(unsigned char *optionptr); -int add_option_string(unsigned char *optionptr, unsigned char *string); -int add_simple_option(unsigned char *optionptr, unsigned char code, u_int32_t data); +uint8_t *get_option(struct dhcpMessage *packet, int code); +int end_option(uint8_t *optionptr); +int add_option_string(uint8_t *optionptr, uint8_t *string); +int add_simple_option(uint8_t *optionptr, uint8_t code, uint32_t data); struct option_set *find_option(struct option_set *opt_list, char code); void attach_option(struct option_set **opt_list, struct dhcp_option *option, char *buffer, int length); 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) if (packet->op == BOOTREQUEST && (vendor = get_option(packet, DHCP_VENDOR))) { for (i = 0; broken_vendors[i][0]; i++) { - if (vendor[OPT_LEN - 2] == (unsigned char) strlen(broken_vendors[i]) && + if (vendor[OPT_LEN - 2] == (uint8_t) strlen(broken_vendors[i]) && !strncmp(vendor, broken_vendors[i], vendor[OPT_LEN - 2])) { DEBUG(LOG_INFO, "broken client (%s), forcing broadcast", broken_vendors[i]); @@ -83,13 +83,13 @@ int get_packet(struct dhcpMessage *packet, int fd) } -u_int16_t checksum(void *addr, int count) +uint16_t checksum(void *addr, int count) { /* Compute Internet Checksum for "count" bytes * beginning at location "addr". */ register int32_t sum = 0; - u_int16_t *source = (u_int16_t *) addr; + uint16_t *source = (uint16_t *) addr; while (count > 1) { /* This is the inner loop */ @@ -101,8 +101,8 @@ u_int16_t checksum(void *addr, int count) if (count > 0) { /* Make sure that the left-over byte is added correctly both * with little and big endian hosts */ - u_int16_t tmp = 0; - *(unsigned char *) (&tmp) = * (unsigned char *) source; + uint16_t tmp = 0; + *(uint8_t *) (&tmp) = * (uint8_t *) source; sum += tmp; } /* Fold 32-bit sum to 16 bits */ @@ -114,8 +114,8 @@ u_int16_t checksum(void *addr, int count) /* Constuct a ip/udp header for a packet, and specify the source and dest hardware address */ -int raw_packet(struct dhcpMessage *payload, u_int32_t source_ip, int source_port, - u_int32_t dest_ip, int dest_port, unsigned char *dest_arp, int ifindex) +int raw_packet(struct dhcpMessage *payload, uint32_t source_ip, int source_port, + uint32_t dest_ip, int dest_port, uint8_t *dest_arp, int ifindex) { int fd; int result; @@ -167,8 +167,8 @@ int raw_packet(struct dhcpMessage *payload, u_int32_t source_ip, int source_port /* Let the kernel do all the work for packet generation */ -int kernel_packet(struct dhcpMessage *payload, u_int32_t source_ip, int source_port, - u_int32_t dest_ip, int dest_port) +int kernel_packet(struct dhcpMessage *payload, uint32_t source_ip, int source_port, + uint32_t dest_ip, int dest_port) { int n = 1; 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 @@ #include <netinet/ip.h> struct dhcpMessage { - u_int8_t op; - u_int8_t htype; - u_int8_t hlen; - u_int8_t hops; - u_int32_t xid; - u_int16_t secs; - u_int16_t flags; - u_int32_t ciaddr; - u_int32_t yiaddr; - u_int32_t siaddr; - u_int32_t giaddr; - u_int8_t chaddr[16]; - u_int8_t sname[64]; - u_int8_t file[128]; - u_int32_t cookie; - u_int8_t options[308]; /* 312 - cookie */ + uint8_t op; + uint8_t htype; + uint8_t hlen; + uint8_t hops; + uint32_t xid; + uint16_t secs; + uint16_t flags; + uint32_t ciaddr; + uint32_t yiaddr; + uint32_t siaddr; + uint32_t giaddr; + uint8_t chaddr[16]; + uint8_t sname[64]; + uint8_t file[128]; + uint32_t cookie; + uint8_t options[308]; /* 312 - cookie */ }; struct udp_dhcp_packet { @@ -31,11 +31,11 @@ struct udp_dhcp_packet { void init_header(struct dhcpMessage *packet, char type); int get_packet(struct dhcpMessage *packet, int fd); -u_int16_t checksum(void *addr, int count); -int raw_packet(struct dhcpMessage *payload, u_int32_t source_ip, int source_port, - u_int32_t dest_ip, int dest_port, unsigned char *dest_arp, int ifindex); -int kernel_packet(struct dhcpMessage *payload, u_int32_t source_ip, int source_port, - u_int32_t dest_ip, int dest_port); +uint16_t checksum(void *addr, int count); +int raw_packet(struct dhcpMessage *payload, uint32_t source_ip, int source_port, + uint32_t dest_ip, int dest_port, uint8_t *dest_arp, int ifindex); +int kernel_packet(struct dhcpMessage *payload, uint32_t source_ip, int source_port, + uint32_t dest_ip, int dest_port); #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) } -static int sprintip(char *dest, char *pre, unsigned char *ip) +static int sprintip(char *dest, char *pre, uint8_t *ip) { return sprintf(dest, "%s%d.%d.%d.%d", pre, ip[0], ip[1], ip[2], ip[3]); } @@ -74,12 +74,12 @@ static int mton(struct in_addr *mask) /* Fill dest with the text of option 'option'. */ -static void fill_options(char *dest, unsigned char *option, struct dhcp_option *type_p) +static void fill_options(char *dest, uint8_t *option, struct dhcp_option *type_p) { int type, optlen; - u_int16_t val_u16; + uint16_t val_u16; int16_t val_s16; - u_int32_t val_u32; + uint32_t val_u32; int32_t val_s32; int len = option[OPT_LEN - 2]; @@ -138,7 +138,7 @@ static char **fill_envp(struct dhcpMessage *packet) int num_options = 0; int i, j; char **envp; - unsigned char *temp; + uint8_t *temp; struct in_addr subnet; char over = 0; @@ -168,7 +168,7 @@ static char **fill_envp(struct dhcpMessage *packet) if (packet == NULL) return envp; envp[j] = xmalloc(sizeof("ip=255.255.255.255")); - sprintip(envp[j++], "ip=", (unsigned char *) &packet->yiaddr); + sprintip(envp[j++], "ip=", (uint8_t *) &packet->yiaddr); for (i = 0; dhcp_options[i].code; i++) { @@ -186,7 +186,7 @@ static char **fill_envp(struct dhcpMessage *packet) } if (packet->siaddr) { envp[j] = xmalloc(sizeof("siaddr=255.255.255.255")); - sprintip(envp[j++], "siaddr=", (unsigned char *) &packet->siaddr); + sprintip(envp[j++], "siaddr=", (uint8_t *) &packet->siaddr); } if (!(over & FILE_FIELD) && packet->file[0]) { /* 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) /* send a packet to a specific arp address and ip address by creating our own ip packet */ static int send_packet_to_client(struct dhcpMessage *payload, int force_broadcast) { - unsigned char *chaddr; - u_int32_t ciaddr; + uint8_t *chaddr; + uint32_t ciaddr; if (force_broadcast) { DEBUG(LOG_INFO, "broadcasting packet to client (NAK)"); @@ -108,8 +108,8 @@ int sendOffer(struct dhcpMessage *oldpacket) { struct dhcpMessage packet; struct dhcpOfferedAddr *lease = NULL; - u_int32_t req_align, lease_time_align = server_config.lease; - unsigned char *req, *lease_time; + uint32_t req_align, lease_time_align = server_config.lease; + uint8_t *req, *lease_time; struct option_set *curr; struct in_addr addr; @@ -196,12 +196,12 @@ int sendNAK(struct dhcpMessage *oldpacket) } -int sendACK(struct dhcpMessage *oldpacket, u_int32_t yiaddr) +int sendACK(struct dhcpMessage *oldpacket, uint32_t yiaddr) { struct dhcpMessage packet; struct option_set *curr; - unsigned char *lease_time; - u_int32_t lease_time_align = server_config.lease; + uint8_t *lease_time; + uint32_t lease_time_align = server_config.lease; struct in_addr addr; 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 @@ int sendOffer(struct dhcpMessage *oldpacket); int sendNAK(struct dhcpMessage *oldpacket); -int sendACK(struct dhcpMessage *oldpacket, u_int32_t yiaddr); +int sendACK(struct dhcpMessage *oldpacket, uint32_t yiaddr); int send_inform(struct dhcpMessage *oldpacket); 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 @@ #include "socket.h" #include "common.h" -int read_interface(char *interface, int *ifindex, u_int32_t *addr, unsigned char *arp) +int read_interface(char *interface, int *ifindex, uint32_t *addr, uint8_t *arp) { int fd; struct ifreq ifr; @@ -90,7 +90,7 @@ int read_interface(char *interface, int *ifindex, u_int32_t *addr, unsigned char } -int listen_socket(unsigned int ip, int port, char *inf) +int listen_socket(uint32_t ip, int port, char *inf) { struct ifreq interface; 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 @@ #ifndef _SOCKET_H #define _SOCKET_H -int read_interface(char *interface, int *ifindex, u_int32_t *addr, unsigned char *arp); -int listen_socket(unsigned int ip, int port, char *inf); +int read_interface(char *interface, int *ifindex, uint32_t *addr, uint8_t *arp); +int listen_socket(uint32_t ip, int port, char *inf); #endif |