Diffstat (limited to 'noncore/net/wellenreiter/daemon/source/daemon.cc') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/wellenreiter/daemon/source/daemon.cc | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/noncore/net/wellenreiter/daemon/source/daemon.cc b/noncore/net/wellenreiter/daemon/source/daemon.cc index a2e1f96..75b2222 100644 --- a/noncore/net/wellenreiter/daemon/source/daemon.cc +++ b/noncore/net/wellenreiter/daemon/source/daemon.cc | |||
@@ -3,43 +3,31 @@ | |||
3 | * | 3 | * |
4 | * $Id$ | 4 | * $Id$ |
5 | */ | 5 | */ |
6 | 6 | ||
7 | #include "config.hh" | 7 | #include "config.hh" |
8 | #include "daemon.hh" | 8 | #include "daemon.hh" |
9 | #include "cardmode.hh" | ||
10 | #include "sniffer.hh" | ||
11 | 9 | ||
12 | /* Main function of wellenreiterd */ | 10 | /* Main function of wellenreiterd */ |
13 | int main(int argc, char **argv) | 11 | int main(int argc, char **argv) |
14 | { | 12 | { |
15 | int sock, maxfd, retval; | 13 | int sock, maxfd, retval; |
16 | char buffer[128]; | 14 | char buffer[128]; |
17 | pcap_t *handletopcap; /* The handle to the libpcap */ | 15 | pcap_t *handletopcap; |
18 | char errbuf[PCAP_ERRBUF_SIZE]; /* The errorbuffer of libpacap */ | ||
19 | struct pcap_pkthdr header; /* The packet header from pcap*/ | ||
20 | const u_char *packet; /* The actual packet content*/ | ||
21 | 16 | ||
22 | fd_set rset; | 17 | fd_set rset; |
23 | 18 | ||
24 | fprintf(stderr, "wellenreiterd %s\n\n", VERSION); | 19 | fprintf(stderr, "wellenreiterd %s\n\n", VERSION); |
25 | 20 | ||
26 | #if 0 | ||
27 | /* will be replaced soon, just for max because max is lazy :-) */ | 21 | /* will be replaced soon, just for max because max is lazy :-) */ |
28 | if(card_into_monitormode (SNIFFER_DEVICE, CARD_TYPE_NG) < 0) | 22 | if(!card_into_monitormode(handletopcap, SNIFFER_DEVICE, CARD_TYPE_NG)) |
29 | { | 23 | { |
30 | fprintf(stderr, "Cannot set card into mon mode, aborting\n"); | 24 | wl_logerr("Cannot set card into mon mode, aborting"); |
31 | exit(-1); | 25 | exit(-1); |
32 | } | 26 | } |
33 | #endif | 27 | wl_loginfo("Set card into monitor mode"); |
34 | |||
35 | /* opening the pcap for sniffing */ | ||
36 | handletopcap = pcap_open_live(SNIFFER_DEVICE, BUFSIZ, 1, 1000, errbuf); | ||
37 | #ifdef HAVE_PCAP_NONBLOCK | ||
38 | pcap_setnonblock(handletopcap, 1, errstr); | ||
39 | #endif | ||
40 | 28 | ||
41 | /* Setup socket for incoming commands */ | 29 | /* Setup socket for incoming commands */ |
42 | if((sock=commsock(DAEMONADDR, DAEMONPORT)) < 0) | 30 | if((sock=commsock(DAEMONADDR, DAEMONPORT)) < 0) |
43 | { | 31 | { |
44 | wl_logerr("Cannot setup socket"); | 32 | wl_logerr("Cannot setup socket"); |
45 | exit(-1); | 33 | exit(-1); |