Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 34983 - ucspi-tcp's tcpserver doesnt work correctly with ipv6 in USE
Summary: ucspi-tcp's tcpserver doesnt work correctly with ipv6 in USE
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Server (show other bugs)
Hardware: All Linux
: High normal
Assignee: Net-Mail Packages
URL:
Whiteboard:
Keywords:
: 69410 82147 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-12-03 09:37 UTC by Stian Knudsen
Modified: 2005-02-15 18:28 UTC (History)
4 users (show)

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


Attachments
Patch for ucspi-tcp-0.88-r9.ebuild to upgrade it to ucspi-tcp-0.88-r10.ebuild (bug34983-ucspi-tcp-0.88-r10.ebuild.patch,830 bytes, patch)
2005-02-08 14:10 UTC, Sascha Silbe
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Stian Knudsen 2003-12-03 09:37:26 UTC
When i emerge ucspi-tcp with -ipv6 use flag, qmail reads rcpthosts even if im 
added in tcp.smtp.
It compiles with no error or warning message.
Compiling it without ipv6 flag works.

Reproducible: Always
Steps to Reproduce:
1.
2.
3.
Comment 1 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2003-12-03 15:06:20 UTC
do you mean to say that qmail is not letting you relay when it should?
provide lots more detail please, including 'emerge info'.
qmail version too!
Comment 2 Stian Knudsen 2003-12-04 07:29:50 UTC
Qmail has nothing to do with it really, i havent recompiled qmail, only the tcpserver package. That works.
Im pretty sure that it is the tcpserver which fails to match the adresses in tcp.smtp.cdb. When this happens, qmail wont let me relay.
btw: i meant to write +ipv6 flag, not -ipv6 flag.

Emerge info:
Portage 2.0.49-r15 (default-x86-1.4, gcc-3.2.3, glibc-2.3.2-r3, 2.4.20)
=================================================================
System uname: 2.4.20 i686 AMD Duron(tm) Processor
Gentoo Base System version 1.4.3.10p1
ACCEPT_KEYWORDS="x86"           
AUTOCLEAN="yes"                 
CFLAGS="-O2 -mcpu=i686 -pipe"   
CHOST="i686-pc-linux-gnu"       
COMPILER="gcc3"                 
CONFIG_PROTECT="/etc /usr/share/config /usr/kde/2/share/config /usr/kde/3/share/config /var/bind /var/qmail/control /var/qmail/alias"
CONFIG_PROTECT_MASK="/etc/gconf /etc/env.d"
CXXFLAGS="-O2 -mcpu=i686 -pipe" 
DISTDIR="/usr/portage/distfiles"
FEATURES="sandbox ccache autoaddcvs"
GENTOO_MIRRORS="http://gentoo.linux.no"
MAKEOPTS="-j2"                  
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY=""
SYNC="rsync://rsync.gentoo.linux.no/gentoo-portage"
USE="x86 -X -gtk -gnome -alsa -kde -xv -imlib -sdl -qt -motif -opengl -apache apache2 mysql ssl tcpd libwww perl png -ipv6 xml xml2"

Comment 3 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2003-12-04 10:57:57 UTC
which version of ucspi-tcp were you using before, and what version are you using now that is broken?
Comment 4 Stian Knudsen 2003-12-04 12:34:49 UTC
Ive been using version 0.88-r5 of ucspi-tcp all the time.
Comment 5 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2003-12-04 15:55:05 UTC
could you please attach your tcp.smtp or email it to me privately (robbat2@gentoo.org) ?
Comment 6 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2003-12-05 13:03:39 UTC
I can't reproduce your error at all.
TCPREMOTEIP=10.0.0.1 tcprulescheck tcp.smtp.cdb
rule 10.:
set environment variable RELAYCLIENT=
allow connection

Please include some of the actual error you are getting from qmail, because I certainly can't reproduce it.

Also, if you are using rblsmtpd in your qmail setup, you need to add RBLSMTPD="" to each of your relay rules here.
Comment 7 Stian Knudsen 2003-12-07 05:03:41 UTC
I'm not getting an error, tcpserver just refuses to set RELAYCLIENT for the addresses in tcp.smtp.cdb

tcprulescheck works, even though tcpserver wont
Comment 8 SpanKY gentoo-dev 2003-12-24 12:07:41 UTC
ok, after banging my head on the table for a few hours i finally found out i have
this exact same bug :)

it isnt related to qmail persay, it's just that we noticed it while using qmail
here's a pretty simple test setup to reproduce the bug:
env USE=ipv6 emerge ucspi-tcp
cat << EOF > testrules
127.0.0.1:allow
:deny
EOF
cat testrules | tcprules testrules.cdb testrules.tmp
tcpserver 0 1 env &
nc localhost 1  # <- this will work (no rule file given and default is to allow)
# now kill that tcpserver with `fg` and CTRL+C
tcpserver -x testrules.cdb 0 1 env &
nc localhost 1  # <- this will fail (even thought it shouldnt ...)
sed -i 's|deny|allow|' testrules
cat testrules | tcprules testrules.cdb testrules.tmp
nc localhost 1  # <- this will work (like it should have in the first place ...)

even if you run tcprulescheck on the file, it'll report that it should work (just
like Stian reported)
env TCPREMOTEIP=127.0.0.1 tcprulescheck testrules.cdb
rule 127.0.0.1:
allow connection
it will give this output for before and after the sed in the above example even
though we see that it'll fail since it didnt match the first allow rule

thuuuuuuuuus it is our opinion that the ipv6 breaks stuff horribly ! :)
Comment 9 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2003-12-24 18:36:29 UTC
bug traced down to ::ffff:127.0.0.1 being treated differently to 127.0.0.1
they need to be treated the same.
Comment 10 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2004-01-20 22:36:06 UTC
the ipv6 + ssl stuff has changed for ucspi-tcp, please try the new version and see if the same problem is still present.
Comment 11 SpanKY gentoo-dev 2004-02-06 08:07:36 UTC
still broken over here ...

env USE="ipv6" emerge ucspi-tcp # this installed 0.88-r8
/etc/init.d/svscan restart
<try to send mail via 127.0.0.1 but relaying is denied>
env USE="-ipv6" emerge ucspi-tcp
/etc/init.d/svscan restart
<send mail via 127.0.0.1 and it works>
Comment 12 Manolito 2004-05-07 09:21:34 UTC
U could solve it, by writing the rules -ur /etc/tcp.smpt file- in ipv6 format,
so 127.0.0. becomes ::ffff:127.0.0.
Comment 13 Sascha Silbe 2004-07-26 07:49:11 UTC
Same problem here. The "prepend ::ffff:"-workaround works, but it's just a workaround, not a solution.  
Comment 14 SpanKY gentoo-dev 2004-08-29 08:27:25 UTC
any update robbat ?
Comment 15 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2004-08-29 15:24:52 UTC
vapier: i haven't succeeded in tracing it in the source code :-(.
if you want to take a shot at it, you're welcome.
Comment 16 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2004-09-15 02:20:18 UTC
clearing up my bug tracking
Comment 17 SpanKY gentoo-dev 2004-10-30 13:50:46 UTC
*** Bug 69410 has been marked as a duplicate of this bug. ***
Comment 18 Jochen Schug 2005-01-12 04:22:54 UTC
I ran into the same problem this morning... It seems that "+ipv6" is now common standard. I upgraded from ucspi-tcp-r8 to -r9 last week, and that update broke relaying. After forcing "-ipv6", things seem to work fine.

The ebuild should definately print out a warning like "if you're going to compile tcpserver with IPv6, you'll have to change your tcprules file" or similar.
Comment 19 Michael Hanselmann (hansmi) (RETIRED) gentoo-dev 2005-01-12 04:39:32 UTC
You've to modifiy your tcprule-file. It now (with USE=ipv6) needs something like this for IPv4 addresses:
::ffff:1.2.3.4:allow,RELAYCLIENT=""

This is by design.
Comment 20 SpanKY gentoo-dev 2005-01-12 06:17:21 UTC
it's crappy design

how hard is it to go 'oh, this looks like an IPv4 address' and then prepend ':ffff:' ?
Comment 21 Martin Mokrejš 2005-01-15 05:42:29 UTC
Yes, I also see ipv6 is magically added to my "emerge info" output. I had to put into make.conf "-ipv6" as of ucspi-tcp-0.88-r9.
Comment 22 Michael Hanselmann (hansmi) (RETIRED) gentoo-dev 2005-01-15 05:46:00 UTC
vapier: It's not crappy design, it's by RFC. ::ffff:1.2.3.4 is defined in RFC 1884, section 2.2.3. We cannot fix this.

http://www.faqs.org/rfcs/rfc1884.html
Comment 23 Sascha Silbe 2005-01-15 05:51:14 UTC
RFC 1884, Section 2.2.3 says:       3. An alternative form that is sometimes more convenient when         dealing with a mixed environment of IPv4 and IPv6 nodes is         x:x:x:x:x:x:d.d.d.d, where the 'x's are the hexadecimal values         of the six high-order 16-bit pieces of the address, and the 'd's         are the decimal values of the four low-order 8-bit pieces of the         address (standard IPv4 representation).  Examples:               0:0:0:0:0:0:13.1.68.3               0:0:0:0:0:FFFF:129.144.52.38          or in compressed form:               ::13.1.68.3               ::FFFF:129.144.52.38   Please note the term "alternative form" in the first sentence. The RFC does not require this syntax to be used, quite to the contrary (it says "sometimes", not "often").  
Comment 24 SpanKY gentoo-dev 2005-01-16 10:50:44 UTC
i dont recall telling anyone to change a RFC

we're talking about the CONFIG FILE for ucspi-tcp ... a package that supports BOTH ipv4 and ipv6 ... internal CONFIG FILES have NOTHING to do with RFC's

USE=ipv6 doesnt say 'hey, i only want to support ipv6, screw ipv4' ... it says 'i want ipv6 support in addition to ipv4' ... last i checked, the a.b.c.d notation for IP addresses was ipv4
Comment 25 Sascha Silbe 2005-02-08 12:49:55 UTC
ucspi-tcp-0.88-ipv6.diff14.bz2 [1] has been released on 2004-05-26 [2]. A quick glance over the changes suggests that the bug discussed here has been fixed:

>        if (!flagallownorules) drop_rules();
>      }
>      else {
> -      if (rules(found,fdrules,remoteipstr,remotehost,flagrem
> +      int fakev4=0;
> +      char* temp;
> +      if (!forcev6 && ip6_isv4mapped(remoteip))
> +       fakev4=1;
> +      if (fakev4)
> +       temp=remoteipstr+7;
> +      else
> +       temp=remoteipstr;
> +      if (rules(found,fdrules,temp,remotehost,flagremoteinfo
>        close(fdrules);
>      }
>    }
> @@ -240,7 +273,7 @@


Please update the patch.

[1] http://www.fefe.de/ucspi/ucspi-tcp-0.88-ipv6.diff14.bz2
[2] http://www.fefe.de/
Comment 26 Sascha Silbe 2005-02-08 13:02:32 UTC
Confirmation: The updated ipv6 patch fixes this bug.
Comment 27 Andrej Kacian (RETIRED) gentoo-dev 2005-02-08 13:29:40 UTC
Why is this bug assigned to net-mail? base-system, it's your package, I wouldn't want to step on your turf, please take care of it, as it seems to have a solution already.

Keeping net-mail on CC
Comment 28 SpanKY gentoo-dev 2005-02-08 13:46:00 UTC
it's with net-mail because when this bug first existed, they were the sole managers of it

they're still the people with the know how (robbat2), no point in trying to dump it onto base system :p
Comment 29 Sascha Silbe 2005-02-08 14:10:58 UTC
Created attachment 50782 [details, diff]
Patch for ucspi-tcp-0.88-r9.ebuild to upgrade it to ucspi-tcp-0.88-r10.ebuild

cd /usr/portage/sys-apps/ucspi-tcp
cp ucspi-tcp-0.88-r9.ebuild ucspi-tcp-0.88-r10.ebuild
patch < .../path/to/this/patch
ebuild ucspi-tcp-0.88-r10.ebuild fetch digest
vi ChangeLog
repoman commit
Comment 30 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2005-02-13 22:14:16 UTC
in cvs finally.
Comment 31 SpanKY gentoo-dev 2005-02-15 18:28:24 UTC
*** Bug 82147 has been marked as a duplicate of this bug. ***