[pve-devel] [PATCH] add ipaddress option to net interface

Alexandre Derumier aderumier at odiso.com
Wed Jun 11 04:01:05 CEST 2014


used by firewall for ipfilter.
(could be used later for dhcp too)

Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 PVE/QemuServer.pm |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index e1b85c3..96a8a7b 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -478,7 +478,7 @@ my $nic_model_list_txt = join(' ', sort @$nic_model_list);
 my $netdesc = {
     optional => 1,
     type => 'string', format => 'pve-qm-net',
-    typetext => "MODEL=XX:XX:XX:XX:XX:XX [,bridge=<dev>][,rate=<mbps>][,tag=<vlanid>][,firewall=0|1]",
+    typetext => "MODEL=XX:XX:XX:XX:XX:XX [,bridge=<dev>][,rate=<mbps>][,tag=<vlanid>][,ipaddress=<ipaddress>][,firewall=0|1]",
     description => <<EODESCR,
 Specify network devices.
 
@@ -1279,6 +1279,8 @@ sub parse_net {
             $res->{tag} = $1;
         } elsif ($kvp =~ m/^firewall=(\d+)$/) {
 	    $res->{firewall} = $1;
+        } elsif ($kvp =~ m/^ipaddress=(\S+)$/) {
+	    $res->{ipaddress} = $1;
 	} else {
 	    return undef;
 	}
@@ -1298,6 +1300,7 @@ sub print_net {
     $res .= ",bridge=$net->{bridge}" if $net->{bridge};
     $res .= ",rate=$net->{rate}" if $net->{rate};
     $res .= ",tag=$net->{tag}" if $net->{tag};
+    $res .= ",ipaddress=$net->{ipaddress}" if $net->{ipaddress};
     $res .= ",firewall=$net->{firewall}" if $net->{firewall};
 
     return $res;
-- 
1.7.10.4




More information about the pve-devel mailing list