diff mbox

[PATCHv4,2/6] qemu/net: routines to get tap fd

Message ID 20091102222340.GC15153@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Michael S. Tsirkin Nov. 2, 2009, 10:23 p.m. UTC
None
diff mbox

Patch

diff --git a/net.c b/net.c
index 6a7f1c2..8ac639b 100644
--- a/net.c
+++ b/net.c
@@ -1472,6 +1472,16 @@  static int tap_set_sndbuf(TAPState *s, QemuOpts *opts)
 }
 #endif /* TUNSETSNDBUF */
 
+int tap_get_fd(VLANClientState *vc)
+{
+    TAPState *s = vc->opaque;
+
+    if (vc->receive != tap_receive)
+        return -1;
+
+    return s->fd;
+}
+
 int tap_has_vnet_hdr(void *opaque)
 {
     VLANClientState *vc = opaque;
diff --git a/net.h b/net.h
index d1ba23b..7246d16 100644
--- a/net.h
+++ b/net.h
@@ -92,6 +92,7 @@  void do_set_link(Monitor *mon, const QDict *qdict);
 
 void do_info_usernet(Monitor *mon);
 
+int tap_get_fd(VLANClientState *vc);
 int tap_has_vnet_hdr(void *opaque);
 void tap_using_vnet_hdr(void *opaque, int using_vnet_hdr);