Using the dummy0 interface for a local-only service to be broadcasted by Avahi

Till Kamppeter till.kamppeter at gmail.com
Fri Dec 30 13:37:14 UTC 2016


On 12/29/2016 10:29 PM, Till Kamppeter wrote:
> do you (does someone) know how to set up the dummy-based interface named
> "ippusbxd" so that it does multicast?
>
>    Till
>

The multicast problem I have solved now. I set up the interface via

sudo ip link add ippusbxd type dummy
sudo ip link set ippusbxd up
sudo ifconfig ippusbxd multicast

The first two lines are Stephane Graber's original suggestion, the third 
I have added and this added the multicast support making ippusbxd 
registering the printer for Avahi/Bonjour broadcast.

For this setup I would also like to know

- Is there any replacement for the third line using the "ip" instead of 
the "ifconfig" command?

- How can I implement these three lines in C?

And now to the real problem:

I register the printer with an Avahi function call like this:

error =
     avahi_entry_group_add_service_strlst(bonjour_data->ipp_ref,
                 (int)if_nametoindex("ippusbxd"),
		AVAHI_PROTO_UNSPEC, 0,
		dnssd_name,
		"_ipp._tcp", NULL, NULL, 60000,
		ipp_txt);

This makes my printer being advertised as an "Internet Printer" on the 
"ippusbxd" interface, IPv6-only, with the IPv6 IP address of the 
"ippusbxd" interface on port 60000.

avahi-discover shows the following record on the local machine:

Service Type: _ipp._tcp
Service Name: Deskjet 2540 series [BR54BFB02C05XK]
Domain Name: local
Interface: ippusbxd IPv6
Address: till-x1carbon.local/fe80::24bb:2ff:fe83:ca22:60000
TXT URF = CP1,IS1-5-7,MT1-2-3-4-5-6-8-9-10-11-12-13,RS300,SRGB24,V1.4,W8,DM1
TXT rp = ipp/print
TXT usb_MDL = Deskjet 2540 series
TXT qtotal = 1
TXT usb_MFG = HP
TXT ty = HP Deskjet 2540 series
TXT product = (Deskjet 2540 series)
TXT priority = 60
TXT Duplex = U
TXT pdl = image/urf,image/jpeg
TXT Color = U
TXT adminurl = http://localhost:60000/
TXT txtvers = 1

The problem is the advertised address ("Address:" line). First, the host 
name of the local box is advertised and, second, the IPv6 IP address has 
no interface specification ("%ippusbxd" or "%25ippusbxd").

A client (like ippfind) picking up this record would create a printer 
URI with the host name, "ipp://till-x1carbon.local:60000/ipp/print" in 
this case ("ipp;//" + <host name> + ":" + <port> + "/" + <TXT rp>).

If a print queue would get set up and printed on it, the host name 
"till-x1carbon.local" would get resolved to the default IPv4 IP address 
of the eth0 interface, 192.168.0.11 for example, and not to the IP of 
the ippusbxd interface. The record even does not have any mention of the 
"ippusbxd" interface.

So first, I would like to know how to assign another host name to the 
fe80::24bb:2ff:fe83:ca22 IPv6 address of the "ippusbxd" interface, like 
for example "ippusbxd-printers", preferably via Zeroconf/Avahi, 
especially as ippusbxd could more easily set it up this way than 
manipulate /etc/hosts. I tried also /etc/hosts, like it is done with 
"localhost" for 127.0.0.1 and ::1, but this did not work for me.

cups-browsed sets up the queues with IP addresses and not with host 
names, but the tools of CUPS itself all use host names.

I tried to set up a CUPS queue manually, using the IP (as I do not have 
a working host name) and the URI (pure IP)

ipp://[fe80::e828:7eff:fe19:9962]:60000/ipp/print

does not work whereas the URI (IP with specification of interface)

ipp://[fe80::e828:7eff:fe19:9962%25ippusbxd]:60000/ipp/print

works perfectly.

So I would need:

- A host name assigned to the "ippusbxd" IP being resolved to 
"[fe80::e828:7eff:fe19:9962%25ippusbxd]" and not only 
"[fe80::e828:7eff:fe19:9962]". This would be required for CUPS' own 
tools to work.

- cups-browsed adding "%25ippusbxd". To implement this I would need a 
method (in C) which finds out that the IP belongs to the "ippusbxd" 
interface.

Any help here is highly appreciated

    Till





More information about the ubuntu-devel mailing list