Skip to content

Commit

Permalink
Merge pull request #1157 from RaspAP/feature/routing-table
Browse files Browse the repository at this point in the history
Implement routing table raw output
  • Loading branch information
billz committed Apr 24, 2022
2 parents 658a300 + f0d1fe9 commit 5cbe9eb
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 0 deletions.
11 changes: 11 additions & 0 deletions includes/internetRoute.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,14 @@ function getRouteInfo($checkAccess)
return $rInfo;
}

/*
* Fetches raw output of ip route
*
* @return string
*/
function getRouteInfoRaw()
{
exec('ip route list', $routes);
return $routes;
}

2 changes: 2 additions & 0 deletions includes/networking.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@ function DisplayNetworkingConfig()

exec("ls /sys/class/net | grep -v lo", $interfaces);
$routeInfo = getRouteInfo(true);
$routeInfoRaw = getRouteInfoRaw();
$arrHostapdConf = parse_ini_file(RASPI_CONFIG.'/hostapd.ini');
$bridgedEnabled = $arrHostapdConf['BridgedEnable'];

echo renderTemplate("networking", compact(
"status",
"interfaces",
"routeInfo",
"routeInfoRaw",
"bridgedEnabled")
);
}
Binary file modified locale/en_US/LC_MESSAGES/messages.mo
Binary file not shown.
6 changes: 6 additions & 0 deletions locale/en_US/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,12 @@ msgstr "Error saving network configuration to file"
msgid "Unable to detect interface"
msgstr "Unable to detect interface"

msgid "Routing table"
msgstr "Routing table"

msgid "raw output"
msgstr "raw output"

#: includes/system.php
msgid "System Information"
msgstr "System Information"
Expand Down
23 changes: 23 additions & 0 deletions templates/networking.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,29 @@
</div>
</div>
</div>

<h4 class="mt-3"><?php echo _("Routing table"); ?></h4>
<div class="card h-100 w-100">
<div class="card-header"><?php echo _("raw output") ?></div>
<div class="card-body">
<div class="row">
<div class="col-sm-12">
<div class="table-responsive">
<table class="table">
<tbody>
<?php foreach($routeInfoRaw as $route): ?>
<tr>
<pre class="unstyled"><?php echo $route; ?></pre>
</tr>
<?php endforeach ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>

<h4 class="mt-3"><?php echo _("Current settings") ?></h4>
<div class="row">
<?php if (!$bridgedEnabled) : // No interface details when bridged ?>
Expand Down

0 comments on commit 5cbe9eb

Please sign in to comment.