[pve-devel] [PATCH v2 3/3] www/network: node networking: ipv6 support

Wolfgang Bumiller w.bumiller at proxmox.com
Thu Jun 25 14:14:49 CEST 2015


IPv6 address shown in cidr notation in the IP address
column, the subnet column only includes the ipv4 subnet
mask, the gateway includes both.
---
 www/manager/node/NetworkEdit.js | 42 +++++++++++++++++++++++++++++++++++++++++
 www/manager/node/NetworkView.js | 28 +++++++++++++++++++++++----
 2 files changed, 66 insertions(+), 4 deletions(-)

diff --git a/www/manager/node/NetworkEdit.js b/www/manager/node/NetworkEdit.js
index 072bee6..733777b 100644
--- a/www/manager/node/NetworkEdit.js
+++ b/www/manager/node/NetworkEdit.js
@@ -233,6 +233,48 @@ Ext.define('PVE.node.NetworkEdit', {
 		    fieldLabel: gettext('Gateway'),
 		    vtype: 'IPAddress',
 		    name: 'gateway'
+		},
+		{
+		    xtype: 'pvetextfield',
+		    deleteEmpty: !me.create,
+		    fieldLabel: gettext('IPv6 address'),
+		    vtype: 'IP6Address',
+		    name: 'address6'
+		},
+		{
+		    xtype: 'numberfield',
+		    deleteEmpty: !me.create,
+		    fieldLabel: gettext('Prefix length'),
+		    name: 'netmask6',
+		    value: '',
+		    minValue: 0,
+		    maxValue: 128,
+		    allowBlank: true,
+		    validator: function(value) {
+			/*jslint confusion: true */
+			if (!me.items) {
+			    return true;
+			}
+			var address = me.down('field[name=address6]').getValue();
+			if (value !== '') {
+			    if (address === '') {
+				return "IPv6 prefix length requires option 'IPv6 address'";
+			    }
+			} else {
+			    if (address !== '') {
+				return "Option 'IPv6 address' requires an IPv6 prefix length";
+			    }
+			}
+
+			return true;
+		    }
+		},
+		{
+		    xtype: 'pvetextfield',
+		    deleteEmpty: !me.create,
+		    fieldLabel: gettext('Gateway'),
+		    vtype: 'IP6Address',
+		    name: 'gateway6'
 		}
 	    ]);
 	}
diff --git a/www/manager/node/NetworkView.js b/www/manager/node/NetworkView.js
index 4b1db77..c45107a 100644
--- a/www/manager/node/NetworkView.js
+++ b/www/manager/node/NetworkView.js
@@ -266,7 +266,17 @@ Ext.define('PVE.node.NetworkView', {
 			{
 			    header: gettext('IP address'),
 			    sortable: true,
-			    dataIndex: 'address'
+			    dataIndex: 'address',
+			    renderer: function(value, metaData, rec) {
+				if (rec.data.address && rec.data.address6) {
+				    return rec.data.address + "<br>"
+				           + rec.data.address6 + '/' + rec.data.netmask6;
+				} else if (rec.data.address6) {
+				    return rec.data.address6 + '/' + rec.data.netmask6;
+				} else {
+				    return rec.data.address;
+				}
+			    }
 			},
 			{
 			    header: gettext('Subnet mask'),
@@ -276,7 +286,16 @@ Ext.define('PVE.node.NetworkView', {
 			{
 			    header: gettext('Gateway'),
 			    sortable: true,
-			    dataIndex: 'gateway'
+			    dataIndex: 'gateway',
+			    renderer: function(value, metaData, rec) {
+				if (rec.data.gateway && rec.data.gateway6) {
+				    return rec.data.gateway + "<br>" + rec.data.gateway6;
+				} else if (rec.data.gateway6) {
+				    return rec.data.gateway6;
+				} else {
+				    return rec.data.gateway;
+				}
+			    }
 			}
 		    ],
 		    listeners: {
@@ -312,8 +331,9 @@ Ext.define('PVE.node.NetworkView', {
 	extend: 'Ext.data.Model',
 	fields: [ 
 	    'iface', 'type', 'active', 'autostart',
-	    'bridge_ports', 'slaves', 'address',
-	    'netmask', 'gateway'
+	    'bridge_ports', 'slaves',
+	    'address', 'netmask', 'gateway',
+	    'address6', 'netmask6', 'gateway6',
 	],
 	idProperty: 'iface'
     });
-- 
2.1.4




More information about the pve-devel mailing list