summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorPreport <erdemgezzz@gmail.com>2024-11-14 23:07:05 +0300
committerPaul Donald <newtwen+github@gmail.com>2024-11-30 05:16:59 +0100
commitf3d26a2a560d8ae526c617eb1c28821ec900fa7a (patch)
tree740caa70d2a4e711b9d37c99eabd5a32552e0440
parent4024dfa3020868638869316f43968e62697868e1 (diff)
luci-proto-3g/ppp/pppossh: fix being unable to set keepalive to 0
Since on openwrt keepalive option defaults to "5 1" when it's not defined: https://github.com/openwrt/openwrt/blob/6720c4ccba256186bf2f1b1edadb851c447e62a5/package/network/services/ppp/files/ppp.sh#L128 Users must be able to set it to 0 to ignore connection failures. Signed-off-by: Erdem Gez <perport@perport.net> Signed-off-by: Paul Donald <newtwen+github@gmail.com>
-rw-r--r--protocols/luci-proto-3g/htdocs/luci-static/resources/protocol/3g.js6
-rw-r--r--protocols/luci-proto-ppp/htdocs/luci-static/resources/protocol/ppp.js6
-rw-r--r--protocols/luci-proto-ppp/htdocs/luci-static/resources/protocol/pppoa.js6
-rw-r--r--protocols/luci-proto-ppp/htdocs/luci-static/resources/protocol/pppoe.js6
-rw-r--r--protocols/luci-proto-ppp/htdocs/luci-static/resources/protocol/pptp.js6
-rw-r--r--protocols/luci-proto-pppossh/htdocs/luci-static/resources/protocol/pppossh.js6
6 files changed, 18 insertions, 18 deletions
diff --git a/protocols/luci-proto-3g/htdocs/luci-static/resources/protocol/3g.js b/protocols/luci-proto-3g/htdocs/luci-static/resources/protocol/3g.js
index 1d599dc822..1e0cb6ba33 100644
--- a/protocols/luci-proto-3g/htdocs/luci-static/resources/protocol/3g.js
+++ b/protocols/luci-proto-3g/htdocs/luci-static/resources/protocol/3g.js
@@ -26,13 +26,13 @@ function write_keepalive(section_id, value) {
f = (f_opt != null) ? +f_opt[0].formvalue(section_id) : null,
i = (i_opt != null) ? +i_opt[0].formvalue(section_id) : null;
- if (f == null || f == '' || isNaN(f))
- f = 0;
+ if (f === '' || isNaN(f))
+ f = null;
if (i == null || i == '' || isNaN(i) || i < 1)
i = 1;
- if (f > 0)
+ if (f !== null)
uci.set('network', section_id, 'keepalive', '%d %d'.format(f, i));
else
uci.unset('network', section_id, 'keepalive');
diff --git a/protocols/luci-proto-ppp/htdocs/luci-static/resources/protocol/ppp.js b/protocols/luci-proto-ppp/htdocs/luci-static/resources/protocol/ppp.js
index 4bd88be5bb..c7f7103125 100644
--- a/protocols/luci-proto-ppp/htdocs/luci-static/resources/protocol/ppp.js
+++ b/protocols/luci-proto-ppp/htdocs/luci-static/resources/protocol/ppp.js
@@ -26,13 +26,13 @@ function write_keepalive(section_id, value) {
f = (f_opt != null) ? +f_opt[0].formvalue(section_id) : null,
i = (i_opt != null) ? +i_opt[0].formvalue(section_id) : null;
- if (f == null || f == '' || isNaN(f))
- f = 0;
+ if (f === '' || isNaN(f))
+ f = null;
if (i == null || i == '' || isNaN(i) || i < 1)
i = 1;
- if (f > 0)
+ if (f !== null)
uci.set('network', section_id, 'keepalive', '%d %d'.format(f, i));
else
uci.unset('network', section_id, 'keepalive');
diff --git a/protocols/luci-proto-ppp/htdocs/luci-static/resources/protocol/pppoa.js b/protocols/luci-proto-ppp/htdocs/luci-static/resources/protocol/pppoa.js
index 0a5dc95788..b1f945caf9 100644
--- a/protocols/luci-proto-ppp/htdocs/luci-static/resources/protocol/pppoa.js
+++ b/protocols/luci-proto-ppp/htdocs/luci-static/resources/protocol/pppoa.js
@@ -11,13 +11,13 @@ function write_keepalive(section_id, value) {
f = (f_opt != null) ? +f_opt[0].formvalue(section_id) : null,
i = (i_opt != null) ? +i_opt[0].formvalue(section_id) : null;
- if (f == null || f == '' || isNaN(f))
- f = 0;
+ if (f === '' || isNaN(f))
+ f = null;
if (i == null || i == '' || isNaN(i) || i < 1)
i = 1;
- if (f > 0)
+ if (f !== null)
uci.set('network', section_id, 'keepalive', '%d %d'.format(f, i));
else
uci.unset('network', section_id, 'keepalive');
diff --git a/protocols/luci-proto-ppp/htdocs/luci-static/resources/protocol/pppoe.js b/protocols/luci-proto-ppp/htdocs/luci-static/resources/protocol/pppoe.js
index 0a891eb32e..d028a18a87 100644
--- a/protocols/luci-proto-ppp/htdocs/luci-static/resources/protocol/pppoe.js
+++ b/protocols/luci-proto-ppp/htdocs/luci-static/resources/protocol/pppoe.js
@@ -11,13 +11,13 @@ function write_keepalive(section_id, value) {
f = (f_opt != null) ? +f_opt[0].formvalue(section_id) : null,
i = (i_opt != null) ? +i_opt[0].formvalue(section_id) : null;
- if (f == null || f == '' || isNaN(f))
- f = 0;
+ if (f === '' || isNaN(f))
+ f = null;
if (i == null || i == '' || isNaN(i) || i < 1)
i = 1;
- if (f > 0)
+ if (f !== null)
uci.set('network', section_id, 'keepalive', '%d %d'.format(f, i));
else
uci.unset('network', section_id, 'keepalive');
diff --git a/protocols/luci-proto-ppp/htdocs/luci-static/resources/protocol/pptp.js b/protocols/luci-proto-ppp/htdocs/luci-static/resources/protocol/pptp.js
index d8fd67166a..3ee6e69cb1 100644
--- a/protocols/luci-proto-ppp/htdocs/luci-static/resources/protocol/pptp.js
+++ b/protocols/luci-proto-ppp/htdocs/luci-static/resources/protocol/pptp.js
@@ -11,13 +11,13 @@ function write_keepalive(section_id, value) {
f = (f_opt != null) ? +f_opt[0].formvalue(section_id) : null,
i = (i_opt != null) ? +i_opt[0].formvalue(section_id) : null;
- if (f == null || f == '' || isNaN(f))
- f = 0;
+ if (f === '' || isNaN(f))
+ f = null;
if (i == null || i == '' || isNaN(i) || i < 1)
i = 1;
- if (f > 0)
+ if (f !== null)
uci.set('network', section_id, 'keepalive', '%d %d'.format(f, i));
else
uci.unset('network', section_id, 'keepalive');
diff --git a/protocols/luci-proto-pppossh/htdocs/luci-static/resources/protocol/pppossh.js b/protocols/luci-proto-pppossh/htdocs/luci-static/resources/protocol/pppossh.js
index 343a56b3ec..bc1345ee3e 100644
--- a/protocols/luci-proto-pppossh/htdocs/luci-static/resources/protocol/pppossh.js
+++ b/protocols/luci-proto-pppossh/htdocs/luci-static/resources/protocol/pppossh.js
@@ -11,13 +11,13 @@ function write_keepalive(section_id, value) {
f = (f_opt != null) ? +f_opt[0].formvalue(section_id) : null,
i = (i_opt != null) ? +i_opt[0].formvalue(section_id) : null;
- if (f == null || f == '' || isNaN(f))
- f = 0;
+ if (f === '' || isNaN(f))
+ f = null;
if (i == null || i == '' || isNaN(i) || i < 1)
i = 1;
- if (f > 0)
+ if (f !== null)
uci.set('network', section_id, 'keepalive', '%d %d'.format(f, i));
else
uci.unset('network', section_id, 'keepalive');