Posted 11 March 2013 - 08:39
Posted 11 March 2013 - 16:37
Posted 11 March 2013 - 17:27
xorangekiller, on 11 March 2013 - 16:37, said:
Posted 11 March 2013 - 21:17
pes2013, on 11 March 2013 - 17:27, said:
Posted 11 March 2013 - 23:35
# Bring our Network Manager connection up.
sub nm_con_up
{
my $myiface; # Interface from $conf to bring up.
my $mytimeout; # Timeout from $conf to pass to nmcli.
$myiface = $conf->iface;
$mytimeout = $conf->timeout;
@towt = qx[nmcli con up uuid ${NM_UUID} iface ${myiface} --timeout ${mytimeout} 2>&1];
$towt[0] =~ /Error: Unknown connection: ${NM_UUID}/i and die "Our profile is not registered with Network Manager!\n";
$towt[0] =~ /[E|e]rror[.]*[T|t]imeout[.]*[E|e]xpired[.]*/ and return 0;
return 1;
}
# Take our Network Manager connection down.
sub nm_con_down
{
my $myiface; # Interface from $conf to bring up.
my @status; # Network Manager status output.
my $is_down; # Is the interface down?
$myiface = $conf->iface;
@status = qx[nmcli con status 2>&1];
$is_down = 0;
for my $elem (@status)
{
if ($elem =~ /${NM_UUID}/)
{
@towt = qx[nmcli con down uuid ${NM_UUID} 2>&1];
$is_down = 1;
}
elsif ($elem =~ /${myiface}/)
{
my @tokens; # Tokenized version of the element.
my $myuuid; # UUID associated with $myiface.
@tokens = split(/[ ]+/, $elem);
foreach my $token (@tokens)
{
if ($token =~ /[a-f0-9]{8}[-]([a-f0-9]{4}[-]){3}[a-f0-9]{12}/)
{
$myuuid = $token;
last;
}
}
@towt = qx[nmcli con down uuid ${myuuid} 2>&1];
$is_down = 1;
}
}
die "Network connection could not be taken down!\n" unless $is_down == 1;
}
Posted 12 March 2013 - 08:31
xorangekiller, on 11 March 2013 - 21:17, said:
Posted 12 March 2013 - 14:08
Posted 13 March 2013 - 07:59
xorangekiller, on 12 March 2013 - 14:08, said:
Posted 13 March 2013 - 13:41