-rw-r--r-- | noncore/net/wellenreiter/daemon/source/daemon.cc | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/noncore/net/wellenreiter/daemon/source/daemon.cc b/noncore/net/wellenreiter/daemon/source/daemon.cc index b836a31..6467af7 100644 --- a/noncore/net/wellenreiter/daemon/source/daemon.cc +++ b/noncore/net/wellenreiter/daemon/source/daemon.cc | |||
@@ -21,5 +21,5 @@ int main(int argc, char **argv) | |||
21 | fprintf(stderr, "wellenreiterd %s\n\n", VERSION); | 21 | fprintf(stderr, "wellenreiterd %s\n\n", VERSION); |
22 | 22 | ||
23 | if(!card_into_monitormode(handletopcap, SNIFFER_DEVICE, CARD_TYPE_NG)) | 23 | if(!card_into_monitormode(&handletopcap, SNIFFER_DEVICE, CARD_TYPE_NG)) |
24 | { | 24 | { |
25 | wl_logerr("Cannot set card into mon mode, aborting"); | 25 | wl_logerr("Cannot set card into mon mode, aborting"); |
@@ -28,4 +28,26 @@ int main(int argc, char **argv) | |||
28 | wl_loginfo("Set card into monitor mode"); | 28 | wl_loginfo("Set card into monitor mode"); |
29 | 29 | ||
30 | /////// following line will be moved to lib as soon as possible //////////// | ||
31 | if((handletopcap = pcap_open_live(SNIFFER_DEVICE, BUFSIZ, 1, 0, NULL)) == NULL) | ||
32 | { | ||
33 | wl_logerr("pcap_open_live() failed: %s", strerror(errno)); | ||
34 | exit(-1); | ||
35 | } | ||
36 | |||
37 | #ifdef HAVE_PCAP_NONBLOCK | ||
38 | pcap_setnonblock(handletopcap, 1, NULL); | ||
39 | #endif | ||
40 | |||
41 | /* getting the datalink type */ | ||
42 | retval = pcap_datalink(handletopcap); | ||
43 | if (retval != DLT_IEEE802_11) /* Rawmode is IEEE802_11 */ | ||
44 | { | ||
45 | wl_loginfo("Interface %s does not work in the correct 802.11 raw mode", SNIFFER_DEVICE); | ||
46 | pcap_close(handletopcap); | ||
47 | return 0; | ||
48 | } | ||
49 | wl_loginfo("Your successfully listen on %s in 802.11 raw mode", SNIFFER_DEVICE); | ||
50 | //////////////////////////////////////// | ||
51 | |||
30 | /* Setup socket for incoming commands */ | 52 | /* Setup socket for incoming commands */ |
31 | if((sock=commsock(DAEMONADDR, DAEMONPORT)) < 0) | 53 | if((sock=commsock(DAEMONADDR, DAEMONPORT)) < 0) |