dyndns: return `nochg` when nothing changed
Maintainers usually reply within 14 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 62/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- python
- Domain
- api, documentation
Research direction
Start with DynDNS12UpdateView.get in api/desecapi/views/dyndns.py and PDNSChangeTracker in api/desecapi/pdns_change_tracker.py, then check RRset.save_records and RRsetSerializer.update to confirm an unchanged request fires no signal. Add a has_changes check to the tracker and return nochg instead of good when nothing changed. Done means an unchanged update returns nochg, a real change still returns good, and the dyndns docs describe both responses.
Written by the indexing model from the issue text.
Description
Current behaviour
DynDNS12UpdateView.get (api/desecapi/views/dyndns.py:384) always answers good, even when the
request did not change any record. Clients cannot tell a real update from a no-op heartbeat.
dyndns2 defines nochg for this case. ddclient supposedly warns and backs off on nochg, so that's good for our infrastructure.
We could also add per-domain tracking of nochg events, and rate limit them more aggressively / reach out to fix config etc.
Observation
The information is already available when the response is built. On an unchanged request:
RRset.save_records(api/desecapi/models/records.py:198) deletes nothing and inserts nothing, so noRRsignal fires;RRsetSerializer.update(api/desecapi/serializers/records.py:573) only saves the RRset when the TTL differs, otherwise it bumpstouchedvia a querysetupdate(), which fires no signal;- hence
PDNSChangeTrackerrecords nothing and_compute_changes()is empty, so no pdns call and no AXFR.
PDNSChangeTracker.__enter__ resets the tracking dicts; but __exit__ does not clear them, so they can be inspected after the with block.
Suggested change
- Add a read-only
has_changesproperty toPDNSChangeTracker(api/desecapi/pdns_change_tracker.py), e.g.any(self._rr_set_additions.values()) or any(self._rr_set_modifications.values()) or any(self._rr_set_deletions.values()) or self._domain_additions or self._domain_deletions(or store the result of_compute_changes()in__exit__). - In
DynDNS12UpdateView.get, keep the tracker in a variable and branch on it:with PDNSChangeTracker() as tracker: # requires adding `return self` to `__enter__` serializer.save() return Response("good" if tracker.has_changes else "nochg", content_type="text/plain") - Docs: "If successful, the server will return a response with status
200 OKand a body of eithergood(records were changed) ornochg(the records already had the requested values), as per the dyndns2 protocol specification."
Detection note
A real address change always deletes at least one RR before inserting the new ones, so the tracker registers it via post_delete even though bulk_create emits no post_save. Creating the RRset on a first update and TTL-only changes fire RRset signals directly. All of these stay good.
- Dominant language
- Python
- Stars
- 678
- Forks
- 74
- Avg merge
- 7d 23h
- Merged PRs (30d)
- 1
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from desec-io/desec-stack
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
desec-io/desec-stack#1312 ·
Maintainers usually reply within 14 days
-
UI bug and inconsistency: Adding IPv6 address/netmask to token IP restriction silently errors outOpen
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
desec-io/desec-stack#1310 ·
Maintainers usually reply within 14 days
-
Here-strings in request examplesPossibly taken @jadhavgaurav claimed this 28 days ago. Opendocs help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
desec-io/desec-stack#1286 · 1 comment ·
Maintainers usually reply within 14 days
-
api enhancement prio: low
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
desec-io/desec-stack#1246 · 1 comment ·
Maintainers usually reply within 14 days
-
enhancement gui help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
desec-io/desec-stack#1181 · 1 comment ·
Maintainers usually reply within 14 days
All issues in desec-io/desec-stack
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
Maintainers usually reply within 1 day
-
Unused loot bag group names left in dreamcraft en_US.langPossibly taken A pull request linked to this issue is open or already merged. OpenStatus: Triage Suggestion
Difficulty 1/5 Under an hour Newbie friendliness 90/100
GTNewHorizons/GT-New-Horizons-Modpack#27789 ·
Maintainers usually reply within 1 day
-
bug frontend sev-5
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
-
core good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
b4b code health next
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
ESCOMP/CTSM#4330 · 1 comment ·
Maintainers usually reply within 1 day