[avahi] Advertizing a service only on the local machine
Till Kamppeter
till.kamppeter at gmail.com
Tue Dec 13 20:58:14 UTC 2016
Hi,
I am leading the OpenPrinting project and currently I am working on
driverless (IPP Everywhere, AirPrint) printing.
Driverless means that not driver is needed on the client. As driver we
consider any kind of printer-model-specific software or data.
Driverless printers advertise themselves by Bonjour and are accessible
via IPP. IPP is used as the client can poll capability information from
the printer, so that no printer-model-specific data (the printer's
capabilities) is needed. The printer also works with at least one known
Page Description Language (PDL) so that no printer-model-specific
software (filter for proprietary PDL) is needed.
This works fine in a network. I have made cups-browsed (part of
cups-filters which I am maintaining) listening to Bonjour broadcasts of
driverless printers to automatically set up print queues for them.
Now there are also IPP-over-USB printers. These printers have IPP
implemented via USB, so that they can get queried for driverless
printing like IPP network printers, and one can use the printer's web
administration interface. I am maintaining ippusbxd which is a simple
daemon mapping the the input and output to and from the printer to
localhost:60000 (or other ports). With this one can set up the
IPP-over-USB printer like an IPP network printer and also driverless
printing works.
What is missing is that the IPP-over-USB printer gets advertised to the
local cups-browsed for automatic print queue setup, as the printer is
not Bonjour-broadcasting. So I tried to fire up an appropriate Avahi
service from ippusbxd. What I need is that the service's address is
"localhost:6000" and/or "127.0.0.1:60000" and that service is only
advertised on the local machine, not on other machines on the local
network, because the printer is only accessible from the local machine.
I have tried to add the service via
avahi_entry_group_add_service_strlst(bonjour_data->ipp_ref,
AVAHI_IF_UNSPEC,
AVAHI_PROTO_UNSPEC, 0,
dnssd_name,
"_ipp._tcp", NULL,
NULL, port,
ipp_txt);
and then the service gets advertised in the whole local network with the
network IP and host name of my computer. The remote machines are not
able to access the printer.
With
avahi_entry_group_add_service_strlst(bonjour_data->ipp_ref,
AVAHI_IF_UNSPEC,
AVAHI_PROTO_UNSPEC, 0,
dnssd_name,
"_ipp._tcp", NULL,
"localhost", port,
ipp_txt);
I get a host name error (-3).
With
avahi_entry_group_add_service_strlst(bonjour_data->ipp_ref,
AVAHI_IF_UNSPEC,
AVAHI_PROTO_UNSPEC, 0,
dnssd_name,
"_ipp._tcp", NULL,
"localhost.local", port,
ipp_txt);
the service gets broadcasted, but it apperas also on remote machines
(see output of avahi-discover) but when one clicks on the list entry in
avahi-discover, the details do not get shown. One gets a timeout after
some seconds.
How do I have to proceed? I do not want to create D-Bus communication
between ippusbxd and cups-browsed, nor do I want to build ippusbxd into
cups-browsed.
Till
More information about the avahi
mailing list