[pve-devel] [PATCH container] pct create: Set the NICs firewall to enabled by default on container creation

Christian Ebner c.ebner at proxmox.com
Wed Apr 3 15:57:54 CEST 2019


Signed-off-by: Christian Ebner <c.ebner at proxmox.com>
---
 src/PVE/API2/LXC.pm | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/PVE/API2/LXC.pm b/src/PVE/API2/LXC.pm
index 5a8a9c9..8234df4 100644
--- a/src/PVE/API2/LXC.pm
+++ b/src/PVE/API2/LXC.pm
@@ -296,6 +296,10 @@ __PACKAGE__->register_method({
 	    } elsif ($opt =~ m/^unused\d+$/) {
 		warn "ignoring '$opt', cannot create/restore with unused volume\n";
 		delete $param->{$opt};
+	    } elsif ($opt =~ m/^net\d+$/) {
+		my $net = PVE::LXC::Config->parse_lxc_network($param->{$opt});
+		$net->{'firewall'} = 1 if !defined($net->{'firewall'});
+		$no_disk_param->{$opt} = PVE::LXC::Config->print_lxc_network($net);
 	    } else {
 		$no_disk_param->{$opt} = $value;
 	    }
-- 
2.11.0




More information about the pve-devel mailing list