summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/libwellenreiter/source/cardmode.cc43
-rw-r--r--noncore/net/wellenreiter/libwellenreiter/source/cardmode.hh8
2 files changed, 48 insertions, 3 deletions
diff --git a/noncore/net/wellenreiter/libwellenreiter/source/cardmode.cc b/noncore/net/wellenreiter/libwellenreiter/source/cardmode.cc
index d868438..697d182 100644
--- a/noncore/net/wellenreiter/libwellenreiter/source/cardmode.cc
+++ b/noncore/net/wellenreiter/libwellenreiter/source/cardmode.cc
@@ -66,2 +66,12 @@ int card_into_monitormode (pcap_t **orighandle, char *device, int cardtype)
66 } 66 }
67 else if (cardtype == CARD_TYPE_ORINOCCO)
68 {
69 char lucentcmd[62];
70 snprintf(lucentcmd, sizeof(lucentcmd) - 1, "$(which iwpriv) %s monitor 2 %d", device, 1);
71 if (system(lucentcmd) != 0)
72 {
73 wl_logerr("Could not set %s in raw mode, check cardtype", device);
74 return 0;
75 }
76 }
67 77
@@ -144 +154,34 @@ int card_set_promisc_up (const char *device)
144} 154}
155
156/* Set channel (Wireless frequency) of the device */
157int card_set_channel (const char *device, int channel, int cardtype)
158{
159
160 if (cardtype == CARD_TYPE_CISCO)
161 {
162 /* Cisco cards don't need channelswitching */
163 return 1;
164 }
165 /* If it is a lucent orinocco card */
166 else if (cardtype == CARD_TYPE_ORINOCCO)
167 {
168 char lucentreset[63];
169 char lucentcmd[62];
170 snprintf(lucentreset, sizeof(lucentreset) -1,"$(which iwpriv) %s card_reset", device);
171 if (system(lucentreset) != 0)
172 {
173 wl_logerr("Could not reset the card %s",device);
174 return 0;
175 }
176 snprintf(lucentcmd, sizeof(lucentcmd) - 1, "$(which iwpriv) %s monitor 2 %d", device, channel);
177 if (system(lucentcmd) != 0)
178 {
179 wl_logerr("Could not set %s in raw mode, check cardtype", device);
180 return 0;
181 }
182 }
183
184 /* For undefined situations */
185 return 0;
186}
187
diff --git a/noncore/net/wellenreiter/libwellenreiter/source/cardmode.hh b/noncore/net/wellenreiter/libwellenreiter/source/cardmode.hh
index 4eec122..3a1991b 100644
--- a/noncore/net/wellenreiter/libwellenreiter/source/cardmode.hh
+++ b/noncore/net/wellenreiter/libwellenreiter/source/cardmode.hh
@@ -24,6 +24,7 @@ extern "C"
24#define DEFAULT_PATH "/proc/driver/aironet/%s/Config" 24#define DEFAULT_PATH "/proc/driver/aironet/%s/Config"
25 #define CISCO_STATUS "/proc/driver/aironet/%s/Status" 25#define CISCO_STATUS "/proc/driver/aironet/%s/Status"
26 #define CARD_TYPE_CISCO1 26 #define CARD_TYPE_CISCO 1
27 #define CARD_TYPE_NG 2 27 #define CARD_TYPE_NG 2
28 #define CARD_TYPE_HOSTAP3 28 #define CARD_TYPE_HOSTAP3
29#define CARD_TYPE_ORINOCCO 4
29 30
@@ -40,2 +41,3 @@ int card_into_monitormode (pcap_t **, char *, int);
40int card_set_promisc_up (const char *); 41int card_set_promisc_up (const char *);
42int card_set_channel (const char *device, int channel,int cardtype);
41 43