summaryrefslogtreecommitdiff
path: root/networking/libiproute
diff options
context:
space:
mode:
Diffstat (limited to 'networking/libiproute')
-rw-r--r--networking/libiproute/ip_parse_common_args.c2
-rw-r--r--networking/libiproute/ipaddress.c10
-rw-r--r--networking/libiproute/iplink.c4
-rw-r--r--networking/libiproute/iproute.c10
-rw-r--r--networking/libiproute/iptunnel.c6
-rw-r--r--networking/libiproute/utils.c4
-rw-r--r--networking/libiproute/utils.h4
7 files changed, 20 insertions, 20 deletions
diff --git a/networking/libiproute/ip_parse_common_args.c b/networking/libiproute/ip_parse_common_args.c
index 52e549e..6d49157 100644
--- a/networking/libiproute/ip_parse_common_args.c
+++ b/networking/libiproute/ip_parse_common_args.c
@@ -56,7 +56,7 @@ void ip_parse_common_args(int *argcp, char ***argvp)
else if (strcmp(argv[1], "link") == 0)
preferred_family = AF_PACKET;
else
- invarg(argv[1], "invalid protocol family");
+ invarg(argv[1], "protocol family");
} else if (strcmp(opt, "-4") == 0) {
preferred_family = AF_INET;
} else if (strcmp(opt, "-6") == 0) {
diff --git a/networking/libiproute/ipaddress.c b/networking/libiproute/ipaddress.c
index a048cff..ee9825b 100644
--- a/networking/libiproute/ipaddress.c
+++ b/networking/libiproute/ipaddress.c
@@ -430,11 +430,11 @@ int ipaddr_list_or_flush(int argc, char **argv, int flush)
if (flush) {
if (argc <= 0) {
- fprintf(stderr, "Flush requires arguments.\n");
+ bb_error_msg(bb_msg_requires_arg, "flush");
return -1;
}
if (filter.family == AF_PACKET) {
- fprintf(stderr, "Cannot flush link addresses.\n");
+ bb_error_msg("Cannot flush link addresses.");
return -1;
}
}
@@ -456,7 +456,7 @@ int ipaddr_list_or_flush(int argc, char **argv, int flush)
filter.scopemask = -1;
if (rtnl_rtscope_a2n(&scope, *argv)) {
if (strcmp(*argv, "all") != 0) {
- invarg("invalid \"scope\"\n", *argv);
+ invarg(*argv, "scope");
}
scope = RT_SCOPE_NOWHERE;
filter.scopemask = 0;
@@ -711,7 +711,7 @@ static int ipaddr_modify(int cmd, int argc, char **argv)
uint32_t scope = 0;
NEXT_ARG();
if (rtnl_rtscope_a2n(&scope, *argv)) {
- invarg(*argv, "invalid scope value");
+ invarg(*argv, "scope");
}
req.ifa.ifa_scope = scope;
scoped = 1;
@@ -744,7 +744,7 @@ static int ipaddr_modify(int cmd, int argc, char **argv)
}
if (d == NULL) {
- bb_error_msg("Not enough information: \"dev\" argument is required");
+ bb_error_msg(bb_msg_requires_arg,"\"dev\"");
return -1;
}
if (l && matches(d, l) != 0) {
diff --git a/networking/libiproute/iplink.c b/networking/libiproute/iplink.c
index 2797f02..9e30122 100644
--- a/networking/libiproute/iplink.c
+++ b/networking/libiproute/iplink.c
@@ -252,7 +252,7 @@ static int do_set(int argc, char **argv)
if (mtu != -1)
duparg("mtu", *argv);
if (get_integer(&mtu, *argv, 0))
- invarg("Invalid \"mtu\" value\n", *argv);
+ invarg(*argv, "mtu");
} else if (strcmp(*argv, "multicast") == 0) {
NEXT_ARG();
mask |= IFF_MULTICAST;
@@ -286,7 +286,7 @@ static int do_set(int argc, char **argv)
}
if (!dev) {
- bb_error_msg("Not enough of information: \"dev\" argument is required.");
+ bb_error_msg(bb_msg_requires_arg, "\"dev\"");
exit(-1);
}
diff --git a/networking/libiproute/iproute.c b/networking/libiproute/iproute.c
index 6052a30..511e891 100644
--- a/networking/libiproute/iproute.c
+++ b/networking/libiproute/iproute.c
@@ -343,14 +343,14 @@ static int iproute_modify(int cmd, unsigned flags, int argc, char **argv)
NEXT_ARG();
}
if (get_unsigned(&mtu, *argv, 0)) {
- invarg("\"mtu\" value is invalid\n", *argv);
+ invarg(*argv, "mtu");
}
rta_addattr32(mxrta, sizeof(mxbuf), RTAX_MTU, mtu);
} else if (matches(*argv, "protocol") == 0) {
uint32_t prot;
NEXT_ARG();
if (rtnl_rtprot_a2n(&prot, *argv))
- invarg("\"protocol\" value is invalid\n", *argv);
+ invarg(*argv, "protocol");
req.r.rtm_protocol = prot;
proto_ok =1;
} else if (strcmp(*argv, "dev") == 0 ||
@@ -487,7 +487,7 @@ static int iproute_list_or_flush(int argc, char **argv, int flush)
filter.tb = RT_TABLE_MAIN;
if (flush && argc <= 0) {
- fprintf(stderr, "\"ip route flush\" requires arguments.\n");
+ bb_error_msg(bb_msg_requires_arg, "\"ip route flush\"");
return -1;
}
@@ -498,7 +498,7 @@ static int iproute_list_or_flush(int argc, char **argv, int flush)
filter.protocolmask = -1;
if (rtnl_rtprot_a2n(&prot, *argv)) {
if (strcmp(*argv, "all") != 0) {
- invarg("invalid \"protocol\"\n", *argv);
+ invarg(*argv, "protocol");
}
prot = 0;
filter.protocolmask = 0;
@@ -541,7 +541,7 @@ static int iproute_list_or_flush(int argc, char **argv, int flush)
if (matches(*argv, "cache") == 0) {
filter.tb = -1;
} else if (matches(*argv, "main") != 0) {
- invarg("invalid \"table\"", *argv);
+ invarg(*argv, "table");
}
} else if (matches(*argv, "cache") == 0) {
filter.tb = -1;
diff --git a/networking/libiproute/iptunnel.c b/networking/libiproute/iptunnel.c
index 1b1458e..9b96920 100644
--- a/networking/libiproute/iptunnel.c
+++ b/networking/libiproute/iptunnel.c
@@ -259,9 +259,9 @@ static int parse_args(int argc, char **argv, int cmd, struct ip_tunnel_parm *p)
NEXT_ARG();
if (strcmp(*argv, "inherit") != 0) {
if (get_unsigned(&uval, *argv, 0))
- invarg("invalid TTL\n", *argv);
+ invarg(*argv, "TTL");
if (uval > 255)
- invarg("TTL must be <=255\n", *argv);
+ invarg(*argv, "TTL must be <=255");
p->iph.ttl = uval;
}
} else if (strcmp(*argv, "tos") == 0 ||
@@ -270,7 +270,7 @@ static int parse_args(int argc, char **argv, int cmd, struct ip_tunnel_parm *p)
NEXT_ARG();
if (strcmp(*argv, "inherit") != 0) {
if (rtnl_dsfield_a2n(&uval, *argv))
- invarg("bad TOS value", *argv);
+ invarg(*argv, "TOS");
p->iph.tos = uval;
} else
p->iph.tos = 1;
diff --git a/networking/libiproute/utils.c b/networking/libiproute/utils.c
index 3a161ea..2e2aa90 100644
--- a/networking/libiproute/utils.c
+++ b/networking/libiproute/utils.c
@@ -240,9 +240,9 @@ void incomplete_command(void)
exit(-1);
}
-void invarg(char *msg, char *arg)
+void invarg(const char const *arg, const char const *opt)
{
- bb_error_msg("argument \"%s\" is wrong: %s", arg, msg);
+ bb_error_msg(bb_msg_invalid_arg, arg, opt);
exit(-1);
}
diff --git a/networking/libiproute/utils.h b/networking/libiproute/utils.h
index 0a3a06c..af286c8 100644
--- a/networking/libiproute/utils.h
+++ b/networking/libiproute/utils.h
@@ -1,13 +1,13 @@
#ifndef __UTILS_H__
#define __UTILS_H__ 1
+#include "libbb.h"
#include <asm/types.h>
#include <resolv.h>
#include "libnetlink.h"
#include "ll_map.h"
#include "rtm_map.h"
-#include "libbb.h"
extern int preferred_family;
extern int show_stats;
@@ -77,7 +77,7 @@ extern int get_s8(__s8 *val, char *arg, int base);
extern const char *format_host(int af, int len, void *addr, char *buf, int buflen);
extern const char *rt_addr_n2a(int af, int len, void *addr, char *buf, int buflen);
-void invarg(char *, char *) ATTRIBUTE_NORETURN;
+void invarg(const char const*, const char const*) ATTRIBUTE_NORETURN;
void duparg(char *, char *) ATTRIBUTE_NORETURN;
void duparg2(char *, char *) ATTRIBUTE_NORETURN;
int matches(char *arg, char *pattern);