diff mbox

tap-win32: don't abort in tap_enable(); enables -netdev tap

Message ID 20170324234646.15264-1-Andrew.Baumann@microsoft.com
State New
Headers show

Commit Message

Andrew Baumann March 24, 2017, 11:46 p.m. UTC
The docs generally steer users away from using the legacy -net
parameter, however on win32 attempting to enable a tap device using
-netdev tap fails at an abort() in tap_enable(). Removing the abort()s
seems to be enough to get everything working, so do that.

Signed-off-by: Andrew Baumann <Andrew.Baumann@microsoft.com>
---
 net/tap-win32.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Stefan Weil March 28, 2017, 6:28 p.m. UTC | #1
Am 25.03.2017 um 00:46 schrieb Andrew Baumann:
> The docs generally steer users away from using the legacy -net
> parameter, however on win32 attempting to enable a tap device using
> -netdev tap fails at an abort() in tap_enable(). Removing the abort()s
> seems to be enough to get everything working, so do that.
>
> Signed-off-by: Andrew Baumann <Andrew.Baumann@microsoft.com>
> ---
>  net/tap-win32.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/net/tap-win32.c b/net/tap-win32.c
> index 662f9b6..3620843 100644
> --- a/net/tap-win32.c
> +++ b/net/tap-win32.c
> @@ -811,10 +811,10 @@ int net_init_tap(const Netdev *netdev, const char *name,
>
>  int tap_enable(NetClientState *nc)
>  {
> -    abort();
> +    return 0;
>  }
>
>  int tap_disable(NetClientState *nc)
>  {
> -    abort();
> +    return 0;
>  }

As I never worked with TAP on Windows, I cannot say much to this fix.

Jason, what is the use of tap_enable, tap_disable? Is it fine
to simply do nothing on Windows here?

And is this something for QEMU‌ 2.9 (I added question to subject line)?

Stefan
Cameron Esfahani via March 28, 2017, 6:55 p.m. UTC | #2
> From: Stefan Weil [mailto:sw@weilnetz.de]

> Sent: Tuesday, 28 March 2017 11:28


> Am 25.03.2017 um 00:46 schrieb Andrew Baumann:

> > The docs generally steer users away from using the legacy -net

> > parameter, however on win32 attempting to enable a tap device using

> > -netdev tap fails at an abort() in tap_enable(). Removing the abort()s

> > seems to be enough to get everything working, so do that.

> >

> > Signed-off-by: Andrew Baumann <Andrew.Baumann@microsoft.com>

> > ---

> >  net/tap-win32.c | 4 ++--

> >  1 file changed, 2 insertions(+), 2 deletions(-)

> >

> > diff --git a/net/tap-win32.c b/net/tap-win32.c

> > index 662f9b6..3620843 100644

> > --- a/net/tap-win32.c

> > +++ b/net/tap-win32.c

> > @@ -811,10 +811,10 @@ int net_init_tap(const Netdev *netdev, const char

> *name,

> >

> >  int tap_enable(NetClientState *nc)

> >  {

> > -    abort();

> > +    return 0;

> >  }

> >

> >  int tap_disable(NetClientState *nc)

> >  {

> > -    abort();

> > +    return 0;

> >  }

> 

> As I never worked with TAP on Windows, I cannot say much to this fix.

> 

> Jason, what is the use of tap_enable, tap_disable? Is it fine

> to simply do nothing on Windows here?


I was also hoping for a review -- I'm no expert on this stuff either, but my quick reading of those code paths is that they issue ioctls to enable/disable packet reception on the underlying tap device. As win32 TAP is implemented, that is already enabled from start of day.

It's possible this patch still does not permit dynamic reconfiguration of tap devices (e.g. from the monitor console). However, it does work with the -netdev tap option on the command-line.

> And is this something for QEMU‌ 2.9 (I added question to subject line)?


Ideally, yes. If not, -netdev tap will continue to blow up in the abort as it does today...

Andrew
diff mbox

Patch

diff --git a/net/tap-win32.c b/net/tap-win32.c
index 662f9b6..3620843 100644
--- a/net/tap-win32.c
+++ b/net/tap-win32.c
@@ -811,10 +811,10 @@  int net_init_tap(const Netdev *netdev, const char *name,
 
 int tap_enable(NetClientState *nc)
 {
-    abort();
+    return 0;
 }
 
 int tap_disable(NetClientState *nc)
 {
-    abort();
+    return 0;
 }