SMT: Show status on vulnerabilities.cgi

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
This commit is contained in:
Michael Tremer
2019-05-20 21:54:05 +01:00
parent f238e25172
commit 1cbcd044af
11 changed files with 57 additions and 1 deletions

View File

@@ -170,12 +170,20 @@ print "<form method='post' action='$ENV{'SCRIPT_NAME'}'>\n";
&Header::openbox('100%', 'center', $Lang::tr{'settings'});
my $smt_status = &smt_status();
print <<END;
<table class="tbl" width="66%">
<tbody>
<tr>
<th colspan="2" align="center">
<strong>$smt_status</strong>
</th>
</tr>
<tr>
<td width="50%" align="left">
<strong>$Lang::tr{'enable smt'}</strong>
$Lang::tr{'enable smt'}
</td>
<td width="50%" align="center">
@@ -222,3 +230,21 @@ sub check_status($) {
return $status;
}
sub smt_status() {
open(FILE, "/sys/devices/system/cpu/smt/control");
my $status = <FILE>;
close(FILE);
chomp($status);
if ($status eq "on") {
return $Lang::tr{'smt enabled'};
} elsif (($status eq "off") || ($status eq "forceoff")) {
return $Lang::tr{'smt disabled'};
} elsif ($status eq "notsupported") {
return $Lang::tr{'smt not supported'};
}
return $status;
}