* [iproute PATCH] lib/utils: improve error messages of get_addr() and get_prefix()
@ 2015-10-29 16:05 Phil Sutter
2015-10-29 16:20 ` [iproute PATCH v2] " Phil Sutter
2015-11-04 0:33 ` [iproute PATCH] " Stephen Hemminger
0 siblings, 2 replies; 3+ messages in thread
From: Phil Sutter @ 2015-10-29 16:05 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: netdev
Instead of statically complaining about illegal inet address, use
get_family() to get the address family right.
Based on a patch by Hangbin Liu to print "inet6" for AF_INET6 made more
generic by me.
Signed-off-by: Phil Sutter <phil@nwl.cc>
---
lib/utils.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/lib/utils.c b/lib/utils.c
index b7bdb9d..939a44f 100644
--- a/lib/utils.c
+++ b/lib/utils.c
@@ -531,7 +531,8 @@ done:
int get_addr(inet_prefix *dst, const char *arg, int family)
{
if (get_addr_1(dst, arg, family)) {
- fprintf(stderr, "Error: an %s address is expected rather than \"%s\".\n", (family == AF_INET6 ? "inet6" : "inet") ,arg);
+ fprintf(stderr, "Error: %s address is expected rather than \"%s\".\n",
+ family_name(family) ,arg);
exit(1);
}
return 0;
@@ -544,7 +545,8 @@ int get_prefix(inet_prefix *dst, char *arg, int family)
exit(1);
}
if (get_prefix_1(dst, arg, family)) {
- fprintf(stderr, "Error: an %s prefix is expected rather than \"%s\".\n", (family == AF_INET6 ? "inet6" : "inet") ,arg);
+ fprintf(stderr, "Error: %s prefix is expected rather than \"%s\".\n",
+ family_name(family) ,arg);
exit(1);
}
return 0;
--
2.1.2
^ permalink raw reply related [flat|nested] 3+ messages in thread* [iproute PATCH v2] lib/utils: improve error messages of get_addr() and get_prefix()
2015-10-29 16:05 [iproute PATCH] lib/utils: improve error messages of get_addr() and get_prefix() Phil Sutter
@ 2015-10-29 16:20 ` Phil Sutter
2015-11-04 0:33 ` [iproute PATCH] " Stephen Hemminger
1 sibling, 0 replies; 3+ messages in thread
From: Phil Sutter @ 2015-10-29 16:20 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: netdev
Instead of statically complaining about illegal inet address, use
get_family() to get the address family right.
Based on a patch by Hangbin Liu to print "inet6" for AF_INET6 made more
generic by me.
Signed-off-by: Phil Sutter <phil@nwl.cc>
---
Changes since v1:
- Rebased this patch on top of Stephen Hemminger's master branch, v1 did not
apply cleanly.
---
lib/utils.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/lib/utils.c b/lib/utils.c
index 107e3f5..939a44f 100644
--- a/lib/utils.c
+++ b/lib/utils.c
@@ -531,7 +531,8 @@ done:
int get_addr(inet_prefix *dst, const char *arg, int family)
{
if (get_addr_1(dst, arg, family)) {
- fprintf(stderr, "Error: an inet address is expected rather than \"%s\".\n", arg);
+ fprintf(stderr, "Error: %s address is expected rather than \"%s\".\n",
+ family_name(family) ,arg);
exit(1);
}
return 0;
@@ -544,7 +545,8 @@ int get_prefix(inet_prefix *dst, char *arg, int family)
exit(1);
}
if (get_prefix_1(dst, arg, family)) {
- fprintf(stderr, "Error: an inet prefix is expected rather than \"%s\".\n", arg);
+ fprintf(stderr, "Error: %s prefix is expected rather than \"%s\".\n",
+ family_name(family) ,arg);
exit(1);
}
return 0;
--
2.1.2
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [iproute PATCH] lib/utils: improve error messages of get_addr() and get_prefix()
2015-10-29 16:05 [iproute PATCH] lib/utils: improve error messages of get_addr() and get_prefix() Phil Sutter
2015-10-29 16:20 ` [iproute PATCH v2] " Phil Sutter
@ 2015-11-04 0:33 ` Stephen Hemminger
1 sibling, 0 replies; 3+ messages in thread
From: Stephen Hemminger @ 2015-11-04 0:33 UTC (permalink / raw)
To: Phil Sutter; +Cc: netdev
On Thu, 29 Oct 2015 17:05:38 +0100
Phil Sutter <phil@nwl.cc> wrote:
> Instead of statically complaining about illegal inet address, use
> get_family() to get the address family right.
>
> Based on a patch by Hangbin Liu to print "inet6" for AF_INET6 made more
> generic by me.
>
> Signed-off-by: Phil Sutter <phil@nwl.cc>
> ---
Applied for 4.3 release.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-11-04 0:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-29 16:05 [iproute PATCH] lib/utils: improve error messages of get_addr() and get_prefix() Phil Sutter
2015-10-29 16:20 ` [iproute PATCH v2] " Phil Sutter
2015-11-04 0:33 ` [iproute PATCH] " Stephen Hemminger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).