Repository navigation
fix(desec): only send dynDNS updates when the public IP changed - #9079
Conversation
|
Looks good. Nits:
Also, I noticed that an invalid token or deleted domain is retried every 10 minutes indefinitely. It's unrelated to #8997, but maybe you have an idea how it could be addressed as well. |
|
Thanks for the review!
Thanks! Should be addressed by the latest commit. Please have another look :)
I moved this to an issue for now so that we dont forget and address this going forward: #9097 |
6657da1 to
26a013d
Compare
|
rebased and fixed conflicts |
|
@pabzm should be fixed now! Please check again! :) |
|
Playwright failure is unrelated |
pabzm
left a comment
There was a problem hiding this comment.
Thanks for the adaptions! I have two suggestions for how to make the code much less verbose and also more comprehensible.
| $packed = inet_pton($ip); | ||
| if ($packed === false) { | ||
| return $ip; | ||
| } | ||
|
|
||
| $normalized = inet_ntop($packed); | ||
|
|
||
| return $normalized === false ? $ip : $normalized; |
There was a problem hiding this comment.
This could be reduced to
| $packed = inet_pton($ip); | |
| if ($packed === false) { | |
| return $ip; | |
| } | |
| $normalized = inet_ntop($packed); | |
| return $normalized === false ? $ip : $normalized; | |
| return inet_ntop(inet_pton($ip) ?: ''); |
And since it's then a oneliner method, that is called only from one other line of code, it could be inlined there.
There was a problem hiding this comment.
adjusted in 80c8218. please check again!
There was a problem hiding this comment.
I really dislike that new code, it is not comprehensible and not well structured in my eyes. But I'm tired of arguing against such AI code, so I'll stop here.
From a functional point of view it probably does what it should, I guess.
deSEC's terms of use ask clients to only send update requests when there is something to update. Look up the current public addresses via deSEC's check-IP services and compare them to the addresses last sent (kept locally, since AIO's token is the only client changing these records), so no update is sent when nothing changed. Also send myipv4/myipv6 explicitly, using 'preserve' for a family that is unchanged or could not be determined, so a manually added record of the other address family is no longer deleted. Add a random 10-60s delay to the updater loop to spread out requests. See #8997 Signed-off-by: Simon L. <szaimen@e.mail.de> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Simon L. <szaimen@e.mail.de>
Send both address families together whenever an update is needed. A family whose address can no longer be determined is now sent empty, so a record that AIO itself published earlier is removed (e.g. when the host lost IPv6). 'preserve' is only used for a family AIO never published, so manually added records are still kept. Clear the remembered addresses on registration, so a domain that was deleted at deSEC and re-created under the same name gets its records again right away instead of only once the IP changes. Assisted-by: ClaudeCode:claude-opus-5-5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Simon L. <szaimen@e.mail.de>
Container start times are not synchronised across instances, so the delay did not spread out requests to deSEC in practice. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Simon L. <szaimen@e.mail.de>
The addresses stored locally miss changes made to the records outside of AIO, which would then never be corrected. Querying deSEC's authoritative nameservers directly compares against the real records and is not affected by caching or split-brain DNS of the local resolver. Locally, only which address families AIO published is kept, so that a manually added record is never removed. The test mock answers DNS queries itself, so tests never query deSEC. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Simon L. <szaimen@e.mail.de>
Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Simon L. <szaimen@e.mail.de>
Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Simon L. <szaimen@e.mail.de>
Both the check-IP and the DNS lookup validated addresses and then normalised them separately; one helper keeps that logic in one place. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Simon L. <szaimen@e.mail.de>
80c8218 to
5985801
Compare
|
Just rebased to hopefully fix the playwright test |
pabzm
left a comment
There was a problem hiding this comment.
This is not good code, but I guess it does what it's supposed to do.
|
This is now released with v15.2.0 Beta. Testing and feedback is welcome! See https://github.com/nextcloud/all-in-one#how-to-switch-the-channel |
deSEC's terms of use ask clients to only send update requests when there is something to update. Look up the current public addresses via deSEC's check-IP services and compare them to the addresses last sent (kept locally, since AIO's token is the only client changing these records), so no update is sent when nothing changed.
Also send myipv4/myipv6 explicitly, using 'preserve' for a family that is unchanged or could not be determined, so a manually added record of the other address family is no longer deleted. Add a random 10-60s delay to the updater loop to spread out requests.
Summary
3. to review, feature component)AI (if applicable)