Your message dated Tue, 27 Jan 2009 15:47:03 +0000
with message-id <[email protected]>
and subject line Bug#500170: fixed in hunt 1.5-5
has caused the Debian Bug report #500170,
regarding [patch] Program should be aborted if the selected network interface
is down
to be marked as done.
This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.
(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)
--
500170: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=500170
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: hunt
Version: 1.5-4
Severity: normal
Tags: patch
If eth0 network interface is down or have not configured an ip address and I
you execute hunt without arguments, as you can see the hunt program prints
the main logo and exit. But I saw that a hunt process was still executing on
my computer and eating 100% of cpu usage. I saw that this is happening when
the selected network interface (eth0 by default) is down or does not have an
ip address, but if the network interface is up and have an address, the
program works properly.
So, I think that program should be aborted if selected network interface is
down or does not have an ip address. I attach a possible fix to this bug. The
open_sockets function is taken from iwlist program of the wireless-tools
package.
-- System Information:
Debian Release: lenny/sid
APT prefers testing
APT policy: (500, 'testing'), (500, 'stable')
Architecture: i386 (i686)
Kernel: Linux 2.6.26-1-686 (SMP w/2 CPU cores)
Locale: LANG=es_ES.UTF-8, LC_CTYPE=es_ES.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Versions of packages hunt depends on:
ii libc6 2.7-13 GNU C Library: Shared libraries
hunt recommends no packages.
hunt suggests no packages.
-- no debconf information
--- /home/privado/hunt-original/hunt-1.5/main.c 2000-05-26 16:06:39.000000000 +0200
+++ /home/privado/hunt/hunt-1.5/main.c 2008-09-25 19:39:10.000000000 +0200
@@ -14,6 +14,14 @@
#include <string.h>
#include <pthread.h>
+#include <sys/ioctl.h>
+#include <net/if.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <string.h>
+
+#define MAX_IFS 100
+
void logo(void)
{
@@ -452,12 +460,52 @@
return sec;
}
+/*
+ * Open a socket.
+ * Depending on the protocol present, open the right socket. The socket
+ * will allow us to talk to the driver.
+ */
+int
+sockets_open(void)
+{
+ static const int families[] = {
+ AF_INET, AF_IPX, AF_AX25, AF_APPLETALK
+ };
+ unsigned int i;
+ int sock;
+
+ /*
+ * Now pick any (exisiting) useful socket family for generic queries
+ * Note : don't open all the socket, only returns when one matches,
+ * all protocols might not be valid.
+ * Workaround by Jim Kaba <[email protected]>
+ * Note : in 99% of the case, we will just open the inet_sock.
+ * The remaining 1% case are not fully correct...
+ */
+
+ /* Try all families we support */
+ for(i = 0; i < sizeof(families)/sizeof(int); ++i)
+ {
+ /* Try to open the socket, if success returns it */
+ sock = socket(families[i], SOCK_DGRAM, 0);
+ if(sock >= 0)
+ return sock;
+ }
+
+ return -1;
+}
+
int main(int argc, char *argv[])
{
struct user_conn_info uci;
struct sigaction sac;
int run_it;
int c;
+ int skfd;
+ struct ifreq my_ifreq;
+ struct ifconf my_ifconf;
+ int i;
+ int eth_device_found;
if (geteuid() || getuid()) {
fprintf(stderr, "UID or EUID of 0 needed\n");
@@ -480,6 +528,34 @@
exit(1);
}
}
+
+ //Checks if the network interface is up and have an IP address.
+ skfd = sockets_open();
+ if (skfd == -1){
+ fprintf(stderr, "Cannot get socket\n");
+ exit(1);
+ }
+ strncpy(my_ifreq.ifr_name, eth_device, IFNAMSIZ);
+ ioctl(skfd,SIOCGIFFLAGS,&my_ifreq);
+ if (!((my_ifreq.ifr_flags & IFF_UP) == IFF_UP)){
+ fprintf(stderr, "Network interface %s is down\n", eth_device);
+ exit(1);
+ }
+ my_ifconf.ifc_len = MAX_IFS*sizeof(struct ifreq);
+ my_ifconf.ifc_buf = malloc(my_ifconf.ifc_len);
+ ioctl(skfd,SIOCGIFCONF,&my_ifconf);
+ eth_device_found = 0;
+ for(i = 0; my_ifconf.ifc_req[i].ifr_name[0] != '\0'; i++) {
+ if (!strcmp(eth_device, my_ifconf.ifc_req[i].ifr_name))
+ eth_device_found = 1;
+ }
+ if (!eth_device_found){
+ fprintf(stderr, "Network interface %s does not have \
+ an ip address\n", eth_device);
+ exit(1);
+ }
+
+
sigemptyset(&intr_mask);
sigaddset(&intr_mask, SIGINT);
--- End Message ---
--- Begin Message ---
Source: hunt
Source-Version: 1.5-5
We believe that the bug you reported is fixed in the latest version of
hunt, which is due to be installed in the Debian FTP archive:
hunt_1.5-5.diff.gz
to pool/main/h/hunt/hunt_1.5-5.diff.gz
hunt_1.5-5.dsc
to pool/main/h/hunt/hunt_1.5-5.dsc
hunt_1.5-5_i386.deb
to pool/main/h/hunt/hunt_1.5-5_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 [email protected],
and the maintainer will reopen the bug report if appropriate.
Debian distribution maintenance software
pp.
Barry deFreese <[email protected]> (supplier of updated hunt 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 [email protected])
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Format: 1.8
Date: Tue, 27 Jan 2009 09:44:34 -0500
Source: hunt
Binary: hunt
Architecture: source i386
Version: 1.5-5
Distribution: unstable
Urgency: low
Maintainer: Debian QA Group <[email protected]>
Changed-By: Barry deFreese <[email protected]>
Description:
hunt - Advanced packet sniffer and connection intrusion
Closes: 500170 500485
Changes:
hunt (1.5-5) unstable; urgency=low
.
* QA upload.
+ Set maintainer to Debian QA Group <[email protected]>.
* Version debhelper build-dep (>= 5.0.0).
* Add debian/compat and set to 5.
* Add ${misc:Depends}.
* Make clean not ignore errors.
* Clean up debian/copyright.
* Replace dh_installmanpages with dh_installman.
* Move file copies from rules to debian/install.
* Abort gracefully if interface is down. (Closes: #500170).
* Don't affect terminal colors when finished. (Closes: #500485).
+ Thanks to José Manuel SantamarÃa Lema for both fixes.
* Bump Standards Version to 3.8.0.
Checksums-Sha1:
d463d16e0fceff1ca37123af14d358ff2843d147 911 hunt_1.5-5.dsc
d67f54b3363cf980acfc6602833d0faa14c5eb6e 4280 hunt_1.5-5.diff.gz
d56f9d640d59e63706b02fb3f65f52aa3bc0e066 81630 hunt_1.5-5_i386.deb
Checksums-Sha256:
de540ae6b590529e1f07aef745cd4e55237ba026fc186ef716674f38b01d0f95 911
hunt_1.5-5.dsc
cb0f29aea24ef69c06f18930c07548b9338ed646a2941b11a2a81c3ce200ab74 4280
hunt_1.5-5.diff.gz
997605f38a22b9da4eb97132cc19c5858ebc5498b8418abf3ef5950d2f320bc6 81630
hunt_1.5-5_i386.deb
Files:
63ba667b1f4a8afda6ed38de8a3a75bb 911 net optional hunt_1.5-5.dsc
5acac6f39b53f143ca8535e38eb367e9 4280 net optional hunt_1.5-5.diff.gz
931e5cd412191bd3c48990f7fd33e850 81630 net optional hunt_1.5-5_i386.deb
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
iEYEARECAAYFAkl/KskACgkQ5ItltUs5T35AjACgxZfrUBbMqmg5rHFlucGPqABb
H20An2xm+nuUCJVXohN86qNa3PvZM+Vd
=hY60
-----END PGP SIGNATURE-----
--- End Message ---