Fixes for MDNS device communication errors
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
HPLIP |
Opinion
|
Undecided
|
Unassigned |
Bug Description
In my home network, the HP printer/scanner (ENVY 5530) often fails with messages like this:
hp-toolbox[7119]: [7119]: error: Unable to communicate with device (code=12): hp:/net/
I've tracked this down to two problems with the MDNS implementation in HPLIP:
1. On a multi-homed host, HPLIP uses only one interface for MDNS multicast send and receive. This leads to failure if the printer is not on the "default" network. The code uses just INADDR_ANY in its multicast IP_MULTPATH_IF and IP_ADD_MEMBERSHIP setsockopt calls, meaning that the kernel has to figure out the interface to use. This fails if the system has no default route, or if the HP device is on a different network than the default route. The solution is to receive and send multicast on all interfaces.
2. MDNS authorities (including HP printers) don't answer every query, especially the same query is repeated quickly. The latter happens when the HP tools start, causing the MDNS lookup procedure to fail and the "communication error" to be detected. This can be solved by retrying the query after a short wait (1-2s).
I have created patches that solve both problems. Tested in my home network.
Many HPLIP bug reports on (code=12) errors can be found on the web; I have reason to believe that these patches would fix some of them, and would obsolete questionable advices that are found in various places ("disable SELinux"; "disable the Firewall").
I am attaching the "hp-check" output as required by your bug reporting guidelines but I assure you that it has no relevance for the problem. My patched hplip runs smoothly although hp-check reports many missing dependencies.
I am working under OpenSUSE Tumbleweed, hplip package 3.16.5. I double-checked against 3.16.7 and have no reason to believe that any of the problems I encountered are fixed there, as the respective code has remained unchanged.
Changed in hplip: | |
status: | New → Opinion |
In addition to the previous patch, which enables receiving of
MDNS packets on all interfaces, this patch causes hplip
to also send queries on all interfaces.