* [PATCH bpf-next] bpftool: Fix bpftool net output
@ 2018-09-25 22:20 Andrey Ignatov
2018-09-26 4:33 ` Song Liu
2018-09-26 10:19 ` Daniel Borkmann
0 siblings, 2 replies; 3+ messages in thread
From: Andrey Ignatov @ 2018-09-25 22:20 UTC (permalink / raw)
To: netdev; +Cc: Andrey Ignatov, ast, daniel, yhs
Print `bpftool net` output to stdout instead of stderr. Only errors
should be printed to stderr. Regular output should go to stdout and this
is what all other subcommands of bpftool do, including --json and
--pretty formats of `bpftool net` itself.
Fixes: commit f6f3bac08ff9 ("tools/bpf: bpftool: add net support")
Signed-off-by: Andrey Ignatov <rdna@fb.com>
Acked-by: Yonghong Song <yhs@fb.com>
---
tools/bpf/bpftool/netlink_dumper.h | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/tools/bpf/bpftool/netlink_dumper.h b/tools/bpf/bpftool/netlink_dumper.h
index 0788cfbbed0e..e3516b586a34 100644
--- a/tools/bpf/bpftool/netlink_dumper.h
+++ b/tools/bpf/bpftool/netlink_dumper.h
@@ -16,7 +16,7 @@
jsonw_name(json_wtr, name); \
jsonw_start_object(json_wtr); \
} else { \
- fprintf(stderr, "%s {", name); \
+ fprintf(stdout, "%s {", name); \
} \
}
@@ -25,7 +25,7 @@
if (json_output) \
jsonw_start_object(json_wtr); \
else \
- fprintf(stderr, "{"); \
+ fprintf(stdout, "{"); \
}
#define NET_END_OBJECT_NESTED \
@@ -33,7 +33,7 @@
if (json_output) \
jsonw_end_object(json_wtr); \
else \
- fprintf(stderr, "}"); \
+ fprintf(stdout, "}"); \
}
#define NET_END_OBJECT \
@@ -47,7 +47,7 @@
if (json_output) \
jsonw_end_object(json_wtr); \
else \
- fprintf(stderr, "\n"); \
+ fprintf(stdout, "\n"); \
}
#define NET_START_ARRAY(name, fmt_str) \
@@ -56,7 +56,7 @@
jsonw_name(json_wtr, name); \
jsonw_start_array(json_wtr); \
} else { \
- fprintf(stderr, fmt_str, name); \
+ fprintf(stdout, fmt_str, name); \
} \
}
@@ -65,7 +65,7 @@
if (json_output) \
jsonw_end_array(json_wtr); \
else \
- fprintf(stderr, "%s", endstr); \
+ fprintf(stdout, "%s", endstr); \
}
#define NET_DUMP_UINT(name, fmt_str, val) \
@@ -73,7 +73,7 @@
if (json_output) \
jsonw_uint_field(json_wtr, name, val); \
else \
- fprintf(stderr, fmt_str, val); \
+ fprintf(stdout, fmt_str, val); \
}
#define NET_DUMP_STR(name, fmt_str, str) \
@@ -81,7 +81,7 @@
if (json_output) \
jsonw_string_field(json_wtr, name, str);\
else \
- fprintf(stderr, fmt_str, str); \
+ fprintf(stdout, fmt_str, str); \
}
#define NET_DUMP_STR_ONLY(str) \
@@ -89,7 +89,7 @@
if (json_output) \
jsonw_string(json_wtr, str); \
else \
- fprintf(stderr, "%s ", str); \
+ fprintf(stdout, "%s ", str); \
}
#endif
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH bpf-next] bpftool: Fix bpftool net output
2018-09-25 22:20 [PATCH bpf-next] bpftool: Fix bpftool net output Andrey Ignatov
@ 2018-09-26 4:33 ` Song Liu
2018-09-26 10:19 ` Daniel Borkmann
1 sibling, 0 replies; 3+ messages in thread
From: Song Liu @ 2018-09-26 4:33 UTC (permalink / raw)
To: Andrey Ignatov; +Cc: Networking, Alexei Starovoitov, Daniel Borkmann, yhs
On Tue, Sep 25, 2018 at 3:25 PM Andrey Ignatov <rdna@fb.com> wrote:
>
> Print `bpftool net` output to stdout instead of stderr. Only errors
> should be printed to stderr. Regular output should go to stdout and this
> is what all other subcommands of bpftool do, including --json and
> --pretty formats of `bpftool net` itself.
>
> Fixes: commit f6f3bac08ff9 ("tools/bpf: bpftool: add net support")
> Signed-off-by: Andrey Ignatov <rdna@fb.com>
> Acked-by: Yonghong Song <yhs@fb.com>
Acked-by: Song Liu <songliubraving@fb.com>
> ---
> tools/bpf/bpftool/netlink_dumper.h | 18 +++++++++---------
> 1 file changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/tools/bpf/bpftool/netlink_dumper.h b/tools/bpf/bpftool/netlink_dumper.h
> index 0788cfbbed0e..e3516b586a34 100644
> --- a/tools/bpf/bpftool/netlink_dumper.h
> +++ b/tools/bpf/bpftool/netlink_dumper.h
> @@ -16,7 +16,7 @@
> jsonw_name(json_wtr, name); \
> jsonw_start_object(json_wtr); \
> } else { \
> - fprintf(stderr, "%s {", name); \
> + fprintf(stdout, "%s {", name); \
> } \
> }
>
> @@ -25,7 +25,7 @@
> if (json_output) \
> jsonw_start_object(json_wtr); \
> else \
> - fprintf(stderr, "{"); \
> + fprintf(stdout, "{"); \
> }
>
> #define NET_END_OBJECT_NESTED \
> @@ -33,7 +33,7 @@
> if (json_output) \
> jsonw_end_object(json_wtr); \
> else \
> - fprintf(stderr, "}"); \
> + fprintf(stdout, "}"); \
> }
>
> #define NET_END_OBJECT \
> @@ -47,7 +47,7 @@
> if (json_output) \
> jsonw_end_object(json_wtr); \
> else \
> - fprintf(stderr, "\n"); \
> + fprintf(stdout, "\n"); \
> }
>
> #define NET_START_ARRAY(name, fmt_str) \
> @@ -56,7 +56,7 @@
> jsonw_name(json_wtr, name); \
> jsonw_start_array(json_wtr); \
> } else { \
> - fprintf(stderr, fmt_str, name); \
> + fprintf(stdout, fmt_str, name); \
> } \
> }
>
> @@ -65,7 +65,7 @@
> if (json_output) \
> jsonw_end_array(json_wtr); \
> else \
> - fprintf(stderr, "%s", endstr); \
> + fprintf(stdout, "%s", endstr); \
> }
>
> #define NET_DUMP_UINT(name, fmt_str, val) \
> @@ -73,7 +73,7 @@
> if (json_output) \
> jsonw_uint_field(json_wtr, name, val); \
> else \
> - fprintf(stderr, fmt_str, val); \
> + fprintf(stdout, fmt_str, val); \
> }
>
> #define NET_DUMP_STR(name, fmt_str, str) \
> @@ -81,7 +81,7 @@
> if (json_output) \
> jsonw_string_field(json_wtr, name, str);\
> else \
> - fprintf(stderr, fmt_str, str); \
> + fprintf(stdout, fmt_str, str); \
> }
>
> #define NET_DUMP_STR_ONLY(str) \
> @@ -89,7 +89,7 @@
> if (json_output) \
> jsonw_string(json_wtr, str); \
> else \
> - fprintf(stderr, "%s ", str); \
> + fprintf(stdout, "%s ", str); \
> }
>
> #endif
> --
> 2.17.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH bpf-next] bpftool: Fix bpftool net output
2018-09-25 22:20 [PATCH bpf-next] bpftool: Fix bpftool net output Andrey Ignatov
2018-09-26 4:33 ` Song Liu
@ 2018-09-26 10:19 ` Daniel Borkmann
1 sibling, 0 replies; 3+ messages in thread
From: Daniel Borkmann @ 2018-09-26 10:19 UTC (permalink / raw)
To: Andrey Ignatov, netdev; +Cc: ast, yhs
On 09/26/2018 12:20 AM, Andrey Ignatov wrote:
> Print `bpftool net` output to stdout instead of stderr. Only errors
> should be printed to stderr. Regular output should go to stdout and this
> is what all other subcommands of bpftool do, including --json and
> --pretty formats of `bpftool net` itself.
>
> Fixes: commit f6f3bac08ff9 ("tools/bpf: bpftool: add net support")
> Signed-off-by: Andrey Ignatov <rdna@fb.com>
> Acked-by: Yonghong Song <yhs@fb.com>
Applied to bpf-next, thanks Andrey!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-09-26 16:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-25 22:20 [PATCH bpf-next] bpftool: Fix bpftool net output Andrey Ignatov
2018-09-26 4:33 ` Song Liu
2018-09-26 10:19 ` Daniel Borkmann
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.