mirror of
https://git.openwrt.org/project/luci.git
synced 2025-10-14 01:32:18 +08:00
luci-proto-3g/ppp/pppossh: fix setting of keepalive
Fix regressions from f3d26a2a56
:
1) It is now possible again to leave the keepalive option empty.
2) It is possible now to set an interval different from 1 without the
need to explicitly set the failure threshold.
Signed-off-by: Erik Karlsson <erik.karlsson@iopsys.eu>
This commit is contained in:

committed by
Paul Donald

parent
7f6c7271b2
commit
a88d4af4e9
@@ -23,15 +23,15 @@ network.registerPatternVirtual(/^3g-.+$/);
|
||||
function write_keepalive(section_id, value) {
|
||||
var f_opt = this.map.lookupOption('_keepalive_failure', section_id),
|
||||
i_opt = this.map.lookupOption('_keepalive_interval', section_id),
|
||||
f = (f_opt != null) ? +f_opt[0].formvalue(section_id) : null,
|
||||
i = (i_opt != null) ? +i_opt[0].formvalue(section_id) : null;
|
||||
f = parseInt(f_opt?.[0]?.formvalue(section_id), 10),
|
||||
i = parseInt(i_opt?.[0]?.formvalue(section_id), 10);
|
||||
|
||||
if (f === '' || isNaN(f))
|
||||
f = null;
|
||||
|
||||
if (i == null || i == '' || isNaN(i) || i < 1)
|
||||
if (isNaN(i))
|
||||
i = 1;
|
||||
|
||||
if (isNaN(f))
|
||||
f = (i == 1) ? null : 5;
|
||||
|
||||
if (f !== null)
|
||||
uci.set('network', section_id, 'keepalive', '%d %d'.format(f, i));
|
||||
else
|
||||
@@ -142,7 +142,7 @@ return network.registerProtocol('3g', {
|
||||
|
||||
o = s.taboption('advanced', form.Value, '_keepalive_interval', _('LCP echo interval'), _('Send LCP echo requests at the given interval in seconds, only effective in conjunction with failure threshold'));
|
||||
o.placeholder = '1';
|
||||
o.datatype = 'min(1)';
|
||||
o.datatype = 'and(uinteger,min(1))';
|
||||
o.write = write_keepalive;
|
||||
o.remove = write_keepalive;
|
||||
o.cfgvalue = function(section_id) {
|
||||
|
@@ -23,15 +23,15 @@ network.registerPatternVirtual(/^ppp-.+$/);
|
||||
function write_keepalive(section_id, value) {
|
||||
var f_opt = this.map.lookupOption('_keepalive_failure', section_id),
|
||||
i_opt = this.map.lookupOption('_keepalive_interval', section_id),
|
||||
f = (f_opt != null) ? +f_opt[0].formvalue(section_id) : null,
|
||||
i = (i_opt != null) ? +i_opt[0].formvalue(section_id) : null;
|
||||
f = parseInt(f_opt?.[0]?.formvalue(section_id), 10),
|
||||
i = parseInt(i_opt?.[0]?.formvalue(section_id), 10);
|
||||
|
||||
if (f === '' || isNaN(f))
|
||||
f = null;
|
||||
|
||||
if (i == null || i == '' || isNaN(i) || i < 1)
|
||||
if (isNaN(i))
|
||||
i = 1;
|
||||
|
||||
if (isNaN(f))
|
||||
f = (i == 1) ? null : 5;
|
||||
|
||||
if (f !== null)
|
||||
uci.set('network', section_id, 'keepalive', '%d %d'.format(f, i));
|
||||
else
|
||||
@@ -114,7 +114,7 @@ return network.registerProtocol('ppp', {
|
||||
|
||||
o = s.taboption('advanced', form.Value, '_keepalive_interval', _('LCP echo interval'), _('Send LCP echo requests at the given interval in seconds, only effective in conjunction with failure threshold'));
|
||||
o.placeholder = '1';
|
||||
o.datatype = 'min(1)';
|
||||
o.datatype = 'and(uinteger,min(1))';
|
||||
o.write = write_keepalive;
|
||||
o.remove = write_keepalive;
|
||||
o.cfgvalue = function(section_id) {
|
||||
|
@@ -8,15 +8,15 @@ network.registerPatternVirtual(/^pppoa-.+$/);
|
||||
function write_keepalive(section_id, value) {
|
||||
var f_opt = this.map.lookupOption('_keepalive_failure', section_id),
|
||||
i_opt = this.map.lookupOption('_keepalive_interval', section_id),
|
||||
f = (f_opt != null) ? +f_opt[0].formvalue(section_id) : null,
|
||||
i = (i_opt != null) ? +i_opt[0].formvalue(section_id) : null;
|
||||
f = parseInt(f_opt?.[0]?.formvalue(section_id), 10),
|
||||
i = parseInt(i_opt?.[0]?.formvalue(section_id), 10);
|
||||
|
||||
if (f === '' || isNaN(f))
|
||||
f = null;
|
||||
|
||||
if (i == null || i == '' || isNaN(i) || i < 1)
|
||||
if (isNaN(i))
|
||||
i = 1;
|
||||
|
||||
if (isNaN(f))
|
||||
f = (i == 1) ? null : 5;
|
||||
|
||||
if (f !== null)
|
||||
uci.set('network', section_id, 'keepalive', '%d %d'.format(f, i));
|
||||
else
|
||||
@@ -100,7 +100,7 @@ return network.registerProtocol('pppoa', {
|
||||
|
||||
o = s.taboption('advanced', form.Value, '_keepalive_interval', _('LCP echo interval'), _('Send LCP echo requests at the given interval in seconds, only effective in conjunction with failure threshold'));
|
||||
o.placeholder = '1';
|
||||
o.datatype = 'min(1)';
|
||||
o.datatype = 'and(uinteger,min(1))';
|
||||
o.write = write_keepalive;
|
||||
o.remove = write_keepalive;
|
||||
o.cfgvalue = function(section_id) {
|
||||
|
@@ -8,15 +8,15 @@ network.registerPatternVirtual(/^pppoe-.+$/);
|
||||
function write_keepalive(section_id, value) {
|
||||
var f_opt = this.map.lookupOption('_keepalive_failure', section_id),
|
||||
i_opt = this.map.lookupOption('_keepalive_interval', section_id),
|
||||
f = (f_opt != null) ? +f_opt[0].formvalue(section_id) : null,
|
||||
i = (i_opt != null) ? +i_opt[0].formvalue(section_id) : null;
|
||||
f = parseInt(f_opt?.[0]?.formvalue(section_id), 10),
|
||||
i = parseInt(i_opt?.[0]?.formvalue(section_id), 10);
|
||||
|
||||
if (f === '' || isNaN(f))
|
||||
f = null;
|
||||
|
||||
if (i == null || i == '' || isNaN(i) || i < 1)
|
||||
if (isNaN(i))
|
||||
i = 1;
|
||||
|
||||
if (isNaN(f))
|
||||
f = (i == 1) ? null : 5;
|
||||
|
||||
if (f !== null)
|
||||
uci.set('network', section_id, 'keepalive', '%d %d'.format(f, i));
|
||||
else
|
||||
@@ -74,7 +74,7 @@ return network.registerProtocol('pppoe', {
|
||||
|
||||
o = s.taboption('advanced', form.Value, '_keepalive_interval', _('LCP echo interval'), _('Send LCP echo requests at the given interval in seconds, only effective in conjunction with failure threshold'));
|
||||
o.placeholder = '1';
|
||||
o.datatype = 'min(1)';
|
||||
o.datatype = 'and(uinteger,min(1))';
|
||||
o.write = write_keepalive;
|
||||
o.remove = write_keepalive;
|
||||
o.cfgvalue = function(section_id) {
|
||||
|
@@ -8,15 +8,15 @@ network.registerPatternVirtual(/^pptp-.+$/);
|
||||
function write_keepalive(section_id, value) {
|
||||
var f_opt = this.map.lookupOption('_keepalive_failure', section_id),
|
||||
i_opt = this.map.lookupOption('_keepalive_interval', section_id),
|
||||
f = (f_opt != null) ? +f_opt[0].formvalue(section_id) : null,
|
||||
i = (i_opt != null) ? +i_opt[0].formvalue(section_id) : null;
|
||||
f = parseInt(f_opt?.[0]?.formvalue(section_id), 10),
|
||||
i = parseInt(i_opt?.[0]?.formvalue(section_id), 10);
|
||||
|
||||
if (f === '' || isNaN(f))
|
||||
f = null;
|
||||
|
||||
if (i == null || i == '' || isNaN(i) || i < 1)
|
||||
if (isNaN(i))
|
||||
i = 1;
|
||||
|
||||
if (isNaN(f))
|
||||
f = (i == 1) ? null : 5;
|
||||
|
||||
if (f !== null)
|
||||
uci.set('network', section_id, 'keepalive', '%d %d'.format(f, i));
|
||||
else
|
||||
@@ -87,7 +87,7 @@ return network.registerProtocol('pptp', {
|
||||
|
||||
o = s.taboption('advanced', form.Value, '_keepalive_interval', _('LCP echo interval'), _('Send LCP echo requests at the given interval in seconds, only effective in conjunction with failure threshold'));
|
||||
o.placeholder = '1';
|
||||
o.datatype = 'min(1)';
|
||||
o.datatype = 'and(uinteger,min(1))';
|
||||
o.write = write_keepalive;
|
||||
o.remove = write_keepalive;
|
||||
o.cfgvalue = function(section_id) {
|
||||
|
@@ -8,15 +8,15 @@ network.registerPatternVirtual(/^pppossh-.+$/);
|
||||
function write_keepalive(section_id, value) {
|
||||
var f_opt = this.map.lookupOption('_keepalive_failure', section_id),
|
||||
i_opt = this.map.lookupOption('_keepalive_interval', section_id),
|
||||
f = (f_opt != null) ? +f_opt[0].formvalue(section_id) : null,
|
||||
i = (i_opt != null) ? +i_opt[0].formvalue(section_id) : null;
|
||||
f = parseInt(f_opt?.[0]?.formvalue(section_id), 10),
|
||||
i = parseInt(i_opt?.[0]?.formvalue(section_id), 10);
|
||||
|
||||
if (f === '' || isNaN(f))
|
||||
f = null;
|
||||
|
||||
if (i == null || i == '' || isNaN(i) || i < 1)
|
||||
if (isNaN(i))
|
||||
i = 1;
|
||||
|
||||
if (isNaN(f))
|
||||
f = (i == 1) ? null : 5;
|
||||
|
||||
if (f !== null)
|
||||
uci.set('network', section_id, 'keepalive', '%d %d'.format(f, i));
|
||||
else
|
||||
@@ -110,7 +110,7 @@ return network.registerProtocol('pppossh', {
|
||||
|
||||
o = s.taboption('advanced', form.Value, '_keepalive_interval', _('LCP echo interval'), _('Send LCP echo requests at the given interval in seconds, only effective in conjunction with failure threshold'));
|
||||
o.placeholder = '1';
|
||||
o.datatype = 'min(1)';
|
||||
o.datatype = 'and(uinteger,min(1))';
|
||||
o.write = write_keepalive;
|
||||
o.remove = write_keepalive;
|
||||
o.cfgvalue = function(section_id) {
|
||||
|
Reference in New Issue
Block a user