Skip to content

Commit faa7dab

Browse files
committed
system: audit staticroute' config access for #10027
1 parent 700d6a0 commit faa7dab

4 files changed

Lines changed: 4 additions & 8 deletions

File tree

src/etc/inc/plugins.inc.d/pf.inc

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,7 @@ function pf_firewall($fw)
125125
* interface in question to avoid problems with complicated routing
126126
* topologies
127127
*/
128-
if (
129-
isset($config['filter']['bypassstaticroutes']) && isset($config['staticroutes']['route']) &&
130-
count($config['staticroutes']['route'])
131-
) {
128+
if (isset($config['filter']['bypassstaticroutes']) && count(config_read_array('staticroutes', 'route', false))) {
132129
$ifdetails = $fw->getIfconfigDetails();
133130
$GatewaysList = $fw->getGateways()->gatewaysIndexedByName(false, true);
134131

src/etc/inc/util.inc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1158,11 +1158,10 @@ function is_URL($url)
11581158

11591159
function get_staticroutes($returnsubnetsonly = false)
11601160
{
1161-
global $aliastable;
1162-
11631161
$allstaticroutes = [];
11641162
$allsubnets = [];
1165-
foreach (config_read_array('staticroutes', 'route') as $route) {
1163+
1164+
foreach (config_read_array('staticroutes', 'route', false) as $route) {
11661165
if (is_subnet($route['network'])) {
11671166
$allstaticroutes[] = $route;
11681167
$allsubnets[] = $route['network'];

src/opnsense/mvc/app/controllers/OPNsense/Routing/Api/SettingsController.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ public function addGatewayAction()
193193
return $this->addBase("gateway_item", "gateway_item");
194194
}
195195

196+
/* XXX consider removing $cfg use -- everything should have a model now */
196197
public function delGatewayAction($uuid)
197198
{
198199
$result = ["result" => "failed"];

src/opnsense/mvc/app/models/OPNsense/Firewall/Alias.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@ private function getAliasSource()
126126
$sources[] = [['nat', 'outbound', 'rule'], ['destination', 'network']];
127127
$sources[] = [['nat', 'outbound', 'rule'], ['dstport']];
128128
$sources[] = [['nat', 'outbound', 'rule'], ['target']];
129-
$sources[] = [['staticroutes', 'route'], ['network']];
130129
$sources[] = [['OPNsense', 'Firewall', 'Filter', 'onetoone', 'rule'], ['source_net']];
131130
$sources[] = [['OPNsense', 'Firewall', 'Filter', 'onetoone', 'rule'], ['destination_net']];
132131
$sources[] = [['OPNsense', 'Firewall', 'Filter', 'rules', 'rule'], ['source_net']];

0 commit comments

Comments
 (0)