summaryrefslogtreecommitdiff
path: root/hmp.c
diff options
context:
space:
mode:
Diffstat (limited to 'hmp.c')
-rw-r--r--hmp.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/hmp.c b/hmp.c
index 42ced2a202..7a4e25f30c 100644
--- a/hmp.c
+++ b/hmp.c
@@ -14,6 +14,8 @@
*/
#include "hmp.h"
+#include "net.h"
+#include "qemu-option.h"
#include "qemu-timer.h"
#include "qmp-commands.h"
@@ -969,3 +971,22 @@ void hmp_dump_guest_memory(Monitor *mon, const QDict *qdict)
&errp);
hmp_handle_error(mon, &errp);
}
+
+void hmp_netdev_add(Monitor *mon, const QDict *qdict)
+{
+ Error *err = NULL;
+ QemuOpts *opts;
+
+ opts = qemu_opts_from_qdict(qemu_find_opts("netdev"), qdict, &err);
+ if (error_is_set(&err)) {
+ goto out;
+ }
+
+ netdev_add(opts, &err);
+ if (error_is_set(&err)) {
+ qemu_opts_del(opts);
+ }
+
+out:
+ hmp_handle_error(mon, &err);
+}