mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-28 11:43:25 +02:00
firewall: Fix accessing port forwardings from internal networks.
When a different "external port" was used, false rules have been created in the mangle table.
This commit is contained in:
@@ -354,20 +354,21 @@ sub buildrules {
|
|||||||
|
|
||||||
# Destination NAT
|
# Destination NAT
|
||||||
if ($NAT_MODE eq "DNAT") {
|
if ($NAT_MODE eq "DNAT") {
|
||||||
# Make port-forwardings useable from the internal networks.
|
|
||||||
my @internal_addresses = &fwlib::get_internal_firewall_ip_addresses(1);
|
|
||||||
unless ($nat_address ~~ @internal_addresses) {
|
|
||||||
&add_dnat_mangle_rules($nat_address, @options);
|
|
||||||
}
|
|
||||||
|
|
||||||
my @nat_options = ();
|
my @nat_options = ();
|
||||||
if ($protocol ne "all") {
|
if ($protocol ne "all") {
|
||||||
my @nat_protocol_options = &get_protocol_options($hash, $key, $protocol, 1);
|
my @nat_protocol_options = &get_protocol_options($hash, $key, $protocol, 1);
|
||||||
push(@nat_options, @nat_protocol_options);
|
push(@nat_options, @nat_protocol_options);
|
||||||
}
|
}
|
||||||
|
push(@nat_options, @time_options);
|
||||||
|
|
||||||
|
# Make port-forwardings useable from the internal networks.
|
||||||
|
my @internal_addresses = &fwlib::get_internal_firewall_ip_addresses(1);
|
||||||
|
unless ($nat_address ~~ @internal_addresses) {
|
||||||
|
&add_dnat_mangle_rules($nat_address, @nat_options);
|
||||||
|
}
|
||||||
|
|
||||||
push(@nat_options, @source_options);
|
push(@nat_options, @source_options);
|
||||||
push(@nat_options, ("-d", $nat_address));
|
push(@nat_options, ("-d", $nat_address));
|
||||||
push(@nat_options, @time_options);
|
|
||||||
|
|
||||||
my $dnat_port;
|
my $dnat_port;
|
||||||
if ($protocol_has_ports) {
|
if ($protocol_has_ports) {
|
||||||
|
|||||||
Reference in New Issue
Block a user