inadyn icon indicating copy to clipboard operation
inadyn copied to clipboard

Add IPv4/v6 dual-stack to the configuration

Open jorhett opened this issue 6 years ago • 40 comments

Add to plugin

  • address_type for address types supported
  • checkip_name_v6 for IPv6 lookup

Add to provider configuration

  • addrtype for type of address to submit
  • checkip_cmd_v6 for IPv6 command to lookup IP

NOTE: This adds the necessary types to the configuration. It does not (yet) change the behavior of the stack. I wanted to stop here and get feedback from @troglobit on whether or not I'm going in the right direction, or if my rusty C skills are making him puke ;-)

When done will address #52

jorhett avatar Oct 21 '18 07:10 jorhett

It's almost like riding a bike :)

In general I think the PR looks good. I have a few comments though:

  • I'd prefer a different namespace for the new additions: e.g. checkip6_foo for variables and checkip6-foo for configuration parameters
  • The constructs with strstr() looks a bit fragile, but I have no other suggestion so let's just go with that for now
  • Currently it doesn't build, but I guess you're on top of that. If not, see the Travis-CI build (red 'x') above

Also, it'd be great to get some feedback from @acolomb who I know have been working on this as well.

Minor note, when finalizing your commits for this pull request, add one (relevant) that has "Fix #52: some-descriptive-text". Makes it easier for me to track and automatically close GitHub issues when I merge the pull request :)

troglobit avatar Oct 21 '18 10:10 troglobit

So the reason I didn't use a different namespace is because it would appear that only two parameters need to be changed. All the other variables in that namespace can be shared AFAICT.

I can still use the different namespace, but it wouldn't be obvious to the eye that it is shared.

jorhett avatar Oct 22 '18 16:10 jorhett

Fair enough, I guess I can add an alias later on if it bothers me :)

troglobit avatar Oct 23 '18 05:10 troglobit

Guys, how should we proceed with this one? @acolomb @jorhett

troglobit avatar Oct 26 '18 18:10 troglobit

I couldn't ponder about it further, but so far I think it would not really disturb my plans. Keeping one or two legacy option names for backwards compatibility wouldn't make much of a difference. But it's not thought through to the end.

acolomb avatar Oct 26 '18 19:10 acolomb

OK, thanks for the feedback @acolomb! I'd really like to get something in there since this has been an oft asked question, so if we can reach 70% of use-cases I'd be very happy.

troglobit avatar Oct 26 '18 19:10 troglobit

Maybe we should finalize work on this. I'm willing to help out to push this through the door, what about you @jorhett ?

troglobit avatar Apr 27 '19 07:04 troglobit

I am looking forward to this, as the inadyn-mt has had support for some time but no SSL, and it is kinda broken in other ways.

I ended up trying to patch inadyn-mt for using libcurl, to no good.

However I didn't realize that this fork uses the native tcp.c stuff.

nihilus avatar Apr 30 '19 19:04 nihilus

@acolomb the only thing I see missing is a fixup for cache.c which itself has an IPv4-only nslookup() function.

nihilus avatar Apr 30 '19 20:04 nihilus

Maybe we should finalize work on this. I'm willing to help out to push this through the door, what about you @jorhett ?

I'm totally onboard and as of this week have time to work on it again ;-) Every single one of my nodes is either dual stack or v6 only so I've got lots of testing options.

jorhett avatar Apr 30 '19 21:04 jorhett

@jorhett Awesome, great to see you again! :-)

troglobit avatar May 01 '19 10:05 troglobit

I will check the fix out tomorrow at work, and try to fix cache.c (should be pretty much a cut 'n paste from the sntpd code).

nihilus avatar May 01 '19 17:05 nihilus

Sorry I've not been following up on this project. Family life has been keeping me way too busy to get some coding done.

No objections from my side for going ahead with this approach. My "big plans" have always been about making IPv6 a first class citizen and give more explicit control, especially when IPv4 is not even involved. However, the current "tacked on" state of IPv6 support can definitely be improved as well.

acolomb avatar May 01 '19 21:05 acolomb

Amazing feedback suddenly in this tread! :heart:

Remember to sync with each other, use this PR if you like.

troglobit avatar May 01 '19 22:05 troglobit

One issue is "ddns.c:125:37: error: 'ddns_info_t' has no member named 'checkip_url_v6'"

nihilus avatar May 02 '19 08:05 nihilus

That's a very old patch. I'll push a rebase plus namespace changes that @troglobit recommended this weekend. Let's discuss from that point.

jorhett avatar May 02 '19 16:05 jorhett

@jorhett, neat

nihilus avatar May 02 '19 20:05 nihilus

I must say I am not totally confident how 'addrtype = ' works, should it be 'addrtype = 4,6' for dual updates?

nihilus avatar Oct 23 '19 16:10 nihilus

It should also be noted that FreeDNS suppports IPv6 perfectly fine.

nihilus avatar Oct 23 '19 16:10 nihilus

Hate to be the party crasher but I found some obvious flaws in it and the current code. inadyn should in a dual-stacked environment update both A and AAAA records (if it doesn't have an IP it should use 0.0.0.0 and ::, to make sure end-to-end DNS works), it should also create a socket of respective type when connecting to the server to resolve it's IP addresses.

nihilus avatar Oct 23 '19 17:10 nihilus

With "current code", do you mean current master or the code in this pull request?

troglobit avatar Oct 23 '19 18:10 troglobit

What I am using is a "mishmash" based on current dev-branch, combined with this PR and some fixes for the company I work at (nothing special really, just disabling SSL-strict by default and disable the caching and reading IPs from flat files, some extra syslogging which doesn't really makes sense and rudimentary i18n-support, and using the proxy-interface for SO_BINDTODEVICE).

nihilus avatar Oct 23 '19 18:10 nihilus

OK. Looking forward to reviewing your take on things.

troglobit avatar Oct 23 '19 18:10 troglobit

I can give an update, I did duplicate much code and elements in the structs. Implemented request_v6, response_v6, and setup_v6 (I know that passing a boolean or piggybacking more on the adresstype introduced in this PR would be more appropriate). I also created specific IPv4 and IPv6 sockets by passing the family to the http_init(). The biggest pitfall was that if getaddrinfo() in tcp.c fails we must set it to AF_UNSPEC and try again (FreeDNS is ipv4-only but supports quad-A records). Dynu worked out of the box for me. I will test some more providers tomorrow.

Also I made sure not to assume the path for IPv6 would be the very same; it is a matter of provider implementation and might change in the future.

nihilus avatar Oct 24 '19 17:10 nihilus

And I must say this code is like rewrite of the original code, the old code was such a PITA I quickly gave up making it work with IPv6.

nihilus avatar Oct 24 '19 17:10 nihilus

@nihilus That's fine, as long as the patches are readable and doesn't mess up the IPv4 code paths (more than necessary). Really hoping to get this into In-a-dyn soon, since it's the main blocker for the next release.

troglobit avatar Dec 09 '19 12:12 troglobit

Well, I did find it working but there are some buffer overruns and the code is pretty intrusive.

nihilus avatar Dec 10 '19 19:12 nihilus

@nihilus Sorry to hear that. Do you have any plans on trying to fix it and submit here, or do you recommend we proceed with the current code and "fork" our two efforts? Like I said, I consider the IPv6 issues the main blocker for the next release, which is quite delayed by now. So I'd like to get some sort of commitment, so I can make a decision going forward.

troglobit avatar Dec 11 '19 07:12 troglobit

Yes, but I don't think I'll have something ready for a pull request before january.

nihilus avatar Dec 11 '19 09:12 nihilus

@nihilus OK, I'll hold off the release until then. Looking forward to it!

troglobit avatar Dec 11 '19 10:12 troglobit