summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings2/lancard/lancardrun.cpp
Unidiff
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,6 +1,7 @@
1#include <qfile.h> 1#include <qfile.h>
2#include <qtextstream.h> 2#include <qtextstream.h>
3#include <qstringlist.h>
3#include <resources.h> 4#include <resources.h>
4#include "lancardrun.h" 5#include "lancardrun.h"
5 6
6void LanCardRun::detectState( NodeCollection * NC ) { 7void LanCardRun::detectState( NodeCollection * NC ) {
@@ -52,10 +53,14 @@ void LanCardRun::detectState( NodeCollection * NC ) {
52 for( QDictIterator<InterfaceInfo> It(Sys.interfaces()); 53 for( QDictIterator<InterfaceInfo> It(Sys.interfaces());
53 It.current(); 54 It.current();
54 ++It ) { 55 ++It ) {
55 Run = It.current(); 56 Run = It.current();
56 if( handlesInterface( Run->Name ) && 57 if( handlesInterface( *Run ) &&
57 Run->CardType == ARPHRD_ETHER && 58 ( Run->CardType == ARPHRD_ETHER
59#ifdef ARPHRD_IEEE1394
60 || Run->CardType == ARPHRD_IEEE1394
61#endif
62 ) &&
58 ! Run->IsUp 63 ! Run->IsUp
59 ) { 64 ) {
60 // proper type, and Not UP -> free 65 // proper type, and Not UP -> free
61 NC->setCurrentState( Off ); 66 NC->setCurrentState( Off );
@@ -144,10 +149,14 @@ InterfaceInfo * LanCardRun::getInterface( void ) {
144 for( QDictIterator<InterfaceInfo> It(S.interfaces()); 149 for( QDictIterator<InterfaceInfo> It(S.interfaces());
145 It.current(); 150 It.current();
146 ++It ) { 151 ++It ) {
147 Run = It.current(); 152 Run = It.current();
148 if( handlesInterface( Run->Name ) && 153 if( handlesInterface( *Run ) &&
149 Run->CardType == ARPHRD_ETHER 154 ( Run->CardType == ARPHRD_ETHER
155#ifdef ARPHRD_IEEE1394
156 || Run->CardType == ARPHRD_IEEE1394
157#endif
158 )
150 ) { 159 ) {
151 // this is a LAN card 160 // this is a LAN card
152 if( Run->assignedNode() == netNode() ) { 161 if( Run->assignedNode() == netNode() ) {
153 // assigned to us 162 // assigned to us
@@ -161,6 +170,23 @@ InterfaceInfo * LanCardRun::getInterface( void ) {
161 return best; // can be 0 170 return best; // can be 0
162} 171}
163 172
164bool LanCardRun::handlesInterface( const QString & S ) { 173bool LanCardRun::handlesInterface( const QString & S ) {
174 InterfaceInfo * II;
175 II = NSResources->system().interface( S );
176 if( ( II = NSResources->system().interface( S ) ) ) {
177 return handlesInterface( *II );
178 }
165 return Pat.match( S ) >= 0; 179 return Pat.match( S ) >= 0;
166} 180}
181
182bool LanCardRun::handlesInterface( const InterfaceInfo & II ) {
183 if( Pat.match( II.Name ) < 0 )
184 return 0;
185
186 if( Data->AnyLanCard ) {
187 return 1;
188 }
189
190 // must also match hardware address
191 return ( Data->HWAddresses.findIndex( II.MACAddress ) >= 0 );
192}