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.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/noncore/settings/networksettings2/network/networkrun.cpp b/noncore/settings/networksettings2/network/networkrun.cpp
index ddb9a5f..c19235a 100644
--- a/noncore/settings/networksettings2/network/networkrun.cpp
+++ b/noncore/settings/networksettings2/network/networkrun.cpp
@@ -9,58 +9,58 @@ void NetworkRun::detectState( NodeCollection * NC ) {
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 return;
14 } 14 }
15 15
16 // has no interface -> delegate 16 // has no interface -> delegate
17 RI->detectState( NC ); 17 RI->detectState( NC );
18} 18}
19 19
20bool NetworkRun::setState( NodeCollection * NC, Action_t A ) { 20bool NetworkRun::setState( NodeCollection * NC, Action_t A ) {
21 // we handle UP and DOWN 21 // we handle UP and DOWN
22 RuntimeInfo * RI = netNode()->nextNode()->runtime(); 22 RuntimeInfo * RI = netNode()->nextNode()->runtime();
23 AsDevice * Next = RI->asDevice(); 23 AsDevice * Next = RI->asDevice();
24 InterfaceInfo * II = Next->assignedInterface(); 24 InterfaceInfo * II = Next->assignedInterface();
25 25
26 if( A == Up ) { 26 if( A == Up ) {
27 // we can bring UP if lower level is available 27 // we can bring UP if lower level is available
28 if( NC->currentState() == Available ) { 28 if( NC->currentState() == Available ) {
29 QString S; 29 QString S;
30 S.sprintf( "ifup %s=%s-c%d-allowed", 30 S.sprintf( "ifup %s=%s-c%d-allowed",
31 II->Name.latin1(), II->Name.latin1(), 31 II->Name.latin1(), II->Name.latin1(),
32 connection()->number() ); 32 connection()->number() );
33 NSResources->system().execute( S ); 33 NSResources->system().runAsRoot( S );
34 } 34 }
35 return 1; 35 return 1;
36 } else if( A == Down ) { 36 } else if( A == Down ) {
37 if( NC->currentState() == IsUp ) { 37 if( NC->currentState() == IsUp ) {
38 QString S; 38 QString S;
39 S.sprintf( "ifdown %s=%s-c%d-allowed", 39 S.sprintf( "ifdown %s=%s-c%d-allowed",
40 II->Name.latin1(), II->Name.latin1(), 40 II->Name.latin1(), II->Name.latin1(),
41 connection()->number() ); 41 connection()->number() );
42 NSResources->system().execute( S ); 42 NSResources->system().runAsRoot( S );
43 } 43 }
44 return 1; 44 return 1;
45 } 45 }
46 // delegate 46 // delegate
47 return RI->setState( NC, A ); 47 return RI->setState( NC, A );
48} 48}
49 49
50bool NetworkRun::canSetState( State_t Curr, Action_t A ) { 50bool NetworkRun::canSetState( State_t Curr, Action_t A ) {
51 // we handle UP and DOWN 51 // we handle UP and DOWN
52 RuntimeInfo * RI = netNode()->nextNode()->runtime(); 52 RuntimeInfo * RI = netNode()->nextNode()->runtime();
53 53
54 if( A == Up ) { 54 if( A == Up ) {
55 return ( Curr == Available ); 55 return ( Curr == Available );
56 } else if( A == Down ) { 56 } else if( A == Down ) {
57 return ( Curr == IsUp ); 57 return ( Curr == IsUp );
58 } 58 }
59 // delegate 59 // delegate
60 return RI->canSetState( Curr, A ); 60 return RI->canSetState( Curr, A );
61} 61}
62 62
63bool NetworkRun::handlesInterface( const QString & S ) { 63bool NetworkRun::handlesInterface( const QString & S ) {
64 // donno -> pass deeper 64 // donno -> pass deeper
65 return netNode()->nextNode()->runtime()->handlesInterface(S); 65 return netNode()->nextNode()->runtime()->handlesInterface(S);
66} 66}