summaryrefslogtreecommitdiff
authormjm <mjm>2002-12-31 12:36:06 (UTC)
committer mjm <mjm>2002-12-31 12:36:06 (UTC)
commitd331ca1cf11e8f525665a1e5cb10f491d47c19e8 (patch) (side-by-side diff)
tree42e46b280ac5b9ce5762f0df3a09189c4912d560
parente34eef8e2f2a36797ef980d505a99948f88a5df2 (diff)
downloadopie-d331ca1cf11e8f525665a1e5cb10f491d47c19e8.zip
opie-d331ca1cf11e8f525665a1e5cb10f491d47c19e8.tar.gz
opie-d331ca1cf11e8f525665a1e5cb10f491d47c19e8.tar.bz2
wl_recv was more or less broken because of missing socket structure, fixed.
general cleanup. GUI has to be updated in functions wl_setupsock and wl_recv
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/wellenreiter/libwellenreiter/source/sniff.cc30
-rw-r--r--noncore/net/wellenreiter/libwellenreiter/source/wl_proto.cc5
-rw-r--r--noncore/net/wellenreiter/libwellenreiter/source/wl_proto.hh9
-rw-r--r--noncore/net/wellenreiter/libwellenreiter/source/wl_sock.cc11
-rw-r--r--noncore/net/wellenreiter/libwellenreiter/source/wl_sock.hh7
5 files changed, 33 insertions, 29 deletions
diff --git a/noncore/net/wellenreiter/libwellenreiter/source/sniff.cc b/noncore/net/wellenreiter/libwellenreiter/source/sniff.cc
index e516177..6e512c4 100644
--- a/noncore/net/wellenreiter/libwellenreiter/source/sniff.cc
+++ b/noncore/net/wellenreiter/libwellenreiter/source/sniff.cc
@@ -10,2 +10,3 @@
#include "wl_log.hh"
+#include "wl_types.hh"
#include "wl_proto.hh"
@@ -13,3 +14,6 @@
/* Main function, checks packets */
-void process_packets(const struct pcap_pkthdr *pkthdr, const unsigned char *packet, char *guihost, int guiport)
+void process_packets(const struct pcap_pkthdr *pkthdr,
+ const unsigned char *packet,
+ char *guihost,
+ int guiport)
{
@@ -108,4 +112,2 @@ void process_packets(const struct pcap_pkthdr *pkthdr, const unsigned char *pack
- memset(wl_net.bssid, 0, sizeof(wl_net.bssid));
-
if (strcmp (pinfoptr->ssid,NONBROADCASTING) ==0)
@@ -116,2 +118,3 @@ void process_packets(const struct pcap_pkthdr *pkthdr, const unsigned char *pack
wl_loginfo("SSID is: %s", pinfoptr->ssid);
+ memset(wl_net.bssid, 0, sizeof(wl_net.bssid));
memcpy(wl_net.bssid, pinfoptr->ssid, sizeof(wl_net.bssid)-1);
@@ -239,3 +242,4 @@ int handle_beacon(u_int16_t fc, const u_char *p,struct packetinfo *ppinfo)
{
- memcpy(&(pbody.ssid.ssid),p+offset,pbody.ssid.length); offset += pbody.ssid.length;
+ memcpy(&(pbody.ssid.ssid),p+offset,pbody.ssid.length);
+ offset += pbody.ssid.length;
pbody.ssid.ssid[pbody.ssid.length]='\0';
@@ -253,3 +257,4 @@ int handle_beacon(u_int16_t fc, const u_char *p,struct packetinfo *ppinfo)
{
- memcpy(&(pbody.challenge.text),p+offset,pbody.challenge.length); offset += pbody.challenge.length;
+ memcpy(&(pbody.challenge.text),p+offset,pbody.challenge.length);
+ offset += pbody.challenge.length;
pbody.challenge.text[pbody.challenge.length]='\0';
@@ -261,3 +266,4 @@ int handle_beacon(u_int16_t fc, const u_char *p,struct packetinfo *ppinfo)
{
- memcpy(&(pbody.rates.rate),p+offset,pbody.rates.length); offset += pbody.rates.length;
+ memcpy(&(pbody.rates.rate),p+offset,pbody.rates.length);
+ offset += pbody.rates.length;
}
@@ -265,3 +271,4 @@ int handle_beacon(u_int16_t fc, const u_char *p,struct packetinfo *ppinfo)
case E_DS:
- memcpy(&(pbody.ds),p+offset,3); offset +=3;
+ memcpy(&(pbody.ds),p+offset,3);
+ offset +=3;
ppinfo->channel = pbody.ds.channel;
@@ -269,7 +276,10 @@ int handle_beacon(u_int16_t fc, const u_char *p,struct packetinfo *ppinfo)
case E_CF:
- memcpy(&(pbody.cf),p+offset,8); offset +=8;
+ memcpy(&(pbody.cf),p+offset,8);
+ offset +=8;
break;
case E_TIM:
- memcpy(&(pbody.tim),p+offset,2); offset +=2;
- memcpy(&(pbody.tim.count),p+offset,3); offset +=3;
+ memcpy(&(pbody.tim),p+offset,2);
+ offset +=2;
+ memcpy(&(pbody.tim.count),p+offset,3);
+ offset +=3;
if ((pbody.tim.length -3) > 0)
diff --git a/noncore/net/wellenreiter/libwellenreiter/source/wl_proto.cc b/noncore/net/wellenreiter/libwellenreiter/source/wl_proto.cc
index 0630d04..664ba92 100644
--- a/noncore/net/wellenreiter/libwellenreiter/source/wl_proto.cc
+++ b/noncore/net/wellenreiter/libwellenreiter/source/wl_proto.cc
@@ -6,2 +6,3 @@
+#include "wl_types.hh"
#include "wl_proto.hh"
@@ -36,3 +37,3 @@ int get_field(const char *buffer, char *out, int maxlen)
- if(atoi(len)-3 > maxlen -1)
+ if(atoi(len) > maxlen -1)
memcpy(out, buffer + 3, maxlen - 1);
@@ -56,3 +57,3 @@ int send_network_found (const char *guihost, int guiport, void *structure)
memset(temp, 0, sizeof(temp));
- snprintf(temp, sizeof(temp), "%.2d", NETFOUND);
+ snprintf(temp, sizeof(temp), "%.2d", WL_NETFOUND);
memcpy(buffer, temp, 2);
diff --git a/noncore/net/wellenreiter/libwellenreiter/source/wl_proto.hh b/noncore/net/wellenreiter/libwellenreiter/source/wl_proto.hh
index f645f58..46ef8e5 100644
--- a/noncore/net/wellenreiter/libwellenreiter/source/wl_proto.hh
+++ b/noncore/net/wellenreiter/libwellenreiter/source/wl_proto.hh
@@ -20,11 +20,2 @@ int get_network_found (void *, const char *);
-typedef struct {
- int net_type; /* 1 = Accesspoint ; 2 = Ad-Hoc */
- int ssid_len; /* Length of SSID */
- int channel; /* Channel */
- int wep; /* 1 = WEP enabled ; 0 = disabled */
- char mac[64]; /* MAC address of Accesspoint */
- char bssid[128]; /* BSSID of Net */
-} wl_network_t;
-
#endif /* WLPROTO_HH */
diff --git a/noncore/net/wellenreiter/libwellenreiter/source/wl_sock.cc b/noncore/net/wellenreiter/libwellenreiter/source/wl_sock.cc
index db6b7b8..6e26cb8 100644
--- a/noncore/net/wellenreiter/libwellenreiter/source/wl_sock.cc
+++ b/noncore/net/wellenreiter/libwellenreiter/source/wl_sock.cc
@@ -10,5 +10,4 @@
/* Setup UDP Socket for incoming commands */
-int wl_setupsock(const char *host, int port)
+int wl_setupsock(const char *host, int port, struct sockaddr_in saddr)
{
- struct sockaddr_in saddr;
int sock;
@@ -75,5 +74,4 @@ int wl_send(const char *host, int port, const char *string, ...)
/* Check for new messages on commsock */
-int wl_recv(int *sock, char *out, int maxlen)
+int wl_recv(int *sock, struct sockaddr_in cliaddr, char *out, int maxlen)
{
- struct sockaddr_in *cliaddr;
socklen_t len = sizeof(struct sockaddr);
@@ -82,4 +80,7 @@ int wl_recv(int *sock, char *out, int maxlen)
memset(out, 0, maxlen);
- if(recvfrom(*sock, out, maxlen - 1, 0, (struct sockaddr *)cliaddr, &len) < 0)
+ if(recvfrom(*sock, out, maxlen - 1, 0, (struct sockaddr *)&cliaddr, &len) < 0)
+ {
+ wl_logerr("Cannot receive from socket: %s", strerror(errno));
return -1;
+ }
diff --git a/noncore/net/wellenreiter/libwellenreiter/source/wl_sock.hh b/noncore/net/wellenreiter/libwellenreiter/source/wl_sock.hh
index 6ddbaef..e7d9747 100644
--- a/noncore/net/wellenreiter/libwellenreiter/source/wl_sock.hh
+++ b/noncore/net/wellenreiter/libwellenreiter/source/wl_sock.hh
@@ -1,2 +1,2 @@
-/* $id */
+/* $Id */
@@ -5,2 +5,3 @@
+#include <stdarg.h>
#include <sys/types.h>
@@ -15,5 +16,5 @@
-int wl_setupsock(const char *, int);
+int wl_setupsock(const char *, int, struct sockaddr_in);
int wl_send(const char *, int, const char *, ...);
-int wl_recv(int *, char *, int);
+int wl_recv(int *, struct sockaddr_in, char *, int);