author | mickeyl <mickeyl> | 2004-02-23 19:04:50 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-02-23 19:04:50 (UTC) |
commit | 7206bf5ae8a9940a9c30a9dc3dd3cb663e64874b (patch) (unidiff) | |
tree | f48e9183a4ffcb9d9bc4c448f79c6f424ac4a387 /libopie2 | |
parent | 4f8be1658bc82040bac404aa98fe70c24239f10c (diff) | |
download | opie-7206bf5ae8a9940a9c30a9dc3dd3cb663e64874b.zip opie-7206bf5ae8a9940a9c30a9dc3dd3cb663e64874b.tar.gz opie-7206bf5ae8a9940a9c30a9dc3dd3cb663e64874b.tar.bz2 |
The Orinoco (and Symbol/Spectrum) driver recently got the monitor mode
patch applied. It uses the WE15 IW_MODE_MONITOR.
Fix OOrinocoMonitoringInterface to work with recent Orinoco drivers
-rw-r--r-- | libopie2/opienet/onetwork.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/libopie2/opienet/onetwork.cpp b/libopie2/opienet/onetwork.cpp index 36f409b..915814d 100644 --- a/libopie2/opienet/onetwork.cpp +++ b/libopie2/opienet/onetwork.cpp | |||
@@ -1072,154 +1072,157 @@ void OCiscoMonitoringInterface::setEnabled( bool b ) | |||
1072 | QFile f( fname ); | 1072 | QFile f( fname ); |
1073 | if ( !f.exists() ) return; | 1073 | if ( !f.exists() ) return; |
1074 | 1074 | ||
1075 | if ( f.open( IO_WriteOnly ) ) | 1075 | if ( f.open( IO_WriteOnly ) ) |
1076 | { | 1076 | { |
1077 | QTextStream s( &f ); | 1077 | QTextStream s( &f ); |
1078 | s << "Mode: r"; | 1078 | s << "Mode: r"; |
1079 | s << "Mode: y"; | 1079 | s << "Mode: y"; |
1080 | s << "XmitPower: 1"; | 1080 | s << "XmitPower: 1"; |
1081 | } | 1081 | } |
1082 | 1082 | ||
1083 | // flushing and closing will be done automatically when f goes out of scope | 1083 | // flushing and closing will be done automatically when f goes out of scope |
1084 | } | 1084 | } |
1085 | 1085 | ||
1086 | 1086 | ||
1087 | QString OCiscoMonitoringInterface::name() const | 1087 | QString OCiscoMonitoringInterface::name() const |
1088 | { | 1088 | { |
1089 | return "cisco"; | 1089 | return "cisco"; |
1090 | } | 1090 | } |
1091 | 1091 | ||
1092 | 1092 | ||
1093 | void OCiscoMonitoringInterface::setChannel( int ) | 1093 | void OCiscoMonitoringInterface::setChannel( int ) |
1094 | { | 1094 | { |
1095 | // cisco devices automatically switch channels when in monitor mode | 1095 | // cisco devices automatically switch channels when in monitor mode |
1096 | } | 1096 | } |
1097 | 1097 | ||
1098 | 1098 | ||
1099 | /*====================================================================================== | 1099 | /*====================================================================================== |
1100 | * OWlanNGMonitoringInterface | 1100 | * OWlanNGMonitoringInterface |
1101 | *======================================================================================*/ | 1101 | *======================================================================================*/ |
1102 | 1102 | ||
1103 | 1103 | ||
1104 | OWlanNGMonitoringInterface::OWlanNGMonitoringInterface( ONetworkInterface* iface, bool prismHeader ) | 1104 | OWlanNGMonitoringInterface::OWlanNGMonitoringInterface( ONetworkInterface* iface, bool prismHeader ) |
1105 | :OMonitoringInterface( iface, prismHeader ) | 1105 | :OMonitoringInterface( iface, prismHeader ) |
1106 | { | 1106 | { |
1107 | iface->setMonitoring( this ); | 1107 | iface->setMonitoring( this ); |
1108 | } | 1108 | } |
1109 | 1109 | ||
1110 | 1110 | ||
1111 | OWlanNGMonitoringInterface::~OWlanNGMonitoringInterface() | 1111 | OWlanNGMonitoringInterface::~OWlanNGMonitoringInterface() |
1112 | { | 1112 | { |
1113 | } | 1113 | } |
1114 | 1114 | ||
1115 | 1115 | ||
1116 | void OWlanNGMonitoringInterface::setEnabled( bool b ) | 1116 | void OWlanNGMonitoringInterface::setEnabled( bool b ) |
1117 | { | 1117 | { |
1118 | //FIXME: do nothing if its already in the same mode | 1118 | //FIXME: do nothing if its already in the same mode |
1119 | 1119 | ||
1120 | QString enable = b ? "true" : "false"; | 1120 | QString enable = b ? "true" : "false"; |
1121 | QString prism = _prismHeader ? "true" : "false"; | 1121 | QString prism = _prismHeader ? "true" : "false"; |
1122 | QString cmd; | 1122 | QString cmd; |
1123 | cmd.sprintf( "$(which wlanctl-ng) %s lnxreq_wlansniff channel=%d enable=%s prismheader=%s", | 1123 | cmd.sprintf( "$(which wlanctl-ng) %s lnxreq_wlansniff channel=%d enable=%s prismheader=%s", |
1124 | (const char*) _if->name(), 1, (const char*) enable, (const char*) prism ); | 1124 | (const char*) _if->name(), 1, (const char*) enable, (const char*) prism ); |
1125 | system( cmd ); | 1125 | system( cmd ); |
1126 | } | 1126 | } |
1127 | 1127 | ||
1128 | 1128 | ||
1129 | QString OWlanNGMonitoringInterface::name() const | 1129 | QString OWlanNGMonitoringInterface::name() const |
1130 | { | 1130 | { |
1131 | return "wlan-ng"; | 1131 | return "wlan-ng"; |
1132 | } | 1132 | } |
1133 | 1133 | ||
1134 | 1134 | ||
1135 | void OWlanNGMonitoringInterface::setChannel( int c ) | 1135 | void OWlanNGMonitoringInterface::setChannel( int c ) |
1136 | { | 1136 | { |
1137 | //NOTE: Older wlan-ng drivers automatically hopped channels while lnxreq_wlansniff=true. Newer ones don't. | 1137 | //NOTE: Older wlan-ng drivers automatically hopped channels while lnxreq_wlansniff=true. Newer ones don't. |
1138 | 1138 | ||
1139 | QString enable = "true"; //_if->monitorMode() ? "true" : "false"; | 1139 | QString enable = "true"; //_if->monitorMode() ? "true" : "false"; |
1140 | QString prism = _prismHeader ? "true" : "false"; | 1140 | QString prism = _prismHeader ? "true" : "false"; |
1141 | QString cmd; | 1141 | QString cmd; |
1142 | cmd.sprintf( "$(which wlanctl-ng) %s lnxreq_wlansniff channel=%d enable=%s prismheader=%s", | 1142 | cmd.sprintf( "$(which wlanctl-ng) %s lnxreq_wlansniff channel=%d enable=%s prismheader=%s", |
1143 | (const char*) _if->name(), c, (const char*) enable, (const char*) prism ); | 1143 | (const char*) _if->name(), c, (const char*) enable, (const char*) prism ); |
1144 | system( cmd ); | 1144 | system( cmd ); |
1145 | } | 1145 | } |
1146 | 1146 | ||
1147 | 1147 | ||
1148 | /*====================================================================================== | 1148 | /*====================================================================================== |
1149 | * OHostAPMonitoringInterface | 1149 | * OHostAPMonitoringInterface |
1150 | *======================================================================================*/ | 1150 | *======================================================================================*/ |
1151 | 1151 | ||
1152 | OHostAPMonitoringInterface::OHostAPMonitoringInterface( ONetworkInterface* iface, bool prismHeader ) | 1152 | OHostAPMonitoringInterface::OHostAPMonitoringInterface( ONetworkInterface* iface, bool prismHeader ) |
1153 | :OMonitoringInterface( iface, prismHeader ) | 1153 | :OMonitoringInterface( iface, prismHeader ) |
1154 | { | 1154 | { |
1155 | iface->setMonitoring( this ); | 1155 | iface->setMonitoring( this ); |
1156 | } | 1156 | } |
1157 | 1157 | ||
1158 | OHostAPMonitoringInterface::~OHostAPMonitoringInterface() | 1158 | OHostAPMonitoringInterface::~OHostAPMonitoringInterface() |
1159 | { | 1159 | { |
1160 | } | 1160 | } |
1161 | 1161 | ||
1162 | void OHostAPMonitoringInterface::setEnabled( bool b ) | 1162 | void OHostAPMonitoringInterface::setEnabled( bool b ) |
1163 | { | 1163 | { |
1164 | int monitorCode = _prismHeader ? 1 : 2; | 1164 | int monitorCode = _prismHeader ? 1 : 2; |
1165 | if ( b ) | 1165 | if ( b ) |
1166 | { | 1166 | { |
1167 | _if->setPrivate( "monitor", 1, monitorCode ); | 1167 | _if->setPrivate( "monitor", 1, monitorCode ); |
1168 | } | 1168 | } |
1169 | else | 1169 | else |
1170 | { | 1170 | { |
1171 | _if->setPrivate( "monitor", 1, 0 ); | 1171 | _if->setPrivate( "monitor", 1, 0 ); |
1172 | } | 1172 | } |
1173 | } | 1173 | } |
1174 | 1174 | ||
1175 | 1175 | ||
1176 | QString OHostAPMonitoringInterface::name() const | 1176 | QString OHostAPMonitoringInterface::name() const |
1177 | { | 1177 | { |
1178 | return "hostap"; | 1178 | return "hostap"; |
1179 | } | 1179 | } |
1180 | 1180 | ||
1181 | 1181 | ||
1182 | /*====================================================================================== | 1182 | /*====================================================================================== |
1183 | * OOrinocoNetworkInterface | 1183 | * OOrinocoNetworkInterface |
1184 | *======================================================================================*/ | 1184 | *======================================================================================*/ |
1185 | 1185 | ||
1186 | OOrinocoMonitoringInterface::OOrinocoMonitoringInterface( ONetworkInterface* iface, bool prismHeader ) | 1186 | OOrinocoMonitoringInterface::OOrinocoMonitoringInterface( ONetworkInterface* iface, bool prismHeader ) |
1187 | :OMonitoringInterface( iface, prismHeader ) | 1187 | :OMonitoringInterface( iface, prismHeader ) |
1188 | { | 1188 | { |
1189 | iface->setMonitoring( this ); | 1189 | iface->setMonitoring( this ); |
1190 | } | 1190 | } |
1191 | 1191 | ||
1192 | 1192 | ||
1193 | OOrinocoMonitoringInterface::~OOrinocoMonitoringInterface() | 1193 | OOrinocoMonitoringInterface::~OOrinocoMonitoringInterface() |
1194 | { | 1194 | { |
1195 | } | 1195 | } |
1196 | 1196 | ||
1197 | 1197 | ||
1198 | void OOrinocoMonitoringInterface::setChannel( int c ) | 1198 | void OOrinocoMonitoringInterface::setChannel( int c ) |
1199 | { | 1199 | { |
1200 | int monitorCode = _prismHeader ? 1 : 2; | 1200 | if ( !_if->hasPrivate( "monitor" ) ) |
1201 | _if->setPrivate( "monitor", 2, monitorCode, c ); | 1201 | { |
1202 | this->OMonitoringInterface::setChannel( c ); | ||
1203 | } | ||
1204 | else | ||
1205 | { | ||
1206 | int monitorCode = _prismHeader ? 1 : 2; | ||
1207 | _if->setPrivate( "monitor", 2, monitorCode, c ); | ||
1208 | } | ||
1202 | } | 1209 | } |
1203 | 1210 | ||
1204 | 1211 | ||
1205 | void OOrinocoMonitoringInterface::setEnabled( bool b ) | 1212 | void OOrinocoMonitoringInterface::setEnabled( bool b ) |
1206 | { | 1213 | { |
1207 | // IW_MODE_MONITOR was introduced in Wireless Extensions Version 15 | ||
1208 | // Wireless Extensions < Version 15 need iwpriv commandos for monitoring | ||
1209 | // However, as of recent orinoco drivers, IW_MODE_MONITOR is still not supported | ||
1210 | |||
1211 | if ( b ) | 1214 | if ( b ) |
1212 | { | 1215 | { |
1213 | setChannel( 1 ); | 1216 | setChannel( 1 ); |
1214 | } | 1217 | } |
1215 | else | 1218 | else |
1216 | { | 1219 | { |
1217 | _if->setPrivate( "monitor", 2, 0, 0 ); | 1220 | _if->setPrivate( "monitor", 2, 0, 0 ); |
1218 | } | 1221 | } |
1219 | } | 1222 | } |
1220 | 1223 | ||
1221 | 1224 | ||
1222 | QString OOrinocoMonitoringInterface::name() const | 1225 | QString OOrinocoMonitoringInterface::name() const |
1223 | { | 1226 | { |
1224 | return "orinoco"; | 1227 | return "orinoco"; |
1225 | } | 1228 | } |