OpenPrinting / OpenPrinting/ipp-usb

OCI/ROCK Container: Avahi sees printer as remote service not as local service

Open
#110 11 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
209
Forks
33
PR merge metrics
No merged PRs in 30d

Description

When running the (immutable) OCI container of ipp-usb, from PR #106, from https://github.com/im0vishal/ipp-usb/tree/immutable-ipp-usb, commit 44b2745f ("Updated ReadMe to include runtime flags for data persistence"), started with the command lines

sudo docker volume create ipp-usb-data
sudo docker run -d --network host -v /dev/bus/usb:/dev/bus/usb:ro -v ipp-usb-data:/var/lib/ipp-usb --device-cgroup-rule='c 189:* rmw' --name ipp-usb ipp-usb:latest

the avahi-daemon on the host system sees ipp-usb as a remote service and not as a local service. So running ippfind --local does not list the printer but ippfind --remote lists it.

Especially client tools then do not replace the network host name (XXX.local) by localhost, and if ipp-usb is providing the printer only on the local machine (lo network interface) the printer cannot be accessed as the URI ipp://XXX.local:60000/ipp/print is advertised and used, while ipp://localhost:60000/ipp/print works.

This can be caused by the container running its own avahi-daemon and so the host's avahidaemon receiving the service from the container's avahi-daemon and not directly.

In avahi (I am using 0.8.0), the function avahi_server_is_service_local() in the file avahi-core/server.c of the Avahi source code is actually determining whether a service is local or not.

The function is left by the return 0; in these lines:

    e = find_entry(s, interface, protocol, key);
    avahi_key_unref(key);
    if (!e)
        return 0;

and therefore the service is see as not local. This I found out by applying the attached patch to the Avahi source code and looking for XXX in the /var/log/syslog file and I saw XXX6 but not XXX10 right afterwards.

check-local.patch.txt

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with the Docker command and inspect the attached check-local.patch.txt alongside avahi-core/server.c, especially avahi_server_is_service_local(). Compare the host and container Avahi behavior using ippfind --local and ippfind --remote; done means the printer is recognized as a local service and advertised with the usable local URI.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker
Domain
infrastructure, networking
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.