qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 3/9] filter: remove plugins when remove filter


From: Yang Hongyang
Subject: [Qemu-devel] [PATCH 3/9] filter: remove plugins when remove filter
Date: Fri, 24 Jul 2015 18:55:53 +0800

Signed-off-by: Yang Hongyang <address@hidden>
---
 net/filter.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/net/filter.c b/net/filter.c
index 89ee830..7ef7bee 100644
--- a/net/filter.c
+++ b/net/filter.c
@@ -11,6 +11,7 @@
 #include "qemu-common.h"
 #include "qemu/error-report.h"
 #include "net/filter.h"
+#include "qemu/config-file.h"
 
 typedef struct FilterPlugin FilterPlugin;
 struct FilterPlugin {
@@ -81,6 +82,19 @@ out:
 static void filter_cleanup(NetClientState *nc)
 {
     FILTERState *s = DO_UPCAST(FILTERState, nc, nc);
+    NetClientState *plugin = NULL;
+    FilterPlugin *plug = NULL, *next = NULL;
+    QemuOpts *opts;
+
+    QLIST_FOREACH_SAFE(plug, &s->plugins, next, next) {
+        plugin = plug->plugin;
+        opts = qemu_opts_find(qemu_find_opts_err("netdev", NULL),
+                              plugin->name);
+        assert(opts);
+
+        qemu_del_net_client(plugin);
+        qemu_opts_del(opts);
+    }
 
     if (s->backend && nc->peer) {
         qemu_flush_queued_packets(nc);
-- 
1.9.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]