Skip to content

Commit

Permalink
luci-app-ddns: avoid Absent Interface: "wan" when it does not exist
Browse files Browse the repository at this point in the history
and the Alias Interface is likely what we want for the default.

Signed-off-by: Jan Pazdziora <[email protected]>
  • Loading branch information
adelton committed Jan 12, 2025
1 parent 2520588 commit 02e6c4a
Showing 1 changed file with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
'require rpc';
'require fs';
'require form';
'require network';
'require tools.widgets as widgets';

return view.extend({
Expand Down Expand Up @@ -100,6 +101,16 @@ return view.extend({
}, this))
},

/*
* Figure out what the wan interface on the device is.
* Determine if the physical device exist, or if we should use an alias.
*/
callGetWanInterface: function(m, ev) {
return network.getDevice('wan').then(dev => dev.getName())
.catch(err => network.getNetwork('wan').then(net => '@' + net.getName()))
.catch(err => null);
},

/*
* Check whether or not the service is supported.
* If the script doesn't find any JSON, assume a 'service on demand' install.
Expand Down Expand Up @@ -243,7 +254,8 @@ return view.extend({
this.callDDnsGetStatus(),
this.callDDnsGetEnv(),
this.callGenServiceList(),
uci.load('ddns')
uci.load('ddns'),
this.callGetWanInterface()
]);
},

Expand All @@ -252,6 +264,7 @@ return view.extend({
var status = data[1] || [];
var env = data[2] || [];
var logdir = uci.get('ddns', 'global', 'ddns_logdir') || "/var/log/ddns";
var wan_interface = data[5];

var _this = this;

Expand Down Expand Up @@ -851,7 +864,7 @@ return view.extend({
o.modalonly = true;
o.depends("ip_source", "interface")
o.multiple = false;
o.default = 'wan';
o.default = wan_interface;

o = s.taboption('advanced', form.Value, 'ip_script',
_("Script"),
Expand Down

0 comments on commit 02e6c4a

Please sign in to comment.