return (/^(now|\d{4}-\d{1,2}-\d{1,2}(T\d{1,2}:\d{1,2}:\d{1,2})?)$/).test(v);
},
QemuStartDateText: gettext('Format') + ': "now" or "2006-06-17T16:01:21" or "2006-06-17"',
- IP64AddressList: function(v) {
- var list = v.split(/[\ \,\;]+/);
- var i;
- for (i = 0; i < list.length; i++) {
- if (list[i] == '') {
- continue;
- }
-
- if (!Proxmox.Utils.IP64_match.test(list[i])) {
- return false;
- }
- }
-
- return true;
- },
+ IP64AddressList: v => PVE.Utils.verify_ip64_address_list(v, false),
+ IP64AddressWithSuffixList: v => PVE.Utils.verify_ip64_address_list(v, true),
IP64AddressListText: gettext('Example') + ': 192.168.1.1,192.168.1.2',
IP64AddressListMask: /[A-Fa-f0-9\,\:\.\;\ ]/
});
"Host": 4,
"_default_": 5, // includes custom models
},
+
+ verify_ip64_address_list: function(value, with_suffix) {
+ for (let addr of value.split(/[ ,;]+/)) {
+ if (addr === '') {
+ continue;
+ }
+
+ if (with_suffix) {
+ let parts = addr.split('%');
+ addr = parts[0];
+
+ if (parts.length > 2) {
+ return false;
+ }
+
+ if (parts.length > 1 && !addr.startsWith('fe80:')) {
+ return false;
+ }
+ }
+
+ if (!Proxmox.Utils.IP64_match.test(addr)) {
+ return false;
+ }
+ }
+
+ return true;
+ },
},
singleton: true,
{
xtype: 'proxmoxtextfield',
fieldLabel: gettext('DNS servers'),
- vtype: 'IP64AddressList',
+ vtype: 'IP64AddressWithSuffixList',
allowBlank: true,
emptyText: gettext('use host settings'),
name: 'nameserver',