net/filter: Add filter order info for "info network"
PATCH 1/1 net/filter: Add filter order info for "info network"
From: Zhang Chen <[email protected]>
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 <[email protected]>
--- net/net.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-)
net/net.c +16 -8
@@ -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); + } } }
Signature · 1 line
2.17.GIT