PATCH: Add ipv6 support to libhpmud

Bug #1724089 reported by Thomas Bächler
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
HPLIP
New
Undecided
Unassigned

Bug Description

libhpmud currently only connects to IPv4 hosts. However, newer HP printers fully support IPv6. The attached patch allows using an IPv6 address or a hostname that only resolves to IPv6 in HP URIs. It does not touch any of the discovery protocols which probably only support IPv4 anyway.

With the attached patch, instead of manually creating the socket address and trying to resolve with gethostbyname, the getaddrinfo API is used to perform the task of finding an address to connect to. This makes it possible to use ipv4 addresses, ipv6 addresses or hostnames just the same. The system's C library automatically selects the appropriate addresses (for example, it omits ipv6 addresses if there is no ipv6 connectivity).

Tags: ipv6
Revision history for this message
Thomas Bächler (thomas.arch) wrote :
Revision history for this message
Julian Andres Klode (juliank) wrote :

Unfortunately, things are not that easy in practice as they might be in theory. The patch just aimlessly connects to things in a loop which can easily break.

I just want to note this, as I dealt with this in APT. APT did the looping and connect thing, albeit with timeouts, so a bit better than this. Still, we had plenty of reports from users with broken IPv6 networking where apt failed to connect in a reasonable timeframe.

What we ended up doing in apt was implementing a draft of happy-eyeballs 2: Basically
1. we take the address list returned by the system
2. we re-order it so that it alternates between preferred and other address families
4. loop: we add more connection attempts and select() on them every 200ms

The first connection attempt that succeeds wins.

Revision history for this message
Julian Andres Klode (juliank) wrote :

Which means that currently with the patch you can be stuck indefinitely on a host, or if your lucky, your system has some global timeouts. If you do have timeouts, you need to wait N*T seconds for a timeout of T seconds and N IPv6 addresses before it falls back to IPv4.

(in case anyone is wondering, I got here via a Debian bug report).

Revision history for this message
zdohnal (zdohnal) wrote :

Hi all,

I came here via Fedora report https://bugzilla.redhat.com/show_bug.cgi?id=1969842 .

It would be great if libhpmud had IPv6 in the future.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.