-
Notifications
You must be signed in to change notification settings - Fork 13
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
Implement host lookups #49
Commits on May 10, 2023
-
Co-Authored-By: Félix Baylac-Jacqué <felix@alternativebit.fr>
Configuration menu - View commit details
-
Copy full SHA for 23289bd - Browse repository at this point
Copy the full SHA 23289bdView commit details -
protocol: add HstResponseHeader and serialization test
Co-Authored-By: Félix Baylac-Jacqué <felix@alternativebit.fr>
Configuration menu - View commit details
-
Copy full SHA for a045349 - Browse repository at this point
Copy the full SHA a045349View commit details -
src/handlers: implement serialize_host
Also add some error codes used in the response header. Co-Authored-By: Félix Baylac-Jacqué <felix@alternativebit.fr>
Configuration menu - View commit details
-
Copy full SHA for ef805a4 - Browse repository at this point
Copy the full SHA ef805a4View commit details
Commits on May 19, 2023
-
src/handlers.rs: handle GETHOSTBYADDR, GETHOSTBYADDRv6
Co-Authored-By: Félix Baylac-Jacqué <felix@alternativebit.fr>
Configuration menu - View commit details
-
Copy full SHA for ee60daa - Browse repository at this point
Copy the full SHA ee60daaView commit details -
src/handlers: implement GETHOSTBYNAME*
Co-Authored-By: Félix Baylac-Jacqué <felix@alternativebit.fr>
Configuration menu - View commit details
-
Copy full SHA for 2e6ffe6 - Browse repository at this point
Copy the full SHA 2e6ffe6View commit details -
src/protocol: add AiResponse{Header} structs and serialization test
Co-Authored-By: Florian Klink <flokli@flokli.de>
Configuration menu - View commit details
-
Copy full SHA for de9e5f0 - Browse repository at this point
Copy the full SHA de9e5f0View commit details -
src/handlers: Implement the GETAI operation
We implement the GETAI (aka. get address info) operation. Most of the glibc applications will rely on this operation to perform the hostname -> addrs resolutions. We add some unit tests checking that we're correctly serializing the address info header and its payload. The expected data used in these tests has been extracted from various Nscd socket dumps. We also add an integration test checking that getaddrinfo is able to resolve localhost. Co-Authored-By: Florian Klink <flokli@flokli.de>
Configuration menu - View commit details
-
Copy full SHA for 4953d97 - Browse repository at this point
Copy the full SHA 4953d97View commit details -
Handle IPv6-only results even in GETHOSTBYNAME
Previously IPv6-only results would return an empty successful result message. This doesn't seem to be a valid response from the perspective of Glibc. In my case it caused Firefox to crash.
Configuration menu - View commit details
-
Copy full SHA for 96237d8 - Browse repository at this point
Copy the full SHA 96237d8View commit details -
Remove useless lambda and lambda call in serialize_host
We don't have to use a lambda to return a value from a sub-expression. Rust takes the last value in a scope as return value even if it isn't a function.
Configuration menu - View commit details
-
Copy full SHA for f881aac - Browse repository at this point
Copy the full SHA f881aacView commit details -
Move the host serialize code to a associated function
The function belongs to the data format and not to the actual processing logic. This isn't a clean cut just yet all over the codebase but moving this very fragile piece into its own function will enable us to test it in isolation.
Configuration menu - View commit details
-
Copy full SHA for f0a162b - Browse repository at this point
Copy the full SHA f0a162bView commit details -
Make the GETHOSTBYNAMEv6 handling similar to the v4 equivalent
This makes the result filtering similar and thus should be less confusing.
Configuration menu - View commit details
-
Copy full SHA for 1f386d7 - Browse repository at this point
Copy the full SHA 1f386d7View commit details -
Use as_slice().to_vec() instead of manually pre-allocated buffers
This is as efficient as doing the manual pre-allocation as the `to_vec` method will use the length of the slice for the initial size allocation of the vector.
Configuration menu - View commit details
-
Copy full SHA for c6773d6 - Browse repository at this point
Copy the full SHA c6773d6View commit details -
Make Host::serialize able to serialize empty address lists
Previously this would produce a malformed packet as far as glibc is concerned. If there are no addresses the "found" field should not be one and the other lookup fields can also be left blank.
Configuration menu - View commit details
-
Copy full SHA for 384182e - Browse repository at this point
Copy the full SHA 384182eView commit details -
Move common HostResponseHeader to const structs
This moves the "well-known" wire format structs to constants that can be reused without having to duplicate their definition all the time.
Configuration menu - View commit details
-
Copy full SHA for 22dda36 - Browse repository at this point
Copy the full SHA 22dda36View commit details -
Configuration menu - View commit details
-
Copy full SHA for 94f54bb - Browse repository at this point
Copy the full SHA 94f54bbView commit details
Commits on Oct 20, 2023
-
gethostbyname/gethostbyaddr: use proper glibc function
We internally used getai to restpond to the gethostbyname/gethostbyaddr operations. Sadly, it does not behave as expected and breaks some tools (like hostname --fqdn, see #4. We FFI the right Glibc gethostbyname_2r/gethostbyaddr_2r (now deprecated) functions and use it to back the GETHOSTBYNAME, GETHOSTBYNAME6, GETHOSTBYADDR, and GETHOSTBYADDR6 Nscd interfaces. Using sockburp, we realized the hostent serialization function was bogus: we totally forgot to serialize the aliases. This commit fixes this and makes sure we're producing bit-to-bit identical results with Nscd for gethostbyname/getaddrinfo. Took me three try to get this right. This is actually the third full rewrite. The Nscd behaviour for these two legacy functions is *really* confusing. We're supposed to ignore the herrno (herrno != errno!!) and set it to 0 if gethostbyaddr/name returns a non-null hostent. If we end up with a null hostent, we return the herrno together with a dummy hostent header. I tried to keep things as safe as possible by extracting the glibc hostent to a proper rust structure. This structure mirrors the libc hostent in a Rust idiomatic way. We should probably try to upstream the FFI part of this commit to the Nix crate at some point. Fixes #4
Configuration menu - View commit details
-
Copy full SHA for 66c79cd - Browse repository at this point
Copy the full SHA 66c79cdView commit details
Commits on Oct 24, 2023
-
Merge pull request #9 from nix-community/nin/ghbn
Gethostbyname: use proper glibc function
Configuration menu - View commit details
-
Copy full SHA for 77fd58d - Browse repository at this point
Copy the full SHA 77fd58dView commit details