-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 | |||
@@ -64,6 +64,16 @@ int card_into_monitormode (pcap_t **orighandle, char *device, int cardtype) | |||
64 | return 0; | 64 | return 0; |
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 */ |
69 | if (!card_check_rfmon_datalink(device)) | 79 | if (!card_check_rfmon_datalink(device)) |
@@ -142,3 +152,36 @@ int card_set_promisc_up (const char *device) | |||
142 | return 0; | 152 | return 0; |
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 | |||
@@ -22,10 +22,11 @@ extern "C" | |||
22 | 22 | ||
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 */ |
31 | /*the config file should provide these information */ | 32 | /*the config file should provide these information */ |
@@ -38,5 +39,6 @@ extern "C" | |||
38 | int card_check_rfmon_datalink (char *device); | 39 | 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 */ |