Debian Bug report logs - #336507
File descriptor leaks in udhcpc

version graph

Package: udhcpc; Maintainer for udhcpc is Debian Install System Team <debian-boot@lists.debian.org>; Source for udhcpc is src:busybox.

Reported by: Neil Turton <neilt+deb@chiark.greenend.org.uk>

Date: Sun, 30 Oct 2005 21:03:02 UTC

Severity: normal

Found in version udhcpc/0.9.8cvs20050303

Fixed in version udhcp/0.9.8cvs20050303-2

Done: Eric Van Buggenhaut <ericvb@debian.org>

Bug is archived. No further changes may be made.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, Eric Van Buggenhaut <ericvb@debian.org>:
Bug#336507; Package udhcpc. Full text and rfc822 format available.

Acknowledgement sent to Neil Turton <neilt+deb@chiark.greenend.org.uk>:
New Bug report received and forwarded. Copy sent to Eric Van Buggenhaut <ericvb@debian.org>. Full text and rfc822 format available.

Message #5 received at submit@bugs.debian.org (full text, mbox):

From: Neil Turton <neilt+deb@chiark.greenend.org.uk>
To: submit@bugs.debian.org
Subject: File descriptor leaks in udhcpc
Date: Sun, 30 Oct 2005 20:58:18 +0000
Package: udhcpc
Version: 0.9.8cvs20050303

While my ISP was playing up, udhcpc was getting 30 second leases from
the cable modem.  Somehow it managed to run out of file descriptors
and /proc/nn/fd showed a large number of sockets.  Using strace showed
it was creating a UDP socket, setting SO_REUSEADDR and then attempting
to bind it to a specific IP address.  The bind failed and the socket
was never closed.  Examining kernel_packet() we can see that if the
bind fails, the socket will remain open.  There are a number of
similar cases.  See the patch below.
 
Cheers, Neil.

 diff -ur udhcp-0.9.8cvs20050303.orig/packet.c udhcp-0.9.8cvs20050303/packet.c
 --- udhcp-0.9.8cvs20050303.orig/packet.c	2005-03-03 16:54:10.000000000 +0000
 +++ udhcp-0.9.8cvs20050303/packet.c	2005-10-30 19:41:14.316517790 +0000
 @@ -178,7 +178,10 @@
		 return -1;

	 if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char *) &n, sizeof(n)) == -1)
 +	{
 +		close(fd);
		 return -1;
 +	}

	 memset(&client, 0, sizeof(client));
	 client.sin_family = AF_INET;
 @@ -186,7 +189,10 @@
	 client.sin_addr.s_addr = source_ip;

	 if (bind(fd, (struct sockaddr *)&client, sizeof(struct sockaddr)) == -1)
 +	{
 +		close(fd);
		 return -1;
 +	}

	 memset(&client, 0, sizeof(client));
	 client.sin_family = AF_INET;
 @@ -194,7 +200,10 @@
	 client.sin_addr.s_addr = dest_ip;

	 if (connect(fd, (struct sockaddr *)&client, sizeof(struct sockaddr)) == -1)
 +	{
 +		close(fd);
		 return -1;
 +	}

	 result = write(fd, payload, sizeof(struct dhcpMessage));
	 close(fd);
 diff -ur udhcp-0.9.8cvs20050303.orig/socket.c udhcp-0.9.8cvs20050303/socket.c
 --- udhcp-0.9.8cvs20050303.orig/socket.c	2005-10-30 19:47:38.396382194 +0000
 +++ udhcp-0.9.8cvs20050303/socket.c	2005-10-30 19:44:57.768949490 +0000
 @@ -64,6 +64,7 @@
				 DEBUG(LOG_INFO, "%s (our ip) = %s", ifr.ifr_name, inet_ntoa(our_ip->sin_addr));
			 } else {
				 LOG(LOG_ERR, "SIOCGIFADDR failed, is the interface up and configured?: %m");
 +				close(fd);
				 return -1;
			 }
		 }
 @@ -73,6 +74,7 @@
			 *ifindex = ifr.ifr_ifindex;
		 } else {
			 LOG(LOG_ERR, "SIOCGIFINDEX failed!: %m");
 +			close(fd);
			 return -1;
		 }
		 if (ioctl(fd, SIOCGIFHWADDR, &ifr) == 0) {
 @@ -81,6 +83,7 @@
				 arp[0], arp[1], arp[2], arp[3], arp[4], arp[5]);
		 } else {
			 LOG(LOG_ERR, "SIOCGIFHWADDR failed!: %m");
 +			close(fd);
			 return -1;
		 }
	 } else {



Reply sent to Eric Van Buggenhaut <ericvb@debian.org>:
You have taken responsibility. Full text and rfc822 format available.

Notification sent to Neil Turton <neilt+deb@chiark.greenend.org.uk>:
Bug acknowledged by developer. Full text and rfc822 format available.

Message #10 received at 336507-close@bugs.debian.org (full text, mbox):

From: Eric Van Buggenhaut <ericvb@debian.org>
To: 336507-close@bugs.debian.org
Subject: Bug#336507: fixed in udhcp 0.9.8cvs20050303-2
Date: Fri, 16 Dec 2005 13:47:36 -0800
Source: udhcp
Source-Version: 0.9.8cvs20050303-2

We believe that the bug you reported is fixed in the latest version of
udhcp, which is due to be installed in the Debian FTP archive:

udhcp_0.9.8cvs20050303-2.diff.gz
  to pool/main/u/udhcp/udhcp_0.9.8cvs20050303-2.diff.gz
udhcp_0.9.8cvs20050303-2.dsc
  to pool/main/u/udhcp/udhcp_0.9.8cvs20050303-2.dsc
udhcpc_0.9.8cvs20050303-2_i386.deb
  to pool/main/u/udhcp/udhcpc_0.9.8cvs20050303-2_i386.deb
udhcpd_0.9.8cvs20050303-2_i386.deb
  to pool/main/u/udhcp/udhcpd_0.9.8cvs20050303-2_i386.deb



A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 336507@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Eric Van Buggenhaut <ericvb@debian.org> (supplier of updated udhcp package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Format: 1.7
Date: Fri, 16 Dec 2005 20:31:09 +0100
Source: udhcp
Binary: udhcpd udhcpc
Architecture: source i386
Version: 0.9.8cvs20050303-2
Distribution: unstable
Urgency: low
Maintainer: Eric Van Buggenhaut <ericvb@debian.org>
Changed-By: Eric Van Buggenhaut <ericvb@debian.org>
Description: 
 udhcpc     - very small DHCP client
 udhcpd     - very small DHCP server
Closes: 336507 341139
Changes: 
 udhcp (0.9.8cvs20050303-2) unstable; urgency=low
 .
   * Fix correct number of leases (closes: #341139 - thanks to Ferenc Wagner)
   * Make sure we close unbound sockets (closes: #336507 - thanks to Neil
     Turton)
Files: 
 3a2c3066bec337c680e2e5c6a62b7ced 565 net optional udhcp_0.9.8cvs20050303-2.dsc
 217acf562354cd742f91657447dc2c64 16782 net optional udhcp_0.9.8cvs20050303-2.diff.gz
 d95b76513376d5bad921596f3ac071b9 22692 net optional udhcpc_0.9.8cvs20050303-2_i386.deb
 bacdb88136aea5f430fd14ea970988aa 24412 net optional udhcpd_0.9.8cvs20050303-2_i386.deb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)

iD8DBQFDoxsc4VLuWbCehTARAkCpAKCfTQAp5kKsPIMSBSLyF0b0HgqwzwCfYfoi
vlD/Zrowtr/tStl8GK18tso=
=XgGZ
-----END PGP SIGNATURE-----




Bug archived. Request was from Debbugs Internal Request <owner@bugs.debian.org> to internal_control@bugs.debian.org. (Sun, 24 Jun 2007 12:06:27 GMT) Full text and rfc822 format available.

Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Thu Apr 24 02:50:56 2014; Machine Name: beach.debian.org

Debian Bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.