qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] Allow default network type to be determined from an environmental variable
@ 2008-01-13 21:20 Anthony Liguori
  2008-01-19 21:10 ` Paul Brook
  0 siblings, 1 reply; 10+ messages in thread
From: Anthony Liguori @ 2008-01-13 21:20 UTC (permalink / raw)
  To: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 725 bytes --]

One typically wants to use the same networking type on a given system.  
For instance, if you have a bridge set up for taps, you'll generally 
pass -net tap to the guest.  If you're an unprivileged user, you'll 
typically use -net user.

In the absence of a global configuration file, a reasonably sane way to 
support this configuration system wide is to use an environmental 
variable.  QEMU already uses a number of global variables for 
configuring audio options.

This patch introduces a global variable (QEMU_NET_DEFAULT) which allows 
a user to set a system-wide default networking type.  This saves a lot 
of typing for me as I no longer have to specify -net tap every time I 
launch QEMU.

Regards,

Anthony Liguori

[-- Attachment #2: configurable_default_nic.diff --]
[-- Type: text/x-patch, Size: 671 bytes --]

Index: qemu/vl.c
===================================================================
--- qemu.orig/vl.c	2008-01-13 15:12:55.000000000 -0600
+++ qemu/vl.c	2008-01-13 15:15:02.000000000 -0600
@@ -8754,11 +8754,16 @@
 
     /* init network clients */
     if (nb_net_clients == 0) {
+	const char *net_type = getenv("QEMU_NET_DEFAULT");
+
+	if (net_type == NULL)
+	    net_type = "user";
+
         /* if no clients, we use a default config */
         pstrcpy(net_clients[0], sizeof(net_clients[0]),
                 "nic");
         pstrcpy(net_clients[1], sizeof(net_clients[0]),
-                "user");
+                net_type);
         nb_net_clients = 2;
     }
 

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2008-02-12 12:27 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-13 21:20 [Qemu-devel] [PATCH] Allow default network type to be determined from an environmental variable Anthony Liguori
2008-01-19 21:10 ` Paul Brook
2008-01-19 22:40   ` Anthony Liguori
2008-01-19 22:47   ` M. Warner Losh
2008-02-12  0:17   ` Rob Landley
2008-02-12  1:42     ` Paul Brook
2008-02-12  2:19     ` andrzej zaborowski
2008-02-12  2:46       ` Paul Brook
2008-02-12  3:47         ` Anthony Liguori
2008-02-12 12:27           ` Paul Brook

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).