netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH iproute2 v1 1/1] lib/utils: fix get_addr() and get_prefix() error messages
@ 2016-03-22 13:02 Varlese, Marco
  2016-03-27 17:35 ` Stephen Hemminger
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Varlese, Marco @ 2016-03-22 13:02 UTC (permalink / raw)
  To: netdev@vger.kernel.org
  Cc: davem@davemloft.net, Jiri Pirko, John Fastabend, jhs@mojatatu.com,
	Szczerbik, PrzemyslawX

An attempt to add invalid address to interface would print "???" string
instead of the address family name.

For example:
$ ip address add 256.10.166.1/24 dev ens8
Error: ??? prefix is expected rather than "256.10.166.1/24".

$ ip neighbor add proxy 2001:db8::g dev ens8
Error: ??? address is expected rather than "2001:db8::g".

With this patch the output will look like:
$ ip address add 256.10.166.1/24 dev ens8
Error: inet prefix is expected rather than "256.10.166.1/24".

$ ip neighbor add proxy 2001:db8::g dev ens8
Error: inet6 address is expected rather than "2001:db8::g".

Signed-off-by: Przemyslaw Szczerbik <przemyslawx.szczerbik@intel.com>
Signed-off-by: Marco Varlese <marco.varlese@intel.com>
---
lib/utils.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/utils.c b/lib/utils.c
index fa35f4d..4820de1 100644
--- a/lib/utils.c
+++ b/lib/utils.c
@@ -567,7 +567,7 @@ int get_addr(inet_prefix *dst, const char *arg, int family)
{
        if (get_addr_1(dst, arg, family)) {
                fprintf(stderr, "Error: %s address is expected rather than \"%s\".\n",
-                               family_name(family) ,arg);
+                               family_name(dst->family), arg);
                exit(1);
        }
        return 0;
@@ -581,7 +581,7 @@ int get_prefix(inet_prefix *dst, char *arg, int family)
        }
        if (get_prefix_1(dst, arg, family)) {
                fprintf(stderr, "Error: %s prefix is expected rather than \"%s\".\n",
-                               family_name(family) ,arg);
+                               family_name(dst->family), arg);
                exit(1);
        }
        return 0;

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-03-31  8:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-22 13:02 [PATCH iproute2 v1 1/1] lib/utils: fix get_addr() and get_prefix() error messages Varlese, Marco
2016-03-27 17:35 ` Stephen Hemminger
2016-03-30  7:19   ` Varlese, Marco
2016-03-27 18:02 ` Stephen Hemminger
2016-03-30 23:54 ` Stephen Hemminger
2016-03-31  8:04   ` Varlese, Marco

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).