net/upnp: Fix port maps not listed without description (#4103)

This commit is contained in:
Self-Hosting-Group
2024-08-16 13:37:41 +02:00
committed by GitHub
parent 1ea9867ac9
commit 19070de8d0
4 changed files with 25 additions and 22 deletions
+1 -2
View File
@@ -1,6 +1,5 @@
PLUGIN_NAME= upnp
PLUGIN_VERSION= 1.5
PLUGIN_REVISION= 6
PLUGIN_VERSION= 1.6
PLUGIN_DEPENDS= miniupnpd
PLUGIN_COMMENT= Universal Plug and Play (UPnP IGD & PCP/NAT-PMP) Service
PLUGIN_MAINTAINER= franco@opnsense.org
@@ -232,7 +232,7 @@ function miniupnpd_configure_do($verbose = false)
/* Allow UPnP IGD or PCP/NAT-PMP as requested */
$config_text .= "enable_upnp=" . ( $upnp_config['enable_upnp'] ? "yes\n" : "no\n" );
$config_text .= "enable_natpmp=" . ( $upnp_config['enable_natpmp'] ? "yes\n" : "no\n" );
$config_text .= "enable_pcp_pmp=" . ( $upnp_config['enable_natpmp'] ? "yes\n" : "no\n" );
/* configure lifetimes to force periodic expire */
$config_text .= "clean_ruleset_interval=600\n";
+4 -1
View File
@@ -221,9 +221,12 @@ include("head.inc");
</thead>
<tbody>
<tr>
<td><i class="fa fa-info-circle text-muted"></i> <?=gettext("Enable");?></td>
<td><a id="help_for_enable" href="#" class="showhelp"><i class="fa fa-info-circle text-muted"></i></a> <?=gettext("Enable");?></td>
<td>
<input name="enable" type="checkbox" value="yes" <?=!empty($pconfig['enable']) ? "checked=\"checked\"" : ""; ?> />
<div class="hidden" data-for="help_for_enable">
<?=gettext("Enable autonomous port mapping service.");?>
</div>
</td>
</tr>
<tr>
+19 -18
View File
@@ -62,41 +62,42 @@ include("head.inc");
<?php
else: ?>
<div class="table-responsive">
<table class="table table-striped">
<table class="table table-striped table-condensed table-hover">
<thead>
<tr>
<td><?=gettext("Port");?></td>
<td><?=gettext("Protocol");?></td>
<td><?=gettext("Internal IP");?></td>
<td><?=gettext("Int. Port");?></td>
<td><?=gettext("Description");?></td>
<td><?=gettext("Interface")?></td>
<td><?=gettext("Ext. Port")?></td>
<td><?=gettext("Internal IP")?></td>
<td><?=gettext("Int. Port")?></td>
<td><?=gettext("Protocol")?></td>
<td><?=gettext("Source IP")?></td>
<td><?=gettext("Source Port")?></td>
<td><?=gettext("Description")?></td>
</tr>
</thead>
<tbody>
<?php
foreach ($rdr_entries as $rdr_entry):
if (!preg_match("/on (.*) inet proto (.*) from (.*) to (.*) port = (.*) keep state label \"(.*)\" rtable [0-9] -> (.*) port (.*)/", $rdr_entry, $matches)) {
if (!preg_match("/on (?P<iface>.*) inet proto (?P<proto>.*) from (?P<srcaddr>.*) (port (?P<srcport>.*) )?to (?P<extaddr>.*) port = (?P<extport>.*) keep state (label \"(?P<descr>.*)\" )?rtable [0-9] -> (?P<intaddr>.*) port (?P<intport>.*)/", $rdr_entry, $matches)) {
continue;
}
$rdr_proto = $matches[2];
$rdr_port = $matches[5];
$rdr_label =$matches[6];
$rdr_ip = $matches[7];
$rdr_iport = $matches[8];
?>
<tr>
<td><?=$rdr_port;?></td>
<td><?=$rdr_proto;?></td>
<td><?=$rdr_ip;?></td>
<td><?=$rdr_iport;?></td>
<td><?=$rdr_label;?></td>
<td><?= html_safe(convert_friendly_interface_to_friendly_descr(convert_real_interface_to_friendly_interface_name($matches['iface']))) ?></td>
<td><?= html_safe($matches['extport']) ?></td>
<td><?= html_safe($matches['intaddr']) ?></td>
<td><?= html_safe($matches['intport']) ?></td>
<td><?= html_safe(strtoupper($matches['proto'])) ?></td>
<td><?= html_safe($matches['srcaddr']) ?></td>
<td><?= html_safe($matches['srcport'] ?: "any") ?></td>
<td><?= html_safe($matches['descr']) ?></td>
</tr>
<?php
endforeach;?>
</tbody>
<tfoot>
<tr>
<td colspan="5">
<td colspan="8">
<form method="post">
<button type="submit" name="clear" id="clear" class="btn btn-primary" value="Clear"><?=gettext("Clear");?></button>
<?=gettext("all currently connected sessions");?>.