Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

luci-app-ddns: avoid Absent Interface: "wan" when the physical device does not exist #7555

Merged
merged 1 commit into from
Jan 22, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading