Diffstat (limited to 'noncore/settings/networksettings2/network/networkrun.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/settings/networksettings2/network/networkrun.cpp | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/noncore/settings/networksettings2/network/networkrun.cpp b/noncore/settings/networksettings2/network/networkrun.cpp index c17aa7f..2c93d9d 100644 --- a/noncore/settings/networksettings2/network/networkrun.cpp +++ b/noncore/settings/networksettings2/network/networkrun.cpp @@ -13,39 +13,38 @@ State_t NetworkRun::detectState( void ) { } // had no interface or interface is no longer up -> release nodeCollection()->assignInterface( 0 ); return Unknown; } QString NetworkRun::setMyState( NodeCollection * NC, Action_t A, bool ) { // we handle UP and DOWN InterfaceInfo * II = NC->assignedInterface(); + if( ! II ) { + Log(( "no interface assigned." )); + return QString(); + } + + QStringList SL; + if( A == Up ) { // we can bring UP if lower level is available - QStringList SL; - SL << "ifup" - << QString().sprintf( "%s=%s-c%d-allowed", - II->Name.latin1(), II->Name.latin1(), - nodeCollection()->number() ); - if( ! NSResources->system().runAsRoot( SL ) ) { - return QString("Cannot call %1").arg(SL.join(" ")); - } + SL << "ifup"; + } else if( A == Down ) { + SL << "ifdown"; + } else { return QString(); } - if( A == Down ) { - QStringList SL; - if( II ) { - SL << "ifdown" - << II->Name.latin1(); + SL << QString().sprintf( "%s=%s-c%d-allowed", + II->Name.latin1(), II->Name.latin1(), + nodeCollection()->number() ); + if( ! NSResources->system().runAsRoot( SL ) ) { return QString( "Cannot call %1" ).arg( SL.join( " " )); } - } else { - Log(( "no interface assigned." )); - } - } + return QString(); } |