summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings2/lancard/lancardrun.cpp
Side-by-side diff
Diffstat (limited to 'noncore/settings/networksettings2/lancard/lancardrun.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/networksettings2/lancard/lancardrun.cpp34
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,4 +1,5 @@
#include <qfile.h>
#include <qtextstream.h>
+#include <qstringlist.h>
#include <resources.h>
#include "lancardrun.h"
@@ -54,6 +55,10 @@ void LanCardRun::detectState( NodeCollection * NC ) {
++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
) {
@@ -146,6 +151,10 @@ InterfaceInfo * LanCardRun::getInterface( void ) {
++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
@@ -163,4 +172,21 @@ InterfaceInfo * LanCardRun::getInterface( void ) {
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 );
+}