Package: nast
Version: 0.2.0-3
Severity: important
Tags: patch
Nast fails to initialize libnet as a result of using an autodetected
device (wmaster0) before reading command line arguments.
This patch only moves libnet initialization code after reading command
line arguments.
-- System Information:
Debian Release: lenny/sid
APT prefers testing
APT policy: (990, 'testing'), (120, 'unstable'), (105, 'experimental')
Architecture: i386 (i686)
Kernel: Linux 2.6.23-1-686 (SMP w/2 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Versions of packages nast depends on:
ii libc6 2.7-6 GNU C Library: Shared libraries
ii libncurses5 5.6+20080105-1 Shared libraries for terminal hand
ii libnet1 1.1.2.1-2 library for the construction and h
ii libpcap0.8 0.9.8-2 System interface for user-level pa
nast recommends no packages.
-- no debconf information
--- main.c 2004-02-15 20:51:07.000000000 +0100
+++ ../patched/main.c 2008-02-04 18:27:32.000000000 +0100
@@ -106,48 +106,7 @@ int main(int argc,char **argv)
return -1;
}
- /* finding a suitable device */
- dev = pcap_lookupdev(errbuf);
- if (dev==NULL)
- {
- fprintf (stderr, "Error: can't find a suitable interface to use: %s\n", errbuf);
- return -1;
- }
- /*
- res = pcap_findalldevs(&devices, errbuf);
- if (res < 1 && 0)
- {
- fprintf(stderr, "pcap_findalldevs error: %s\n", errbuf);
- return -1;
- }
-
- try to find the device
- for (devc = devices; devc; devc = devc->next)
- {
- if (!strcmp(devc->name,"any"))
- continue;
- if (devc->flags & PCAP_IF_LOOPBACK)
- {
- strcpy(dev,devc->name);
- continue;
- }
- else
- {
- strcpy(dev,devc->name);
- break;
- }
- }
-
- pcap_freealldevs(devices);
- */
-
- if ((L = libnet_init (LIBNET_LINK, dev, errbuf))==NULL)
- {
- fprintf(stderr, "Error: can't initialize libnet engine: %s", errbuf);
- fprintf(stderr, "Have you activate a non-loopback iface? (man ifconfig)\n");
- exit(-1);
- }
line_s = row_s = cont = lg = 0;
option_index = 0;
@@ -280,6 +239,49 @@ int main(int argc,char **argv)
break;
}
/* END OF ARGS SWITCH */
+
+ /* finding a suitable device */
+ if(dev == NULL) dev = pcap_lookupdev(errbuf);
+ if (dev==NULL)
+ {
+ fprintf (stderr, "Error: can't find a suitable interface to use: %s\n", errbuf);
+ return -1;
+ }
+
+ /*
+ res = pcap_findalldevs(&devices, errbuf);
+ if (res < 1 && 0)
+ {
+ fprintf(stderr, "pcap_findalldevs error: %s\n", errbuf);
+ return -1;
+ }
+
+ try to find the device
+ for (devc = devices; devc; devc = devc->next)
+ {
+ if (!strcmp(devc->name,"any"))
+ continue;
+ if (devc->flags & PCAP_IF_LOOPBACK)
+ {
+ strcpy(dev,devc->name);
+ continue;
+ }
+ else
+ {
+ strcpy(dev,devc->name);
+ break;
+ }
+ }
+
+ pcap_freealldevs(devices);
+ */
+
+ if ((L = libnet_init (LIBNET_LINK, dev, errbuf))==NULL)
+ {
+ fprintf(stderr, "Error: can't initialize libnet engine: %s", errbuf);
+ fprintf(stderr, "Have you activate a non-loopback iface? (man ifconfig)\n");
+ exit(-1);
+ }
if (dev==NULL)
{