Discussion:
[avahi] Broadcast IP address and no host name
Till Kamppeter
2016-12-15 17:37:02 UTC
Permalink
Hi,

I have a machine with several network interfaces (lo, dummy0, eth0,
virbr0, ...).

The dummy0 is set up like this:

sudo modprobe dummy
sudo ifconfig dummy0 10.0.0.1 netmask 255.255.255.0 multicast

Then ifconfig gives this:

----------
dummy0: flags=4291<UP,BROADCAST,RUNNING,NOARP,MULTICAST> mtu 1500
inet 10.0.0.1 netmask 255.255.255.0 broadcast 10.0.0.255
inet6 fe80::243f:c8ff:fe47:e4c2 prefixlen 64 scopeid 0x20<link>
ether 26:3f:c8:47:e4:c2 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 631 bytes 488318 (488.3 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

enx00051bb07395: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.0.15 netmask 255.255.255.0 broadcast 192.168.0.255
inet6 fe80::205:1bff:feb0:7395 prefixlen 64 scopeid 0x20<link>
inet6 2804:14c:5ba8:8b97::5 prefixlen 128 scopeid 0x0<global>
inet6 2804:14c:5ba8:8b97:205:1bff:feb0:7395 prefixlen 64
scopeid 0x0<global>
ether 00:05:1b:b0:73:95 txqueuelen 1000 (Ethernet)
RX packets 269444 bytes 294040282 (294.0 MB)
RX errors 2 dropped 0 overruns 0 frame 0
TX packets 179144 bytes 25171845 (25.1 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

eth0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether 54:ee:75:39:35:2c txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 20 memory 0xf0500000-f0520000

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1 (Local Loopback)
RX packets 241623 bytes 79247221 (79.2 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 241623 bytes 79247221 (79.2 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

virbr0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.122.1 netmask 255.255.255.0 broadcast
192.168.122.255
ether fe:54:00:bc:d2:60 txqueuelen 1000 (Ethernet)
RX packets 37468 bytes 3107560 (3.1 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 62801 bytes 86995841 (86.9 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

vnet0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet6 fe80::fc54:ff:febc:d260 prefixlen 64 scopeid 0x20<link>
ether fe:54:00:bc:d2:60 txqueuelen 1000 (Ethernet)
RX packets 37468 bytes 3632112 (3.6 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 66808 bytes 87498217 (87.4 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

----------

Now I broadcast a service (an IPP printer) as follows:

avahi_entry_group_add_service_strlst(bonjour_data->ipp_ref,
(interface ?
(int)if_nametoindex(interface) :
AVAHI_IF_UNSPEC),
AVAHI_PROTO_UNSPEC, 0,
dnssd_name,
"_ipp._tcp", NULL, NULL, port,
ipp_txt);

Where the variable "interface" is set to "enx00051bb07395" to broadcast
only to my wired Ethernet interface with IP 192.168.0.15. "port" is set
to 60000 as my IPP printer is bound to port 60000 (the standard port 631
is already in use by CUPS).

In avahi-discover I have an entry under

enx00051bb07395 -> local -> Internet Printer

with the "Address" set to "till-x1carbon.local/192.168.0.15:60000"
showing my host name, my interface's IP and the port.

I can talk to the printer via 192.168.0.15:60000 but I cannot talk to it
via till-x1carbon.local:60000. When I do

ping till-x1carbon.local

it associates the name till-x1carbon.local to the IP 10.0.0.1 of dummy0,
which is probably the cause of the problem. Calling the name leads to
the wrong IP.

Now utilities of CUPS show the printers as
ipp://till-x1carbon.local:60000/ipp/print making the host name being used.

Now I want to know whether I can modify the Avahi broadcast so that it
does not use the host name any more, so that the "Adress" in
avahi-discover is something like "192.168.0.15/192.168.0.15:60000", not
containing the name and the CUPS tools are forced to display

ipp://192.168.0.15:60000/ipp/print

then. Is this possible?

Till

Loading...