author | mickeyl <mickeyl> | 2003-05-05 14:57:27 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-05-05 14:57:27 (UTC) |
commit | 29f5c6e6bcb8db0f0e26da25dbf34b2685c01526 (patch) (unidiff) | |
tree | a05e296ff11d532fd3d5fd092aade07474d1ba95 /libopie2 | |
parent | a5818261bec2d0a6d903fef9baeed1a7abc85275 (diff) | |
download | opie-29f5c6e6bcb8db0f0e26da25dbf34b2685c01526.zip opie-29f5c6e6bcb8db0f0e26da25dbf34b2685c01526.tar.gz opie-29f5c6e6bcb8db0f0e26da25dbf34b2685c01526.tar.bz2 |
- fix segfault on unknown linktype (thanks groucho)
- make capturing using PRISM headers optional
-rw-r--r-- | libopie2/opienet/onetwork.cpp | 31 | ||||
-rw-r--r-- | libopie2/opienet/onetwork.h | 11 | ||||
-rw-r--r-- | libopie2/opienet/opcap.cpp | 2 |
3 files changed, 25 insertions, 19 deletions
diff --git a/libopie2/opienet/onetwork.cpp b/libopie2/opienet/onetwork.cpp index 2dfff1d..6cef5cf 100644 --- a/libopie2/opienet/onetwork.cpp +++ b/libopie2/opienet/onetwork.cpp | |||
@@ -808,10 +808,10 @@ bool OWirelessNetworkInterface::wioctl( int call ) const | |||
808 | /*====================================================================================== | 808 | /*====================================================================================== |
809 | * OMonitoringInterface | 809 | * OMonitoringInterface |
810 | *======================================================================================*/ | 810 | *======================================================================================*/ |
811 | 811 | ||
812 | OMonitoringInterface::OMonitoringInterface( ONetworkInterface* iface ) | 812 | OMonitoringInterface::OMonitoringInterface( ONetworkInterface* iface, bool prismHeader ) |
813 | :_if( static_cast<OWirelessNetworkInterface*>( iface ) ) | 813 | :_if( static_cast<OWirelessNetworkInterface*>( iface ) ), _prismHeader( prismHeader ) |
814 | { | 814 | { |
815 | } | 815 | } |
816 | 816 | ||
817 | 817 | ||
@@ -844,10 +844,10 @@ void OMonitoringInterface::setEnabled( bool b ) | |||
844 | /*====================================================================================== | 844 | /*====================================================================================== |
845 | * OCiscoMonitoringInterface | 845 | * OCiscoMonitoringInterface |
846 | *======================================================================================*/ | 846 | *======================================================================================*/ |
847 | 847 | ||
848 | OCiscoMonitoringInterface::OCiscoMonitoringInterface( ONetworkInterface* iface ) | 848 | OCiscoMonitoringInterface::OCiscoMonitoringInterface( ONetworkInterface* iface, bool prismHeader ) |
849 | :OMonitoringInterface( iface ) | 849 | :OMonitoringInterface( iface, prismHeader ) |
850 | { | 850 | { |
851 | iface->setMonitoring( this ); | 851 | iface->setMonitoring( this ); |
852 | } | 852 | } |
853 | 853 | ||
@@ -892,10 +892,10 @@ void OCiscoMonitoringInterface::setChannel( int ) | |||
892 | * OWlanNGMonitoringInterface | 892 | * OWlanNGMonitoringInterface |
893 | *======================================================================================*/ | 893 | *======================================================================================*/ |
894 | 894 | ||
895 | 895 | ||
896 | OWlanNGMonitoringInterface::OWlanNGMonitoringInterface( ONetworkInterface* iface ) | 896 | OWlanNGMonitoringInterface::OWlanNGMonitoringInterface( ONetworkInterface* iface, bool prismHeader ) |
897 | :OMonitoringInterface( iface ) | 897 | :OMonitoringInterface( iface, prismHeader ) |
898 | { | 898 | { |
899 | iface->setMonitoring( this ); | 899 | iface->setMonitoring( this ); |
900 | } | 900 | } |
901 | 901 | ||
@@ -909,10 +909,12 @@ void OWlanNGMonitoringInterface::setEnabled( bool b ) | |||
909 | { | 909 | { |
910 | //FIXME: do nothing if its already in the same mode | 910 | //FIXME: do nothing if its already in the same mode |
911 | 911 | ||
912 | QString enable = b ? "true" : "false"; | 912 | QString enable = b ? "true" : "false"; |
913 | QString prism = _prismHeader ? "true" : "false"; | ||
913 | QString cmd; | 914 | QString cmd; |
914 | cmd.sprintf( "$(which wlanctl-ng) %s lnxreq_wlansniff channel=%d enable=%s", (const char*) _if->name(), 1, (const char*) enable ); | 915 | cmd.sprintf( "$(which wlanctl-ng) %s lnxreq_wlansniff channel=%d enable=%s prismheader=%s", |
916 | (const char*) _if->name(), 1, (const char*) enable, (const char*) prism ); | ||
915 | system( cmd ); | 917 | system( cmd ); |
916 | } | 918 | } |
917 | 919 | ||
918 | 920 | ||
@@ -931,10 +933,10 @@ void OWlanNGMonitoringInterface::setChannel( int ) | |||
931 | /*====================================================================================== | 933 | /*====================================================================================== |
932 | * OHostAPMonitoringInterface | 934 | * OHostAPMonitoringInterface |
933 | *======================================================================================*/ | 935 | *======================================================================================*/ |
934 | 936 | ||
935 | OHostAPMonitoringInterface::OHostAPMonitoringInterface( ONetworkInterface* iface ) | 937 | OHostAPMonitoringInterface::OHostAPMonitoringInterface( ONetworkInterface* iface, bool prismHeader ) |
936 | :OMonitoringInterface( iface ) | 938 | :OMonitoringInterface( iface, prismHeader ) |
937 | { | 939 | { |
938 | iface->setMonitoring( this ); | 940 | iface->setMonitoring( this ); |
939 | } | 941 | } |
940 | 942 | ||
@@ -949,11 +951,13 @@ void OHostAPMonitoringInterface::setEnabled( bool b ) | |||
949 | 951 | ||
950 | //TODO: check wireless extensions version on runtime and use | 952 | //TODO: check wireless extensions version on runtime and use |
951 | //TODO: SIOCSIWMODE( IW_MODE_MONITOR ) if running on WE >= 15 | 953 | //TODO: SIOCSIWMODE( IW_MODE_MONITOR ) if running on WE >= 15 |
952 | 954 | ||
955 | int monitorCode = _prismHeader ? 1 : 2; | ||
956 | |||
953 | if ( b ) | 957 | if ( b ) |
954 | { | 958 | { |
955 | _if->setPrivate( "monitor", 1, 2 ); | 959 | _if->setPrivate( "monitor", 1, monitorCode ); |
956 | } | 960 | } |
957 | else | 961 | else |
958 | { | 962 | { |
959 | _if->setPrivate( "monitor", 1, 0 ); | 963 | _if->setPrivate( "monitor", 1, 0 ); |
@@ -970,10 +974,10 @@ QString OHostAPMonitoringInterface::name() const | |||
970 | /*====================================================================================== | 974 | /*====================================================================================== |
971 | * OOrinocoNetworkInterface | 975 | * OOrinocoNetworkInterface |
972 | *======================================================================================*/ | 976 | *======================================================================================*/ |
973 | 977 | ||
974 | OOrinocoMonitoringInterface::OOrinocoMonitoringInterface( ONetworkInterface* iface ) | 978 | OOrinocoMonitoringInterface::OOrinocoMonitoringInterface( ONetworkInterface* iface, bool prismHeader ) |
975 | :OMonitoringInterface( iface ) | 979 | :OMonitoringInterface( iface, prismHeader ) |
976 | { | 980 | { |
977 | iface->setMonitoring( this ); | 981 | iface->setMonitoring( this ); |
978 | } | 982 | } |
979 | 983 | ||
@@ -984,9 +988,10 @@ OOrinocoMonitoringInterface::~OOrinocoMonitoringInterface() | |||
984 | 988 | ||
985 | 989 | ||
986 | void OOrinocoMonitoringInterface::setChannel( int c ) | 990 | void OOrinocoMonitoringInterface::setChannel( int c ) |
987 | { | 991 | { |
988 | _if->setPrivate( "monitor", 2, 1, c ); | 992 | int monitorCode = _prismHeader ? 1 : 2; |
993 | _if->setPrivate( "monitor", 2, monitorCode, c ); | ||
989 | } | 994 | } |
990 | 995 | ||
991 | 996 | ||
992 | void OOrinocoMonitoringInterface::setEnabled( bool b ) | 997 | void OOrinocoMonitoringInterface::setEnabled( bool b ) |
diff --git a/libopie2/opienet/onetwork.h b/libopie2/opienet/onetwork.h index 1b38d02..eb9d506 100644 --- a/libopie2/opienet/onetwork.h +++ b/libopie2/opienet/onetwork.h | |||
@@ -451,9 +451,9 @@ class OWirelessNetworkInterface : public ONetworkInterface | |||
451 | class OMonitoringInterface | 451 | class OMonitoringInterface |
452 | { | 452 | { |
453 | public: | 453 | public: |
454 | OMonitoringInterface(); | 454 | OMonitoringInterface(); |
455 | OMonitoringInterface( ONetworkInterface* ); | 455 | OMonitoringInterface( ONetworkInterface*, bool _prismHeader ); |
456 | virtual ~OMonitoringInterface(); | 456 | virtual ~OMonitoringInterface(); |
457 | 457 | ||
458 | public: | 458 | public: |
459 | virtual void setEnabled( bool ); | 459 | virtual void setEnabled( bool ); |
@@ -463,8 +463,9 @@ class OMonitoringInterface | |||
463 | virtual QString name() const = 0; | 463 | virtual QString name() const = 0; |
464 | 464 | ||
465 | protected: | 465 | protected: |
466 | OWirelessNetworkInterface* _if; | 466 | OWirelessNetworkInterface* _if; |
467 | bool _prismHeader; | ||
467 | 468 | ||
468 | }; | 469 | }; |
469 | 470 | ||
470 | 471 | ||
@@ -475,9 +476,9 @@ class OMonitoringInterface | |||
475 | 476 | ||
476 | class OCiscoMonitoringInterface : public OMonitoringInterface | 477 | class OCiscoMonitoringInterface : public OMonitoringInterface |
477 | { | 478 | { |
478 | public: | 479 | public: |
479 | OCiscoMonitoringInterface( ONetworkInterface* ); | 480 | OCiscoMonitoringInterface( ONetworkInterface*, bool _prismHeader ); |
480 | virtual ~OCiscoMonitoringInterface(); | 481 | virtual ~OCiscoMonitoringInterface(); |
481 | 482 | ||
482 | virtual void setEnabled( bool ); | 483 | virtual void setEnabled( bool ); |
483 | virtual QString name() const; | 484 | virtual QString name() const; |
@@ -491,9 +492,9 @@ class OCiscoMonitoringInterface : public OMonitoringInterface | |||
491 | 492 | ||
492 | class OWlanNGMonitoringInterface : public OMonitoringInterface | 493 | class OWlanNGMonitoringInterface : public OMonitoringInterface |
493 | { | 494 | { |
494 | public: | 495 | public: |
495 | OWlanNGMonitoringInterface( ONetworkInterface* ); | 496 | OWlanNGMonitoringInterface( ONetworkInterface*, bool _prismHeader ); |
496 | virtual ~OWlanNGMonitoringInterface(); | 497 | virtual ~OWlanNGMonitoringInterface(); |
497 | 498 | ||
498 | public: | 499 | public: |
499 | virtual void setEnabled( bool ); | 500 | virtual void setEnabled( bool ); |
@@ -508,9 +509,9 @@ class OWlanNGMonitoringInterface : public OMonitoringInterface | |||
508 | 509 | ||
509 | class OHostAPMonitoringInterface : public OMonitoringInterface | 510 | class OHostAPMonitoringInterface : public OMonitoringInterface |
510 | { | 511 | { |
511 | public: | 512 | public: |
512 | OHostAPMonitoringInterface( ONetworkInterface* ); | 513 | OHostAPMonitoringInterface( ONetworkInterface*, bool _prismHeader ); |
513 | virtual ~OHostAPMonitoringInterface(); | 514 | virtual ~OHostAPMonitoringInterface(); |
514 | 515 | ||
515 | public: | 516 | public: |
516 | virtual void setEnabled( bool ); | 517 | virtual void setEnabled( bool ); |
@@ -523,9 +524,9 @@ class OHostAPMonitoringInterface : public OMonitoringInterface | |||
523 | 524 | ||
524 | class OOrinocoMonitoringInterface : public OMonitoringInterface | 525 | class OOrinocoMonitoringInterface : public OMonitoringInterface |
525 | { | 526 | { |
526 | public: | 527 | public: |
527 | OOrinocoMonitoringInterface( ONetworkInterface* ); | 528 | OOrinocoMonitoringInterface( ONetworkInterface*, bool _prismHeader ); |
528 | virtual ~OOrinocoMonitoringInterface(); | 529 | virtual ~OOrinocoMonitoringInterface(); |
529 | 530 | ||
530 | public: | 531 | public: |
531 | virtual void setChannel( int ); | 532 | virtual void setChannel( int ); |
diff --git a/libopie2/opienet/opcap.cpp b/libopie2/opienet/opcap.cpp index e2ab6d7..f6d05ea 100644 --- a/libopie2/opienet/opcap.cpp +++ b/libopie2/opienet/opcap.cpp | |||
@@ -70,9 +70,9 @@ OPacket::OPacket( int datalink, packetheaderstruct header, const unsigned char* | |||
70 | new OPrismHeaderPacket( _end, (const struct prism_hdr*) (unsigned char*) data, this ); | 70 | new OPrismHeaderPacket( _end, (const struct prism_hdr*) (unsigned char*) data, this ); |
71 | break; | 71 | break; |
72 | 72 | ||
73 | default: | 73 | default: |
74 | qWarning( "OPacket::OPacket(): Received Packet over unsupported datalink '%s'!", datalink ); | 74 | qWarning( "OPacket::OPacket(): Received Packet over unsupported datalink (type %d)!", datalink ); |
75 | } | 75 | } |
76 | } | 76 | } |
77 | 77 | ||
78 | 78 | ||