author | max <max> | 2003-02-07 10:28:23 (UTC) |
---|---|---|
committer | max <max> | 2003-02-07 10:28:23 (UTC) |
commit | 9bbfe155d26fe42ecb31744de0525a1f854b7ca5 (patch) (unidiff) | |
tree | fefae4afc0dfcb51b8581e67f7b284ed68bc6a92 | |
parent | e73acff447949c3e87da87e0749ccefac448d650 (diff) | |
download | opie-9bbfe155d26fe42ecb31744de0525a1f854b7ca5.zip opie-9bbfe155d26fe42ecb31744de0525a1f854b7ca5.tar.gz opie-9bbfe155d26fe42ecb31744de0525a1f854b7ca5.tar.bz2 |
Monitor commands and set_card_channel
-rw-r--r-- | noncore/net/wellenreiter/libwellenreiter/source/cardmode.cc | 43 | ||||
-rw-r--r-- | noncore/net/wellenreiter/libwellenreiter/source/cardmode.hh | 8 |
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 | |||
@@ -65,4 +65,14 @@ int card_into_monitormode (pcap_t **orighandle, char *device, int cardtype) | |||
65 | } | 65 | } |
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 | ||
68 | /* Setting the promiscous and up flag to the interface */ | 78 | /* Setting the promiscous and up flag to the interface */ |
@@ -143,2 +153,35 @@ int card_set_promisc_up (const char *device) | |||
143 | } | 153 | } |
144 | } | 154 | } |
155 | |||
156 | /* Set channel (Wireless frequency) of the device */ | ||
157 | int 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 | |||
@@ -23,8 +23,9 @@ extern "C" | |||
23 | /* Defines, used for the card setup */ | 23 | /* Defines, used for the card setup */ |
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 | ||
30 | /* only for now, until we have the daemon running */ | 31 | /* only for now, until we have the daemon running */ |
@@ -39,4 +40,5 @@ int card_check_rfmon_datalink (char *device); | |||
39 | int card_into_monitormode (pcap_t **, char *, int); | 40 | int card_into_monitormode (pcap_t **, char *, int); |
40 | int card_set_promisc_up (const char *); | 41 | int card_set_promisc_up (const char *); |
42 | int card_set_channel (const char *device, int channel,int cardtype); | ||
41 | 43 | ||
42 | #endif /* CARDMODE_HH */ | 44 | #endif /* CARDMODE_HH */ |