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/Toolkit.js          |  6 ++++++
 www/manager/Utils.js            |  1 +
 www/manager/node/NetworkEdit.js | 39 +++++++++++++++++++++++++++++++++++++++
 www/manager/node/NetworkView.js | 28 ++++++++++++++++++++++++----
 4 files changed, 70 insertions(+), 4 deletions(-)

diff --git a/www/manager/Toolkit.js b/www/manager/Toolkit.js
index c9a354f..15ba103 100644
--- a/www/manager/Toolkit.js
+++ b/www/manager/Toolkit.js
@@ -25,6 +25,12 @@ Ext.apply(Ext.form.field.VTypes, {
     IP6AddressText:  gettext('Example') + ': 2001:DB8::42',
     IP6AddressMask: /[A-Fa-f0-9:]/,
 
+    IP6Prefix:  function(v) {
+        return IP6_prefix_match.test(v);
+    },
+    IP6PrefixText:  gettext('Example') + ': 112',
+    IP6PrefixMask: /[0-9]/,
+
     IP6CIDRAddress:  function(v) {
        return IP6_cidr_match.test(v);
     },
diff --git a/www/manager/Utils.js b/www/manager/Utils.js
index 7632822..49fa02c 100644
--- a/www/manager/Utils.js
+++ b/www/manager/Utils.js
@@ -45,6 +45,7 @@ var IPV6_REGEXP = "(?:" +
 var IP6_match = new RegExp("^(?:" + IPV6_REGEXP + ")$");
 var IP6_cidr_match = new RegExp("^(?:" + IPV6_REGEXP + ")\/[0-9]{1,3}?$");
 var IP6_bracket_match = new RegExp("^\\[(" + IPV6_REGEXP + ")\\]");
+var IP6_prefix_match = new RegExp("^(?:12[0-8]|1[01][0-9]|[1-9]?[0-9])$");
 
 var IP64_match = new RegExp("^(?:" + IPV6_REGEXP + "|" + IPV4_REGEXP + ")$");
 
diff --git a/www/manager/node/NetworkEdit.js b/www/manager/node/NetworkEdit.js
index 072bee6..1ed81d9 100644
--- a/www/manager/node/NetworkEdit.js
+++ b/www/manager/node/NetworkEdit.js
@@ -233,6 +233,45 @@ 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: 'pvetextfield',
+                   deleteEmpty: !me.create,
+                   fieldLabel: gettext('Prefix length'),
+                   vtype: 'IP6Prefix',
+                   name: 'netmask6',
+                   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


_______________________________________________
pve-devel mailing list
pve-devel@pve.proxmox.com
http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to