[pve-devel] [PATCH firewall 1/5] add dhcp6 option

Wolfgang Bumiller w.bumiller at proxmox.com
Tue Jan 26 10:22:49 CET 2016


---
 src/PVE/API2/Firewall/VM.pm |  5 +++++
 src/PVE/Firewall.pm         | 14 +++++++++++++-
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/src/PVE/API2/Firewall/VM.pm b/src/PVE/API2/Firewall/VM.pm
index f483491..02bad4f 100644
--- a/src/PVE/API2/Firewall/VM.pm
+++ b/src/PVE/API2/Firewall/VM.pm
@@ -28,6 +28,11 @@ my $option_properties = {
 	type => 'boolean',
 	optional => 1,
     },
+    dhcp6 => {
+	description => "Enable DHCPv6.",
+	type => 'boolean',
+	optional => 1,
+    },
     policy_in => {
 	description => "Input policy.",
 	type => 'string',
diff --git a/src/PVE/Firewall.pm b/src/PVE/Firewall.pm
index 8976bad..75809ea 100644
--- a/src/PVE/Firewall.pm
+++ b/src/PVE/Firewall.pm
@@ -1915,6 +1915,18 @@ sub ruleset_create_vm_chain {
 	}
     }
 
+    if ($ipversion == 6 && !(defined($options->{dhcp6}) && $options->{dhcp6} == 0)) {
+	if ($direction eq 'OUT') {
+	    ruleset_generate_rule($ruleset, $chain, $ipversion,
+				  { action => 'PVEFW-SET-ACCEPT-MARK',
+				    proto => 'udp', sport => 546, dport => 547 });
+	} else {
+	    ruleset_generate_rule($ruleset, $chain, $ipversion,
+				  { action => 'ACCEPT',
+				    proto => 'udp', sport => 547, dport => 546 });
+	}
+    }
+
     if ($direction eq 'OUT') {
 	if (defined($macaddr) && !(defined($options->{macfilter}) && $options->{macfilter} == 0)) {
 	    ruleset_addrule($ruleset, $chain, "-m mac ! --mac-source $macaddr -j DROP");
@@ -2311,7 +2323,7 @@ sub parse_vmfw_option {
 
     my $loglevels = "emerg|alert|crit|err|warning|notice|info|debug|nolog";
 
-    if ($line =~ m/^(enable|dhcp|macfilter|ips):\s*(0|1)\s*$/i) {
+    if ($line =~ m/^(enable|dhcp6?|macfilter|ips):\s*(0|1)\s*$/i) {
 	$opt = lc($1);
 	$value = int($2);
     } elsif ($line =~ m/^(log_level_in|log_level_out):\s*(($loglevels)\s*)?$/i) {
-- 
2.1.4





More information about the pve-devel mailing list