summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/wellenreiter/daemon/source/daemon.cc24
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
@@ -20,13 +20,35 @@ int main(int argc, char **argv)
20 20
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");
26 exit(-1); 26 exit(-1);
27 } 27 }
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)
32 { 54 {