dictd icon indicating copy to clipboard operation
dictd copied to clipboard

dictd and IPv6 support

Open mcepl opened this issue 6 years ago • 10 comments

dictd as it stands now (9a2f53e) works only with IPv4 (for example, it still uses gethostbyname function). There were efforts in Red Hat to make all their programs working with IPv6, including this bug for dictd. That included this patch against 1.9.15 by @dkopecek, but the patch has never been finished and applied, AFAIK. It meanwhile bitrotten, so it cannot be directly applied to the current checkout.

Attaching the patch here, so it is preserved for posterity.

mcepl avatar Jan 26 '19 16:01 mcepl

Fixed in dictd-1.13.0. Thanks a lot for pointing out!

cheusov avatar Mar 29 '20 21:03 cheusov

Hmm, rpmlint still complains:

dictd.x86_64: I: binary-or-shlib-calls-gethostbyname /usr/sbin/dictd
The binary calls gethostbyname(). Please port the code to use getaddrinfo().

mcepl avatar Mar 30 '20 12:03 mcepl

Oops. You are right. There are still some gethostbyname :-/

cheusov avatar Mar 30 '20 14:03 cheusov

Is it possible, to listen on all addresses, both IPv4 and IPv6? If yes, how? If not, this would be a good enhancement.

frituc avatar Aug 17 '20 11:08 frituc

Is it possible, to listen on all addresses, both IPv4 and IPv6? If yes, how? If not, this would be a good enhancement.

I have patches against dictd-1.13.1 that do just that, if anyone is interested...

Jamie-Landeg-Jones avatar Jul 24 '24 04:07 Jamie-Landeg-Jones

dictd supports IPv6 in 1.13.1. If you want it to be listening in both, IPv4 and IPv6, you can start it listening to IPv6 --address-family 6 and it will do both.

carlosrodfern avatar Oct 09 '24 04:10 carlosrodfern

Not necessarily. Depends on the OS, and system settings.

You need to set the IPV6_V6ONLY flag to "off" on the socket, hence why I needed the patch.

Also, some systems don't support IPv4 on Ipv6 sockets at all (OpenBSD)

Incidentally, when IPV6_V6ONLY is set, you (obviously) can't bind the socket to listen to a specific address.

Jamie-Landeg-Jones avatar Oct 10 '24 02:10 Jamie-Landeg-Jones

These are my current patches against 1.31.1: dictd.patch

Jamie-Landeg-Jones avatar Oct 10 '24 02:10 Jamie-Landeg-Jones

@Jamie-Landeg-Jones , You are right, ... after I mentioned that I thought of other Unix systems where dictd runs, plus the ipv6 only.

I had started a solution too but using the posix select(..) to try to listen on both sockets by default thinking of Unix. It sort of works but needs some cleanup. I'll see if I can prepare a PR that incorporates also the IPV6_V6ONLY flag.

carlosrodfern avatar Oct 10 '24 04:10 carlosrodfern

It would be nice to have the ability to have listeners on independent sockets (that way you can specify which address to listen on, instead of INADDR_ANY), but I took the lazy way out.

Prior to that, I was running 2 separate dictd instances, but that got a bit heavy when running 252 databases :-) (https://dictionary.catflap.org/?Form=/4)

Jamie-Landeg-Jones avatar Oct 11 '24 14:10 Jamie-Landeg-Jones