Monday, 19 December 2016

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

[ TL;DR: Skip to "Adding dummy0 interface to the distro" ]

Hi,

as most of you know I am working on the printing stack, and one part of
it is IPP-over-USB. IPP is the Internet Printing Protocol, a
sophisticated network protocol to access printers and multi-function
devices in a way that one cannot only send out print jobs, but also
monitor their status, and especially poll capability info from the
printers. The latter allows for using printers without drivers (=
printer-model-specific software and/or data) as long as the printer
knows a standardized language.

To not confine IPP and so driverless printing to network printers,
IPP-over-USB was introduced, which allows to use IPP also on
USB-connected printers. For this I am maintaining ippusbxd:

https://github.com/tillkamppeter/ippusbxd

In the beginning, I simply mirrored an IPP-over-USB printer to
localhost:60000 (and following ports if there is more than one printer)
so that the IPP backend of CUPS can access it like a network printer.

Then I ran into a problem: Printer setup tools like
system-config-printer and the built-in CUPS tool http://localhost:631/
do not auto-discover a printer on localhost:60000 also cups-browsed, a
daemon to auto-setup network printers does not discover such a printer.
The auto discovery is done via Bonjour (Avahi on Linux) and ippusbxd is
not broadcasting the printers via Avahi.

Now I added the Avahi broadcasting to ippusbxd and ran into another
problem: Avahi does not broadcast on the loopback interface "lo". So it
cannot broadcast a service on localhost (note that I only want to
broadcast it on the local machine, not on the network). "lo" does not
support multicast devices.

So I googled and posted on the Avahi mailing list and ended up with

http://unix.stackexchange.com/questions/151980/how-can-i-use-avahi-without-a-network-connection

making me try the "dummy0" device and it works for me (after adding
functionality for selecting the interface to broadcast on to ippusbxd).

I add the interface

sudo modprobe dummy
sudo ifconfig dummy0 10.0.0.1 netmask 255.255.255.0 multicast
sudo ifconfig dummy0 up multicast

and then run ippusbxd like that:

ippusbxd -v 0x03F0 -m 0xC211 -p 60000 -i dummy0

This mirrors the USB printer with VID 0x03F0 and PID 0xC211 to
10.0.0.1:60000 and broadcasts it only on my local machine via
Bonjour/Avahi. cups-browsed picks up the broadcast and auto-creates a
driverless print queue for this printer then.


Adding dummy0 interface to the distro
-------------------------------------

What I would like to do is to add the "dummy0" interface as a
local-only, multicast interface to the distro, either as a default part
like "lo" or initiated by the maintainer scripts of the ippusbxd Debian
package (or the printing snap).

WDYT?

Does it cause any problems using "dummy0" for a production purpose? Is
there any better way? Perhaps even one which would allow me to work with
localhost?

How should I implement this? Simply run above commands from maintainer
scripts of ippusbxd? Get them run when the first IPP-over-USB printer is
detected via UDEV? Or implementation in network-manager or so?

Till

--
ubuntu-devel mailing list
[email protected]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-devel