Package: isc-dhcp-client
Version: 4.3.1-6+deb8u2
Severity: normal
Tags: upstream

Dear Maintainer,

dhclient does not cleanly support interface names with lengths > 13.

debian's packaging of systemd can routinely generate interface names with 
length 15.

If the length is 15, dhclient fails with messages like this:

        debian@beaglebone:~/isc-dhcp-client/isc-dhcp-4.3.1$ sudo dhclient -d 
enxe46f13f3df43
        Internet Systems Consortium DHCP Client 4.3.1
        Copyright 2004-2014 Internet Systems Consortium.
        All rights reserved.
        For info, please visit https://www.isc.org/software/dhcp/

        Bind socket to interface: No such device

        If you think you have received this message due to a bug rather
        than a configuration issue please read the section on submitting
        bugs on either our web page at www.isc.org or in the README file
        before submitting a bug.  These pages explain the proper
        process and the information we find helpful for debugging..

        exiting.

If the length is 14, dhclient fails with messages like this:

        debian@beaglebone:~/isc-dhcp-client/isc-dhcp-4.3.1$ sudo dhclient -d 
enxe46f13f3df4
        Internet Systems Consortium DHCP Client 4.3.1
        Copyright 2004-2014 Internet Systems Consortium.
        All rights reserved.
        For info, please visit https://www.isc.org/software/dhcp/

        Listening on LPF/enxe46f13f3df4/e4:6f:13:f3:df:43
        Sending on   LPF/enxe46f13f3df4/e4:6f:13:f3:df:43
        Sending on   Socket/fallback
        DHCPDISCOVER on enxe46f13f3df4 to 255.255.255.255 port 67 interval 3
        send_packet: No such device
        dhclient.c:1966: Failed to send 300 byte long packet over 
enxe46f13f3df4 interface.
        DHCPDISCOVER on enxe46f13f3df4 to 255.255.255.255 port 67 interval 6
        send_packet: No such device
        dhclient.c:1966: Failed to send 300 byte long packet over 
enxe46f13f3df4 interface.

Interface names lengths of no more than 13 worked as expected:

        debian@beaglebone:~/isc-dhcp-client/isc-dhcp-4.3.1$ sudo dhclient -d 
enxe46f13f3df
        Internet Systems Consortium DHCP Client 4.3.1
        Copyright 2004-2014 Internet Systems Consortium.
        All rights reserved.
        For info, please visit https://www.isc.org/software/dhcp/

        Listening on LPF/enxe46f13f3df/e4:6f:13:f3:df:43
        Sending on   LPF/enxe46f13f3df/e4:6f:13:f3:df:43
        Sending on   Socket/fallback
        DHCPDISCOVER on enxe46f13f3df to 255.255.255.255 port 67 interval 7
        DHCPDISCOVER on enxe46f13f3df to 255.255.255.255 port 67 interval 14
        DHCPREQUEST on enxe46f13f3df to 255.255.255.255 port 67
        DHCPOFFER from 192.168.1.1
        DHCPACK from 192.168.1.1
        bound to 192.168.1.159 -- renewal in 35492 seconds.
        The difference in behaviour is apparently caused by the name being 
truncated before the trailing
        nul in the first case, but being truncated immediately prior to the 
trailing nul in the second case.

The root cause is a strncpy in common/lpf.c:

      /* Bind to the interface name */
        memset (&sa, 0, sizeof sa);
        sa.sa_family = AF_PACKET;
        strncpy (sa.sa_data, (const char *)info -> ifp, sizeof sa.sa_data);
        if (bind (sock, &sa, sizeof sa)) {
                ....

which silently performs a truncated copy of 16 byte structure (info->lfp) into 
a 14 byte structure.

Since the results of silently truncating the name are undefined, it would be 
better 
if dhclient instead aborted with an error message indicating that the long 
interface name
cannot be successfully copied. 

Note that systemd can generate 15 character interface names derived from a mac 
address of the 
underlying device though, by default, it does not.

However, debian's packaging of udevd includes  
/lib/udev/rules.d/73-usb-net-by-mac.rules which 
causes USB ethernet devices on at least some platforms, BeagleBone, to generate 
long
MAC-address based device names using the net_id udev plugin.

To experiment with different interface name lengths, I added 
/etc/udev/rules.d/99-local.rules 

#
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="ax88179_178a", ATTR{dev_id}=="0x0", 
ATTR{type}=="1", NAME="enxe46f13f3df43"

To test different lengths, I truncated NAME to different lengths, then 
re-hotplugged the relevant device.


-- System Information:
Debian Release: 8.7
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: armhf (armv7l)

Kernel: Linux 4.4.26-ti-r59 (SMP w/1 CPU core)
Locale: LANG=en_AU.UTF-8, LC_CTYPE=en_AU.UTF-8 (charmap=locale: Cannot set 
LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages isc-dhcp-client depends on:
ii  debianutils       4.4+b1
ii  iproute2          3.16.0-2
ii  isc-dhcp-common   4.3.1-6+deb8u2
ii  libc6             2.19-18+deb8u7
ii  libdns-export100  1:9.9.5.dfsg-9+deb8u10
ii  libirs-export91   1:9.9.5.dfsg-9+deb8u10
ii  libisc-export95   1:9.9.5.dfsg-9+deb8u10

isc-dhcp-client recommends no packages.

Versions of packages isc-dhcp-client suggests:
pn  avahi-autoipd  <none>
pn  resolvconf     <none>

-- debconf information:
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = (unset),
        LC_ALL = (unset),
        LANG = "en_AU.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory

Reply via email to