[libvirt] [PATCH 2/3] Make umlConnectTapDevice ask brAddTap for a persistent tap device.

2010-08-12 Thread Soren Hansen
This patch does two things:

 * It makes umlConnectTapDevice ask brAddTap for a persistent tap by
   passing it a NULL tapfd argument.
 * Stops umlConnectTapDevice from immediately dismantling the bridge
   it just set up.

Signed-off-by: Soren Hansen so...@linux2go.dk
---
 src/uml/uml_conf.c |6 +-
 1 files changed, 1 insertions(+), 5 deletions(-)

diff --git a/src/uml/uml_conf.c b/src/uml/uml_conf.c
index bc8cbce..06543cb 100644
--- a/src/uml/uml_conf.c
+++ b/src/uml/uml_conf.c
@@ -112,7 +112,6 @@ umlConnectTapDevice(virDomainNetDefPtr net,
 const char *bridge)
 {
 brControl *brctl = NULL;
-int tapfd = -1;
 int template_ifname = 0;
 int err;
 unsigned char tapmac[VIR_MAC_BUFLEN];
@@ -140,7 +139,7 @@ umlConnectTapDevice(virDomainNetDefPtr net,
 net-ifname,
 tapmac,
 0,
-tapfd))) {
+NULL))) {
 if (err == ENOTSUP) {
 /* In this particular case, give a better diagnostic. */
 umlReportError(VIR_ERR_INTERNAL_ERROR,
@@ -164,9 +163,6 @@ umlConnectTapDevice(virDomainNetDefPtr net,
 VIR_FREE(net-ifname);
 goto error;
 }
-close(tapfd);
-
-brShutdown(brctl);
 
 return 0;
 
-- 
1.7.0.4

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH 2/3] Make umlConnectTapDevice ask brAddTap for a persistent tap device.

2010-08-12 Thread Daniel P. Berrange
On Thu, Aug 12, 2010 at 12:10:25AM +0200, Soren Hansen wrote:
 This patch does two things:
 
  * It makes umlConnectTapDevice ask brAddTap for a persistent tap by
passing it a NULL tapfd argument.
  * Stops umlConnectTapDevice from immediately dismantling the bridge
it just set up.
 
 Signed-off-by: Soren Hansen so...@linux2go.dk
 ---
  src/uml/uml_conf.c |6 +-
  1 files changed, 1 insertions(+), 5 deletions(-)
 
 diff --git a/src/uml/uml_conf.c b/src/uml/uml_conf.c
 index bc8cbce..06543cb 100644
 --- a/src/uml/uml_conf.c
 +++ b/src/uml/uml_conf.c
 @@ -112,7 +112,6 @@ umlConnectTapDevice(virDomainNetDefPtr net,
  const char *bridge)
  {
  brControl *brctl = NULL;
 -int tapfd = -1;
  int template_ifname = 0;
  int err;
  unsigned char tapmac[VIR_MAC_BUFLEN];
 @@ -140,7 +139,7 @@ umlConnectTapDevice(virDomainNetDefPtr net,
  net-ifname,
  tapmac,
  0,
 -tapfd))) {
 +NULL))) {
  if (err == ENOTSUP) {
  /* In this particular case, give a better diagnostic. */
  umlReportError(VIR_ERR_INTERNAL_ERROR,
 @@ -164,9 +163,6 @@ umlConnectTapDevice(virDomainNetDefPtr net,
  VIR_FREE(net-ifname);
  goto error;
  }
 -close(tapfd);
 -
 -brShutdown(brctl);

brShutdown doesn't touch the bridge device at all. This simply closes
the socket file handle we used for talking to the kernel to create
the bridge. Removing this causes an FD leak

Regards,
Daniel
-- 
|: Red Hat, Engineering, London-o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :|
|: http://autobuild.org-o- http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH 2/3] Make umlConnectTapDevice ask brAddTap for a persistent tap device.

2010-08-12 Thread Soren Hansen

On 12-08-2010 14:20, Daniel P. Berrange wrote:

-brShutdown(brctl);


brShutdown doesn't touch the bridge device at all. This simply closes
the socket file handle we used for talking to the kernel to create
the bridge. Removing this causes an FD leak


Hm, so it does. I'll put it back.

Regards, Soren.

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list