x86_64 implementation of gethostbyname like feature
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Yann Weber 9a30de2531 Adds README.md & enhance DEBUG support for Makefile 3 weeks ago
src Adds options for QTYPE in r8 argument of dns_getsockaddrbyname 2 years ago
tests_cmp Refactoring code & compilation to produce proper .a static library files 2 years ago
tests_mock Adds options for QTYPE in r8 argument of dns_getsockaddrbyname 2 years ago
Makefile Adds README.md & enhance DEBUG support for Makefile 3 weeks ago
README.md Adds README.md & enhance DEBUG support for Makefile 3 weeks ago
hostbyname.s Adds options for QTYPE in r8 argument of dns_getsockaddrbyname 2 years ago

README.md

Lib sockaddrbyname

Small x86_64 linux assembly library for ultra basic DNS resolution.

Supports AAAA (ipv6) and A (ipv4) requests and export some utility function, handy when working with string representation of IP addresses and struct sockaddr.

The library is shipped with a hostbyname demo program.

Dependencies

  • nasm
  • make
  • ar

Demo program dependencies

  • ld

Tests dependencies

  • ld
  • gcc
  • python3

Building

The library

Run make lib and the static library src/libsockaddrbyname.a should be available.

The demo program

Run make

Run the tests

Run make -j4 tests (adapt the -j4 flag to your machine).

Using the demo program

./hostbyname gnu.org 1.1.1.1

Using the library

Exported functions can be found in src/*.s files header. The main function are found in src/getsockaddrbyname.s.

Linking against the library

With libsockaddrbyname.a in a /PATH/TO/ directory.

ld -s -melf_x86_64 -o foo.bin main.o files.o /PATH/TO/libsockaddrbyname.a

or

ld -s -melf_x86_64 -L /PATH/TO/ -o foo.bin main.o files.o -lsockaddrbyname