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

duckdns provider fix ipv6 update #542

Merged
merged 6 commits into from
Oct 14, 2023
Merged

duckdns provider fix ipv6 update #542

merged 6 commits into from
Oct 14, 2023

Conversation

michelwi
Copy link
Contributor

@michelwi michelwi commented Oct 13, 2023

I am trying to use the duckdns dynamic dns service to assign/update an ipv6. The hostname only has an AAAA record (ipv6) and the A record (ipv4) is empty.
I have encountered two issues that should be fixed with this PR:

First: according to the api documentation

If you do not specify the IP address, then it will be detected - this only works for IPv4 addresses
You can put either an IPv4 or an IPv6 address in the ip parameter
If you want to update BOTH of your IPv4 and IPv6 records at once, then you can use the optional parameter ipv6

The current code in case of ipv4 correctly uses the ip parameter. But in case of ipv6, the ipv6 parameter is used alone without the ip parameter.
This leads to the following behavior:

  • The AAAA record is updated with the new ipv6 as expected
  • As the ip parameter is empty, the ipv4 is automatically detected by duckdns
  • The A record is updated with the found ipv4

In my case, the found ipv4 is some isp provided NAT that I have no control over. So the current behavior is wrong for my use case, but I think it is also not what is intended here.

The proposed change sends both ipv4 and ipv6 to the ip parameter which is the correct thing according to the documentation when updating the ipv6 only.

Edit: after some testing on the command line it seems that the current implementation is correct and the documentation is wrong. I have reverted this part of the PR.
Edit2: the parameter name was wrong. That was why I got an ipv4 update with your code but an ipv6 update on the command line.

Second: when verifying the updated ip, the current code assumes that the ip is ipv4 always. This PR adds the ipv6 case.

Co-authored-by: michelwi <michelwi@users.noreply.github.com>
@qdm12 qdm12 merged commit e635b19 into qdm12:master Oct 14, 2023
2 checks passed
@qdm12
Copy link
Owner

qdm12 commented Oct 14, 2023

Awesome, thanks for the contribution 💯 !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants