]> git.proxmox.com Git - mirror_iproute2.git/commitdiff
iproute2: improved error messages
authorKees van Reeuwijk <reeuwijk@few.vu.nl>
Fri, 8 Feb 2013 03:32:36 +0000 (03:32 +0000)
committerStephen Hemminger <stephen@networkplumber.org>
Mon, 11 Feb 2013 17:22:22 +0000 (09:22 -0800)
This patch improves many error messages as follows:
- For incorrect parameters, show the value of the offending parameter, rather than just say that it is incorrect
- Rephrased messages for clarity
- Rephrased to more `mainstream' english

Signed-off-by: Kees van Reeuwijk <reeuwijk@few.vu.nl>
20 files changed:
ip/ip6tunnel.c
ip/ipaddress.c
ip/ipl2tp.c
ip/iplink.c
ip/iplink_can.c
ip/iplink_ipoib.c
ip/iplink_macvlan.c
ip/iplink_macvtap.c
ip/iplink_vlan.c
ip/iplink_vxlan.c
ip/ipnetns.c
ip/ipprefix.c
ip/iproute.c
ip/iptunnel.c
ip/iptuntap.c
ip/ipxfrm.c
ip/link_gre.c
ip/link_vti.c
ip/tcp_metrics.c
ip/tunnel.c

index fcc9f33c603c4306fabd59c06a891e09529d4f30..216e982f03103f459bdc28811097edafd83a61ee 100644 (file)
@@ -128,7 +128,7 @@ static int parse_args(int argc, char **argv, int cmd, struct ip6_tnl_parm *p)
                                 strcmp(*argv, "any") == 0)
                                p->proto = 0;
                        else {
-                                fprintf(stderr,"Cannot guess tunnel mode.\n");
+                                fprintf(stderr,"Unknown tunnel mode \"%s\"\n", *argv);
                                 exit(-1);
                         }
                 } else if (strcmp(*argv, "remote") == 0) {
@@ -293,7 +293,7 @@ static int do_tunnels_list(struct ip6_tnl_parm *p)
                buf[sizeof(buf) - 1] = '\0';
                if ((ptr = strchr(buf, ':')) == NULL ||
                    (*ptr++ = 0, sscanf(buf, "%s", name) != 1)) {
-                       fprintf(stderr, "Wrong format of /proc/net/dev. Sorry.\n");
+                       fprintf(stderr, "Wrong format for /proc/net/dev. Giving up.\n");
                        goto end;
                }
                if (sscanf(ptr, "%ld%ld%ld%ld%ld%ld%ld%*d%ld%ld%ld%ld%ld%ld%ld",
@@ -309,7 +309,7 @@ static int do_tunnels_list(struct ip6_tnl_parm *p)
                        continue;
                type = ll_index_to_type(index);
                if (type == -1) {
-                       fprintf(stderr, "Failed to get type of [%s]\n", name);
+                       fprintf(stderr, "Failed to get type of \"%s\"\n", name);
                        continue;
                }
                if (type != ARPHRD_TUNNEL6)
@@ -402,7 +402,7 @@ int do_ip6tunnel(int argc, char **argv)
        case AF_INET6:
                break;
        default:
-               fprintf(stderr, "Unsupported family:%d\n", preferred_family);
+               fprintf(stderr, "Unsupported protocol family: %d\n", preferred_family);
                exit(-1);
        }
 
index 297506d40a84d33506989f234bbb7961341ddf3f..0bd8a76ec018079552848a149feb7a590b3af97a 100644 (file)
@@ -785,7 +785,7 @@ static int ipadd_save_prep(void)
        int ret;
 
        if (isatty(STDOUT_FILENO)) {
-               fprintf(stderr, "Not sending binary stream to stdout\n");
+               fprintf(stderr, "Not sending binary stream to stdout\n");
                return -1;
        }
 
index f6e264a843d095ad80fbe33d5f1f8fe8a092d0a1..2d2231796d5db768710912157d9a849bfac99123 100644 (file)
@@ -494,7 +494,7 @@ static int parse_args(int argc, char **argv, int cmd, struct l2tp_parm *p)
                        } else if (strcmp(*argv, "udp") == 0) {
                                p->encap = L2TP_ENCAPTYPE_UDP;
                        } else {
-                               fprintf(stderr, "Unknown tunnel encapsulation.\n");
+                               fprintf(stderr, "Unknown tunnel encapsulation \"%s\"\n", *argv);
                                exit(-1);
                        }
                } else if (strcmp(*argv, "name") == 0) {
index 5ff8f858b0737788b061f3ed62443505b5ab4649..c24f0cebb4edfc2f08a740cf3a309a617fb1b3b1 100644 (file)
@@ -94,9 +94,9 @@ static void usage(void)
        iplink_usage();
 }
 
-static int on_off(char *msg)
+static int on_off(const char *msg, const char *realval)
 {
-       fprintf(stderr, "Error: argument of \"%s\" must be \"on\" or \"off\"\n", msg);
+       fprintf(stderr, "Error: argument of \"%s\" must be \"on\" or \"off\", not \"%s\"\n", msg, realval);
        return -1;
 }
 
@@ -348,7 +348,7 @@ int iplink_parse(int argc, char **argv, struct iplink_req *req,
                        } else if (strcmp(*argv, "off") == 0) {
                                req->i.ifi_flags &= ~IFF_MULTICAST;
                        } else
-                               return on_off("multicast");
+                               return on_off("multicast", *argv);
                } else if (strcmp(*argv, "allmulticast") == 0) {
                        NEXT_ARG();
                        req->i.ifi_change |= IFF_ALLMULTI;
@@ -357,7 +357,7 @@ int iplink_parse(int argc, char **argv, struct iplink_req *req,
                        } else if (strcmp(*argv, "off") == 0) {
                                req->i.ifi_flags &= ~IFF_ALLMULTI;
                        } else
-                               return on_off("allmulticast");
+                               return on_off("allmulticast", *argv);
                } else if (strcmp(*argv, "promisc") == 0) {
                        NEXT_ARG();
                        req->i.ifi_change |= IFF_PROMISC;
@@ -366,7 +366,7 @@ int iplink_parse(int argc, char **argv, struct iplink_req *req,
                        } else if (strcmp(*argv, "off") == 0) {
                                req->i.ifi_flags &= ~IFF_PROMISC;
                        } else
-                               return on_off("promisc");
+                               return on_off("promisc", *argv);
                } else if (strcmp(*argv, "trailers") == 0) {
                        NEXT_ARG();
                        req->i.ifi_change |= IFF_NOTRAILERS;
@@ -375,7 +375,7 @@ int iplink_parse(int argc, char **argv, struct iplink_req *req,
                        } else if (strcmp(*argv, "on") == 0) {
                                req->i.ifi_flags &= ~IFF_NOTRAILERS;
                        } else
-                               return on_off("trailers");
+                               return on_off("trailers", *argv);
                } else if (strcmp(*argv, "arp") == 0) {
                        NEXT_ARG();
                        req->i.ifi_change |= IFF_NOARP;
@@ -384,7 +384,7 @@ int iplink_parse(int argc, char **argv, struct iplink_req *req,
                        } else if (strcmp(*argv, "off") == 0) {
                                req->i.ifi_flags |= IFF_NOARP;
                        } else
-                               return on_off("noarp");
+                               return on_off("noarp", *argv);
                } else if (strcmp(*argv, "vf") == 0) {
                        struct rtattr *vflist;
                        NEXT_ARG();
@@ -417,7 +417,7 @@ int iplink_parse(int argc, char **argv, struct iplink_req *req,
                        } else if (strcmp(*argv, "off") == 0) {
                                req->i.ifi_flags &= ~IFF_DYNAMIC;
                        } else
-                               return on_off("dynamic");
+                               return on_off("dynamic", *argv);
                } else if (matches(*argv, "type") == 0) {
                        NEXT_ARG();
                        *type = *argv;
@@ -852,7 +852,7 @@ static int do_set(int argc, char **argv)
                        } else if (strcmp(*argv, "off") == 0) {
                                flags &= ~IFF_MULTICAST;
                        } else
-                               return on_off("multicast");
+                               return on_off("multicast", *argv);
                } else if (strcmp(*argv, "allmulticast") == 0) {
                        NEXT_ARG();
                        mask |= IFF_ALLMULTI;
@@ -861,7 +861,7 @@ static int do_set(int argc, char **argv)
                        } else if (strcmp(*argv, "off") == 0) {
                                flags &= ~IFF_ALLMULTI;
                        } else
-                               return on_off("allmulticast");
+                               return on_off("allmulticast", *argv);
                } else if (strcmp(*argv, "promisc") == 0) {
                        NEXT_ARG();
                        mask |= IFF_PROMISC;
@@ -870,7 +870,7 @@ static int do_set(int argc, char **argv)
                        } else if (strcmp(*argv, "off") == 0) {
                                flags &= ~IFF_PROMISC;
                        } else
-                               return on_off("promisc");
+                               return on_off("promisc", *argv);
                } else if (strcmp(*argv, "trailers") == 0) {
                        NEXT_ARG();
                        mask |= IFF_NOTRAILERS;
@@ -879,7 +879,7 @@ static int do_set(int argc, char **argv)
                        } else if (strcmp(*argv, "on") == 0) {
                                flags &= ~IFF_NOTRAILERS;
                        } else
-                               return on_off("trailers");
+                               return on_off("trailers", *argv);
                } else if (strcmp(*argv, "arp") == 0) {
                        NEXT_ARG();
                        mask |= IFF_NOARP;
@@ -888,7 +888,7 @@ static int do_set(int argc, char **argv)
                        } else if (strcmp(*argv, "off") == 0) {
                                flags |= IFF_NOARP;
                        } else
-                               return on_off("noarp");
+                               return on_off("noarp", *argv);
                } else if (matches(*argv, "dynamic") == 0) {
                        NEXT_ARG();
                        mask |= IFF_DYNAMIC;
@@ -897,7 +897,7 @@ static int do_set(int argc, char **argv)
                        } else if (strcmp(*argv, "off") == 0) {
                                flags &= ~IFF_DYNAMIC;
                        } else
-                               return on_off("dynamic");
+                               return on_off("dynamic", *argv);
                } else {
                         if (strcmp(*argv, "dev") == 0) {
                                NEXT_ARG();
index c8af4bc263886950b58620578f228709cdeebc10..5674358845e4ce4378482433bee7292c4e4148bc 100644 (file)
@@ -68,8 +68,8 @@ static void set_ctrlmode(char* name, char *arg,
                cm->flags |= flags;
        } else if (strcmp(arg, "off") != 0) {
                fprintf(stderr,
-                       "Error: argument of \"%s\" must be \"on\" or \"off\"\n",
-                       name);
+                       "Error: argument of \"%s\" must be \"on\" or \"off\", not \"%s\"\n",
+                       name, arg);
                exit(-1);
        }
        cm->mask |= flags;
@@ -169,7 +169,7 @@ static int can_parse_opt(struct link_util *lu, int argc, char **argv,
                        usage();
                        return -1;
                } else {
-                       fprintf(stderr, "can: what is \"%s\"?\n", *argv);
+                       fprintf(stderr, "can: unknown option \"%s\"\n", *argv);
                        usage();
                        return -1;
                }
index ae372bcc8fc77e11f1e86933d9196015efa7eeed..5c1c68c46fa6fe52e02e752095a4bb2482886b6e 100644 (file)
@@ -66,7 +66,7 @@ static int ipoib_parse_opt(struct link_util *lu, int argc, char **argv,
                        explain();
                        return -1;
                } else {
-                       fprintf(stderr, "ipoib: what is \"%s\"?\n", *argv);
+                       fprintf(stderr, "ipoib: unknown option \"%s\"?\n", *argv);
                        explain();
                        return -1;
                }
index ed0e34b727dc3ea77b597c0f16e88507ffdbac0a..5b4b868b36ae2413974853869d37736d2a4ca182 100644 (file)
@@ -58,7 +58,7 @@ static int macvlan_parse_opt(struct link_util *lu, int argc, char **argv,
                        explain();
                        return -1;
                } else {
-                       fprintf(stderr, "macvlan: what is \"%s\"?\n", *argv);
+                       fprintf(stderr, "macvlan: unknown option \"%s\"?\n", *argv);
                        explain();
                        return -1;
                }
index 6c7fe1f1f94704acc1a737f556e4938da24ba8a0..bea9f0cfcbe27eb34c796d07418031162b0eb7d9 100644 (file)
@@ -24,10 +24,10 @@ static void explain(void)
        );
 }
 
-static int mode_arg(void)
+static int mode_arg(const char *arg)
 {
         fprintf(stderr, "Error: argument of \"mode\" must be \"private\", "
-               "\"vepa\", \"bridge\" or \"passthru\" \n");
+               "\"vepa\", \"bridge\" or \"passthru\", not \"%s\"\n", arg);
         return -1;
 }
 
@@ -48,14 +48,14 @@ static int macvtap_parse_opt(struct link_util *lu, int argc, char **argv,
                        else if (strcmp(*argv, "passthru") == 0)
                                mode = MACVLAN_MODE_PASSTHRU;
                        else
-                               return mode_arg();
+                               return mode_arg(*argv);
 
                        addattr32(n, 1024, IFLA_MACVLAN_MODE, mode);
                } else if (matches(*argv, "help") == 0) {
                        explain();
                        return -1;
                } else {
-                       fprintf(stderr, "macvtap: what is \"%s\"?\n", *argv);
+                       fprintf(stderr, "macvtap: unknown command \"%s\"?\n", *argv);
                        explain();
                        return -1;
                }
index 97af8d6c43b6597494617c9c74f4a9b8e31ff909..26ceb8d9b24a16e6af89c96fc337d2bd39c42bde 100644 (file)
@@ -33,9 +33,9 @@ static void explain(void)
        );
 }
 
-static int on_off(char *msg)
+static int on_off(const char *msg, const char *arg)
 {
-       fprintf(stderr, "Error: argument of \"%s\" must be \"on\" or \"off\"\n", msg);
+       fprintf(stderr, "Error: argument of \"%s\" must be \"on\" or \"off\", not \"%s\"\n", msg, arg);
        return -1;
 }
 
@@ -93,7 +93,7 @@ static int vlan_parse_opt(struct link_util *lu, int argc, char **argv,
                        else if (strcmp(*argv, "off") == 0)
                                flags.flags &= ~VLAN_FLAG_REORDER_HDR;
                        else
-                               return on_off("reorder_hdr");
+                               return on_off("reorder_hdr", *argv);
                } else if (matches(*argv, "gvrp") == 0) {
                        NEXT_ARG();
                        flags.mask |= VLAN_FLAG_GVRP;
@@ -102,7 +102,7 @@ static int vlan_parse_opt(struct link_util *lu, int argc, char **argv,
                        else if (strcmp(*argv, "off") == 0)
                                flags.flags &= ~VLAN_FLAG_GVRP;
                        else
-                               return on_off("gvrp");
+                               return on_off("gvrp", *argv);
                } else if (matches(*argv, "loose_binding") == 0) {
                        NEXT_ARG();
                        flags.mask |= VLAN_FLAG_LOOSE_BINDING;
@@ -111,7 +111,7 @@ static int vlan_parse_opt(struct link_util *lu, int argc, char **argv,
                        else if (strcmp(*argv, "off") == 0)
                                flags.flags &= ~VLAN_FLAG_LOOSE_BINDING;
                        else
-                               return on_off("loose_binding");
+                               return on_off("loose_binding", *argv);
                } else if (matches(*argv, "ingress-qos-map") == 0) {
                        NEXT_ARG();
                        if (vlan_parse_qos_map(&argc, &argv, n,
@@ -128,7 +128,7 @@ static int vlan_parse_opt(struct link_util *lu, int argc, char **argv,
                        explain();
                        return -1;
                } else {
-                       fprintf(stderr, "vlan: what is \"%s\"?\n", *argv);
+                       fprintf(stderr, "vlan: unknown command \"%s\"?\n", *argv);
                        explain();
                        return -1;
                }
index 4b72361e3b6c945f55c5aef15721c173568f7d54..1025326107b33d3dfcdaeb1476d071ea6483f1e3 100644 (file)
@@ -149,7 +149,7 @@ static int vxlan_parse_opt(struct link_util *lu, int argc, char **argv,
                        explain();
                        return -1;
                } else {
-                       fprintf(stderr, "vxlan: what is \"%s\"?\n", *argv);
+                       fprintf(stderr, "vxlan: unknown command \"%s\"?\n", *argv);
                        explain();
                        return -1;
                }
index 51b1c5e76085bbc3ef6c76fa36b8149678c33e91..b047b979a83091903ff4bbcdc0f0718eec1d8636 100644 (file)
@@ -130,7 +130,7 @@ static int netns_exec(int argc, char **argv)
                return EXIT_FAILURE;
        }
        if (argc < 2) {
-               fprintf(stderr, "No cmd specified\n");
+               fprintf(stderr, "No command specified\n");
                return EXIT_FAILURE;
        }
        name = argv[0];
@@ -138,13 +138,13 @@ static int netns_exec(int argc, char **argv)
        snprintf(net_path, sizeof(net_path), "%s/%s", NETNS_RUN_DIR, name);
        netns = open(net_path, O_RDONLY);
        if (netns < 0) {
-               fprintf(stderr, "Cannot open network namespace %s: %s\n",
+               fprintf(stderr, "Cannot open network namespace \"%s\": %s\n",
                        name, strerror(errno));
                return EXIT_FAILURE;
        }
        if (setns(netns, CLONE_NEWNET) < 0) {
-               fprintf(stderr, "seting the network namespace failed: %s\n",
-                       strerror(errno));
+               fprintf(stderr, "seting the network namespace \"%s\" failed: %s\n",
+                       name, strerror(errno));
                return EXIT_FAILURE;
        }
 
@@ -154,7 +154,7 @@ static int netns_exec(int argc, char **argv)
        }
        /* Don't let any mounts propogate back to the parent */
        if (mount("", "/", "none", MS_SLAVE | MS_REC, NULL)) {
-               fprintf(stderr, "mount --make-rslave / failed: %s\n",
+               fprintf(stderr, "\"mount --make-rslave /\" failed: %s\n",
                        strerror(errno));
                return EXIT_FAILURE;
        }
@@ -172,7 +172,7 @@ static int netns_exec(int argc, char **argv)
        bind_etc(name);
 
        if (execvp(cmd, argv + 1)  < 0)
-               fprintf(stderr, "exec of %s failed: %s\n",
+               fprintf(stderr, "exec of \"%s\" failed: %s\n",
                        cmd, strerror(errno));
        return EXIT_FAILURE;
 }
@@ -330,7 +330,7 @@ static int netns_delete(int argc, char **argv)
        snprintf(netns_path, sizeof(netns_path), "%s/%s", NETNS_RUN_DIR, name);
        umount2(netns_path, MNT_DETACH);
        if (unlink(netns_path) < 0) {
-               fprintf(stderr, "Cannot remove %s: %s\n",
+               fprintf(stderr, "Cannot remove namespace file \"%s\": %s\n",
                        netns_path, strerror(errno));
                return EXIT_FAILURE;
        }
@@ -389,14 +389,14 @@ static int netns_add(int argc, char **argv)
        /* Create the filesystem state */
        fd = open(netns_path, O_RDONLY|O_CREAT|O_EXCL, 0);
        if (fd < 0) {
-               fprintf(stderr, "Could not create %s: %s\n",
+               fprintf(stderr, "Cannot not create namespace file \"%s\": %s\n",
                        netns_path, strerror(errno));
                return EXIT_FAILURE;
        }
        close(fd);
        if (unshare(CLONE_NEWNET) < 0) {
-               fprintf(stderr, "Failed to create a new network namespace: %s\n",
-                       strerror(errno));
+               fprintf(stderr, "Failed to create a new network namespace \"%s\": %s\n",
+                       name, strerror(errno));
                goto out_delete;
        }
 
index ee276b3e57e9f9e4d7c184a294504116e7caf764..cf68f897ddb8a4ecea67dfa81c6121e56cc71e15 100644 (file)
@@ -60,7 +60,7 @@ int print_prefix(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
                return 0;
 
        if (prefix->prefix_family != AF_INET6) {
-               fprintf(stderr, "wrong family %d\n", prefix->prefix_family);
+               fprintf(stderr, "incorrect protocol family: %d\n", prefix->prefix_family);
                return 0;
        }
        if (prefix->prefix_type != ND_OPT_PREFIX_INFORMATION) {
index c60156f9c315d62c21ae6d880568bd0525737e55..309cc8704a756609819d3af42963227863210422 100644 (file)
@@ -1099,7 +1099,7 @@ static int save_route_prep(void)
        int ret;
 
        if (isatty(STDOUT_FILENO)) {
-               fprintf(stderr, "Not sending binary stream to stdout\n");
+               fprintf(stderr, "Not sending binary stream to stdout\n");
                return -1;
        }
 
@@ -1445,7 +1445,7 @@ int iproute_get(int argc, char **argv)
        }
 
        if (req.r.rtm_dst_len == 0) {
-               fprintf(stderr, "need at least destination address\n");
+               fprintf(stderr, "need at least destination address\n");
                exit(1);
        }
 
index f8b91ba0805a1f10b59dd773740d5631566cd5d1..4275f2603814863e4ce84222112f8af69214279a 100644 (file)
@@ -102,7 +102,7 @@ static int parse_args(int argc, char **argv, int cmd, struct ip_tunnel_parm *p)
                                p->iph.protocol = IPPROTO_IPIP;
                                p->i_flags |= VTI_ISVTI;
                        } else {
-                               fprintf(stderr,"Cannot guess tunnel mode.\n");
+                               fprintf(stderr,"Unknown tunnel mode \"%s\"\n", *argv);
                                exit(-1);
                        }
                } else if (strcmp(*argv, "key") == 0) {
@@ -114,7 +114,7 @@ static int parse_args(int argc, char **argv, int cmd, struct ip_tunnel_parm *p)
                                p->i_key = p->o_key = get_addr32(*argv);
                        else {
                                if (get_unsigned(&uval, *argv, 0)<0) {
-                                       fprintf(stderr, "invalid value of \"key\"\n");
+                                       fprintf(stderr, "invalid value for \"key\": \"%s\"; it should be an unsigned integer\n", *argv);
                                        exit(-1);
                                }
                                p->i_key = p->o_key = htonl(uval);
@@ -127,7 +127,7 @@ static int parse_args(int argc, char **argv, int cmd, struct ip_tunnel_parm *p)
                                p->i_key = get_addr32(*argv);
                        else {
                                if (get_unsigned(&uval, *argv, 0)<0) {
-                                       fprintf(stderr, "invalid value of \"ikey\"\n");
+                                       fprintf(stderr, "invalid value for \"ikey\": \"%s\"; it should be an unsigned integer\n", *argv);
                                        exit(-1);
                                }
                                p->i_key = htonl(uval);
@@ -140,7 +140,7 @@ static int parse_args(int argc, char **argv, int cmd, struct ip_tunnel_parm *p)
                                p->o_key = get_addr32(*argv);
                        else {
                                if (get_unsigned(&uval, *argv, 0)<0) {
-                                       fprintf(stderr, "invalid value of \"okey\"\n");
+                                       fprintf(stderr, "invalid value for \"okey\": \"%s\"; it should be an unsigned integer\n", *argv);
                                        exit(-1);
                                }
                                p->o_key = htonl(uval);
@@ -242,7 +242,7 @@ static int parse_args(int argc, char **argv, int cmd, struct ip_tunnel_parm *p)
 
        if (p->iph.protocol == IPPROTO_IPIP || p->iph.protocol == IPPROTO_IPV6) {
                if ((p->i_flags & GRE_KEY) || (p->o_flags & GRE_KEY)) {
-                       fprintf(stderr, "Keys are not allowed with ipip and sit.\n");
+                       fprintf(stderr, "Keys are not allowed with ipip and sit tunnels\n");
                        return -1;
                }
        }
@@ -262,7 +262,7 @@ static int parse_args(int argc, char **argv, int cmd, struct ip_tunnel_parm *p)
                p->o_flags |= GRE_KEY;
        }
        if (IN_MULTICAST(ntohl(p->iph.daddr)) && !p->iph.saddr) {
-               fprintf(stderr, "Broadcast tunnel requires a source address.\n");
+               fprintf(stderr, "A broadcast tunnel requires a source address\n");
                return -1;
        }
        if (isatap)
@@ -444,7 +444,7 @@ static int do_tunnels_list(struct ip_tunnel_parm *p)
                buf[sizeof(buf) - 1] = 0;
                if ((ptr = strchr(buf, ':')) == NULL ||
                    (*ptr++ = 0, sscanf(buf, "%s", name) != 1)) {
-                       fprintf(stderr, "Wrong format of /proc/net/dev. Sorry.\n");
+                       fprintf(stderr, "Wrong format for /proc/net/dev. Giving up.\n");
                        fclose(fp);
                        return -1;
                }
@@ -461,7 +461,7 @@ static int do_tunnels_list(struct ip_tunnel_parm *p)
                        continue;
                type = ll_index_to_type(index);
                if (type == -1) {
-                       fprintf(stderr, "Failed to get type of [%s]\n", name);
+                       fprintf(stderr, "Failed to get type of \"%s\"\n", name);
                        continue;
                }
                if (type != ARPHRD_TUNNEL && type != ARPHRD_IPGRE && type != ARPHRD_SIT)
@@ -558,17 +558,17 @@ static int do_prl(int argc, char **argv)
                        strncpy(medium, *argv, IFNAMSIZ-1);
                        devname++;
                } else {
-                       fprintf(stderr,"%s: Invalid PRL parameter.\n", *argv);
+                       fprintf(stderr,"Invalid PRL parameter \"%s\"\n", *argv);
                        exit(-1);
                }
                if (count > 1) {
-                       fprintf(stderr,"One PRL entry at a time.\n");
+                       fprintf(stderr,"One PRL entry at a time\n");
                        exit(-1);
                }
                argc--; argv++;
        }
        if (devname == 0) {
-               fprintf(stderr, "Must specify dev.\n");
+               fprintf(stderr, "Must specify device\n");
                exit(-1);
        }
 
@@ -608,13 +608,13 @@ static int do_6rd(int argc, char **argv)
                        strncpy(medium, *argv, IFNAMSIZ-1);
                        devname++;
                } else {
-                       fprintf(stderr,"%s: Invalid 6RD parameter.\n", *argv);
+                       fprintf(stderr,"Invalid 6RD parameter \"%s\"\n", *argv);
                        exit(-1);
                }
                argc--; argv++;
        }
        if (devname == 0) {
-               fprintf(stderr, "Must specify dev.\n");
+               fprintf(stderr, "Must specify device\n");
                exit(-1);
        }
 
@@ -637,7 +637,7 @@ int do_iptunnel(int argc, char **argv)
        case AF_INET6:
                return do_ip6tunnel(argc, argv);
        default:
-               fprintf(stderr, "Unsupported family:%d\n", preferred_family);
+               fprintf(stderr, "Unsupported protocol family: %d\n", preferred_family);
                exit(-1);
        }
 
@@ -661,6 +661,6 @@ int do_iptunnel(int argc, char **argv)
        } else
                return do_show(0, NULL);
 
-       fprintf(stderr, "Command \"%s\" is unknown, try \"ip tunnel help\".\n", *argv);
+       fprintf(stderr, "Command \"%s\" is unknown, try \"ip tunnel help\"\n", *argv);
        exit(-1);
 }
index 20914e11471fe84aa445ae616e36795a3ea2cf64..3d9ad7dedd1db179396842621e08859e79e26b23 100644 (file)
@@ -128,7 +128,7 @@ static int parse_args(int argc, char **argv, struct ifreq *ifr, uid_t *uid, gid_
                                }
                                ifr->ifr_flags |= IFF_TAP;
                        } else {
-                               fprintf(stderr,"Cannot guess tunnel mode.\n");
+                               fprintf(stderr,"Unknown tunnel mode \"%s\"\n", *argv);
                                exit(-1);
                        }
                } else if (uid && matches(*argv, "user") == 0) {
index dda4a7a1166aff5ad742aff853686c48cc9d89f5..5a0f215f8a0d944a7016d7e56db7b678f1332e6f 100644 (file)
@@ -1231,7 +1231,7 @@ static int xfrm_selector_upspec_parse(struct xfrm_selector *sel,
                                uval = htonl(get_addr32(*argv));
                        else {
                                if (get_unsigned(&uval, *argv, 0)<0) {
-                                       fprintf(stderr, "invalid value of \"key\"\n");
+                                       fprintf(stderr, "invalid value for \"key\"; it should be an unsigned integer\n");
                                        exit(-1);
                                }
                        }
index 839fb29981b679b36141d239f8a2fc9770440d91..7e0b8966b6c1a7ba2dd43b7cfbc78d33d2850af8 100644 (file)
@@ -141,7 +141,7 @@ get_failed:
                        else {
                                if (get_unsigned(&uval, *argv, 0) < 0) {
                                        fprintf(stderr,
-                                               "Invalid value for \"key\"\n");
+                                               "Invalid value for \"key\": \"%s\"; it should be an unsigned integer\n", *argv);
                                        exit(-1);
                                }
                                uval = htonl(uval);
@@ -157,7 +157,7 @@ get_failed:
                                uval = get_addr32(*argv);
                        else {
                                if (get_unsigned(&uval, *argv, 0)<0) {
-                                       fprintf(stderr, "invalid value of \"ikey\"\n");
+                                       fprintf(stderr, "invalid value for \"ikey\": \"%s\"; it should be an unsigned integer\n", *argv);
                                        exit(-1);
                                }
                                uval = htonl(uval);
@@ -172,7 +172,7 @@ get_failed:
                                uval = get_addr32(*argv);
                        else {
                                if (get_unsigned(&uval, *argv, 0)<0) {
-                                       fprintf(stderr, "invalid value of \"okey\"\n");
+                                       fprintf(stderr, "invalid value for \"okey\": \"%s\"; it should be an unsigned integer\n", *argv);
                                        exit(-1);
                                }
                                uval = htonl(uval);
@@ -247,7 +247,7 @@ get_failed:
                oflags |= GRE_KEY;
        }
        if (IN_MULTICAST(ntohl(daddr)) && !saddr) {
-               fprintf(stderr, "Broadcast tunnel requires a source address.\n");
+               fprintf(stderr, "A broadcast tunnel requires a source address.\n");
                return -1;
        }
 
index 385f435571234396a1e9371f0f14a070455a623c..77a7482cc68983721add16a809d72944e7037a05 100644 (file)
@@ -117,7 +117,7 @@ get_failed:
                        else {
                                if (get_unsigned(&uval, *argv, 0) < 0) {
                                        fprintf(stderr,
-                                               "Invalid value for \"key\"\n");
+                                               "Invalid value for \"key\": \"%s\"; it should be an unsigned integer\n", *argv);
                                        exit(-1);
                                }
                                uval = htonl(uval);
@@ -132,7 +132,7 @@ get_failed:
                                uval = get_addr32(*argv);
                        else {
                                if (get_unsigned(&uval, *argv, 0) < 0) {
-                                       fprintf(stderr, "invalid value of \"ikey\"\n");
+                                       fprintf(stderr, "invalid value for \"ikey\": \"%s\"; it should be an unsigned integer\n", *argv);
                                        exit(-1);
                                }
                                uval = htonl(uval);
@@ -146,7 +146,7 @@ get_failed:
                                uval = get_addr32(*argv);
                        else {
                                if (get_unsigned(&uval, *argv, 0) < 0) {
-                                       fprintf(stderr, "invalid value of \"okey\"\n");
+                                       fprintf(stderr, "invalid value for \"okey\": \"%s\"; it should be an unsigned integer\n", *argv);
                                        exit(-1);
                                }
                                uval = htonl(uval);
@@ -155,7 +155,7 @@ get_failed:
                } else if (!matches(*argv, "remote")) {
                        NEXT_ARG();
                        if (!strcmp(*argv, "any")) {
-                               fprintf(stderr, "invalid value of \"remote\"\n");
+                               fprintf(stderr, "invalid value for \"remote\": \"%s\"\n", *argv);
                                exit(-1);
                        } else {
                                daddr = get_addr32(*argv);
@@ -163,7 +163,7 @@ get_failed:
                } else if (!matches(*argv, "local")) {
                        NEXT_ARG();
                        if (!strcmp(*argv, "any")) {
-                               fprintf(stderr, "invalid value of \"local\"\n");
+                               fprintf(stderr, "invalid value for \"local\": \"%s\"\n", *argv);
                                exit(-1);
                        } else {
                                saddr = get_addr32(*argv);
index 34e1d8e29d01363c7dd2fc98cc5ec435532c5d2a..a01e1fb1c334f9cf790ae777f37a210fcce43900 100644 (file)
@@ -268,7 +268,7 @@ static int tcpm_do_cmd(int cmd, int argc, char **argv)
        case AF_INET6:
                break;
        default:
-               fprintf(stderr, "Unsupported family:%d\n", preferred_family);
+               fprintf(stderr, "Unsupported protocol family: %d\n", preferred_family);
                return -1;
        }
 
index b176d3f04e611feab98ceeb7be391a123f9b1f2e..a6a28466843f24a260832b58533d374f6c82085e 100644 (file)
@@ -74,7 +74,7 @@ int tnl_get_ioctl(const char *basedev, void *p)
        fd = socket(preferred_family, SOCK_DGRAM, 0);
        err = ioctl(fd, SIOCGETTUNNEL, &ifr);
        if (err)
-               fprintf(stderr, "get tunnel %s failed: %s\n", basedev, 
+               fprintf(stderr, "get tunnel \"%s\" failed: %s\n", basedev,
                        strerror(errno));
 
        close(fd);
@@ -95,7 +95,7 @@ int tnl_add_ioctl(int cmd, const char *basedev, const char *name, void *p)
        fd = socket(preferred_family, SOCK_DGRAM, 0);
        err = ioctl(fd, cmd, &ifr);
        if (err)
-               fprintf(stderr, "add tunnel %s failed: %s\n", ifr.ifr_name,
+               fprintf(stderr, "add tunnel \"%s\" failed: %s\n", ifr.ifr_name,
                        strerror(errno));
        close(fd);
        return err;
@@ -116,7 +116,7 @@ int tnl_del_ioctl(const char *basedev, const char *name, void *p)
        fd = socket(preferred_family, SOCK_DGRAM, 0);
        err = ioctl(fd, SIOCDELTUNNEL, &ifr);
        if (err)
-               fprintf(stderr, "delete tunnel %s failed: %s\n",
+               fprintf(stderr, "delete tunnel \"%s\" failed: %s\n",
                        ifr.ifr_name, strerror(errno));
        close(fd);
        return err;