avahi-autoipd fails because network interface name is too long

Bug #1666900 reported by Paul Boven
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
avahi (Ubuntu)
New
Undecided
Unassigned

Bug Description

Trying to use avahi-autoipd on a USB network interface, which gets created when I connect a USB gadget (g_ether) device (my raspberry pi zero). Avahi-autoipd fails to assign an IPv4LL address, and instead reports:

# avahi-autoipd enp0s29u1u2
Found user 'avahi-autoipd' (UID 110) and group 'avahi-autoipd' (GID 120).
Successfully called chroot().
Successfully dropped root privileges.
Starting with address 169.254.7.125
Callout BIND, address 169.254.7.125 on interface enp0s29u1u2
client: RTNETLINK answers: Numerical result out of range
Script execution failed with return value 2
Successfully claimed IP address 169.254.7.125

Although avahi-autoipd claims that the IP address gets configured, ifconfig shows that it didn't succeed.

The root cause is that the label for the interface exceeds the maximum length of 15 characters. This happens in line 44 of /etc/avahi/avahi-autoipd.action:

ip addr add "$3"/16 brd 169.254.255.255 label "$2:avahi" scope link dev "$2"

With $2 the interface name, and $3 the IPv4LL address that it wants to claim.

Interface names and label names can only be 15 characters in length, this is a kernel limitation. IF_NAMESIZE = 16, leaving 15 chars for the name, see /usr/include/net/if.h and IFNAMSIZ in the kernel includes.

The rather long interface name, appended with ":avahi", exceeds this length. This results in the 'Numerical result out of range' error message.

Workaround: I've edited the /etc/avahi/avahi-autopid.action script to only append ":a" for the label (lines 44 and 50) ,and in this case it works as designed.

avahi-autoipd should perhaps check that the label does not exceed this limit of 15 characters.

Note that the label must start with the full interface name, see ip-address(8).

A more compact interface name would be helpful, as these long interface names tend to break
other things as well. The kernel assigns 'usb0', but this gets changed right away.

This occurs on both 16.04 and 16.10, haven't tried any other versions yet.

Revision history for this message
Paul Boven (p-boven) wrote :

Happened to connect my Pi Zero through a hub today. The interface name on the PC becomes "enp0s26u1u3u3i1" which itself is already 15 characters, so no room at all to append a label.

Revision history for this message
Trent Lloyd (lathiat) wrote :

Paul: Could you file this in the upstream bug tracker here?
https://github.com/lathiat/avahi/issues/new

We should probably just drop reliance on the label and store state somehow

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.