[PATCH] ping: implement (ignore) -n option
walter harms
wharms at bfs.de
Thu Mar 14 14:02:56 UTC 2013
+1 :)
re,
wh
Am 14.03.2013 14:56, schrieb Michael Stapelberg:
> From: Michael Stapelberg <michael at stapelberg.de>
>
> I am used to typing ping -n because it doesn’t rely on DNS and therefore
> is more appropriate in many debugging situations. When working on
> OpenWrt or other embedded devices using BusyBox, I always get frustrated
> because ping -n does not work, so I _always_ type ping -n, see the
> error, go back, correct the error, then get the actual ping reply.
>
> Given that BusyBox ping doesn’t resolve hostnames anyway, I think it’s a
> good idea to simply ignore -n, but don’t error out when -n is provided.
> ---
> networking/ping.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/networking/ping.c b/networking/ping.c
> index 3df67f5..75cd26e 100644
> --- a/networking/ping.c
> +++ b/networking/ping.c
> @@ -299,7 +299,7 @@ static int common_ping_main(sa_family_t af, char **argv)
>
> /* Full(er) version */
>
> -#define OPT_STRING ("qvc:s:t:w:W:I:4" IF_PING6("6"))
> +#define OPT_STRING ("qvc:s:t:w:W:I:n4" IF_PING6("6"))
> enum {
> OPT_QUIET = 1 << 0,
> OPT_VERBOSE = 1 << 1,
> @@ -309,8 +309,11 @@ enum {
> OPT_w = 1 << 5,
> OPT_W = 1 << 6,
> OPT_I = 1 << 7,
> - OPT_IPV4 = 1 << 8,
> - OPT_IPV6 = (1 << 9) * ENABLE_PING6,
> + /* Note that -n is ignored, but implemented so that users who have ping -n
> + * in their muscle memory can keep their sanity. */
> + OPT_n = 1 << 8,
> + OPT_IPV4 = 1 << 9,
> + OPT_IPV6 = (1 << 10) * ENABLE_PING6,
> };
>
>
More information about the busybox
mailing list