NLnetLabs / ldns

LDNS is a DNS library that facilitates DNS tool programming
https://nlnetlabs.nl/ldns
BSD 3-Clause "New" or "Revised" License
299 stars 99 forks source link

I'm having a guy who is trying to integrate it into an OS #209

Closed Zero3K closed 1 year ago

Zero3K commented 1 year ago

He has managed to get it to compile but it is not working. It is giving a "No internet connection" or similar error. The code for the components that were modified can be found at the following URLs:

https://github.com/mann3616/reactos/tree/master/dll/win32/dnsapi https://github.com/mann3616/reactos/tree/master/sdk/lib/3rdparty/ldns

wtoorop commented 1 year ago

Can you be a bit more specific? Ideally with a program to reproduce the error? Thanks!

Zero3K commented 1 year ago

Well, it is not a program. It is an operating system. https://github.com/mann3616/reactos/ can be compiled by following the instructions at https://reactos.org/wiki/A_Layman%27s_Guide_-_How_to_Compile_ReactOS. Then you can do the following:

  1. Make a Virtual Machine in VirtualBox with it booting using the compiled bootcd.iso.
  2. Install ReactOS.
  3. Go through the GUI portion of the install and confirm the downloading of the Gecko package.
  4. It will state that you do not have an internet connection.
wtoorop commented 1 year ago

That seems a bit too much, sorry. Would be nice if you could isolate a specific issue, ideally with an example program that produces the error that we can compile and run to reproduce.

Zero3K commented 1 year ago

The dnsapi.dll is reporting (dll/win32/dnsapi/query.c:531) R_ResolverQuery() returned 14. It seems that it is not recognizing that an internet connection is available. I can provide a link to an ISO if that will be enough.

wtoorop commented 1 year ago

That isn't a ldns return code. ldns error/return codes are one of those: https://nlnetlabs.nl/documentation/ldns/error_8h.html#a11f34802bb1624af46054952e3b853af

Can you pinpoint the specific ldns function that does the wrong thing and tell me what it does wrong?

Zero3K commented 1 year ago

I do not know. Nothing about LDNS is logged in the output that I get via its serial outputting of debug output.

mann3616 commented 1 year ago

@wtoorop I am the guy doing this. The issue is that we are not DNS experts and I tried my best to replicate the ADNS library usage in dll/win32/dnsapi/query.c with LDNS. We found out now that in the ADNS library the ReactOS devs added extra functions, namely, adns_init and adns_finish functions. We are trying to find a replication using LDNS code. My guess is that I dont initialize the ldns_resolver correctly so it has no idea what socket to use or that there is a connection in the first place.

Recap: The main places to look at is dll/win32/dnsapi/query.c in the Query_Main function (my fork has the LDNS replacement and the original ReactOS repo will have the original ADNS code that I am trying to replicate) and look at sdk/lib/3rdparty/adns/src/setup.c in the adns_init function and possibly other functions located there as well like ccf_search, adns_finish.

Zero3K commented 1 year ago

It is having an issue with creating the socket that is used when connecting to the DNS server(s) for the resolution of the host name. Here's a screenshot of the differences between two debug logs (the one on the left is the DNS resolver that ReactOS is currently using and the one on the right is LDNS).

image

Zero3K commented 1 year ago

He has now got it to where it is able to resolve some but not all of the host names that are being connected to in the tests that we are doing to it.

Zero3K commented 1 year ago

@FGasper Can you help him get it working properly?

FGasper commented 1 year ago

@Zero3K I don’t believe I can, sorry.

Zero3K commented 1 year ago

Here's the latest modified version of dnsapi and LDNS 1.8.3:

dnsapi.zip ldns.zip

Zero3K commented 1 year ago

He managed to get it working under ReactOS.

maertsen commented 1 year ago

He managed to get it working under ReactOS.

Zero3K commented 1 year ago

Now I am waiting for them to merge it. Its PR is at https://github.com/reactos/reactos/pull/5018.