atftpd: invalid IP address

Bug #972834 reported by Stephen G on 2012-04-03
56
This bug affects 12 people
Affects Status Importance Assigned to Milestone
atftp (Ubuntu)
Undecided
Unassigned

Bug Description

[Impact]
atftpd crashes with the message "atftpd: invalid IP address" in syslog if the parameter "--port XY" isn't given by hand or by "/etc/default/atftpd".

[Text Case]
Unfortunately there is no port set in "/etc/default/atftpd" by default.

Accroding to "man atftpd" it should use some default. "Default is standard
tftp port as determined by getservbyname."

The atftpd seems to stumble doing "getservbyname". This is definetly a BUG.

[Regression Potential]
<fill me in with a discussion of how regressions would typically manifest as a result of this change. It's assumed that all candidate patches are well-tested and have low overall risk of regression; but if there's an area of concern be sure to call it out so testers can check it.>

[Original Report]Cannot start atftpd due to invalid IP address

ProblemType: Bug
DistroRelease: Ubuntu 12.04
Package: atftpd 0.7.dfsg-11
ProcVersionSignature: Ubuntu 3.2.0-21.34-generic 3.2.13
Uname: Linux 3.2.0-21-generic x86_64
NonfreeKernelModules: nvidia
ApportVersion: 2.0-0ubuntu4
Architecture: amd64
Date: Tue Apr 3 16:48:44 2012
EcryptfsInUse: Yes
InstallationMedia: This
ProcEnviron:
 TERM=xterm
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SourcePackage: atftp
UpgradeStatus: No upgrade log present (probably fresh install)
modified.conffile..etc.init.d.atftpd: [modified]
mtime.conffile..etc.init.d.atftpd: 2012-04-03T16:44:43.122900

Related branches

Stephen G (stephengroat) wrote :
Stephen G (stephengroat) wrote :

Error message only appears in /var/log/syslog, will not appear when start atftpd from command line

Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in atftp (Ubuntu):
status: New → Confirmed
Brandon Pierce (ihashacks) wrote :

If invoked with parameters:

atftpd --daemon --no-fork

it exits with $? = 1

If with "--bind-address":

atftpd --daemon --no-fork --bind-address 192.168.77.71

...it will run cleanly and exit with 0 if you keyboard interrupt it. This is on a fresh installation of Precise beta 2 with updates, a single interface (other than loopback) and whether or not IPV6 is disabled in the kernel.

Manually installing version 0.7.dfsg-10 from Oneiric (which works as expected on Oneiric) yeilds the same negative results on Precise as version 0.7.dfsg-11 does. At first glance it doesn't seem like a regression in anything from the changelog of 0.7.dfsg-11:

  * Fixed a potential DoS bug (introduced by the IPv6 patch)
  * Bug fixed: aftpd does not reply properly when there's more than 1 interface
    Closes: #613582, #258998
  * Updated SK and FI debconf translations. Closes: #621007, #620175
  * Bug fixed: Forgets port if Both --port and --bind-address are used.
    Closes: #622840

Brandon Pierce (ihashacks) wrote :

strace of atftpd with --bind-address and terminated with keyboard interrupt

Brandon Pierce (ihashacks) wrote :

strace of atftpd without --bind-address and terminated by self with error "invalid IP address" in syslog and return value 1

Stephen G (stephengroat) wrote :

I do have a global IPv6 address bound on the interface

Brandon Pierce (ihashacks) wrote :

The port is defined as 0 by default. Modifying tftpd.c to initialize it as 69 and rebuilding the deb works:

$ diff tftpd.c tftpd-orig.c
68c68
< short tftpd_port = 69; /* Port atftpd listen to */
---
> short tftpd_port = 0; /* Port atftpd listen to */

You can still override it with --port on the command line. Not sure if this is the cleanest way to fix this.

Brandon Pierce (ihashacks) wrote :

I don't know how "clean" this is, but it "works." Even though the port is defined as 69 it *can* be overridden on the command line with "--port 77" or any other arbitrary valid port:

# atftpd --daemon --no-fork --port 77

$ netstat -an --inet | grep :77
udp 0 0 0.0.0.0:77 0.0.0.0:*

The attachment "tftpd.c-defined_port.patch" of this bug report has been identified as being a patch. The ubuntu-reviewers team has been subscribed to the bug report so that they can review the patch. In the event that this is in fact not a patch you can resolve this situation by removing the tag 'patch' from the bug report and editing the attachment so that it is not flagged as a patch. Additionally, if you are member of the ubuntu-reviewers team please also unsubscribe the team from this bug report.

[This is an automated message performed by a Launchpad user owned by Brian Murray. Please contact him regarding any issues with the action taken in this bug report.]

tags: added: patch
Bryce Harrington (bryce) on 2012-06-21
description: updated

I'm not sure this is really the cause of the issue; according to comment #2.

Hard-coding the port in is probably useful, but if it's not set there is probably a good reason for it.

Stephen, could you attach /var/log/syslog with the error you're seeing and possibly include /etc/init.d/atftpd, which appears to be modified.

Changed in atftp (Ubuntu):
status: Confirmed → Incomplete
Jörn Frenzel (2-jf) wrote :

Changed description.

I guess atftpd seems to stumble doing "getservbyname".

description: updated
Brandon Pierce (ihashacks) wrote :

Since this is merged into upstream, what is the appropriate procedure for requesting the new upstream be merged into a back port and/or Quantal and/or beyond that?

Launchpad Janitor (janitor) wrote :

[Expired for atftp (Ubuntu) because there has been no activity for 60 days.]

Changed in atftp (Ubuntu):
status: Incomplete → Expired
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers