author | mickeyl <mickeyl> | 2005-05-15 13:41:19 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2005-05-15 13:41:19 (UTC) |
commit | 1de015fb8f267f2451dd26d992cc713e6e02af79 (patch) (unidiff) | |
tree | a82bcaf6bce0b713910de85450a83862b2d0a73a /libopie2 | |
parent | 4451abf402aa1dd967ef8b70a7eba1192f13afb0 (diff) | |
download | opie-1de015fb8f267f2451dd26d992cc713e6e02af79.zip opie-1de015fb8f267f2451dd26d992cc713e6e02af79.tar.gz opie-1de015fb8f267f2451dd26d992cc713e6e02af79.tar.bz2 |
submit iw_range*2 as argument to SIOCGIWRANGE.length to make it work on newer hostap drivers
let's see if this breaks it at another end again :/
-rw-r--r-- | libopie2/opienet/onetwork.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/libopie2/opienet/onetwork.cpp b/libopie2/opienet/onetwork.cpp index f4bdbe0..05513f8 100644 --- a/libopie2/opienet/onetwork.cpp +++ b/libopie2/opienet/onetwork.cpp | |||
@@ -529,17 +529,16 @@ void OWirelessNetworkInterface::buildInformation() | |||
529 | 529 | ||
530 | struct iwreq wrq; | 530 | struct iwreq wrq; |
531 | int len = sizeof( struct iw_range )*2; | 531 | int len = sizeof( struct iw_range )*2; |
532 | char *buffer = (char*) malloc( len ); | 532 | char buffer[len]; |
533 | //FIXME: Validate if we actually got the memory block | ||
534 | memset( buffer, 0, len ); | 533 | memset( buffer, 0, len ); |
535 | memcpy( wrq.ifr_name, name(), IFNAMSIZ); | 534 | memcpy( wrq.ifr_name, name(), IFNAMSIZ); |
536 | wrq.u.data.pointer = (caddr_t) buffer; | 535 | wrq.u.data.pointer = (caddr_t) buffer; |
537 | wrq.u.data.length = sizeof( struct iw_range ); | 536 | wrq.u.data.length = sizeof buffer; |
538 | wrq.u.data.flags = 0; | 537 | wrq.u.data.flags = 0; |
539 | 538 | ||
540 | if ( ::ioctl( _sfd, SIOCGIWRANGE, &wrq ) == -1 ) | 539 | if ( ::ioctl( _sfd, SIOCGIWRANGE, &wrq ) == -1 ) |
541 | { | 540 | { |
542 | owarn << "OWirelessNetworkInterface::buildInformation(): Can't get channel information - using default values." << oendl; | 541 | owarn << "OWirelessNetworkInterface::buildInformation(): Can't get driver information (" << strerror( errno ) << ") - using default values." << oendl; |
543 | _channels.insert( 2412, 1 ); // 2.412 GHz | 542 | _channels.insert( 2412, 1 ); // 2.412 GHz |
544 | _channels.insert( 2417, 2 ); // 2.417 GHz | 543 | _channels.insert( 2417, 2 ); // 2.417 GHz |
545 | _channels.insert( 2422, 3 ); // 2.422 GHz | 544 | _channels.insert( 2422, 3 ); // 2.422 GHz |
@@ -582,7 +581,6 @@ void OWirelessNetworkInterface::buildInformation() | |||
582 | 581 | ||
583 | memcpy( &_range, buffer, sizeof( struct iw_range ) ); | 582 | memcpy( &_range, buffer, sizeof( struct iw_range ) ); |
584 | odebug << "OWirelessNetworkInterface::buildInformation(): Information block constructed." << oendl; | 583 | odebug << "OWirelessNetworkInterface::buildInformation(): Information block constructed." << oendl; |
585 | free(buffer); | ||
586 | } | 584 | } |
587 | 585 | ||
588 | 586 | ||
@@ -604,7 +602,7 @@ void OWirelessNetworkInterface::buildPrivateList() | |||
604 | 602 | ||
605 | if ( !wioctl( SIOCGIWPRIV ) ) | 603 | if ( !wioctl( SIOCGIWPRIV ) ) |
606 | { | 604 | { |
607 | owarn << "OWirelessNetworkInterface::buildPrivateList(): Can't get private ioctl information." << oendl; | 605 | owarn << "OWirelessNetworkInterface::buildPrivateList(): Can't get private ioctl information (" << strerror( errno ) << ")." << oendl; |
608 | return; | 606 | return; |
609 | } | 607 | } |
610 | 608 | ||