question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

luci-ddns writes incorrect service_name when "--custom--" service is chosen

See original GitHub issue

luci-ddns write incorrect service into /etc/config/ddns when “–custom–” service is chosen option service_name '-' where this line should be deleted or commented ( https://openwrt.org/docs/guide-user/services/ddns/client#custom_service1 )

This would result in “No update_url found/defined or no update_script found/defined! - TERMINATE” error when it try to update

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:8
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
tavinuscommented, Apr 1, 2022

I was having a look at the code and I think your solution above is not ideal. From what I can understand, we need to suppress the service_name='-' ONLY when saving the configuration file.

So, that is when we call the uci.set command on service_name
Here

uci.set('ddns',section_id,'service_name',service_value);

As it is already done in other parts of the code, we need to check if it is a custom script and then IGNORE the uci.set command for the service_name.

We can do that with

if (service_value != '-') { uci.set('ddns',section_id,'service_name',service_value); }

Was quite the pain to test this in a running OpenWRT router. Browser cache also interfering.

Also, this is done when you select the service type and click CREATE SERVICE (pre-creation)


Patching existing install

(EDIT) Because I had to do the same thing in other routers, I made this one-liner that uses sed to patch it. Should be safe, because if anything in the long pattern changes, it will do nothing. Use it at your own risk tho.

SRC="return m.save(function(){uci.add('ddns','service',section_id);uci.set('ddns',section_id,'service_name',service_value);uci.set('ddns',section_id,'use_ipv6',ipv6_value);})" && DST="return m.save(function(){uci.add('ddns','service',section_id);if(service_value!='-'){uci.set('ddns',section_id,'service_name',service_value);}uci.set('ddns',section_id,'use_ipv6',ipv6_value);})" && sed -i "s/$SRC/$DST/g" /www/luci-static/resources/view/ddns/overview.js


This is what the sed command does:

File: /www/luci-static/resources/view/ddns/overview.js

Original:

return m.save(function(){uci.add('ddns','service',section_id);uci.set('ddns',section_id,'service_name',service_value);uci.set('ddns',section_id,'use_ipv6',ipv6_value);})

Changed:

return m.save(function(){uci.add('ddns','service',section_id);if(service_value!='-'){uci.set('ddns',section_id,'service_name',service_value);}uci.set('ddns',section_id,'use_ipv6',ipv6_value);})

Reload uhttp

/etc/init.d/uhttpd reload

Your browser may be stubborn about the Javascript cache though. Try in another browser to be sure (or inspect the source).

I think this is a simple working solution. I probably won’t be able to make a PR any time soon.

Cheers!

Gus

1reaction
feckertcommented, Oct 26, 2021

The problem is this line. https://github.com/openwrt/luci/blob/master/applications/luci-app-ddns/htdocs/luci-static/resources/view/ddns/overview.js#L517 Please change this line from service_name.value('-',"-- " + _("custom") + " --"); to service_name.value('',"-- " + _("custom") + " --");

Please report back if this solve the issue.

Maybe we also need an service_name.rmempty = true; there?

Read more comments on GitHub >

github_iconTop Results From Across the Web

[OpenWrt Wiki] DDNS client
This guide will help you configure your DDNS service, so that your router ... A possible solution for this option is to use...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found