summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings2/lancard/lancardrun.cpp
Unidiff
Diffstat (limited to 'noncore/settings/networksettings2/lancard/lancardrun.cpp') (more/less context) (ignore 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,5 +1,6 @@
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
@@ -53,8 +54,12 @@ void LanCardRun::detectState( NodeCollection * NC ) {
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
@@ -145,8 +150,12 @@ InterfaceInfo * LanCardRun::getInterface( void ) {
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() ) {
@@ -162,5 +171,22 @@ InterfaceInfo * LanCardRun::getInterface( void ) {
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}