summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opienet/onetwork.cpp41
1 files changed, 29 insertions, 12 deletions
diff --git a/libopie2/opienet/onetwork.cpp b/libopie2/opienet/onetwork.cpp
index 21fa390..cd36f16 100644
--- a/libopie2/opienet/onetwork.cpp
+++ b/libopie2/opienet/onetwork.cpp
@@ -252,262 +252,264 @@ OMonitoringInterface* ONetworkInterface::monitoring() const
252 252
253const QString& ONetworkInterface::name() const 253const QString& ONetworkInterface::name() const
254{ 254{
255 return _name; 255 return _name;
256} 256}
257 257
258 258
259ONetworkInterface::~ONetworkInterface() 259ONetworkInterface::~ONetworkInterface()
260{ 260{
261 qDebug( "ONetworkInterface::~ONetworkInterface()" ); 261 qDebug( "ONetworkInterface::~ONetworkInterface()" );
262 if ( _sfd != -1 ) ::close( _sfd ); 262 if ( _sfd != -1 ) ::close( _sfd );
263} 263}
264 264
265 265
266bool ONetworkInterface::setPromiscuousMode( bool b ) 266bool ONetworkInterface::setPromiscuousMode( bool b )
267{ 267{
268 ioctl( SIOCGIFFLAGS ); 268 ioctl( SIOCGIFFLAGS );
269 if ( b ) _ifr.ifr_flags |= IFF_PROMISC; 269 if ( b ) _ifr.ifr_flags |= IFF_PROMISC;
270 else _ifr.ifr_flags &= (~IFF_PROMISC); 270 else _ifr.ifr_flags &= (~IFF_PROMISC);
271 return ioctl( SIOCSIFFLAGS ); 271 return ioctl( SIOCSIFFLAGS );
272} 272}
273 273
274 274
275bool ONetworkInterface::promiscuousMode() const 275bool ONetworkInterface::promiscuousMode() const
276{ 276{
277 ioctl( SIOCGIFFLAGS ); 277 ioctl( SIOCGIFFLAGS );
278 return _ifr.ifr_flags & IFF_PROMISC; 278 return _ifr.ifr_flags & IFF_PROMISC;
279} 279}
280 280
281 281
282bool ONetworkInterface::isWireless() const 282bool ONetworkInterface::isWireless() const
283{ 283{
284 return ioctl( SIOCGIWNAME ); 284 return ioctl( SIOCGIWNAME );
285} 285}
286 286
287 287
288/*====================================================================================== 288/*======================================================================================
289 * OChannelHopper 289 * OChannelHopper
290 *======================================================================================*/ 290 *======================================================================================*/
291 291
292OChannelHopper::OChannelHopper( OWirelessNetworkInterface* iface ) 292OChannelHopper::OChannelHopper( OWirelessNetworkInterface* iface )
293 :QObject( 0, "Mickey's funky hopper" ), 293 :QObject( 0, "Mickey's funky hopper" ),
294 _iface( iface ), _interval( 0 ), _channel( 1 ), _tid( 0 ), 294 _iface( iface ), _interval( 0 ), _channel( 1 ), _tid( 0 ),
295 _maxChannel( iface->channels()+1 ) 295 _maxChannel( iface->channels()+1 )
296{ 296{
297} 297}
298 298
299 299
300OChannelHopper::~OChannelHopper() 300OChannelHopper::~OChannelHopper()
301{ 301{
302} 302}
303 303
304 304
305bool OChannelHopper::isActive() const 305bool OChannelHopper::isActive() const
306{ 306{
307 return _tid; 307 return _tid;
308} 308}
309 309
310 310
311int OChannelHopper::channel() const 311int OChannelHopper::channel() const
312{ 312{
313 return _channel; 313 return _channel;
314} 314}
315 315
316 316
317void OChannelHopper::timerEvent( QTimerEvent* ) 317void OChannelHopper::timerEvent( QTimerEvent* )
318{ 318{
319 if ( !--_channel ) _channel = _maxChannel; 319 if ( !--_channel ) _channel = _maxChannel;
320 _iface->setChannel( _channel ); 320 _iface->setChannel( _channel );
321 qDebug( "OChannelHopper::timerEvent(): set channel %d on interface '%s'", 321 qDebug( "OChannelHopper::timerEvent(): set channel %d on interface '%s'",
322 _channel, (const char*) _iface->name() ); 322 _channel, (const char*) _iface->name() );
323} 323}
324 324
325 325
326void OChannelHopper::setInterval( int interval ) 326void OChannelHopper::setInterval( int interval )
327{ 327{
328 if ( interval == _interval ) 328 if ( interval == _interval )
329 return; 329 return;
330 330
331 if ( _interval ) 331 if ( _interval )
332 killTimer( _tid ); 332 killTimer( _tid );
333 333
334 _tid = 0; 334 _tid = 0;
335 _interval = interval; 335 _interval = interval;
336 336
337 if ( _interval ) 337 if ( _interval )
338 { 338 {
339 _tid = startTimer( interval ); 339 _tid = startTimer( interval );
340 } 340 }
341} 341}
342 342
343 343
344int OChannelHopper::interval() const 344int OChannelHopper::interval() const
345{ 345{
346 return _interval; 346 return _interval;
347} 347}
348 348
349 349
350/*====================================================================================== 350/*======================================================================================
351 * OWirelessNetworkInterface 351 * OWirelessNetworkInterface
352 *======================================================================================*/ 352 *======================================================================================*/
353 353
354OWirelessNetworkInterface::OWirelessNetworkInterface( const QString& name ) 354OWirelessNetworkInterface::OWirelessNetworkInterface( const QString& name )
355 :ONetworkInterface( name ), _hopper( 0 ) 355 :ONetworkInterface( name ), _hopper( 0 )
356{ 356{
357 qDebug( "OWirelessNetworkInterface::OWirelessNetworkInterface()" ); 357 qDebug( "OWirelessNetworkInterface::OWirelessNetworkInterface()" );
358 init(); 358 init();
359} 359}
360 360
361 361
362OWirelessNetworkInterface::~OWirelessNetworkInterface() 362OWirelessNetworkInterface::~OWirelessNetworkInterface()
363{ 363{
364} 364}
365 365
366 366
367iwreqstruct& OWirelessNetworkInterface::iwr() const 367iwreqstruct& OWirelessNetworkInterface::iwr() const
368{ 368{
369 return _iwr; 369 return _iwr;
370} 370}
371 371
372 372
373void OWirelessNetworkInterface::init() 373void OWirelessNetworkInterface::init()
374{ 374{
375 qDebug( "OWirelessNetworkInterface::init()" ); 375 qDebug( "OWirelessNetworkInterface::init()" );
376 376
377 memset( &_iwr, 0, sizeof( struct iwreq ) ); 377 memset( &_iwr, 0, sizeof( struct iwreq ) );
378 378
379 // IEEE802.11(b) radio frequency channels 379 // IEEE802.11(b) radio frequency channels
380 //FIXME: get these directly from the interface
381 //FIXME: check if these channels are off-by-one
382 380
383 iwrangestruct range; 381 iwrangestruct range;
382 //ML: work around an ugly HostAP bug, which needs
383 //ML: extra space or will complain with "invalid argument length"... :-(
384 char __extraBufferForBuggyDrivers[sizeof range];
384 _iwr.u.data.pointer = (char*) ⦥ 385 _iwr.u.data.pointer = (char*) ⦥
385 _iwr.u.data.length = sizeof( iwrangestruct ); 386 _iwr.u.data.length = (sizeof range) * 2;
387 _iwr.u.data.flags = 0;
386 if ( !wioctl( SIOCGIWRANGE ) ) 388 if ( !wioctl( SIOCGIWRANGE ) )
387 { 389 {
388 qDebug( "OWirelessNetworkInterface::init(): SIOCGIWRANGE failed (%s)", strerror( errno ) ); 390 qDebug( "OWirelessNetworkInterface::init(): SIOCGIWRANGE failed (%s)", strerror( errno ) );
389 return; 391 return;
390 } 392 }
391 393
392 for ( int i = 0; i < range.num_frequency; ++i ) 394 for ( int i = 0; i < range.num_frequency; ++i )
393 { 395 {
394 int freq = (int) ( double( range.freq[i].m ) * pow( 10, range.freq[i].e ) / 1000000.0 ); 396 int freq = (int) ( double( range.freq[i].m ) * pow( 10, range.freq[i].e ) / 1000000.0 );
395 _channels.insert( freq, i+1 ); 397 _channels.insert( freq, i+1 );
396 } 398 }
397} 399}
398 400
399 401
400QString OWirelessNetworkInterface::associatedAP() const 402QString OWirelessNetworkInterface::associatedAP() const
401{ 403{
402 //FIXME: use OMacAddress 404 //FIXME: use OMacAddress
403 QString mac; 405 QString mac;
404 406
405 if ( ioctl( SIOCGIWAP ) ) 407 if ( ioctl( SIOCGIWAP ) )
406 { 408 {
407 mac.sprintf( "%.2X:%.2X:%.2X:%.2X:%.2X:%.2X", 409 mac.sprintf( "%.2X:%.2X:%.2X:%.2X:%.2X:%.2X",
408 _ifr.ifr_hwaddr.sa_data[0]&0xff, 410 _ifr.ifr_hwaddr.sa_data[0]&0xff,
409 _ifr.ifr_hwaddr.sa_data[1]&0xff, 411 _ifr.ifr_hwaddr.sa_data[1]&0xff,
410 _ifr.ifr_hwaddr.sa_data[2]&0xff, 412 _ifr.ifr_hwaddr.sa_data[2]&0xff,
411 _ifr.ifr_hwaddr.sa_data[3]&0xff, 413 _ifr.ifr_hwaddr.sa_data[3]&0xff,
412 _ifr.ifr_hwaddr.sa_data[4]&0xff, 414 _ifr.ifr_hwaddr.sa_data[4]&0xff,
413 _ifr.ifr_hwaddr.sa_data[5]&0xff ); 415 _ifr.ifr_hwaddr.sa_data[5]&0xff );
414 } 416 }
415 else 417 else
416 { 418 {
417 mac = "<Unknown>"; 419 mac = "<Unknown>";
418 } 420 }
419 return mac; 421 return mac;
420} 422}
421 423
422 424
423int OWirelessNetworkInterface::channel() const 425int OWirelessNetworkInterface::channel() const
424{ 426{
425 //FIXME: When monitoring enabled, then use it 427 //FIXME: When monitoring enabled, then use it
426 //FIXME: to gather the current RF channel 428 //FIXME: to gather the current RF channel
427 //FIXME: Until then, get active channel from hopper. 429 //FIXME: Until then, get active channel from hopper.
428 if ( _hopper && _hopper->isActive() ) 430 if ( _hopper && _hopper->isActive() )
429 return _hopper->channel(); 431 return _hopper->channel();
430 432
431 if ( !wioctl( SIOCGIWFREQ ) ) 433 if ( !wioctl( SIOCGIWFREQ ) )
432 { 434 {
433 return -1; 435 return -1;
434 } 436 }
435 else 437 else
436 { 438 {
437 return _channels[ static_cast<int>(double( _iwr.u.freq.m ) * pow( 10, _iwr.u.freq.e ) / 1000000) ]; 439 return _channels[ static_cast<int>(double( _iwr.u.freq.m ) * pow( 10, _iwr.u.freq.e ) / 1000000) ];
438 } 440 }
439} 441}
440 442
441 443
442void OWirelessNetworkInterface::setChannel( int c ) const 444void OWirelessNetworkInterface::setChannel( int c ) const
443{ 445{
444 if ( !_mon ) 446 if ( !_mon )
445 { 447 {
446 memset( &_iwr, 0, sizeof( iwreqstruct ) ); 448 memset( &_iwr, 0, sizeof( iwreqstruct ) );
447 _iwr.u.freq.m = c; 449 _iwr.u.freq.m = c;
448 _iwr.u.freq.e = 0; 450 _iwr.u.freq.e = 0;
449 wioctl( SIOCSIWFREQ ); 451 wioctl( SIOCSIWFREQ );
450 } 452 }
451 else 453 else
452 { 454 {
453 _mon->setChannel( c ); 455 _mon->setChannel( c );
454 } 456 }
455} 457}
456 458
457 459
458double OWirelessNetworkInterface::frequency() const 460double OWirelessNetworkInterface::frequency() const
459{ 461{
460 if ( !wioctl( SIOCGIWFREQ ) ) 462 if ( !wioctl( SIOCGIWFREQ ) )
461 { 463 {
462 return -1.0; 464 return -1.0;
463 } 465 }
464 else 466 else
465 { 467 {
466 return double( _iwr.u.freq.m ) * pow( 10, _iwr.u.freq.e ) / 1000000000.0; 468 return double( _iwr.u.freq.m ) * pow( 10, _iwr.u.freq.e ) / 1000000000.0;
467 } 469 }
468} 470}
469 471
470 472
471int OWirelessNetworkInterface::channels() const 473int OWirelessNetworkInterface::channels() const
472{ 474{
473 return _channels.count(); 475 return _channels.count();
474} 476}
475 477
476 478
477void OWirelessNetworkInterface::setChannelHopping( int interval ) 479void OWirelessNetworkInterface::setChannelHopping( int interval )
478{ 480{
479 if ( !_hopper ) _hopper = new OChannelHopper( this ); 481 if ( !_hopper ) _hopper = new OChannelHopper( this );
480 _hopper->setInterval( interval ); 482 _hopper->setInterval( interval );
481 //FIXME: When and by whom will the channel hopper be deleted? 483 //FIXME: When and by whom will the channel hopper be deleted?
482} 484}
483 485
484 486
485int OWirelessNetworkInterface::channelHopping() const 487int OWirelessNetworkInterface::channelHopping() const
486{ 488{
487 return _hopper->interval(); 489 return _hopper->interval();
488} 490}
489 491
490 492
491void OWirelessNetworkInterface::setMonitorMode( bool b ) 493void OWirelessNetworkInterface::setMonitorMode( bool b )
492{ 494{
493 if ( _mon ) 495 if ( _mon )
494 _mon->setEnabled( b ); 496 _mon->setEnabled( b );
495 else 497 else
496 qDebug( "ONetwork(): can't switch monitor mode without installed monitoring interface" ); 498 qDebug( "ONetwork(): can't switch monitor mode without installed monitoring interface" );
497} 499}
498 500
499 501
500bool OWirelessNetworkInterface::monitorMode() const 502bool OWirelessNetworkInterface::monitorMode() const
501{ 503{
502 return _mon ? _mon->enabled() : false; 504 return _mon ? _mon->enabled() : false;
503} 505}
504 506
505 507
506QString OWirelessNetworkInterface::nickName() const 508QString OWirelessNetworkInterface::nickName() const
507{ 509{
508 char str[IW_ESSID_MAX_SIZE]; 510 char str[IW_ESSID_MAX_SIZE];
509 _iwr.u.data.pointer = &str[0]; 511 _iwr.u.data.pointer = &str[0];
510 _iwr.u.data.length = IW_ESSID_MAX_SIZE; 512 _iwr.u.data.length = IW_ESSID_MAX_SIZE;
511 if ( !wioctl( SIOCGIWNICKN ) ) 513 if ( !wioctl( SIOCGIWNICKN ) )
512 { 514 {
513 return "<unknown>"; 515 return "<unknown>";
@@ -596,197 +598,212 @@ void OMonitoringInterface::setEnabled( bool b )
596{ 598{
597 // open a packet capturer here or leave this to 599 // open a packet capturer here or leave this to
598 // the client code? 600 // the client code?
599 601
600 /* 602 /*
601 603
602 if ( b ) 604 if ( b )
603 { 605 {
604 OPacketCapturer* opcap = new OPacketCapturer(); 606 OPacketCapturer* opcap = new OPacketCapturer();
605 opcap->open( _if->name() ); 607 opcap->open( _if->name() );
606 } 608 }
607 */ 609 */
608 610
609 _enabled = b; 611 _enabled = b;
610 612
611} 613}
612 614
613/*====================================================================================== 615/*======================================================================================
614 * OCiscoMonitoringInterface 616 * OCiscoMonitoringInterface
615 *======================================================================================*/ 617 *======================================================================================*/
616 618
617OCiscoMonitoringInterface::OCiscoMonitoringInterface( ONetworkInterface* iface ) 619OCiscoMonitoringInterface::OCiscoMonitoringInterface( ONetworkInterface* iface )
618 :OMonitoringInterface( iface ) 620 :OMonitoringInterface( iface )
619{ 621{
620 iface->setMonitoring( this ); 622 iface->setMonitoring( this );
621} 623}
622 624
623 625
624OCiscoMonitoringInterface::~OCiscoMonitoringInterface() 626OCiscoMonitoringInterface::~OCiscoMonitoringInterface()
625{ 627{
626} 628}
627 629
628 630
629void OCiscoMonitoringInterface::setEnabled( bool b ) 631void OCiscoMonitoringInterface::setEnabled( bool b )
630{ 632{
631 QString fname; 633 QString fname;
632 fname.sprintf( "/proc/driver/aironet/%s", (const char*) _if->name() ); 634 fname.sprintf( "/proc/driver/aironet/%s", (const char*) _if->name() );
633 QFile f( fname ); 635 QFile f( fname );
634 if ( !f.exists() ) return; 636 if ( !f.exists() ) return;
635 637
636 if ( f.open( IO_WriteOnly ) ) 638 if ( f.open( IO_WriteOnly ) )
637 { 639 {
638 QTextStream s( &f ); 640 QTextStream s( &f );
639 s << "Mode: r"; 641 s << "Mode: r";
640 s << "Mode: y"; 642 s << "Mode: y";
641 s << "XmitPower: 1"; 643 s << "XmitPower: 1";
642 644
643 OMonitoringInterface::setEnabled( b ); 645 OMonitoringInterface::setEnabled( b );
644 646
645 } 647 }
646 648
647 // flushing and closing will be done automatically when f goes out of scope 649 // flushing and closing will be done automatically when f goes out of scope
648} 650}
649 651
650 652
651QString OCiscoMonitoringInterface::name() const 653QString OCiscoMonitoringInterface::name() const
652{ 654{
653 return "cisco"; 655 return "cisco";
654} 656}
655 657
656 658
657void OCiscoMonitoringInterface::setChannel( int ) 659void OCiscoMonitoringInterface::setChannel( int )
658{ 660{
659 // cisco devices automatically switch channels when in monitor mode 661 // cisco devices automatically switch channels when in monitor mode
660} 662}
661 663
662 664
663/*====================================================================================== 665/*======================================================================================
664 * OWlanNGMonitoringInterface 666 * OWlanNGMonitoringInterface
665 *======================================================================================*/ 667 *======================================================================================*/
666 668
667 669
668OWlanNGMonitoringInterface::OWlanNGMonitoringInterface( ONetworkInterface* iface ) 670OWlanNGMonitoringInterface::OWlanNGMonitoringInterface( ONetworkInterface* iface )
669 :OMonitoringInterface( iface ) 671 :OMonitoringInterface( iface )
670{ 672{
671 iface->setMonitoring( this ); 673 iface->setMonitoring( this );
672} 674}
673 675
674 676
675OWlanNGMonitoringInterface::~OWlanNGMonitoringInterface() 677OWlanNGMonitoringInterface::~OWlanNGMonitoringInterface()
676{ 678{
677} 679}
678 680
679 681
680void OWlanNGMonitoringInterface::setEnabled( bool b ) 682void OWlanNGMonitoringInterface::setEnabled( bool b )
681{ 683{
682 //FIXME: do nothing if its already in the same mode 684 //FIXME: do nothing if its already in the same mode
683 685
684 QString enable = b ? "true" : "false"; 686 QString enable = b ? "true" : "false";
685 QString cmd; 687 QString cmd;
686 cmd.sprintf( "$(which wlanctl-ng) %s lnxreq_wlansniff channel=%d enable=%s", (const char*) _if->name(), 1, (const char*) enable ); 688 cmd.sprintf( "$(which wlanctl-ng) %s lnxreq_wlansniff channel=%d enable=%s", (const char*) _if->name(), 1, (const char*) enable );
687 system( cmd ); 689 system( cmd );
688 690
689 OMonitoringInterface::setEnabled( b ); 691 OMonitoringInterface::setEnabled( b );
690} 692}
691 693
692 694
693QString OWlanNGMonitoringInterface::name() const 695QString OWlanNGMonitoringInterface::name() const
694{ 696{
695 return "wlan-ng"; 697 return "wlan-ng";
696} 698}
697 699
698 700
699void OWlanNGMonitoringInterface::setChannel( int ) 701void OWlanNGMonitoringInterface::setChannel( int )
700{ 702{
701 // wlan-ng devices automatically switch channels when in monitor mode 703 // wlan-ng devices automatically switch channels when in monitor mode
702} 704}
703 705
704 706
705/*====================================================================================== 707/*======================================================================================
706 * OHostAPMonitoringInterface 708 * OHostAPMonitoringInterface
707 *======================================================================================*/ 709 *======================================================================================*/
708 710
709OHostAPMonitoringInterface::OHostAPMonitoringInterface( ONetworkInterface* iface ) 711OHostAPMonitoringInterface::OHostAPMonitoringInterface( ONetworkInterface* iface )
710 :OMonitoringInterface( iface ) 712 :OMonitoringInterface( iface )
711{ 713{
712 iface->setMonitoring( this ); 714 iface->setMonitoring( this );
713} 715}
714 716
715OHostAPMonitoringInterface::~OHostAPMonitoringInterface() 717OHostAPMonitoringInterface::~OHostAPMonitoringInterface()
716{ 718{
717} 719}
718 720
719void OHostAPMonitoringInterface::setEnabled( bool b ) 721void OHostAPMonitoringInterface::setEnabled( bool b )
720{ 722{
721 // IW_MODE_MONITOR was introduced in Wireless Extensions Version 15 723 // IW_MODE_MONITOR was introduced in Wireless Extensions Version 15
722 // Wireless Extensions < Version 15 need iwpriv commandos for monitoring 724 // Wireless Extensions < Version 15 need iwpriv commandos for monitoring
723 725
724 #if WIRELESS_EXT > 14 726 if ( b )
725 _if->_iwr.u.mode = IW_MODE_MONITOR; 727 {
726 _if->wioctl( SIOCSIWMODE ); 728 #if WIRELESS_EXT > 14
727 #else 729 _if->_iwr.u.mode = IW_MODE_MONITOR;
728 int* args = (int*) &_if->_iwr.u.name; 730 _if->wioctl( SIOCSIWMODE );
729 args[0] = 2; 731 #else
730 args[1] = 0; 732 int* args = (int*) &_if->_iwr.u.name;
731 _if->wioctl( SIOCDEVPRIVATE ); 733 args[0] = 2;
732 #endif 734 args[1] = 0;
735 _if->wioctl( SIOCDEVPRIVATE );
736 #endif
737 }
738 else
739 {
740 #if WIRELESS_EXT > 14
741 _if->_iwr.u.mode = IW_MODE_INFRA;
742 _if->wioctl( SIOCSIWMODE );
743 #else
744 int* args = (int*) &_if->_iwr.u.name;
745 args[0] = 0;
746 args[1] = 0;
747 _if->wioctl( SIOCDEVPRIVATE );
748 #endif
749 }
733 750
734 OMonitoringInterface::setEnabled( b ); 751 OMonitoringInterface::setEnabled( b );
735} 752}
736 753
737 754
738QString OHostAPMonitoringInterface::name() const 755QString OHostAPMonitoringInterface::name() const
739{ 756{
740 return "hostap"; 757 return "hostap";
741} 758}
742 759
743 760
744/*====================================================================================== 761/*======================================================================================
745 * OOrinocoNetworkInterface 762 * OOrinocoNetworkInterface
746 *======================================================================================*/ 763 *======================================================================================*/
747 764
748OOrinocoMonitoringInterface::OOrinocoMonitoringInterface( ONetworkInterface* iface ) 765OOrinocoMonitoringInterface::OOrinocoMonitoringInterface( ONetworkInterface* iface )
749 :OMonitoringInterface( iface ) 766 :OMonitoringInterface( iface )
750{ 767{
751 iface->setMonitoring( this ); 768 iface->setMonitoring( this );
752} 769}
753 770
754 771
755OOrinocoMonitoringInterface::~OOrinocoMonitoringInterface() 772OOrinocoMonitoringInterface::~OOrinocoMonitoringInterface()
756{ 773{
757} 774}
758 775
759 776
760void OOrinocoMonitoringInterface::setChannel( int c ) 777void OOrinocoMonitoringInterface::setChannel( int c )
761{ 778{
762 // call iwpriv <device> monitor 2 <channel> 779 // call iwpriv <device> monitor 2 <channel>
763 int* args = (int*) &_if->_iwr.u.name; 780 int* args = (int*) &_if->_iwr.u.name;
764 args[0] = 2; 781 args[0] = 2;
765 args[1] = c; 782 args[1] = c;
766 _if->wioctl( SIOCIWFIRSTPRIV + 0x8 ); 783 _if->wioctl( SIOCIWFIRSTPRIV + 0x8 );
767} 784}
768 785
769 786
770void OOrinocoMonitoringInterface::setEnabled( bool b ) 787void OOrinocoMonitoringInterface::setEnabled( bool b )
771{ 788{
772 if ( b ) 789 if ( b )
773 { 790 {
774 setChannel( 1 ); 791 setChannel( 1 );
775 } 792 }
776 else 793 else
777 { 794 {
778 // call iwpriv <device> monitor 0 0 795 // call iwpriv <device> monitor 0 0
779 int* args = (int*) &_if->_iwr.u.name; 796 int* args = (int*) &_if->_iwr.u.name;
780 args[0] = 0; 797 args[0] = 0;
781 args[1] = 0; 798 args[1] = 0;
782 _if->wioctl( SIOCIWFIRSTPRIV + 0x8 ); 799 _if->wioctl( SIOCIWFIRSTPRIV + 0x8 );
783 } 800 }
784 801
785 OMonitoringInterface::setEnabled( b ); 802 OMonitoringInterface::setEnabled( b );
786} 803}
787 804
788 805
789QString OOrinocoMonitoringInterface::name() const 806QString OOrinocoMonitoringInterface::name() const
790{ 807{
791 return "orinoco"; 808 return "orinoco";
792} 809}