aboutsummaryrefslogtreecommitdiff
path: root/networking/libiproute/utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'networking/libiproute/utils.c')
-rw-r--r--networking/libiproute/utils.c34
1 files changed, 18 insertions, 16 deletions
diff --git a/networking/libiproute/utils.c b/networking/libiproute/utils.c
index 42025bc66..fca167ac6 100644
--- a/networking/libiproute/utils.c
+++ b/networking/libiproute/utils.c
@@ -13,7 +13,7 @@
13#include "utils.h" 13#include "utils.h"
14#include "inet_common.h" 14#include "inet_common.h"
15 15
16unsigned get_hz(void) 16unsigned FAST_FUNC get_hz(void)
17{ 17{
18 static unsigned hz_internal; 18 static unsigned hz_internal;
19 FILE *fp; 19 FILE *fp;
@@ -35,7 +35,7 @@ unsigned get_hz(void)
35 return hz_internal; 35 return hz_internal;
36} 36}
37 37
38unsigned get_unsigned(char *arg, const char *errmsg) 38unsigned FAST_FUNC get_unsigned(char *arg, const char *errmsg)
39{ 39{
40 unsigned long res; 40 unsigned long res;
41 char *ptr; 41 char *ptr;
@@ -50,7 +50,7 @@ unsigned get_unsigned(char *arg, const char *errmsg)
50 invarg_1_to_2(arg, errmsg); /* does not return */ 50 invarg_1_to_2(arg, errmsg); /* does not return */
51} 51}
52 52
53uint32_t get_u32(char *arg, const char *errmsg) 53uint32_t FAST_FUNC get_u32(char *arg, const char *errmsg)
54{ 54{
55 unsigned long res; 55 unsigned long res;
56 char *ptr; 56 char *ptr;
@@ -65,7 +65,7 @@ uint32_t get_u32(char *arg, const char *errmsg)
65 invarg_1_to_2(arg, errmsg); /* does not return */ 65 invarg_1_to_2(arg, errmsg); /* does not return */
66} 66}
67 67
68uint16_t get_u16(char *arg, const char *errmsg) 68uint16_t FAST_FUNC get_u16(char *arg, const char *errmsg)
69{ 69{
70 unsigned long res; 70 unsigned long res;
71 char *ptr; 71 char *ptr;
@@ -80,7 +80,7 @@ uint16_t get_u16(char *arg, const char *errmsg)
80 invarg_1_to_2(arg, errmsg); /* does not return */ 80 invarg_1_to_2(arg, errmsg); /* does not return */
81} 81}
82 82
83int get_addr_1(inet_prefix *addr, char *name, int family) 83int FAST_FUNC get_addr_1(inet_prefix *addr, char *name, int family)
84{ 84{
85 memset(addr, 0, sizeof(*addr)); 85 memset(addr, 0, sizeof(*addr));
86 86
@@ -199,7 +199,7 @@ static void get_prefix_1(inet_prefix *dst, char *arg, int family)
199 bb_error_msg_and_die("an %s %s is expected rather than \"%s\"", "inet", "prefix", arg); 199 bb_error_msg_and_die("an %s %s is expected rather than \"%s\"", "inet", "prefix", arg);
200} 200}
201 201
202int get_addr(inet_prefix *dst, char *arg, int family) 202int FAST_FUNC get_addr(inet_prefix *dst, char *arg, int family)
203{ 203{
204 if (family == AF_PACKET) { 204 if (family == AF_PACKET) {
205 bb_error_msg_and_die("\"%s\" may be inet %s, but it is not allowed in this context", arg, "address"); 205 bb_error_msg_and_die("\"%s\" may be inet %s, but it is not allowed in this context", arg, "address");
@@ -210,7 +210,7 @@ int get_addr(inet_prefix *dst, char *arg, int family)
210 return 0; 210 return 0;
211} 211}
212 212
213void get_prefix(inet_prefix *dst, char *arg, int family) 213void FAST_FUNC get_prefix(inet_prefix *dst, char *arg, int family)
214{ 214{
215 if (family == AF_PACKET) { 215 if (family == AF_PACKET) {
216 bb_error_msg_and_die("\"%s\" may be inet %s, but it is not allowed in this context", arg, "prefix"); 216 bb_error_msg_and_die("\"%s\" may be inet %s, but it is not allowed in this context", arg, "prefix");
@@ -218,7 +218,7 @@ void get_prefix(inet_prefix *dst, char *arg, int family)
218 get_prefix_1(dst, arg, family); 218 get_prefix_1(dst, arg, family);
219} 219}
220 220
221uint32_t get_addr32(char *name) 221uint32_t FAST_FUNC get_addr32(char *name)
222{ 222{
223 inet_prefix addr; 223 inet_prefix addr;
224 224
@@ -228,27 +228,29 @@ uint32_t get_addr32(char *name)
228 return addr.data[0]; 228 return addr.data[0];
229} 229}
230 230
231void incomplete_command(void) 231char** FAST_FUNC next_arg(char **argv)
232{ 232{
233 bb_error_msg_and_die("command line is not complete, try \"help\""); 233 if (!*++argv)
234 bb_error_msg_and_die("command line is not complete, try \"help\"");
235 return argv;
234} 236}
235 237
236void invarg_1_to_2(const char *arg, const char *opt) 238void FAST_FUNC invarg_1_to_2(const char *arg, const char *opt)
237{ 239{
238 bb_error_msg_and_die(bb_msg_invalid_arg_to, arg, opt); 240 bb_error_msg_and_die(bb_msg_invalid_arg_to, arg, opt);
239} 241}
240 242
241void duparg(const char *key, const char *arg) 243void FAST_FUNC duparg(const char *key, const char *arg)
242{ 244{
243 bb_error_msg_and_die("duplicate \"%s\": \"%s\" is the second value", key, arg); 245 bb_error_msg_and_die("duplicate \"%s\": \"%s\" is the second value", key, arg);
244} 246}
245 247
246void duparg2(const char *key, const char *arg) 248void FAST_FUNC duparg2(const char *key, const char *arg)
247{ 249{
248 bb_error_msg_and_die("either \"%s\" is duplicate, or \"%s\" is garbage", key, arg); 250 bb_error_msg_and_die("either \"%s\" is duplicate, or \"%s\" is garbage", key, arg);
249} 251}
250 252
251int inet_addr_match(const inet_prefix *a, const inet_prefix *b, int bits) 253int FAST_FUNC inet_addr_match(const inet_prefix *a, const inet_prefix *b, int bits)
252{ 254{
253 const uint32_t *a1 = a->data; 255 const uint32_t *a1 = a->data;
254 const uint32_t *a2 = b->data; 256 const uint32_t *a2 = b->data;
@@ -276,7 +278,7 @@ int inet_addr_match(const inet_prefix *a, const inet_prefix *b, int bits)
276 return 0; 278 return 0;
277} 279}
278 280
279const char *rt_addr_n2a(int af, void *addr) 281const char* FAST_FUNC rt_addr_n2a(int af, void *addr)
280{ 282{
281 switch (af) { 283 switch (af) {
282 case AF_INET: 284 case AF_INET:
@@ -290,7 +292,7 @@ const char *rt_addr_n2a(int af, void *addr)
290} 292}
291 293
292#ifdef RESOLVE_HOSTNAMES 294#ifdef RESOLVE_HOSTNAMES
293const char *format_host(int af, int len, void *addr) 295const char* FAST_FUNC format_host(int af, int len, void *addr)
294{ 296{
295 if (resolve_hosts) { 297 if (resolve_hosts) {
296 struct hostent *h_ent; 298 struct hostent *h_ent;