* [Qemu-devel] [PATCH] net/filter: Add filter order info for "info network"
@ 2019-09-03 8:22 Zhang Chen
0 siblings, 0 replies; only message in thread
From: Zhang Chen @ 2019-09-03 8:22 UTC (permalink / raw)
To: Jason Wang, qemu-dev; +Cc: Zhang Chen, Zhang Chen
From: Zhang Chen <chen.zhang@intel.com>
People need a way to know current filter order if they
want to dynamic add/remove netfilter.
For example:
(qemu) info network
.......
filters order:
m0 ---> redire0 ---> redire1 ---> End
.......
Signed-off-by: Zhang Chen <chen.zhang@intel.com>
---
net/net.c | 24 ++++++++++++++++--------
1 file changed, 16 insertions(+), 8 deletions(-)
diff --git a/net/net.c b/net/net.c
index 84aa6d8d00..496f4aa049 100644
--- a/net/net.c
+++ b/net/net.c
@@ -1253,15 +1253,23 @@ void print_net_client(Monitor *mon, NetClientState *nc)
NetClientDriver_str(nc->info->type),
nc->info_str);
if (!QTAILQ_EMPTY(&nc->filters)) {
- monitor_printf(mon, "filters:\n");
- }
- QTAILQ_FOREACH(nf, &nc->filters, next) {
- char *path = object_get_canonical_path_component(OBJECT(nf));
+ monitor_printf(mon, "filters order:\n");
+ QTAILQ_FOREACH(nf, &nc->filters, next) {
+ char *path = object_get_canonical_path_component(OBJECT(nf));
+
+ monitor_printf(mon, " %s --->", path);
+ }
+ monitor_printf(mon, " End\n");
+ monitor_printf(mon, "filters detail info:\n");
- monitor_printf(mon, " - %s: type=%s", path,
- object_get_typename(OBJECT(nf)));
- netfilter_print_info(mon, nf);
- g_free(path);
+ QTAILQ_FOREACH(nf, &nc->filters, next) {
+ char *path = object_get_canonical_path_component(OBJECT(nf));
+
+ monitor_printf(mon, " - %s: type=%s", path,
+ object_get_typename(OBJECT(nf)));
+ netfilter_print_info(mon, nf);
+ g_free(path);
+ }
}
}
--
2.17.GIT
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2019-09-03 8:29 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-03 8:22 [Qemu-devel] [PATCH] net/filter: Add filter order info for "info network" Zhang Chen
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).