Hello,

I may have found a reproducer and the explanation for this bug.

Reproducer
==========
1) Set a trusty VM with one NIC
2) Install tftp-hpa
3) From the VM console :
$ sudo -s
# service tftpd-hpa status
tftpd-hpa start/running, process 867
# service tftpd-hpa stop
tftpd-hpa stop/waiting
# ps aux | grep tftp | grep -v grep
#
# ifdown eth0
# service tftpd-hpa start
# ps aux | grep tftp | grep -v grep
#


If the NIC is down, the tftpd daemon will not start and the following will 
appear in /var/log/syslog :
Jan  9 16:12:26 TrustyS in.tftpd[1114]: cannot resolve local IPv6 bind address: 
::(Name or service not known)

Starting tftpd while the network interface is still down, while rare,
may happen is situation where the NIC is slow to come up or, for
instance, for people using tftpd on laptop with Wifi only connectivity.

This is caused by the fact that tftpd will do a call to getaddrinfo() if
an IPv6 host address is set, which is the case with [::]:69. This call
fails if the NIC is not configured.

If no IPv6 address is set and :69 is used, the codepath reverts to
INADDR_ANY which does not do the getaddrinfo(). The tftpd daemon binds
correctly to the interface even if it is down as we can see :

# service tftpd-hpa stop
# ifdown eth0
# /usr/sbin/in.tftpd --listen --user tftp --address :69 --secure 
/var/lib/tftpboot
# ps aux | grep tftp | grep -v grep
root      1712  0.0  0.0  15120   152 ?        Ss   16:25   0:00 
/usr/sbin/in.tftpd --listen --user tftp --address :69 --secure /var/lib/tftpboot
# lsof -i | grep tftp
in.tftpd  1712  root    4u  IPv4  10675      0t0  UDP *:tftp
in.tftpd  1712  root    5u  IPv6  10676      0t0  UDP *:tftp

Debian is currently debating the same issue in https://bugs.debian.org
/cgi-bin/bugreport.cgi?bug=771441 and the current option is to change
the default to :69.

I suggest to fix this bug by using the :69 value that will eventually
also be used in debian.

** Bug watch added: Debian Bug tracker #771441
   http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=771441

** Changed in: tftp-hpa (Ubuntu)
       Status: Expired => New

** Changed in: tftp-hpa (Ubuntu)
     Assignee: (unassigned) => Louis Bouchard (louis-bouchard)

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1342580

Title:
  tftpd-hpa doesn't start on boot

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/tftp-hpa/+bug/1342580/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to