Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 371963 - net-ftp/oftpd-0.3.7-r6: using busy listening port causes oftpd to pick a new one at random
Summary: net-ftp/oftpd-0.3.7-r6: using busy listening port causes oftpd to pick a new ...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Michael Weber (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-16 21:39 UTC by SpanKY
Modified: 2013-01-23 17:26 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge --info oftpd (emerge-info.log,8.30 KB, text/plain)
2011-06-16 21:40 UTC, SpanKY
Details
Patch to use correct port (oftpd-0.3.7-htons.patch,611 bytes, patch)
2013-01-23 16:00 UTC, tallungulate
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description SpanKY gentoo-dev 2011-06-16 21:39:01 UTC
i have sshd up and running on port 22:
# netstat -napt | grep LISTEN.*sshd
tcp        0      0 0.0.0.0:22    0.0.0.0:*      LISTEN      3807/sshd
tcp6       0      0 :::22         :::*           LISTEN      3807/sshd

when i launch oftpd with port 22:
# oftpd -p 22 ftp /usr/portage/distfiles/

it forks and runs fine (no warnings), but it ends up on the wrong port:
# netstat -napt | grep oft
tcp6       0      0 :::5632       :::*           LISTEN      4632/oftpd

further, if launch a 2nd instance, it gives a broken message:
# oftpd -N -p 22 ftp /usr/portage/distfiles/ 
error_init: 98 error binding address; %s

clearly that %s should be an actual message ...
Comment 1 SpanKY gentoo-dev 2011-06-16 21:40:09 UTC
Created attachment 277303 [details]
emerge --info oftpd
Comment 2 Michael Weber (RETIRED) gentoo-dev 2011-06-17 00:50:41 UTC
Hello,

this is an upstream problem or introduced by gentoo patches?

Michael
Comment 3 SpanKY gentoo-dev 2011-06-17 03:14:48 UTC
i have no idea.  i'd have to ask the Gentoo maintainer :p.
Comment 4 tallungulate 2013-01-23 16:00:24 UTC
Created attachment 336598 [details, diff]
Patch to use correct port

The port chosen (4632) is the requested port (22), byte-swapped. It fails on the second invocation because it is already listening on the [incorrect] port. This should only happen on little-endian machines. The attached patch modifies ftp_listener.c to use htons on the requested port number.
Comment 5 Michael Weber (RETIRED) gentoo-dev 2013-01-23 17:26:07 UTC
+*oftpd-0.3.7-r8 (23 Jan 2013)
+
+  23 Jan 2013; Michael Weber <xmw@gentoo.org> -oftpd-0.3.7-r3.ebuild,
+  +oftpd-0.3.7-r8.ebuild, -files/oftpd-0.3.7-family.patch,
+  +files/oftpd-0.3.7-htons.patch, +files/oftpd-0.3.7-unistd.patch,
+  -files/conf.d.oftpd, -files/init.d.oftpd:
+  Revbump to add htons patch by tallungulate@gmail.com (bug 371963), fix
+  unistd, EAPI-4, drop old.
+