summaryrefslogtreecommitdiff
authormax <max>2003-02-07 10:28:23 (UTC)
committer max <max>2003-02-07 10:28:23 (UTC)
commit9bbfe155d26fe42ecb31744de0525a1f854b7ca5 (patch) (unidiff)
treefefae4afc0dfcb51b8581e67f7b284ed68bc6a92
parente73acff447949c3e87da87e0749ccefac448d650 (diff)
downloadopie-9bbfe155d26fe42ecb31744de0525a1f854b7ca5.zip
opie-9bbfe155d26fe42ecb31744de0525a1f854b7ca5.tar.gz
opie-9bbfe155d26fe42ecb31744de0525a1f854b7ca5.tar.bz2
Monitor commands and set_card_channel
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/wellenreiter/libwellenreiter/source/cardmode.cc43
-rw-r--r--noncore/net/wellenreiter/libwellenreiter/source/cardmode.hh2
2 files changed, 45 insertions, 0 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 */
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
@@ -26,6 +26,7 @@ extern "C"
26 #define CARD_TYPE_CISCO1 26 #define CARD_TYPE_CISCO1
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"
38int card_check_rfmon_datalink (char *device); 39int card_check_rfmon_datalink (char *device);
39int card_into_monitormode (pcap_t **, char *, int); 40int 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
42#endif /* CARDMODE_HH */ 44#endif /* CARDMODE_HH */