summaryrefslogtreecommitdiff
authormjm <mjm>2002-12-28 12:59:38 (UTC)
committer mjm <mjm>2002-12-28 12:59:38 (UTC)
commit1adf0d153cd8c4714719183af45ed703abef0a43 (patch) (unidiff)
tree8845f1bbee4d050a18a6e5fa970bb5adaa277bc0
parent7a6a55d19048de7920eb885e80a26e1bef0f66e4 (diff)
downloadopie-1adf0d153cd8c4714719183af45ed703abef0a43.zip
opie-1adf0d153cd8c4714719183af45ed703abef0a43.tar.gz
opie-1adf0d153cd8c4714719183af45ed703abef0a43.tar.bz2
cleanup
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/libwellenreiter/source/cardmode.cc9
-rw-r--r--noncore/net/wellenreiter/libwellenreiter/source/sniff.cc6
-rw-r--r--noncore/net/wellenreiter/libwellenreiter/source/wl_proto.cc17
-rw-r--r--noncore/net/wellenreiter/libwellenreiter/source/wl_sock.cc6
4 files changed, 19 insertions, 19 deletions
diff --git a/noncore/net/wellenreiter/libwellenreiter/source/cardmode.cc b/noncore/net/wellenreiter/libwellenreiter/source/cardmode.cc
index c29f4d0..7362f14 100644
--- a/noncore/net/wellenreiter/libwellenreiter/source/cardmode.cc
+++ b/noncore/net/wellenreiter/libwellenreiter/source/cardmode.cc
@@ -20,7 +20,7 @@ int card_into_monitormode (pcap_t **orighandle, char *device, int cardtype)
20 return 0; 20 return 0;
21 } 21 }
22 22
23 /* Setting the prmiscous and up flag to the interface */ 23 /* Setting the promiscous and up flag to the interface */
24 if (!card_set_promisc_up(device)) 24 if (!card_set_promisc_up(device))
25 { 25 {
26 wl_logerr("Cannot set interface to promisc mode: %s", strerror(errno)); 26 wl_logerr("Cannot set interface to promisc mode: %s", strerror(errno));
@@ -64,14 +64,11 @@ int card_into_monitormode (pcap_t **orighandle, char *device, int cardtype)
64/* Set card into promisc mode */ 64/* Set card into promisc mode */
65int card_set_promisc_up (const char *device) 65int card_set_promisc_up (const char *device)
66{ 66{
67 char ifconfigcmd[32]; 67 char ifconfigcmd[48];
68 int retval=0; 68 int retval=0;
69 69
70 snprintf(ifconfigcmd, sizeof(ifconfigcmd) - 1, SBIN_PATH, device); 70 snprintf(ifconfigcmd, sizeof(ifconfigcmd) - 1, SBIN_PATH, device);
71 retval = system(ifconfigcmd); 71 retval = system(ifconfigcmd);
72 72
73 if(retval != 0) 73 return (retval ? 0 : 1);
74 return 0;
75
76return 1;
77} 74}
diff --git a/noncore/net/wellenreiter/libwellenreiter/source/sniff.cc b/noncore/net/wellenreiter/libwellenreiter/source/sniff.cc
index e2169ca..9b4e360 100644
--- a/noncore/net/wellenreiter/libwellenreiter/source/sniff.cc
+++ b/noncore/net/wellenreiter/libwellenreiter/source/sniff.cc
@@ -124,7 +124,11 @@ void process_packets(const struct pcap_pkthdr *pkthdr, const unsigned char *pack
124 wl_loginfo("Mac is: %s", pinfoptr->sndhwaddr); 124 wl_loginfo("Mac is: %s", pinfoptr->sndhwaddr);
125 memcpy(wl_net.mac, pinfoptr->sndhwaddr, sizeof(wl_net.mac)-1);; 125 memcpy(wl_net.mac, pinfoptr->sndhwaddr, sizeof(wl_net.mac)-1);;
126 126
127 send_network_found((char *)guihost, guiport, &wl_net); 127 if(!send_network_found((char *)guihost, guiport, &wl_net))
128 {
129 wl_logerr("Error sending data to UI: %s", strerror(errno));
130 break;
131 }
128 wl_loginfo("Sent network to GUI '%s:%d'", guihost, guiport); 132 wl_loginfo("Sent network to GUI '%s:%d'", guihost, guiport);
129 } 133 }
130 break; 134 break;
diff --git a/noncore/net/wellenreiter/libwellenreiter/source/wl_proto.cc b/noncore/net/wellenreiter/libwellenreiter/source/wl_proto.cc
index f15523f..5317f52 100644
--- a/noncore/net/wellenreiter/libwellenreiter/source/wl_proto.cc
+++ b/noncore/net/wellenreiter/libwellenreiter/source/wl_proto.cc
@@ -35,10 +35,11 @@ int get_field(const char *buffer, char *out)
35 memset(out, 0, atoi(len) + 1); 35 memset(out, 0, atoi(len) + 1);
36 memcpy(out, buffer + 3, atoi(len)); 36 memcpy(out, buffer + 3, atoi(len));
37 37
38 return atoi(len) + 3; 38 /* Return length of whole field (including 3 byte length) */
39 return (atoi(len) + 3);
39} 40}
40 41
41/* Send found network to GUI */ 42/* Send found network to UI */
42int send_network_found (const char *guihost, int guiport, void *structure) 43int send_network_found (const char *guihost, int guiport, void *structure)
43{ 44{
44 wl_network_t *ptr; 45 wl_network_t *ptr;
@@ -75,20 +76,18 @@ int send_network_found (const char *guihost, int guiport, void *structure)
75 len += retval; 76 len += retval;
76 77
77 /* Set Mac */ 78 /* Set Mac */
78 retval = add_field(buffer + len, (char *)ptr->mac, 17); 79 retval = add_field(buffer + len, ptr->mac, 17);
79 len += retval; 80 len += retval;
80 81
81 /* Set ssid */ 82 /* Set ssid */
82 retval = add_field(buffer + len, (char *)ptr->bssid, ptr->ssid_len); 83 retval = add_field(buffer + len, ptr->bssid, ptr->ssid_len);
83 84
84 /* Send prepared buffer to GUI */ 85 /* Send prepared buffer to UI */
85#ifdef DEBUG 86#ifdef DEBUG
86 wl_loginfo("Sending network to GUI: '%s'", buffer); 87 wl_loginfo("Sending network to UI: '%s'", buffer);
87#endif 88#endif
88 89
89 wl_send(guihost, guiport, buffer); 90 return ((!wl_send(guihost, guiport, buffer)) ? 0 : 1);
90
91 return 1;
92} 91}
93 92
94/* Fill buffer into structur */ 93/* Fill buffer into structur */
diff --git a/noncore/net/wellenreiter/libwellenreiter/source/wl_sock.cc b/noncore/net/wellenreiter/libwellenreiter/source/wl_sock.cc
index 5714afb..4942fba 100644
--- a/noncore/net/wellenreiter/libwellenreiter/source/wl_sock.cc
+++ b/noncore/net/wellenreiter/libwellenreiter/source/wl_sock.cc
@@ -56,20 +56,20 @@ int wl_send(const char *host, int port, const char *string, ...)
56 if((sock=socket(AF_INET, SOCK_DGRAM, 0)) < 0) 56 if((sock=socket(AF_INET, SOCK_DGRAM, 0)) < 0)
57 { 57 {
58 wl_logerr("Cannot set up socket: %s", strerror(errno)); 58 wl_logerr("Cannot set up socket: %s", strerror(errno));
59 return -1; 59 return 0;
60 } 60 }
61 61
62 if(sendto(sock, buffer, sizeof(buffer), 0, (struct sockaddr *)&saddr, sizeof(saddr)) < 0) 62 if(sendto(sock, buffer, sizeof(buffer), 0, (struct sockaddr *)&saddr, sizeof(saddr)) < 0)
63 { 63 {
64 wl_logerr("Cannot write to socket: %s", strerror(errno)); 64 wl_logerr("Cannot write to socket: %s", strerror(errno));
65 close(sock); 65 close(sock);
66 return -1; 66 return 0;
67 } 67 }
68 68
69 if(close(sock) < 0) 69 if(close(sock) < 0)
70 wl_logerr("Cannot close socket: %s", strerror(errno)); 70 wl_logerr("Cannot close socket: %s", strerror(errno));
71 71
72 return 0; 72 return 1;
73} 73}
74 74
75/* Check for new messages on commsock */ 75/* Check for new messages on commsock */