ec_network.c (ettercap-0.8.3) | : | ec_network.c (ettercap-0.8.3.1) | ||
---|---|---|---|---|
skipping to change at line 14 | skipping to change at line 14 | |||
#include <ec_queue.h> | #include <ec_queue.h> | |||
#include <ec_network.h> | #include <ec_network.h> | |||
#include <ec_threads.h> | #include <ec_threads.h> | |||
#include <pcap.h> | #include <pcap.h> | |||
#include <libnet.h> | #include <libnet.h> | |||
#if !defined(OS_WINDOWS) | #if !defined(OS_WINDOWS) | |||
#include <ifaddrs.h> | #include <ifaddrs.h> | |||
#endif | #endif | |||
#if defined(OS_BSD_OPEN) || defined(OS_LINUX) | #if defined(OS_BSD_OPEN) | |||
/* LINUX does not care about timeout */ | ||||
/* OPENBSD needs 0 */ | /* OPENBSD needs 0 */ | |||
#define PCAP_TIMEOUT 0 | #define PCAP_TIMEOUT 0 | |||
#elif defined(OS_SOLARIS) | #elif defined(OS_SOLARIS) | |||
/* SOLARIS needs > 1 */ | /* SOLARIS needs > 1 */ | |||
#define PCAP_TIMEOUT 10 | #define PCAP_TIMEOUT 10 | |||
#else | #else | |||
/* LINUX needs > 0 */ | ||||
/* FREEBSD needs 1 */ | /* FREEBSD needs 1 */ | |||
/* MACOSX needs 1 */ | /* MACOSX needs 1 */ | |||
#define PCAP_TIMEOUT 1 | #define PCAP_TIMEOUT 1 | |||
#endif | #endif | |||
struct source_entry { | struct source_entry { | |||
struct iface_env iface; | struct iface_env iface; | |||
LIST_ENTRY(source_entry) next; | LIST_ENTRY(source_entry) next; | |||
}; | }; | |||
skipping to change at line 54 | skipping to change at line 54 | |||
static int secondary_sources_init(char **sources); | static int secondary_sources_init(char **sources); | |||
static void close_secondary_sources(void); | static void close_secondary_sources(void); | |||
static void l3_init(void); | static void l3_init(void); | |||
static void l3_close(void); | static void l3_close(void); | |||
/* the code */ | /* the code */ | |||
void network_init() | void network_init() | |||
{ | { | |||
char *iface; | char *iface; | |||
char perrbuf[PCAP_ERRBUF_SIZE]; | ||||
DEBUG_MSG("init_network"); | DEBUG_MSG("init_network"); | |||
EC_GBL_PCAP->snaplen = UINT16_MAX; | EC_GBL_PCAP->snaplen = UINT16_MAX; | |||
if(EC_GBL_OPTIONS->read) { | if(EC_GBL_OPTIONS->read) { | |||
source_init(EC_GBL_OPTIONS->pcapfile_in, EC_GBL_IFACE, true, false); | source_init(EC_GBL_OPTIONS->pcapfile_in, EC_GBL_IFACE, true, false); | |||
source_print(EC_GBL_IFACE); | source_print(EC_GBL_IFACE); | |||
} else { | } else { | |||
iface = EC_GBL_OPTIONS->iface ? EC_GBL_OPTIONS->iface : (EC_GBL_OPTIONS->i face = pcap_lookupdev(perrbuf)); | iface = EC_GBL_OPTIONS->iface ? EC_GBL_OPTIONS->iface : (EC_GBL_OPTIONS->i face = capture_default_if()); | |||
ON_ERROR(iface, NULL, "No suitable interface found..."); | ON_ERROR(iface, NULL, "No suitable interface found..."); | |||
source_init(iface, EC_GBL_IFACE, true, true); | source_init(iface, EC_GBL_IFACE, true, true); | |||
source_print(EC_GBL_IFACE); | source_print(EC_GBL_IFACE); | |||
if(EC_GBL_SNIFF->type == SM_BRIDGED) { | if(EC_GBL_SNIFF->type == SM_BRIDGED) { | |||
source_init(EC_GBL_OPTIONS->iface_bridge, EC_GBL_BRIDGE, true, true); | source_init(EC_GBL_OPTIONS->iface_bridge, EC_GBL_BRIDGE, true, true); | |||
source_print(EC_GBL_BRIDGE); | source_print(EC_GBL_BRIDGE); | |||
if(EC_GBL_BRIDGE->dlt != EC_GBL_IFACE->dlt) | if(EC_GBL_BRIDGE->dlt != EC_GBL_IFACE->dlt) | |||
FATAL_ERROR("Can't bridge interfaces of different types"); | FATAL_ERROR("Can't bridge interfaces of different types"); | |||
} | } | |||
} | } | |||
End of changes. 4 change blocks. | ||||
4 lines changed or deleted | 3 lines changed or added |