What's new

how to read /sbin/ddns_custom_updated

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

OK, back to my complex DDNS script: While double NAT, I check external IP on my own. If external IP is the same as 30 minutes before, I know that since I saved previous value.

Now, nothing changed, I need not issue:

/sbin/ddns_custom_updated 1

as nothing changed. So, no point to update anything and write to NVRAM. Correct?
If you are doing all that already and handling all the update activity, there's no reason for you to call ddns_custom_updated at all. You can write a status file with the last address to /tmp (no nvram), and just make sure your scripts handles the case where the file isn't present as would occur during a reboot.
 
... no reason for you to call ddns_custom_updated at all. You can write a status file with the last address to /tmp (no nvram), and just make sure your scripts handles the case where the file isn't present as would occur during a reboot.

OK, that seems inline with my backiup plan. My problem is I am not familiar with memory strucutre of router. If I can write to RAM, that is perfect for me. It will get lost after a reboot, and that is exatly what I need.

I will try that, as if it is written to RAM, I am more comfortable with that solution than using unkinown variables that seem to suit me but I have no control over.
 
seems to me I would kill for a source code change in last line:

instead of

return 0;

to be

return (ddns_status);

I posted the C function from the firmware. That function call returns a value that isn't reused by the rest of the firmware, that's why it returns 0.
 
I posted the C function from the firmware. That function call returns a value that isn't reused by the rest of the firmware, that's why it returns 0.

I thought my intention was clear :) No help from a function that would always return 1 instead of current 0, if we read the code :) We would need another else where we would read the actual value and then return it somehow.

My problem is that this function makes no sense. Value ddns_status never changes. It is possibly in undefined value only after a router boot and before the first call ever. It would actually suit my need :) Butm it should have been defined and changed accordingly, instead of being hardcoded to 1.
 
Forget about the return code from the C function, I only pasted it to show you the list of nvram variables that get set after you run ddns_custom_updated with a value of 1. ddns_updated isn't intended for what you want to do. That flag is only to determine if a DDNS update was completed. Once it's completed, it will always remain set to 1 until the route reboot. That flag isn't intended to validate whether a DDNS record is up-to-date or not.
 

Similar threads

Latest threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top