summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings2/network/networkrun.cpp
Unidiff
Diffstat (limited to 'noncore/settings/networksettings2/network/networkrun.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings2/network/networkrun.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/noncore/settings/networksettings2/network/networkrun.cpp b/noncore/settings/networksettings2/network/networkrun.cpp
index f34fdbf..ddb9a5f 100644
--- a/noncore/settings/networksettings2/network/networkrun.cpp
+++ b/noncore/settings/networksettings2/network/networkrun.cpp
@@ -1,36 +1,37 @@
1#include <system.h> 1#include <system.h>
2#include <asdevice.h> 2#include <asdevice.h>
3#include "networkrun.h" 3#include "networkrun.h"
4 4
5void NetworkRun::detectState( NodeCollection * NC ) { 5void NetworkRun::detectState( NodeCollection * NC ) {
6 RuntimeInfo * RI = netNode()->nextNode()->runtime(); 6 RuntimeInfo * RI = netNode()->nextNode()->runtime();
7 AsDevice * Next = RI->asDevice(); 7 AsDevice * Next = RI->asDevice();
8 InterfaceInfo * II = Next->assignedInterface(); 8 InterfaceInfo * II = Next->assignedInterface();
9 9
10 if( II ) { 10 if( II ) {
11 // device has assigned interface 11 // device has assigned interface
12 NC->setCurrentState( (( II->IsUp ) ? IsUp : Available) ); 12 NC->setCurrentState( (( II->IsUp ) ? IsUp : Available) );
13 return;
13 } 14 }
14 15
15 // has no interface -> delegate 16 // has no interface -> delegate
16 RI->detectState( NC ); 17 RI->detectState( NC );
17} 18}
18 19
19bool NetworkRun::setState( NodeCollection * NC, Action_t A ) { 20bool NetworkRun::setState( NodeCollection * NC, Action_t A ) {
20 // we handle UP and DOWN 21 // we handle UP and DOWN
21 RuntimeInfo * RI = netNode()->nextNode()->runtime(); 22 RuntimeInfo * RI = netNode()->nextNode()->runtime();
22 AsDevice * Next = RI->asDevice(); 23 AsDevice * Next = RI->asDevice();
23 InterfaceInfo * II = Next->assignedInterface(); 24 InterfaceInfo * II = Next->assignedInterface();
24 25
25 if( A == Up ) { 26 if( A == Up ) {
26 // we can bring UP if lower level is available 27 // we can bring UP if lower level is available
27 if( NC->currentState() == Available ) { 28 if( NC->currentState() == Available ) {
28 QString S; 29 QString S;
29 S.sprintf( "ifup %s=%s-c%d-allowed", 30 S.sprintf( "ifup %s=%s-c%d-allowed",
30 II->Name.latin1(), II->Name.latin1(), 31 II->Name.latin1(), II->Name.latin1(),
31 connection()->number() ); 32 connection()->number() );
32 NSResources->system().execute( S ); 33 NSResources->system().execute( S );
33 } 34 }
34 return 1; 35 return 1;
35 } else if( A == Down ) { 36 } else if( A == Down ) {
36 if( NC->currentState() == IsUp ) { 37 if( NC->currentState() == IsUp ) {