aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--networking/udhcp/arpping.c2
-rw-r--r--networking/udhcp/clientpacket.c14
-rw-r--r--networking/udhcp/clientsocket.c2
-rw-r--r--networking/udhcp/common.h31
-rw-r--r--networking/udhcp/dhcpc.c8
-rw-r--r--networking/udhcp/dhcpc.h16
-rw-r--r--networking/udhcp/dhcpd.c4
-rw-r--r--networking/udhcp/dhcpd.h34
-rw-r--r--networking/udhcp/dhcprelay.c8
-rw-r--r--networking/udhcp/domain_codec.c4
-rw-r--r--networking/udhcp/files.c8
-rw-r--r--networking/udhcp/leases.c10
-rw-r--r--networking/udhcp/options.c8
-rw-r--r--networking/udhcp/options.h12
-rw-r--r--networking/udhcp/packet.c10
-rw-r--r--networking/udhcp/script.c2
-rw-r--r--networking/udhcp/serverpacket.c8
-rw-r--r--networking/udhcp/signalpipe.c6
-rw-r--r--networking/udhcp/socket.c4
-rw-r--r--networking/udhcp/static_leases.c8
20 files changed, 98 insertions, 101 deletions
diff --git a/networking/udhcp/arpping.c b/networking/udhcp/arpping.c
index 44815ad74..e0710dc4a 100644
--- a/networking/udhcp/arpping.c
+++ b/networking/udhcp/arpping.c
@@ -39,7 +39,7 @@ enum {
39 39
40/* Returns 1 if no reply received */ 40/* Returns 1 if no reply received */
41 41
42int arpping(uint32_t test_ip, uint32_t from_ip, uint8_t *from_mac, const char *interface) 42int FAST_FUNC arpping(uint32_t test_ip, uint32_t from_ip, uint8_t *from_mac, const char *interface)
43{ 43{
44 int timeout_ms; 44 int timeout_ms;
45 struct pollfd pfd[1]; 45 struct pollfd pfd[1];
diff --git a/networking/udhcp/clientpacket.c b/networking/udhcp/clientpacket.c
index 3e4561946..77331d98d 100644
--- a/networking/udhcp/clientpacket.c
+++ b/networking/udhcp/clientpacket.c
@@ -25,7 +25,7 @@
25 25
26 26
27/* Create a random xid */ 27/* Create a random xid */
28uint32_t random_xid(void) 28uint32_t FAST_FUNC random_xid(void)
29{ 29{
30 static smallint initialized; 30 static smallint initialized;
31 31
@@ -81,7 +81,7 @@ static void add_param_req_option(struct dhcpMessage *packet)
81 81
82#if ENABLE_FEATURE_UDHCPC_ARPING 82#if ENABLE_FEATURE_UDHCPC_ARPING
83/* Unicast a DHCP decline message */ 83/* Unicast a DHCP decline message */
84int send_decline(uint32_t xid, uint32_t server, uint32_t requested) 84int FAST_FUNC send_decline(uint32_t xid, uint32_t server, uint32_t requested)
85{ 85{
86 struct dhcpMessage packet; 86 struct dhcpMessage packet;
87 87
@@ -98,7 +98,7 @@ int send_decline(uint32_t xid, uint32_t server, uint32_t requested)
98#endif 98#endif
99 99
100/* Broadcast a DHCP discover packet to the network, with an optionally requested IP */ 100/* Broadcast a DHCP discover packet to the network, with an optionally requested IP */
101int send_discover(uint32_t xid, uint32_t requested) 101int FAST_FUNC send_discover(uint32_t xid, uint32_t requested)
102{ 102{
103 struct dhcpMessage packet; 103 struct dhcpMessage packet;
104 104
@@ -120,7 +120,7 @@ int send_discover(uint32_t xid, uint32_t requested)
120 120
121 121
122/* Broadcasts a DHCP request message */ 122/* Broadcasts a DHCP request message */
123int send_selecting(uint32_t xid, uint32_t server, uint32_t requested) 123int FAST_FUNC send_selecting(uint32_t xid, uint32_t server, uint32_t requested)
124{ 124{
125 struct dhcpMessage packet; 125 struct dhcpMessage packet;
126 struct in_addr addr; 126 struct in_addr addr;
@@ -140,7 +140,7 @@ int send_selecting(uint32_t xid, uint32_t server, uint32_t requested)
140 140
141 141
142/* Unicasts or broadcasts a DHCP renew message */ 142/* Unicasts or broadcasts a DHCP renew message */
143int send_renew(uint32_t xid, uint32_t server, uint32_t ciaddr) 143int FAST_FUNC send_renew(uint32_t xid, uint32_t server, uint32_t ciaddr)
144{ 144{
145 struct dhcpMessage packet; 145 struct dhcpMessage packet;
146 146
@@ -159,7 +159,7 @@ int send_renew(uint32_t xid, uint32_t server, uint32_t ciaddr)
159 159
160 160
161/* Unicasts a DHCP release message */ 161/* Unicasts a DHCP release message */
162int send_release(uint32_t server, uint32_t ciaddr) 162int FAST_FUNC send_release(uint32_t server, uint32_t ciaddr)
163{ 163{
164 struct dhcpMessage packet; 164 struct dhcpMessage packet;
165 165
@@ -175,7 +175,7 @@ int send_release(uint32_t server, uint32_t ciaddr)
175 175
176 176
177/* Returns -1 on errors that are fatal for the socket, -2 for those that aren't */ 177/* Returns -1 on errors that are fatal for the socket, -2 for those that aren't */
178int udhcp_recv_raw_packet(struct dhcpMessage *payload, int fd) 178int FAST_FUNC udhcp_recv_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;
diff --git a/networking/udhcp/clientsocket.c b/networking/udhcp/clientsocket.c
index 0e13824b6..1dcc10570 100644
--- a/networking/udhcp/clientsocket.c
+++ b/networking/udhcp/clientsocket.c
@@ -36,7 +36,7 @@
36#include "dhcpd.h" 36#include "dhcpd.h"
37#include "dhcpc.h" 37#include "dhcpc.h"
38 38
39int raw_socket(int ifindex) 39int FAST_FUNC udhcp_raw_socket(int ifindex)
40{ 40{
41 int fd; 41 int fd;
42 struct sockaddr_ll sock; 42 struct sockaddr_ll sock;
diff --git a/networking/udhcp/common.h b/networking/udhcp/common.h
index 0f3b79647..bf099d8d2 100644
--- a/networking/udhcp/common.h
+++ b/networking/udhcp/common.h
@@ -57,25 +57,25 @@ struct BUG_bad_sizeof_struct_udp_dhcp_packet {
57 [(sizeof(struct udp_dhcp_packet) != 576 + CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS) ? -1 : 1]; 57 [(sizeof(struct udp_dhcp_packet) != 576 + CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS) ? -1 : 1];
58}; 58};
59 59
60uint16_t udhcp_checksum(void *addr, int count); 60uint16_t udhcp_checksum(void *addr, int count) FAST_FUNC;
61 61
62void udhcp_init_header(struct dhcpMessage *packet, char type); 62void udhcp_init_header(struct dhcpMessage *packet, char type) FAST_FUNC;
63 63
64/*int udhcp_recv_raw_packet(struct dhcpMessage *payload, int fd); - in dhcpc.h */ 64/*int udhcp_recv_raw_packet(struct dhcpMessage *payload, int fd); - in dhcpc.h */
65int udhcp_recv_kernel_packet(struct dhcpMessage *packet, int fd); 65int udhcp_recv_kernel_packet(struct dhcpMessage *packet, int fd) FAST_FUNC;
66 66
67int udhcp_send_raw_packet(struct dhcpMessage *payload, 67int udhcp_send_raw_packet(struct dhcpMessage *payload,
68 uint32_t source_ip, int source_port, 68 uint32_t source_ip, int source_port,
69 uint32_t dest_ip, int dest_port, 69 uint32_t dest_ip, int dest_port,
70 const uint8_t *dest_arp, int ifindex); 70 const uint8_t *dest_arp, int ifindex) FAST_FUNC;
71int udhcp_send_kernel_packet(struct dhcpMessage *payload, 71int udhcp_send_kernel_packet(struct dhcpMessage *payload,
72 uint32_t source_ip, int source_port, 72 uint32_t source_ip, int source_port,
73 uint32_t dest_ip, int dest_port); 73 uint32_t dest_ip, int dest_port) FAST_FUNC;
74 74
75 75
76/**/ 76/**/
77 77
78void udhcp_run_script(struct dhcpMessage *packet, const char *name); 78void udhcp_run_script(struct dhcpMessage *packet, const char *name) FAST_FUNC;
79 79
80// Still need to clean these up... 80// Still need to clean these up...
81 81
@@ -84,18 +84,15 @@ void udhcp_run_script(struct dhcpMessage *packet, const char *name);
84#define end_option udhcp_end_option 84#define end_option udhcp_end_option
85#define add_option_string udhcp_add_option_string 85#define add_option_string udhcp_add_option_string
86#define add_simple_option udhcp_add_simple_option 86#define add_simple_option udhcp_add_simple_option
87/* from socket.h */ 87
88#define listen_socket udhcp_listen_socket 88void udhcp_sp_setup(void) FAST_FUNC;
89#define read_interface udhcp_read_interface 89int udhcp_sp_fd_set(fd_set *rfds, int extra_fd) FAST_FUNC;
90 90int udhcp_sp_read(const fd_set *rfds) FAST_FUNC;
91void udhcp_sp_setup(void); 91int udhcp_raw_socket(int ifindex) FAST_FUNC;
92int udhcp_sp_fd_set(fd_set *rfds, int extra_fd); 92int udhcp_read_interface(const char *interface, int *ifindex, uint32_t *addr, uint8_t *arp) FAST_FUNC;
93int udhcp_sp_read(const fd_set *rfds); 93int udhcp_listen_socket(/*uint32_t ip,*/ int port, const char *inf) FAST_FUNC;
94int raw_socket(int ifindex);
95int read_interface(const char *interface, int *ifindex, uint32_t *addr, uint8_t *arp);
96int listen_socket(/*uint32_t ip,*/ int port, const char *inf);
97/* Returns 1 if no reply received */ 94/* Returns 1 if no reply received */
98int arpping(uint32_t test_ip, uint32_t from_ip, uint8_t *from_mac, const char *interface); 95int arpping(uint32_t test_ip, uint32_t from_ip, uint8_t *from_mac, const char *interface) FAST_FUNC;
99 96
100#if ENABLE_FEATURE_UDHCP_DEBUG 97#if ENABLE_FEATURE_UDHCP_DEBUG
101# define DEBUG(str, args...) bb_info_msg("### " str, ## args) 98# define DEBUG(str, args...) bb_info_msg("### " str, ## args)
diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c
index 4cc42eae0..5ec8d39b9 100644
--- a/networking/udhcp/dhcpc.c
+++ b/networking/udhcp/dhcpc.c
@@ -267,7 +267,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
267 client_config.opt_mask[n >> 3] |= 1 << (n & 7); 267 client_config.opt_mask[n >> 3] |= 1 << (n & 7);
268 } 268 }
269 269
270 if (read_interface(client_config.interface, &client_config.ifindex, 270 if (udhcp_read_interface(client_config.interface, &client_config.ifindex,
271 NULL, client_config.arp)) 271 NULL, client_config.arp))
272 return 1; 272 return 1;
273#if !BB_MMU 273#if !BB_MMU
@@ -322,9 +322,9 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
322 322
323 if (listen_mode != LISTEN_NONE && sockfd < 0) { 323 if (listen_mode != LISTEN_NONE && sockfd < 0) {
324 if (listen_mode == LISTEN_KERNEL) 324 if (listen_mode == LISTEN_KERNEL)
325 sockfd = listen_socket(/*INADDR_ANY,*/ CLIENT_PORT, client_config.interface); 325 sockfd = udhcp_listen_socket(/*INADDR_ANY,*/ CLIENT_PORT, client_config.interface);
326 else 326 else
327 sockfd = raw_socket(client_config.ifindex); 327 sockfd = udhcp_raw_socket(client_config.ifindex);
328 } 328 }
329 max_fd = udhcp_sp_fd_set(&rfds, sockfd); 329 max_fd = udhcp_sp_fd_set(&rfds, sockfd);
330 330
@@ -348,7 +348,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
348 * resend discover/renew/whatever 348 * resend discover/renew/whatever
349 */ 349 */
350 if (retval == 0) { 350 if (retval == 0) {
351 /* We will restart wait afresh in any case */ 351 /* We will restart the wait in any case */
352 already_waited_sec = 0; 352 already_waited_sec = 0;
353 353
354 switch (state) { 354 switch (state) {
diff --git a/networking/udhcp/dhcpc.h b/networking/udhcp/dhcpc.h
index 04e320cf0..6ca440071 100644
--- a/networking/udhcp/dhcpc.h
+++ b/networking/udhcp/dhcpc.h
@@ -37,17 +37,17 @@ struct client_config_t {
37 37
38/*** clientpacket.h ***/ 38/*** clientpacket.h ***/
39 39
40uint32_t random_xid(void); 40uint32_t random_xid(void) FAST_FUNC;
41int send_discover(uint32_t xid, uint32_t requested); 41int send_discover(uint32_t xid, uint32_t requested) FAST_FUNC;
42int send_selecting(uint32_t xid, uint32_t server, uint32_t requested); 42int send_selecting(uint32_t xid, uint32_t server, uint32_t requested) FAST_FUNC;
43#if ENABLE_FEATURE_UDHCPC_ARPING 43#if ENABLE_FEATURE_UDHCPC_ARPING
44int send_decline(uint32_t xid, uint32_t server, uint32_t requested); 44int send_decline(uint32_t xid, uint32_t server, uint32_t requested) FAST_FUNC;
45#endif 45#endif
46int send_renew(uint32_t xid, uint32_t server, uint32_t ciaddr); 46int send_renew(uint32_t xid, uint32_t server, uint32_t ciaddr) FAST_FUNC;
47int send_renew(uint32_t xid, uint32_t server, uint32_t ciaddr); 47int send_renew(uint32_t xid, uint32_t server, uint32_t ciaddr) FAST_FUNC;
48int send_release(uint32_t server, uint32_t ciaddr); 48int send_release(uint32_t server, uint32_t ciaddr) FAST_FUNC;
49 49
50int udhcp_recv_raw_packet(struct dhcpMessage *payload, int fd); 50int udhcp_recv_raw_packet(struct dhcpMessage *payload, int fd) FAST_FUNC;
51 51
52#if __GNUC_PREREQ(4,1) 52#if __GNUC_PREREQ(4,1)
53# pragma GCC visibility pop 53# pragma GCC visibility pop
diff --git a/networking/udhcp/dhcpd.c b/networking/udhcp/dhcpd.c
index 0cd6b9d50..b512c45ee 100644
--- a/networking/udhcp/dhcpd.c
+++ b/networking/udhcp/dhcpd.c
@@ -94,7 +94,7 @@ int udhcpd_main(int argc UNUSED_PARAM, char **argv)
94 leases = xzalloc(server_config.max_leases * sizeof(*leases)); 94 leases = xzalloc(server_config.max_leases * sizeof(*leases));
95 read_leases(server_config.lease_file); 95 read_leases(server_config.lease_file);
96 96
97 if (read_interface(server_config.interface, &server_config.ifindex, 97 if (udhcp_read_interface(server_config.interface, &server_config.ifindex,
98 &server_config.server, server_config.arp)) { 98 &server_config.server, server_config.arp)) {
99 retval = 1; 99 retval = 1;
100 goto ret; 100 goto ret;
@@ -107,7 +107,7 @@ int udhcpd_main(int argc UNUSED_PARAM, char **argv)
107 while (1) { /* loop until universe collapses */ 107 while (1) { /* loop until universe collapses */
108 108
109 if (server_socket < 0) { 109 if (server_socket < 0) {
110 server_socket = listen_socket(/*INADDR_ANY,*/ SERVER_PORT, 110 server_socket = udhcp_listen_socket(/*INADDR_ANY,*/ SERVER_PORT,
111 server_config.interface); 111 server_config.interface);
112 } 112 }
113 113
diff --git a/networking/udhcp/dhcpd.h b/networking/udhcp/dhcpd.h
index 87e1afc1f..2d9752845 100644
--- a/networking/udhcp/dhcpd.h
+++ b/networking/udhcp/dhcpd.h
@@ -82,40 +82,40 @@ struct dhcpOfferedAddr {
82 uint32_t expires; /* host order */ 82 uint32_t expires; /* host order */
83}; 83};
84 84
85struct dhcpOfferedAddr *add_lease(const uint8_t *chaddr, uint32_t yiaddr, unsigned long lease); 85struct dhcpOfferedAddr *add_lease(const uint8_t *chaddr, uint32_t yiaddr, unsigned long lease) FAST_FUNC;
86int lease_expired(struct dhcpOfferedAddr *lease); 86int lease_expired(struct dhcpOfferedAddr *lease) FAST_FUNC;
87struct dhcpOfferedAddr *find_lease_by_chaddr(const uint8_t *chaddr); 87struct dhcpOfferedAddr *find_lease_by_chaddr(const uint8_t *chaddr) FAST_FUNC;
88struct dhcpOfferedAddr *find_lease_by_yiaddr(uint32_t yiaddr); 88struct dhcpOfferedAddr *find_lease_by_yiaddr(uint32_t yiaddr) FAST_FUNC;
89uint32_t find_address(int check_expired); 89uint32_t find_address(int check_expired) FAST_FUNC;
90 90
91 91
92/*** static_leases.h ***/ 92/*** static_leases.h ***/
93 93
94/* Config file will pass static lease info to this function which will add it 94/* Config file will pass static lease info to this function which will add it
95 * to a data structure that can be searched later */ 95 * to a data structure that can be searched later */
96int addStaticLease(struct static_lease **lease_struct, uint8_t *mac, uint32_t *ip); 96int addStaticLease(struct static_lease **lease_struct, uint8_t *mac, uint32_t *ip) FAST_FUNC;
97/* Check to see if a mac has an associated static lease */ 97/* Check to see if a mac has an associated static lease */
98uint32_t getIpByMac(struct static_lease *lease_struct, void *arg); 98uint32_t getIpByMac(struct static_lease *lease_struct, void *arg) FAST_FUNC;
99/* Check to see if an ip is reserved as a static ip */ 99/* Check to see if an ip is reserved as a static ip */
100uint32_t reservedIp(struct static_lease *lease_struct, uint32_t ip); 100uint32_t reservedIp(struct static_lease *lease_struct, uint32_t ip) FAST_FUNC;
101/* Print out static leases just to check what's going on (debug code) */ 101/* Print out static leases just to check what's going on (debug code) */
102void printStaticLeases(struct static_lease **lease_struct); 102void printStaticLeases(struct static_lease **lease_struct) FAST_FUNC;
103 103
104 104
105/*** serverpacket.h ***/ 105/*** serverpacket.h ***/
106 106
107int send_offer(struct dhcpMessage *oldpacket); 107int send_offer(struct dhcpMessage *oldpacket) FAST_FUNC;
108int send_NAK(struct dhcpMessage *oldpacket); 108int send_NAK(struct dhcpMessage *oldpacket) FAST_FUNC;
109int send_ACK(struct dhcpMessage *oldpacket, uint32_t yiaddr); 109int send_ACK(struct dhcpMessage *oldpacket, uint32_t yiaddr) FAST_FUNC;
110int send_inform(struct dhcpMessage *oldpacket); 110int send_inform(struct dhcpMessage *oldpacket) FAST_FUNC;
111 111
112 112
113/*** files.h ***/ 113/*** files.h ***/
114 114
115void read_config(const char *file); 115void read_config(const char *file) FAST_FUNC;
116void write_leases(void); 116void write_leases(void) FAST_FUNC;
117void read_leases(const char *file); 117void read_leases(const char *file) FAST_FUNC;
118struct option_set *find_option(struct option_set *opt_list, uint8_t code); 118struct option_set *find_option(struct option_set *opt_list, uint8_t code) FAST_FUNC;
119 119
120 120
121#if __GNUC_PREREQ(4,1) 121#if __GNUC_PREREQ(4,1)
diff --git a/networking/udhcp/dhcprelay.c b/networking/udhcp/dhcprelay.c
index 90ecf4831..f3b2855d8 100644
--- a/networking/udhcp/dhcprelay.c
+++ b/networking/udhcp/dhcprelay.c
@@ -156,12 +156,12 @@ static int init_sockets(char **client, int num_clients,
156 int i, n; 156 int i, n;
157 157
158 /* talk to real server on bootps */ 158 /* talk to real server on bootps */
159 fds[0] = listen_socket(/*INADDR_ANY,*/ SERVER_PORT, server); 159 fds[0] = udhcp_listen_socket(/*INADDR_ANY,*/ SERVER_PORT, server);
160 n = fds[0]; 160 n = fds[0];
161 161
162 for (i = 1; i < num_clients; i++) { 162 for (i = 1; i < num_clients; i++) {
163 /* listen for clients on bootps */ 163 /* listen for clients on bootps */
164 fds[i] = listen_socket(/*INADDR_ANY,*/ SERVER_PORT, client[i-1]); 164 fds[i] = udhcp_listen_socket(/*INADDR_ANY,*/ SERVER_PORT, client[i-1]);
165 if (fds[i] > n) 165 if (fds[i] > n)
166 n = fds[i]; 166 n = fds[i];
167 } 167 }
@@ -271,7 +271,7 @@ static void dhcprelay_loop(int *fds, int num_sockets, int max_socket, char **cli
271 (struct sockaddr *)(&client_addr), &addr_size); 271 (struct sockaddr *)(&client_addr), &addr_size);
272 if (packlen <= 0) 272 if (packlen <= 0)
273 continue; 273 continue;
274 if (read_interface(clients[i-1], NULL, &dhcp_msg.giaddr, NULL)) 274 if (udhcp_read_interface(clients[i-1], NULL, &dhcp_msg.giaddr, NULL))
275 dhcp_msg.giaddr = gw_ip; 275 dhcp_msg.giaddr = gw_ip;
276 pass_on(&dhcp_msg, packlen, i, fds, &client_addr, server_addr); 276 pass_on(&dhcp_msg, packlen, i, fds, &client_addr, server_addr);
277 } 277 }
@@ -305,7 +305,7 @@ int dhcprelay_main(int argc, char **argv)
305 fds = xmalloc(num_sockets * sizeof(fds[0])); 305 fds = xmalloc(num_sockets * sizeof(fds[0]));
306 max_socket = init_sockets(clients, num_sockets, argv[2], fds); 306 max_socket = init_sockets(clients, num_sockets, argv[2], fds);
307 307
308 if (read_interface(argv[2], NULL, &gw_ip, NULL)) 308 if (udhcp_read_interface(argv[2], NULL, &gw_ip, NULL))
309 return 1; 309 return 1;
310 310
311 /* doesn't return */ 311 /* doesn't return */
diff --git a/networking/udhcp/domain_codec.c b/networking/udhcp/domain_codec.c
index 239ae5b5c..6da4e8d69 100644
--- a/networking/udhcp/domain_codec.c
+++ b/networking/udhcp/domain_codec.c
@@ -23,7 +23,7 @@
23 * returns a newly allocated string containing the space-separated domains, 23 * returns a newly allocated string containing the space-separated domains,
24 * prefixed with the contents of string pre, or NULL if an error occurs. 24 * prefixed with the contents of string pre, or NULL if an error occurs.
25 */ 25 */
26char *dname_dec(const uint8_t *cstr, int clen, const char *pre) 26char* FAST_FUNC dname_dec(const uint8_t *cstr, int clen, const char *pre)
27{ 27{
28 const uint8_t *c; 28 const uint8_t *c;
29 int crtpos, retpos, depth, plen = 0, len = 0; 29 int crtpos, retpos, depth, plen = 0, len = 0;
@@ -178,7 +178,7 @@ static int find_offset(const uint8_t *cstr, int clen, const uint8_t *dname)
178 * The computed string is returned directly; its length is returned via retlen; 178 * The computed string is returned directly; its length is returned via retlen;
179 * NULL and 0, respectively, are returned if an error occurs. 179 * NULL and 0, respectively, are returned if an error occurs.
180 */ 180 */
181uint8_t *dname_enc(const uint8_t *cstr, int clen, const char *src, int *retlen) 181uint8_t* FAST_FUNC dname_enc(const uint8_t *cstr, int clen, const char *src, int *retlen)
182{ 182{
183 uint8_t *d, *dname; 183 uint8_t *d, *dname;
184 int off; 184 int off;
diff --git a/networking/udhcp/files.c b/networking/udhcp/files.c
index ff5847d25..b7bad3309 100644
--- a/networking/udhcp/files.c
+++ b/networking/udhcp/files.c
@@ -69,7 +69,7 @@ static int read_yn(const char *line, void *arg)
69 69
70 70
71/* find option 'code' in opt_list */ 71/* find option 'code' in opt_list */
72struct option_set *find_option(struct option_set *opt_list, uint8_t code) 72struct option_set* FAST_FUNC find_option(struct option_set *opt_list, uint8_t code)
73{ 73{
74 while (opt_list && opt_list->data[OPT_CODE] < code) 74 while (opt_list && opt_list->data[OPT_CODE] < code)
75 opt_list = opt_list->next; 75 opt_list = opt_list->next;
@@ -307,7 +307,7 @@ static const struct config_keyword keywords[] = {
307}; 307};
308enum { KWS_WITH_DEFAULTS = ARRAY_SIZE(keywords) - 6 }; 308enum { KWS_WITH_DEFAULTS = ARRAY_SIZE(keywords) - 6 };
309 309
310void read_config(const char *file) 310void FAST_FUNC read_config(const char *file)
311{ 311{
312 parser_t *parser; 312 parser_t *parser;
313 const struct config_keyword *k; 313 const struct config_keyword *k;
@@ -338,7 +338,7 @@ void read_config(const char *file)
338} 338}
339 339
340 340
341void write_leases(void) 341void FAST_FUNC write_leases(void)
342{ 342{
343 int fp; 343 int fp;
344 unsigned i; 344 unsigned i;
@@ -380,7 +380,7 @@ void write_leases(void)
380} 380}
381 381
382 382
383void read_leases(const char *file) 383void FAST_FUNC read_leases(const char *file)
384{ 384{
385 int fp; 385 int fp;
386 unsigned i; 386 unsigned i;
diff --git a/networking/udhcp/leases.c b/networking/udhcp/leases.c
index 1745fee03..ff52da9fb 100644
--- a/networking/udhcp/leases.c
+++ b/networking/udhcp/leases.c
@@ -43,7 +43,7 @@ static void clear_lease(const uint8_t *chaddr, uint32_t yiaddr)
43 43
44 44
45/* add a lease into the table, clearing out any old ones */ 45/* add a lease into the table, clearing out any old ones */
46struct dhcpOfferedAddr *add_lease(const uint8_t *chaddr, uint32_t yiaddr, unsigned long lease) 46struct dhcpOfferedAddr* FAST_FUNC add_lease(const uint8_t *chaddr, uint32_t yiaddr, unsigned long lease)
47{ 47{
48 struct dhcpOfferedAddr *oldest; 48 struct dhcpOfferedAddr *oldest;
49 49
@@ -63,14 +63,14 @@ struct dhcpOfferedAddr *add_lease(const uint8_t *chaddr, uint32_t yiaddr, unsign
63 63
64 64
65/* true if a lease has expired */ 65/* true if a lease has expired */
66int lease_expired(struct dhcpOfferedAddr *lease) 66int FAST_FUNC lease_expired(struct dhcpOfferedAddr *lease)
67{ 67{
68 return (lease->expires < (unsigned long) time(0)); 68 return (lease->expires < (unsigned long) time(0));
69} 69}
70 70
71 71
72/* Find the first lease that matches chaddr, NULL if no match */ 72/* Find the first lease that matches chaddr, NULL if no match */
73struct dhcpOfferedAddr *find_lease_by_chaddr(const uint8_t *chaddr) 73struct dhcpOfferedAddr* FAST_FUNC find_lease_by_chaddr(const uint8_t *chaddr)
74{ 74{
75 unsigned i; 75 unsigned i;
76 76
@@ -83,7 +83,7 @@ struct dhcpOfferedAddr *find_lease_by_chaddr(const uint8_t *chaddr)
83 83
84 84
85/* Find the first lease that matches yiaddr, NULL is no match */ 85/* Find the first lease that matches yiaddr, NULL is no match */
86struct dhcpOfferedAddr *find_lease_by_yiaddr(uint32_t yiaddr) 86struct dhcpOfferedAddr* FAST_FUNC find_lease_by_yiaddr(uint32_t yiaddr)
87{ 87{
88 unsigned i; 88 unsigned i;
89 89
@@ -119,7 +119,7 @@ static int nobody_responds_to_arp(uint32_t addr)
119 119
120/* find an assignable address, if check_expired is true, we check all the expired leases as well. 120/* find an assignable address, if check_expired is true, we check all the expired leases as well.
121 * Maybe this should try expired leases by age... */ 121 * Maybe this should try expired leases by age... */
122uint32_t find_address(int check_expired) 122uint32_t FAST_FUNC find_address(int check_expired)
123{ 123{
124 uint32_t addr, ret; 124 uint32_t addr, ret;
125 struct dhcpOfferedAddr *lease = NULL; 125 struct dhcpOfferedAddr *lease = NULL;
diff --git a/networking/udhcp/options.c b/networking/udhcp/options.c
index 12e566210..b6e77e3e5 100644
--- a/networking/udhcp/options.c
+++ b/networking/udhcp/options.c
@@ -118,7 +118,7 @@ const uint8_t dhcp_option_lengths[] ALIGN1 = {
118 118
119 119
120/* get an option with bounds checking (warning, not aligned). */ 120/* get an option with bounds checking (warning, not aligned). */
121uint8_t *get_option(struct dhcpMessage *packet, int code) 121uint8_t* FAST_FUNC get_option(struct dhcpMessage *packet, int code)
122{ 122{
123 int i, length; 123 int i, length;
124 uint8_t *optionptr; 124 uint8_t *optionptr;
@@ -175,7 +175,7 @@ uint8_t *get_option(struct dhcpMessage *packet, int code)
175 175
176 176
177/* return the position of the 'end' option (no bounds checking) */ 177/* return the position of the 'end' option (no bounds checking) */
178int end_option(uint8_t *optionptr) 178int FAST_FUNC end_option(uint8_t *optionptr)
179{ 179{
180 int i = 0; 180 int i = 0;
181 181
@@ -191,7 +191,7 @@ int end_option(uint8_t *optionptr)
191 191
192/* add an option string to the options (an option string contains an option code, 192/* add an option string to the options (an option string contains an option code,
193 * length, then data) */ 193 * length, then data) */
194int add_option_string(uint8_t *optionptr, uint8_t *string) 194int FAST_FUNC add_option_string(uint8_t *optionptr, uint8_t *string)
195{ 195{
196 int end = end_option(optionptr); 196 int end = end_option(optionptr);
197 197
@@ -209,7 +209,7 @@ int add_option_string(uint8_t *optionptr, uint8_t *string)
209 209
210 210
211/* add a one to four byte option to a packet */ 211/* add a one to four byte option to a packet */
212int add_simple_option(uint8_t *optionptr, uint8_t code, uint32_t data) 212int FAST_FUNC add_simple_option(uint8_t *optionptr, uint8_t code, uint32_t data)
213{ 213{
214 const struct dhcp_option *dh; 214 const struct dhcp_option *dh;
215 215
diff --git a/networking/udhcp/options.h b/networking/udhcp/options.h
index cf3fe3b18..70b8704d2 100644
--- a/networking/udhcp/options.h
+++ b/networking/udhcp/options.h
@@ -107,13 +107,13 @@ extern const struct dhcp_option dhcp_options[];
107extern const char dhcp_option_strings[]; 107extern const char dhcp_option_strings[];
108extern const uint8_t dhcp_option_lengths[]; 108extern const uint8_t dhcp_option_lengths[];
109 109
110uint8_t *get_option(struct dhcpMessage *packet, int code); 110uint8_t *get_option(struct dhcpMessage *packet, int code) FAST_FUNC;
111int end_option(uint8_t *optionptr); 111int end_option(uint8_t *optionptr) FAST_FUNC;
112int add_option_string(uint8_t *optionptr, uint8_t *string); 112int add_option_string(uint8_t *optionptr, uint8_t *string) FAST_FUNC;
113int add_simple_option(uint8_t *optionptr, uint8_t code, uint32_t data); 113int add_simple_option(uint8_t *optionptr, uint8_t code, uint32_t data) FAST_FUNC;
114#if ENABLE_FEATURE_RFC3397 114#if ENABLE_FEATURE_RFC3397
115char *dname_dec(const uint8_t *cstr, int clen, const char *pre); 115char *dname_dec(const uint8_t *cstr, int clen, const char *pre) FAST_FUNC;
116uint8_t *dname_enc(const uint8_t *cstr, int clen, const char *src, int *retlen); 116uint8_t *dname_enc(const uint8_t *cstr, int clen, const char *src, int *retlen) FAST_FUNC;
117#endif 117#endif
118 118
119#if __GNUC_PREREQ(4,1) 119#if __GNUC_PREREQ(4,1)
diff --git a/networking/udhcp/packet.c b/networking/udhcp/packet.c
index 923add628..58f45e54e 100644
--- a/networking/udhcp/packet.c
+++ b/networking/udhcp/packet.c
@@ -15,7 +15,7 @@
15#include "options.h" 15#include "options.h"
16 16
17 17
18void udhcp_init_header(struct dhcpMessage *packet, char type) 18void FAST_FUNC udhcp_init_header(struct dhcpMessage *packet, char type)
19{ 19{
20 memset(packet, 0, sizeof(struct dhcpMessage)); 20 memset(packet, 0, sizeof(struct dhcpMessage));
21 packet->op = BOOTREQUEST; 21 packet->op = BOOTREQUEST;
@@ -34,7 +34,7 @@ void udhcp_init_header(struct dhcpMessage *packet, char type)
34 34
35 35
36/* read a packet from socket fd, return -1 on read error, -2 on packet error */ 36/* read a packet from socket fd, return -1 on read error, -2 on packet error */
37int udhcp_recv_kernel_packet(struct dhcpMessage *packet, int fd) 37int FAST_FUNC udhcp_recv_kernel_packet(struct dhcpMessage *packet, int fd)
38{ 38{
39 int bytes; 39 int bytes;
40 unsigned char *vendor; 40 unsigned char *vendor;
@@ -85,7 +85,7 @@ int udhcp_recv_kernel_packet(struct dhcpMessage *packet, int fd)
85} 85}
86 86
87 87
88uint16_t udhcp_checksum(void *addr, int count) 88uint16_t FAST_FUNC udhcp_checksum(void *addr, int count)
89{ 89{
90 /* Compute Internet Checksum for "count" bytes 90 /* Compute Internet Checksum for "count" bytes
91 * beginning at location "addr". 91 * beginning at location "addr".
@@ -116,7 +116,7 @@ uint16_t udhcp_checksum(void *addr, int count)
116 116
117 117
118/* Construct a ip/udp header for a packet, send packet */ 118/* Construct a ip/udp header for a packet, send packet */
119int udhcp_send_raw_packet(struct dhcpMessage *payload, 119int FAST_FUNC udhcp_send_raw_packet(struct dhcpMessage *payload,
120 uint32_t source_ip, int source_port, 120 uint32_t source_ip, int source_port,
121 uint32_t dest_ip, int dest_port, const uint8_t *dest_arp, int ifindex) 121 uint32_t dest_ip, int dest_port, const uint8_t *dest_arp, int ifindex)
122{ 122{
@@ -186,7 +186,7 @@ int udhcp_send_raw_packet(struct dhcpMessage *payload,
186 186
187 187
188/* Let the kernel do all the work for packet generation */ 188/* Let the kernel do all the work for packet generation */
189int udhcp_send_kernel_packet(struct dhcpMessage *payload, 189int FAST_FUNC udhcp_send_kernel_packet(struct dhcpMessage *payload,
190 uint32_t source_ip, int source_port, 190 uint32_t source_ip, int source_port,
191 uint32_t dest_ip, int dest_port) 191 uint32_t dest_ip, int dest_port)
192{ 192{
diff --git a/networking/udhcp/script.c b/networking/udhcp/script.c
index 4f4bc253a..2324ea95b 100644
--- a/networking/udhcp/script.c
+++ b/networking/udhcp/script.c
@@ -209,7 +209,7 @@ static char **fill_envp(struct dhcpMessage *packet)
209 209
210 210
211/* Call a script with a par file and env vars */ 211/* Call a script with a par file and env vars */
212void udhcp_run_script(struct dhcpMessage *packet, const char *name) 212void FAST_FUNC udhcp_run_script(struct dhcpMessage *packet, const char *name)
213{ 213{
214 int pid; 214 int pid;
215 char **envp, **curr; 215 char **envp, **curr;
diff --git a/networking/udhcp/serverpacket.c b/networking/udhcp/serverpacket.c
index fc6249725..2fcf93033 100644
--- a/networking/udhcp/serverpacket.c
+++ b/networking/udhcp/serverpacket.c
@@ -97,7 +97,7 @@ static void add_bootp_options(struct dhcpMessage *packet)
97 97
98 98
99/* send a DHCP OFFER to a DHCP DISCOVER */ 99/* send a DHCP OFFER to a DHCP DISCOVER */
100int send_offer(struct dhcpMessage *oldpacket) 100int FAST_FUNC send_offer(struct dhcpMessage *oldpacket)
101{ 101{
102 struct dhcpMessage packet; 102 struct dhcpMessage packet;
103 struct dhcpOfferedAddr *lease = NULL; 103 struct dhcpOfferedAddr *lease = NULL;
@@ -185,7 +185,7 @@ int send_offer(struct dhcpMessage *oldpacket)
185} 185}
186 186
187 187
188int send_NAK(struct dhcpMessage *oldpacket) 188int FAST_FUNC send_NAK(struct dhcpMessage *oldpacket)
189{ 189{
190 struct dhcpMessage packet; 190 struct dhcpMessage packet;
191 191
@@ -196,7 +196,7 @@ int send_NAK(struct dhcpMessage *oldpacket)
196} 196}
197 197
198 198
199int send_ACK(struct dhcpMessage *oldpacket, uint32_t yiaddr) 199int FAST_FUNC send_ACK(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;
@@ -244,7 +244,7 @@ int send_ACK(struct dhcpMessage *oldpacket, uint32_t yiaddr)
244} 244}
245 245
246 246
247int send_inform(struct dhcpMessage *oldpacket) 247int FAST_FUNC send_inform(struct dhcpMessage *oldpacket)
248{ 248{
249 struct dhcpMessage packet; 249 struct dhcpMessage packet;
250 struct option_set *curr; 250 struct option_set *curr;
diff --git a/networking/udhcp/signalpipe.c b/networking/udhcp/signalpipe.c
index 1486b3b2d..a025bd8b5 100644
--- a/networking/udhcp/signalpipe.c
+++ b/networking/udhcp/signalpipe.c
@@ -35,7 +35,7 @@ static void signal_handler(int sig)
35 35
36/* Call this before doing anything else. Sets up the socket pair 36/* Call this before doing anything else. Sets up the socket pair
37 * and installs the signal handler */ 37 * and installs the signal handler */
38void udhcp_sp_setup(void) 38void FAST_FUNC udhcp_sp_setup(void)
39{ 39{
40 /* was socketpair, but it needs AF_UNIX in kernel */ 40 /* was socketpair, but it needs AF_UNIX in kernel */
41 xpiped_pair(signal_pipe); 41 xpiped_pair(signal_pipe);
@@ -53,7 +53,7 @@ void udhcp_sp_setup(void)
53/* Quick little function to setup the rfds. Will return the 53/* Quick little function to setup the rfds. Will return the
54 * max_fd for use with select. Limited in that you can only pass 54 * max_fd for use with select. Limited in that you can only pass
55 * one extra fd */ 55 * one extra fd */
56int udhcp_sp_fd_set(fd_set *rfds, int extra_fd) 56int FAST_FUNC udhcp_sp_fd_set(fd_set *rfds, int extra_fd)
57{ 57{
58 FD_ZERO(rfds); 58 FD_ZERO(rfds);
59 FD_SET(signal_pipe.rd, rfds); 59 FD_SET(signal_pipe.rd, rfds);
@@ -68,7 +68,7 @@ int udhcp_sp_fd_set(fd_set *rfds, int extra_fd)
68/* Read a signal from the signal pipe. Returns 0 if there is 68/* Read a signal from the signal pipe. Returns 0 if there is
69 * no signal, -1 on error (and sets errno appropriately), and 69 * no signal, -1 on error (and sets errno appropriately), and
70 * your signal on success */ 70 * your signal on success */
71int udhcp_sp_read(const fd_set *rfds) 71int FAST_FUNC udhcp_sp_read(const fd_set *rfds)
72{ 72{
73 unsigned char sig; 73 unsigned char sig;
74 74
diff --git a/networking/udhcp/socket.c b/networking/udhcp/socket.c
index 2cbd4aa88..2d272510d 100644
--- a/networking/udhcp/socket.c
+++ b/networking/udhcp/socket.c
@@ -37,7 +37,7 @@
37#include "common.h" 37#include "common.h"
38 38
39 39
40int read_interface(const char *interface, int *ifindex, uint32_t *addr, uint8_t *arp) 40int FAST_FUNC udhcp_read_interface(const char *interface, int *ifindex, uint32_t *addr, uint8_t *arp)
41{ 41{
42 int fd; 42 int fd;
43 struct ifreq ifr; 43 struct ifreq ifr;
@@ -85,7 +85,7 @@ int read_interface(const char *interface, int *ifindex, uint32_t *addr, uint8_t
85 85
86/* 1. None of the callers expects it to ever fail */ 86/* 1. None of the callers expects it to ever fail */
87/* 2. ip was always INADDR_ANY */ 87/* 2. ip was always INADDR_ANY */
88int listen_socket(/*uint32_t ip,*/ int port, const char *inf) 88int FAST_FUNC udhcp_listen_socket(/*uint32_t ip,*/ int port, const char *inf)
89{ 89{
90 int fd; 90 int fd;
91 struct ifreq interface; 91 struct ifreq interface;
diff --git a/networking/udhcp/static_leases.c b/networking/udhcp/static_leases.c
index aabfb81aa..bd07c5026 100644
--- a/networking/udhcp/static_leases.c
+++ b/networking/udhcp/static_leases.c
@@ -14,7 +14,7 @@
14/* Takes the address of the pointer to the static_leases linked list, 14/* Takes the address of the pointer to the static_leases linked list,
15 * Address to a 6 byte mac address 15 * Address to a 6 byte mac address
16 * Address to a 4 byte ip address */ 16 * Address to a 4 byte ip address */
17int addStaticLease(struct static_lease **lease_struct, uint8_t *mac, uint32_t *ip) 17int FAST_FUNC addStaticLease(struct static_lease **lease_struct, uint8_t *mac, uint32_t *ip)
18{ 18{
19 struct static_lease *cur; 19 struct static_lease *cur;
20 struct static_lease *new_static_lease; 20 struct static_lease *new_static_lease;
@@ -41,7 +41,7 @@ int addStaticLease(struct static_lease **lease_struct, uint8_t *mac, uint32_t *i
41} 41}
42 42
43/* Check to see if a mac has an associated static lease */ 43/* Check to see if a mac has an associated static lease */
44uint32_t getIpByMac(struct static_lease *lease_struct, void *arg) 44uint32_t FAST_FUNC getIpByMac(struct static_lease *lease_struct, void *arg)
45{ 45{
46 uint32_t return_ip; 46 uint32_t return_ip;
47 struct static_lease *cur = lease_struct; 47 struct static_lease *cur = lease_struct;
@@ -62,7 +62,7 @@ uint32_t getIpByMac(struct static_lease *lease_struct, void *arg)
62} 62}
63 63
64/* Check to see if an ip is reserved as a static ip */ 64/* Check to see if an ip is reserved as a static ip */
65uint32_t reservedIp(struct static_lease *lease_struct, uint32_t ip) 65uint32_t FAST_FUNC reservedIp(struct static_lease *lease_struct, uint32_t ip)
66{ 66{
67 struct static_lease *cur = lease_struct; 67 struct static_lease *cur = lease_struct;
68 68
@@ -82,7 +82,7 @@ uint32_t reservedIp(struct static_lease *lease_struct, uint32_t ip)
82#if ENABLE_FEATURE_UDHCP_DEBUG 82#if ENABLE_FEATURE_UDHCP_DEBUG
83/* Print out static leases just to check what's going on */ 83/* Print out static leases just to check what's going on */
84/* Takes the address of the pointer to the static_leases linked list */ 84/* Takes the address of the pointer to the static_leases linked list */
85void printStaticLeases(struct static_lease **arg) 85void FAST_FUNC printStaticLeases(struct static_lease **arg)
86{ 86{
87 /* Get a pointer to the linked list */ 87 /* Get a pointer to the linked list */
88 struct static_lease *cur = *arg; 88 struct static_lease *cur = *arg;