]> xenbits.xensource.com Git - libvirt.git/commitdiff
Allow brAddTap to create a tap device that is down
authorLaine Stump <laine@laine.org>
Wed, 9 Feb 2011 06:20:39 +0000 (01:20 -0500)
committerLaine Stump <laine@laine.org>
Thu, 17 Feb 2011 18:36:22 +0000 (13:36 -0500)
An upcoming patch has a use for a tap device to be created that
doesn't need to be actually put into the "up" state, and keeping it
"down" keeps the output of ifconfig from being unnecessarily cluttered
(ifconfig won't show down interfaces unless you add "-a").

bridge.[ch]: add "up" as an arg to brAddTap()
uml_conf.c, qemu_command.c: add "up" (set to "true") to brAddTap() call.

src/qemu/qemu_command.c
src/uml/uml_conf.c
src/util/bridge.c
src/util/bridge.h

index b0eddd4e73c2f51a6f56394085dd63fba356028a..618d3a97d453409f902e1c1f3511200dcc135750 100644 (file)
@@ -252,6 +252,7 @@ qemuNetworkIfaceConnect(virConnectPtr conn,
                         &net->ifname,
                         tapmac,
                         vnet_hdr,
+                        true,
                         &tapfd))) {
         if (err == ENOTSUP) {
             /* In this particular case, give a better diagnostic. */
index e5dbed997281770ebf2076b90b878673667e99cb..7c8fb16892383da932a4a5d4f110e681df2e56e4 100644 (file)
@@ -143,6 +143,7 @@ umlConnectTapDevice(virConnectPtr conn,
                         &net->ifname,
                         tapmac,
                         0,
+                        true,
                         NULL))) {
         if (err == ENOTSUP) {
             /* In this particular case, give a better diagnostic. */
index e53fce5f7359681dcf2727366f1b1f9a986b64e7..3ed71be7c7f454be3fafa71cdee94d77ce78c362 100644 (file)
@@ -484,6 +484,7 @@ brAddTap(brControl *ctl,
          char **ifname,
          const unsigned char *macaddr,
          int vnet_hdr,
+         bool up,
          int *tapfd)
 {
     int fd;
@@ -530,7 +531,7 @@ brAddTap(brControl *ctl,
         goto error;
     if ((errno = brAddInterface(ctl, bridge, ifr.ifr_name)))
         goto error;
-    if ((errno = brSetInterfaceUp(ctl, ifr.ifr_name, 1)))
+    if (up && ((errno = brSetInterfaceUp(ctl, ifr.ifr_name, 1))))
         goto error;
     if (!tapfd &&
         (errno = ioctl(fd, TUNSETPERSIST, 1)))
index e8e7ecae90a61fc773887ec8096eaa83ac5725ae..93f0b3381a616c4af3d3833d70f701c80ad98d8f 100644 (file)
@@ -71,6 +71,7 @@ int     brAddTap                (brControl *ctl,
                                  char **ifname,
                                  const unsigned char *macaddr,
                                  int vnet_hdr,
+                                 bool up,
                                  int *tapfd);
 
 int     brDeleteTap             (brControl *ctl,