From: "Blue Swirl" <blauwirbel@gmail.com>
To: Paul Brook <paul@codesourcery.com>
Cc: Mark Glines <mark@glines.org>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] emulated lance device crashes in debian-sparc32
Date: Sun, 20 May 2007 22:45:41 +0300 [thread overview]
Message-ID: <f43fc5580705201245m4cc98069k39fbef95d0c33f9f@mail.gmail.com> (raw)
In-Reply-To: <f43fc5580705200845p4984f6e3ve6eb2ad3de984995@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 698 bytes --]
On 5/20/07, Blue Swirl <blauwirbel@gmail.com> wrote:
> On 5/20/07, Paul Brook <paul@codesourcery.com> wrote:
> > > > I think Qemu should reject -net user only. Currently that seems to
> > > > mean that there is no nic, but still the vlan is connected to slirp
> > > > stack. That does not make any sense.
> >
> > If you do this, do it properly and warn if any qemu vlans have a single device
> > attached.
>
> That is not correct either: -net user,vlan=0 -net socket,connect=1.2.3.4:1234.
>
> How about this rule:
> ((one or more guest devices in a vlan) and (zero with a warning? or
> more host devices)) or (no devices at all on either side)
This patch implements the logic above. Any comments?
[-- Attachment #2: net_checks.diff --]
[-- Type: text/x-diff, Size: 2611 bytes --]
Index: qemu/vl.c
===================================================================
--- qemu.orig/vl.c 2007-05-20 18:58:14.000000000 +0000
+++ qemu/vl.c 2007-05-20 19:36:53.000000000 +0000
@@ -4195,6 +4195,7 @@
}
nd->vlan = vlan;
nb_nics++;
+ vlan->nb_guest_devs++;
ret = 0;
} else
if (!strcmp(device, "none")) {
@@ -4207,6 +4208,7 @@
if (get_param_value(buf, sizeof(buf), "hostname", p)) {
pstrcpy(slirp_hostname, sizeof(slirp_hostname), buf);
}
+ vlan->nb_host_devs++;
ret = net_slirp_init(vlan);
} else
#endif
@@ -4217,6 +4219,7 @@
fprintf(stderr, "tap: no interface name\n");
return -1;
}
+ vlan->nb_host_devs++;
ret = tap_win32_init(vlan, ifname);
} else
#else
@@ -4236,6 +4239,7 @@
if (get_param_value(setup_script, sizeof(setup_script), "script", p) == 0) {
pstrcpy(setup_script, sizeof(setup_script), DEFAULT_NETWORK_SCRIPT);
}
+ vlan->nb_host_devs++;
ret = net_tap_init(vlan, ifname, setup_script);
}
} else
@@ -4257,6 +4261,7 @@
fprintf(stderr, "Unknown socket options: %s\n", p);
return -1;
}
+ vlan->nb_host_devs++;
} else
{
fprintf(stderr, "Unknown network device: %s\n", device);
@@ -6992,6 +6997,7 @@
int usb_devices_index;
int fds[2];
const char *pid_file = NULL;
+ VLANState *vlan;
LIST_INIT (&vm_change_state_head);
#ifndef _WIN32
@@ -7611,6 +7617,19 @@
if (net_client_init(net_clients[i]) < 0)
exit(1);
}
+ for(vlan = first_vlan; vlan != NULL; vlan = vlan->next) {
+ if (vlan->nb_guest_devs == 0 && vlan->nb_host_devs == 0)
+ continue;
+ if (vlan->nb_guest_devs == 0) {
+ fprintf(stderr, "Invalid vlan (%d) with no nics\n", vlan->id);
+ exit(1);
+ }
+ if (vlan->nb_host_devs == 0) {
+ fprintf(stderr,
+ "Warning: vlan %d is not connected to host network\n",
+ vlan->id);
+ }
+ }
#ifdef TARGET_I386
if (boot_device == 'n') {
Index: qemu/vl.h
===================================================================
--- qemu.orig/vl.h 2007-05-20 19:01:59.000000000 +0000
+++ qemu/vl.h 2007-05-20 19:30:16.000000000 +0000
@@ -389,6 +389,7 @@
int id;
VLANClientState *first_client;
struct VLANState *next;
+ int nb_guest_devs, nb_host_devs;
} VLANState;
VLANState *qemu_find_vlan(int id);
prev parent reply other threads:[~2007-05-20 19:45 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-19 14:16 [Qemu-devel] emulated lance device crashes in debian-sparc32 Mark Glines
2007-05-19 17:03 ` Blue Swirl
2007-05-19 19:08 ` Blue Swirl
2007-05-19 22:08 ` Mark Glines
2007-05-20 7:10 ` Blue Swirl
2007-05-20 9:11 ` Mark Glines
2007-05-20 10:25 ` Paul Brook
2007-05-20 13:15 ` Mark Glines
2007-05-20 13:51 ` Paul Brook
2007-05-20 15:45 ` Blue Swirl
2007-05-20 19:45 ` Blue Swirl [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f43fc5580705201245m4cc98069k39fbef95d0c33f9f@mail.gmail.com \
--to=blauwirbel@gmail.com \
--cc=mark@glines.org \
--cc=paul@codesourcery.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).