Skip to content

Commit f2279f2

Browse files
miniupnpd: Improve configuration generation
Signed-off-by: Self Hosting Group <[email protected]>
1 parent 05d611d commit f2279f2

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

net/miniupnpd/files/miniupnpd.init

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,11 @@ conf_rule_add() {
3131
local ext_start ext_end int_start int_end comment
3232

3333
config_get action "$cfg" action "deny" # allow or deny
34-
upnpd_get_port_range "ext" "$cfg" ext_ports "0-65535" # external ports: x, x-y, x:y
34+
upnpd_get_port_range "ext" "$cfg" ext_ports "1-65535" # external ports: x, x-y, x:y
3535
config_get int_addr "$cfg" int_addr "0.0.0.0/0" # ip or network and subnet mask (internal)
36-
upnpd_get_port_range "int" "$cfg" int_ports "0-65535" # internal ports: x, x-y, x:y or range
36+
upnpd_get_port_range "int" "$cfg" int_ports "1-65535" # internal ports: x, x-y, x:y or range
3737
config_get comment "$cfg" comment "ACL" # comment
3838

39-
# Make a single IP IP/32 so that miniupnpd.conf can use it.
40-
[ "${int_addr%/*}" = "$int_addr" ] && int_addr="$int_addr/32"
41-
4239
echo "$action $ext_start${ext_end:+-}$ext_end $int_addr $int_start${int_end:+-}$int_end #$comment"
4340
}
4441

@@ -175,8 +172,6 @@ upnpd() {
175172

176173
[ "$uuid" = "nocli" ] || echo "uuid=$uuid"
177174

178-
config_foreach conf_rule_add perm_rule
179-
180175
if [ "$FW" = "fw4" ]; then
181176
#When using nftables configure miniupnpd to use its own table and chains
182177
echo "upnp_table_name=fw4"
@@ -186,6 +181,8 @@ upnpd() {
186181
echo "upnp_nat_postrouting_chain=upnp_postrouting"
187182
fi
188183

184+
config_foreach conf_rule_add perm_rule
185+
189186
} > "$tmpconf"
190187
fi
191188

0 commit comments

Comments
 (0)