Diffstat (limited to 'noncore/settings/networksettings2/lancard/lancardrun.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings2/lancard/lancardrun.cpp | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/noncore/settings/networksettings2/lancard/lancardrun.cpp b/noncore/settings/networksettings2/lancard/lancardrun.cpp index 951756d..2e4fc43 100644 --- a/noncore/settings/networksettings2/lancard/lancardrun.cpp +++ b/noncore/settings/networksettings2/lancard/lancardrun.cpp @@ -1,8 +1,9 @@ #include <qfile.h> #include <qtextstream.h> +#include <qstringlist.h> #include <resources.h> #include "lancardrun.h" void LanCardRun::detectState( NodeCollection * NC ) { // unavailable : no card found @@ -50,14 +51,18 @@ void LanCardRun::detectState( NodeCollection * NC ) { // find possible interface for( QDictIterator<InterfaceInfo> It(Sys.interfaces()); It.current(); ++It ) { Run = It.current(); - if( handlesInterface( Run->Name ) && - Run->CardType == ARPHRD_ETHER && + if( handlesInterface( *Run ) && + ( Run->CardType == ARPHRD_ETHER +#ifdef ARPHRD_IEEE1394 + || Run->CardType == ARPHRD_IEEE1394 +#endif + ) && ! Run->IsUp ) { // proper type, and Not UP -> free NC->setCurrentState( Off ); return; } @@ -142,14 +147,18 @@ InterfaceInfo * LanCardRun::getInterface( void ) { InterfaceInfo * best = 0, * Run; for( QDictIterator<InterfaceInfo> It(S.interfaces()); It.current(); ++It ) { Run = It.current(); - if( handlesInterface( Run->Name ) && - Run->CardType == ARPHRD_ETHER + if( handlesInterface( *Run ) && + ( Run->CardType == ARPHRD_ETHER +#ifdef ARPHRD_IEEE1394 + || Run->CardType == ARPHRD_IEEE1394 +#endif + ) ) { // this is a LAN card if( Run->assignedNode() == netNode() ) { // assigned to us return Run; } else if( Run->assignedNode() == 0 ) { @@ -159,8 +168,25 @@ InterfaceInfo * LanCardRun::getInterface( void ) { } } return best; // can be 0 } bool LanCardRun::handlesInterface( const QString & S ) { + InterfaceInfo * II; + II = NSResources->system().interface( S ); + if( ( II = NSResources->system().interface( S ) ) ) { + return handlesInterface( *II ); + } return Pat.match( S ) >= 0; } + +bool LanCardRun::handlesInterface( const InterfaceInfo & II ) { + if( Pat.match( II.Name ) < 0 ) + return 0; + + if( Data->AnyLanCard ) { + return 1; + } + + // must also match hardware address + return ( Data->HWAddresses.findIndex( II.MACAddress ) >= 0 ); +} |