-rw-r--r-- | libopie2/opienet/onetwork.cpp | 50 |
1 files changed, 22 insertions, 28 deletions
diff --git a/libopie2/opienet/onetwork.cpp b/libopie2/opienet/onetwork.cpp index f52279a..e916c44 100644 --- a/libopie2/opienet/onetwork.cpp +++ b/libopie2/opienet/onetwork.cpp | |||
@@ -225,4 +225,12 @@ QString ONetworkInterface::ipV4Address() const | |||
225 | 225 | ||
226 | 226 | ||
227 | void ONetworkInterface::setMacAddress( const OMacAddress& addr ) | ||
228 | { | ||
229 | _ifr.ifr_hwaddr.sa_family = ARPHRD_ETHER; | ||
230 | memcpy( &_ifr.ifr_hwaddr.sa_data, addr.native(), 6 ); | ||
231 | ioctl( SIOCSIFHWADDR ); | ||
232 | } | ||
233 | |||
234 | |||
227 | OMacAddress ONetworkInterface::macAddress() const | 235 | OMacAddress ONetworkInterface::macAddress() const |
228 | { | 236 | { |
@@ -648,4 +656,11 @@ void OWirelessNetworkInterface::setPrivate( const QString& call, int numargs, .. | |||
648 | void OWirelessNetworkInterface::getPrivate( const QString& call ) | 656 | void OWirelessNetworkInterface::getPrivate( const QString& call ) |
649 | { | 657 | { |
658 | qWarning( "OWirelessNetworkInterface::getPrivate() is not implemented yet." ); | ||
659 | } | ||
660 | |||
661 | |||
662 | bool OWirelessNetworkInterface::hasPrivate( const QString& call ) | ||
663 | { | ||
664 | return child( (const char*) call ); | ||
650 | } | 665 | } |
651 | 666 | ||
@@ -835,27 +850,14 @@ void OHostAPMonitoringInterface::setEnabled( bool b ) | |||
835 | // Wireless Extensions < Version 15 need iwpriv commandos for monitoring | 850 | // Wireless Extensions < Version 15 need iwpriv commandos for monitoring |
836 | 851 | ||
852 | //TODO: check wireless extensions version on runtime and use | ||
853 | //TODO: SIOCSIWMODE( IW_MODE_MONITOR ) if running on WE >= 15 | ||
854 | |||
837 | if ( b ) | 855 | if ( b ) |
838 | { | 856 | { |
839 | #if WIRELESS_EXT > 14 | 857 | _if->setPrivate( "monitor", 1, 2 ); |
840 | _if->_iwr.u.mode = IW_MODE_MONITOR; | ||
841 | _if->wioctl( SIOCSIWMODE ); | ||
842 | #else | ||
843 | int* args = (int*) &_if->_iwr.u.name; | ||
844 | args[0] = 2; | ||
845 | args[1] = 0; | ||
846 | _if->wioctl( SIOCDEVPRIVATE ); | ||
847 | #endif | ||
848 | } | 858 | } |
849 | else | 859 | else |
850 | { | 860 | { |
851 | #if WIRELESS_EXT > 14 | 861 | _if->setPrivate( "monitor", 1, 0 ); |
852 | _if->_iwr.u.mode = IW_MODE_INFRA; | ||
853 | _if->wioctl( SIOCSIWMODE ); | ||
854 | #else | ||
855 | int* args = (int*) &_if->_iwr.u.name; | ||
856 | args[0] = 0; | ||
857 | args[1] = 0; | ||
858 | _if->wioctl( SIOCDEVPRIVATE ); | ||
859 | #endif | ||
860 | } | 862 | } |
861 | } | 863 | } |
@@ -886,9 +888,5 @@ OOrinocoMonitoringInterface::~OOrinocoMonitoringInterface() | |||
886 | void OOrinocoMonitoringInterface::setChannel( int c ) | 888 | void OOrinocoMonitoringInterface::setChannel( int c ) |
887 | { | 889 | { |
888 | // call iwpriv <device> monitor 2 <channel> | 890 | _if->setPrivate( "monitor", 2, 2, c ); |
889 | int* args = (int*) &_if->_iwr.u.name; | ||
890 | args[0] = 2; | ||
891 | args[1] = c; | ||
892 | _if->wioctl( SIOCIWFIRSTPRIV + 0x8 ); | ||
893 | } | 891 | } |
894 | 892 | ||
@@ -902,9 +900,5 @@ void OOrinocoMonitoringInterface::setEnabled( bool b ) | |||
902 | else | 900 | else |
903 | { | 901 | { |
904 | // call iwpriv <device> monitor 0 0 | 902 | _if->setPrivate( "monitor", 2, 0, 0 ); |
905 | int* args = (int*) &_if->_iwr.u.name; | ||
906 | args[0] = 0; | ||
907 | args[1] = 0; | ||
908 | _if->wioctl( SIOCIWFIRSTPRIV + 0x8 ); | ||
909 | } | 903 | } |
910 | } | 904 | } |