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 @@ -19,9 +19,9 @@ int card_into_monitormode (pcap_t **orighandle, char *device, int cardtype) wl_logerr("No device given"); return 0; } - /* Setting the prmiscous and up flag to the interface */ + /* Setting the promiscous and up flag to the interface */ if (!card_set_promisc_up(device)) { wl_logerr("Cannot set interface to promisc mode: %s", strerror(errno)); return 0; @@ -63,15 +63,12 @@ int card_into_monitormode (pcap_t **orighandle, char *device, int cardtype) /* Set card into promisc mode */ int card_set_promisc_up (const char *device) { - char ifconfigcmd[32]; + char ifconfigcmd[48]; int retval=0; snprintf(ifconfigcmd, sizeof(ifconfigcmd) - 1, SBIN_PATH, device); retval = system(ifconfigcmd); - if(retval != 0) - return 0; - -return 1; + return (retval ? 0 : 1); } 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 @@ -123,9 +123,13 @@ void process_packets(const struct pcap_pkthdr *pkthdr, const unsigned char *pack wl_loginfo("Mac is: %s", pinfoptr->sndhwaddr); memcpy(wl_net.mac, pinfoptr->sndhwaddr, sizeof(wl_net.mac)-1);; - send_network_found((char *)guihost, guiport, &wl_net); + if(!send_network_found((char *)guihost, guiport, &wl_net)) + { + wl_logerr("Error sending data to UI: %s", strerror(errno)); + break; + } wl_loginfo("Sent network to GUI '%s:%d'", guihost, guiport); } 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 @@ -34,12 +34,13 @@ int get_field(const char *buffer, char *out) /* Copy buffer to out pointer */ memset(out, 0, atoi(len) + 1); memcpy(out, buffer + 3, atoi(len)); - return atoi(len) + 3; + /* Return length of whole field (including 3 byte length) */ + return (atoi(len) + 3); } -/* Send found network to GUI */ +/* Send found network to UI */ int send_network_found (const char *guihost, int guiport, void *structure) { wl_network_t *ptr; char buffer[2048]; @@ -74,22 +75,20 @@ int send_network_found (const char *guihost, int guiport, void *structure) retval = add_field(buffer + len, temp, 1); len += retval; /* Set Mac */ - retval = add_field(buffer + len, (char *)ptr->mac, 17); + retval = add_field(buffer + len, ptr->mac, 17); len += retval; /* Set ssid */ - retval = add_field(buffer + len, (char *)ptr->bssid, ptr->ssid_len); + retval = add_field(buffer + len, ptr->bssid, ptr->ssid_len); - /* Send prepared buffer to GUI */ + /* Send prepared buffer to UI */ #ifdef DEBUG - wl_loginfo("Sending network to GUI: '%s'", buffer); + wl_loginfo("Sending network to UI: '%s'", buffer); #endif - wl_send(guihost, guiport, buffer); - - return 1; + return ((!wl_send(guihost, guiport, buffer)) ? 0 : 1); } /* Fill buffer into structur */ int get_network_found (void *structure, const char *buffer) 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 @@ -55,22 +55,22 @@ int wl_send(const char *host, int port, const char *string, ...) /* Setup socket */ if((sock=socket(AF_INET, SOCK_DGRAM, 0)) < 0) { wl_logerr("Cannot set up socket: %s", strerror(errno)); - return -1; + return 0; } if(sendto(sock, buffer, sizeof(buffer), 0, (struct sockaddr *)&saddr, sizeof(saddr)) < 0) { wl_logerr("Cannot write to socket: %s", strerror(errno)); close(sock); - return -1; + return 0; } if(close(sock) < 0) wl_logerr("Cannot close socket: %s", strerror(errno)); - return 0; + return 1; } /* Check for new messages on commsock */ int wl_recv(int *sock, char *out, int maxlen) |