Last Comment Bug 491843 - IPv6 address literal is not usable as server name
: IPv6 address literal is not usable as server name
Status: RESOLVED FIXED
[Halloween2011Bug]
:
Product: MailNews Core
Classification: Components
Component: Networking (show other bugs)
: Trunk
: All All
: -- normal with 1 vote (vote)
: Thunderbird 13.0
Assigned To: Ian Neal
:
Mentors:
Depends on:
Blocks: 733210 80855
  Show dependency treegraph
 
Reported: 2009-05-07 05:58 PDT by Xuân Baldauf
Modified: 2012-05-19 14:37 PDT (History)
14 users (show)
iann_bugzilla: in‑testsuite-
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
wontfix
fixed
wontfix
fixed
fixed


Attachments
correct entered ipv6 address, before save (107.12 KB, image/png)
2011-11-12 03:27 PST, Florian Holzhauer
no flags Details
cut off ip address after save (118.32 KB, image/png)
2011-11-12 03:28 PST, Florian Holzhauer
no flags Details
strace - TB 10.0 Linux DE IPv6 crash (506.34 KB, text/plain)
2012-02-12 09:59 PST, shrek-m
no flags Details
Only strip port from string when there is just one colon [Checked in: comm-central Comment 37 , comm-aurora Comment 45] (1.85 KB, patch)
2012-02-18 13:54 PST, Ian Neal
mozilla: review+
acelists: feedback+
standard8: approval‑comm‑aurora+
standard8: approval‑comm‑beta-
Details | Diff | Review

Description Xuân Baldauf 2009-05-07 05:58:34 PDT
User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.19) Gecko/20081213 SUSE/1.1.14-1.1 SeaMonkey/1.1.14 Mnenhy/0.7.6.666
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.19) Gecko/20081213 SUSE/1.1.14-1.1 SeaMonkey/1.1.14 Mnenhy/0.7.6.666

When editing an account, it is not possible to enter an IPv6 address (like "2A01:cafe:babe::1"). as a server name 

Reproducible: Always

Steps to Reproduce:
1. Try to setup a new POP3 account.
2. After creating the account, change the server name to "2A01:cafe:babe::1".
3. Press "OK" and reopen the dialog
Actual Results:  
The server name is "2A01"

Expected Results:  
The server name is "2A01:cafe:babe::1"

This bug is likely to happen in Thunderbird as well.
Comment 1 Serge Gautherie (:sgautherie) 2009-05-08 07:46:54 PDT
Can you reproduce with SeaMonkey v2.0a3?
Comment 2 Phoenix 2011-10-30 11:11:32 PDT
Confirming, bug still here, but not sure is it Seamonkey specific and should not be moved to Thunderbird 
Build identifier: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0a1) Gecko/20111017 Firefox/10.0a1 SeaMonkey/2.7a1
Comment 3 Florian Holzhauer 2011-11-12 03:25:52 PST
Phoenix: I have the same bug with Thunderbird 8.

(User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:8.0) Gecko/20111105 Thunderbird/8.0)
Comment 4 Florian Holzhauer 2011-11-12 03:27:23 PST
Created attachment 574023 [details]
correct entered ipv6 address, before save
Comment 5 Florian Holzhauer 2011-11-12 03:28:07 PST
Created attachment 574024 [details]
cut off ip address after save
Comment 6 shrek-m 2012-01-18 10:52:29 PST
The same happens here

Thunderbird 9.0.1 DE
Mac OSX 10.7.2

2001:db8:1::2    =save=>  2001
[2001:db8:1::2]  =save=>  [2001
Comment 7 :aceman 2012-02-11 18:09:53 PST
Interesting, still happens in TB13.
Notice TB does not yet check for the validity of the server name/IP. That must be settled down in bug 80855.
This IPv6 mangling must be some bug in storing parsing the value. Maybe it does not expect ':' to appear in server name so it uses it internaly as a delimiter for something. I'll look into that.

shrek-m, can you meanwhile look if the backend would work with such an address?
Put that IP manually into prefs.js: user_pref("mail.server.serverX.realhostname", "2001:db8:1::2");

Where X is ID number of your account, you must find out which one is the correct one.

What happens?
Comment 8 shrek-m 2012-02-11 19:26:27 PST
TB 10.0 Mac crashes immediately if i click on this account with the ipv6, other email-accounts with ipv4 are ok.

always reproduceable
with ipv6 ==> crash
user_pref("mail.server.server14.realhostname", "2001:db8:1::2");

with ipv4 ==> all is ok.
user_pref("mail.server.server14.realhostname", "192.168.101.2");

i have done the changes in prefs.js with  `vi`


":" seems to be a delimiter for the account-info
serveraddress:  "192.16:8.101.2"   ==>  serveraddress  "192.16"  and  ":8.101.2" appears additional into the account-info
Comment 9 :aceman 2012-02-12 05:14:23 PST
So it looks like the backend is not yet prepared for ipv6 addresses as hostnames.
So we must explicitly reject them in the account manager.
Comment 10 :aceman 2012-02-12 05:14:54 PST
shrek-m can you find the crash ID for the crash you experienced in comment 8?
Comment 11 shrek-m 2012-02-12 08:27:09 PST
yes, with a short google search :)

mac osx - firefox:
~/Library/Application\ Support/Firefox/Crash\ Reports/

oops, other location
mac osx - thunderbird:
~/Library/Thunderbird/Crash Reports/

here they are.
03:35 - 1 request timed out with thunderbird  10.0  OSX 10.7.2 DE
04:06 - 2 submitted with thunderbird  10.0  OSX 10.7.2 DE
10:12 - 1 submitted with earlybird  12.a02 OSX 10.7.2 DE

$ ls ~/Library/Thunderbird/Crash Reports/submit.log
[Sun Feb 12 03:35:53 2012] Crash report submission failed: The request timed out.
[Sun Feb 12 04:06:40 2012] Crash report submitted successfully
[Sun Feb 12 04:06:41 2012] Crash report submitted successfully
[Sun Feb 12 10:12:26 2012] Crash report submitted successfully

$ ls ~/Library/Thunderbird/Crash Reports/submitted/
bp-6e2aaac1-e36c-4223-bdee-9395c2120212.txt
bp-b6a22d31-2ec8-4aed-bcd3-133f12120212.txt  (=earlybird 10:12)
bp-bf9b4eb6-eb67-43da-998e-4918b2120212.txt

$ cat ~/Library/Thunderbird/Crash Reports/submitted/*
Absturz-ID: bp-6e2aaac1-e36c-4223-bdee-9395c2120212
Absturz-ID: bp-b6a22d31-2ec8-4aed-bcd3-133f12120212  (=earlybird 10:12)
Absturz-ID: bp-bf9b4eb6-eb67-43da-998e-4918b2120212
Comment 12 :aceman 2012-02-12 08:35:13 PST
Wayne, do you know what it means when the crash report is EMPTY? No stack is there.
Comment 13 Wayne Mery (:wsmwk, NI for questions) 2012-02-12 08:46:00 PST
at the most superficial level, it typically means that the process involved is in OOM, and hence there is not enough memory left for the crash reporter process to work.

One might try to get a stack using alternate methods.
Or if it is a regression, chase down the regression range.
Comment 14 shrek-m 2012-02-12 09:59:57 PST
Created attachment 596495 [details]
strace - TB 10.0 Linux DE IPv6 crash

prefs.js test with IPv6
$ thunderbird
Speicherzugriffsfehler

$ strace -o strace_tb_10.0-linux-de--ipv6-crash thunderbird
== see attachment



back to prefs.js with IPv4
$ thunderbird
< all is ok >
Comment 15 :aceman 2012-02-12 11:24:01 PST
There should not be an OOM in this case, probably some uncatched invalid pointer.
On Linux I got a segmentation fault upon accessing the account manager -> server settings, but no crash reporter or crash ID (TB11).
Comment 16 :aceman 2012-02-18 09:50:17 PST
So I have determined that the IPv6 value is properly passed around in the Account manager, up to the saving of the changed values in AccountManager.js/saveAccount(). Then it seems to be passed into nsIMsgIncomingServer. I can't follow it after that, but it is written truncated into the prefs.js file.
I will make sure that until this backend problem is fixed we do not allow IPv6 in bug 80855 and must enable checks of server name in the Account manager (bug 327812).
Comment 17 Ian Neal 2012-02-18 13:54:14 PST
Created attachment 598578 [details] [diff] [review]
Only strip port from string when there is just one colon [Checked in: comm-central Comment 37 , comm-aurora Comment 45]

At the moment the nsMsgIncomingServer assumes any hostname with colon in is trying to set a port as well as a hostname.
This patch:
* Counts the number of colons before reformatting the string

The crash mentioned in this bug when setting the pref by directly editing the prefs file was caused by running out of memory from infinite looping between setting and getting the realhostname.

Tests:
1/ Setting to host specified in comment 0 is now retained
2/ Setting to something like mail.example.com:143 correctly strips the port number off
Comment 18 :aceman 2012-02-18 14:28:48 PST
Comment on attachment 598578 [details] [diff] [review]
Only strip port from string when there is just one colon [Checked in: comm-central Comment 37 , comm-aurora Comment 45]

After testing the patch I can confirm that with the patch an IPv6 address input into the Account manager does get stored properly into prefs.js . After restarting Thunderbird, it comes up normally (without the patch it would crash at startup), the value (realhostname) is loaded correctly and is visible in the Account manager again. I could not test if TB actually connects to the server properly, I do not have IPv6 addressing enabled in the system.

Thanks for the fix!
Comment 19 shrek-m 2012-02-18 15:21:02 PST
Will this patch be included in earlybird 12.0a2 for testing ?


--------
postfix, dovecot, cyrus-imapd, ... have ipv6 enabled as default

you can check if your service is ipv6-listening with lsof
# lsof -i6
----
# grep -i2 ipv6 /etc/postfix/main.cf 
inet_interfaces = all

# Enable IPv4, and IPv6 if supported
inet_protocols = all
----
# grep -i3 ipv6 /etc/dovecot/dovecot.conf 
#protocols = imap pop3 lmtp

# A comma separated list of IPs or hosts where to listen in for connections. 
# "*" listens in all IPv4 interfaces, "::" listens in all IPv6 interfaces.
# If you want to specify non-default ports or anything more complex,
# edit conf.d/master.conf.
#listen = *, ::
----
# lsof -i6 | grep cyrus
cyrus-mas 1956  cyrus   10u  IPv6  13101      0t0  TCP *:imap (LISTEN)
cyrus-mas 1956  cyrus   16u  IPv6  13107      0t0  TCP *:imaps (LISTEN)
cyrus-mas 1956  cyrus   22u  IPv6  13113      0t0  TCP *:pop3 (LISTEN)
cyrus-mas 1956  cyrus   28u  IPv6  13119      0t0  TCP *:pop3s (LISTEN)
cyrus-mas 1956  cyrus   34u  IPv6  13125      0t0  TCP *:sieve (LISTEN)
imapd     1977  cyrus    4u  IPv6  13101      0t0  TCP *:imap (LISTEN)
imapd     1978  cyrus    4u  IPv6  13107      0t0  TCP *:imaps (LISTEN)
pop3d     1979  cyrus    4u  IPv6  13113      0t0  TCP *:pop3 (LISTEN)
pop3d     1980  cyrus    4u  IPv6  13119      0t0  TCP *:pop3s (LISTEN)
imapd     2005  cyrus    4u  IPv6  13101      0t0  TCP *:imap (LISTEN)
pop3d     2006  cyrus    4u  IPv6  13113      0t0  TCP *:pop3 (LISTEN)
imapd     2125  cyrus    4u  IPv6  13101      0t0  TCP *:imap (LISTEN)
imapd     2126  cyrus    4u  IPv6  13101      0t0  TCP *:imap (LISTEN)
imapd     2127  cyrus    4u  IPv6  13101      0t0  TCP *:imap (LISTEN)
pop3d     2128  cyrus    4u  IPv6  13113      0t0  TCP *:pop3 (LISTEN)
Comment 20 :aceman 2012-02-18 15:24:42 PST
It is not yet even in nightly 13a1. Maybe Ian can provide a trybuild that you could download for testing.
Comment 21 Ian Neal 2012-02-18 16:21:20 PST
(In reply to :aceman from comment #20)
> It is not yet even in nightly 13a1. Maybe Ian can provide a trybuild that
> you could download for testing.

Push to try http://hg.mozilla.org/try-comm-central/rev/6428ec2d4257

It can be monitored on http://build.mozillamessaging.com/tinderboxpushlog/?tree=ThunderbirdTry&pusher=iann_cvs@blueyonder.co.uk

It should arrive in http://ftp.mozilla.org/pub/mozilla.org/thunderbird/try-builds/?C=M;O=D at some point.
Comment 22 shrek-m 2012-02-19 02:52:26 PST
OK, i tried OSX 10.7.3 as client (2001:db8:1::3)
scientific linux 6.2 as server (2001:db8:1::2)


---- imap ok ----
I could now change the imap-server-address to the IPv6 without problems,
i could connect and login to the cyrus-imapd,
i could create new folders and move emails into,
...
imap seems to be ok.
--------


smtp need evtl. some work.

i could not change the smtp-server to the IPv6  2001:db8:1::2
message: "Please enter a valid hostname."

i changed it with 'vi' to 2001:db8:1::2 in the prefs.js 
daily-13.0a1 (2012-02-18) did not crash.

$ grep 2001:db8 Library/Thunderbird/Profiles/k2ayfa2h.default/prefs.js 
user_pref("mail.server.server14.name", "admin - 2001:db8:1::2");
user_pref("mail.server.server14.realhostname", "2001:db8:1::2");
user_pref("mail.smtpserver.smtp10.hostname", "2001:db8:1::2");

i could not send mails, but this seems to be more a *postfix-configuration problem on my side*

daily-13.0a1 tries to connect but could not authenticate
message: "Unable to authenticate to SMTP server 2001:db8:1::2. Please check the password, and verify the 'Authentication method' in 'Account Settings | Outgoing server (SMTP)'."

---- /var/log/maillog ----
Feb 19 10:39:47 srv01 postfix/smtpd[2296]: connect from unknown[unknown]
Feb 19 10:39:47 srv01 postfix/smtpd[2296]: lost connection after CONNECT from unknown[unknown]
Feb 19 10:39:47 srv01 postfix/smtpd[2296]: disconnect from unknown[unknown]
Feb 19 10:41:04 srv01 postfix/smtpd[2296]: connect from unknown[2001:db8:1::2]
Feb 19 10:41:04 srv01 postfix/smtpd[2296]: lost connection after CONNECT from unknown[2001:db8:1::2]
Feb 19 10:41:04 srv01 postfix/smtpd[2296]: disconnect from unknown[2001:db8:1::2]
Feb 19 10:41:19 srv01 imap[1999]: warning: can't get client address: Connection reset by peer
---- postconf ----
# postconf | grep -i dns
disable_dns_lookups = no
lmtp_host_lookup = dns
smtp_host_lookup = dns
--------

with the IPv4 daily-13.0a1 has no problems to authenticate and send mails via this postfix server.

I will try it later, we have here now sunday morning.
Comment 23 :aceman 2012-02-19 04:03:57 PST
(In reply to shrek-m from comment #22)
> smtp need evtl. some work.
> 
> i could not change the smtp-server to the IPv6  2001:db8:1::2
> message: "Please enter a valid hostname."
> 
This is expected and will be lifted in bug 80855.

Thanks for great testing!

Can you also check some POP3 server?
Comment 24 shrek-m 2012-02-19 06:49:50 PST
no problems with ipv6 pop3 accounts (cyrus:pop3)
login, mark, tag, compress, ... all is ok.

i would create a new pop3-account directly with ipv6 but
daily-13.0a1 (2012-02-18) mangled the  "2001:db8:1::2"  here to  "2001"  too.
no great problem since i can change it later in the settings.


i could not get to work the ipv6-smtp setting :(


----
if you will test with public IPv6s:
http://en.wikipedia.org/wiki/List_of_IPv6_tunnel_brokers

1)  sixxs  http://www.sixxs.net/
2)  he tunnelbroker  http://www.tunnelbroker.net/
3)  gogo6-freenet6  http://gogonet.gogo6.com/page/freenet6-account

personally, i find 3) the easiest and fastest way to get and manage your own ipv6/64 subnet for your lan.
the gogo6-client does a great job, he manages his own radvd-settings.
Comment 25 :aceman 2012-02-19 07:15:59 PST
Can you determine what is the problem at the IPv6 SMTP server? Does it reject the connection for some reason? Or does TB not open proper connections?
Comment 26 shrek-m 2012-02-19 08:06:38 PST
daily-13.0a1 (2012-02-18) does not even try to connect the smtp server ipv6  2001:db8:1::2
the immediately message: "Unable to authenticate to SMTP server 2001:db8:1::2. Please check the password, and verify the 'Authentication method' in 'Account Settings | Outgoing server (SMTP)'."

the new created test account is smtp11
i changed the smtp11.hostname from "changeme-ipv6" with vi to "2001:db8:1::2"

$ grep -i smtp11 Library/Thunderbird/Profiles/k2ayfa2h.default/prefs.js 
user_pref("mail.identity.id1.smtpServer", "smtp11");
user_pref("mail.smtpserver.smtp11.authMethod", 3);
user_pref("mail.smtpserver.smtp11.description", "test");
user_pref("mail.smtpserver.smtp11.hostname", "2001:db8:1::2");
user_pref("mail.smtpserver.smtp11.port", 25);
user_pref("mail.smtpserver.smtp11.try_ssl", 0);
user_pref("mail.smtpserver.smtp11.username", "test");
user_pref("mail.smtpservers", "smtp11,smtp5,smtp7,smtp8,smtp1,smtp2,smtp3,smtp4,smtp6,smtp9,smtp10");


nothing happens on the smtp server eth2:
# tcpdump -n  -i eth2 host 2001:db8:1::3
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth2, link-type EN10MB (Ethernet), capture size 65535 bytes
^C
0 packets captured
0 packets received by filter
0 packets dropped by kernel


---- some test ----
nmap from the client side is ok:
# nmap -p pop3,pop3s 2001:db8:1::2 -6
Starting Nmap 5.51 ( http://nmap.org ) at 2012-02-19 16:46 CET
Nmap scan report for 2001:db8:1::2
Host is up (0.0024s latency).
PORT    STATE SERVICE
110/tcp open  pop3
995/tcp open  pop3s
Nmap done: 1 IP address (1 host up) scanned in 0.29 seconds


tcpdump on the server eth2 - client nmap
is ok, no firewall or other problems:
# tcpdump -n  -i eth2 host 2001:db8:1::3
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth2, link-type EN10MB (Ethernet), capture size 65535 bytes
16:45:58.971461 IP6 2001:db8:1::3.63911 > 2001:db8:1::2.pop3: Flags [S], seq 1429764023, win 65535, options [mss 1220,nop,wscale 2,nop,nop,TS val 747100446 ecr 0,sackOK,eol], length 0
16:45:58.971484 IP6 2001:db8:1::2.pop3 > 2001:db8:1::3.63911: Flags [S.], seq 2318551589, ack 1429764024, win 14280, options [mss 1440,sackOK,TS val 22116113 ecr 747100446,nop,wscale 5], length 0
16:45:58.971489 IP6 2001:db8:1::3.63912 > 2001:db8:1::2.pop3s: Flags [S], seq 2554913841, win 65535, options [mss 1220,nop,wscale 2,nop,nop,TS val 747100446 ecr 0,sackOK,eol], length 0
16:45:58.971502 IP6 2001:db8:1::2.pop3s > 2001:db8:1::3.63912: Flags [S.], seq 826925077, ack 2554913842, win 14280, options [mss 1440,sackOK,TS val 22116113 ecr 747100446,nop,wscale 5], length 0
16:45:58.973501 IP6 2001:db8:1::3.63911 > 2001:db8:1::2.pop3: Flags [.], ack 1, win 65535, options [nop,nop,TS val 747100448 ecr 22116113], length 0
16:45:58.973743 IP6 2001:db8:1::3.63911 > 2001:db8:1::2.pop3: Flags [R.], seq 1, ack 1, win 65535, length 0
16:45:58.973757 IP6 2001:db8:1::3.63912 > 2001:db8:1::2.pop3s: Flags [.], ack 1, win 65535, options [nop,nop,TS val 747100448 ecr 22116113], length 0
16:45:58.973784 IP6 2001:db8:1::3.63912 > 2001:db8:1::2.pop3s: Flags [R.], seq 1, ack 1, win 65535, length 0
16:46:03.877592 IP6 2001:db8:1::3 > 2001:db8:1::2: ICMP6, neighbor solicitation, who has 2001:db8:1::2, length 32
16:46:03.877648 IP6 2001:db8:1::2 > 2001:db8:1::3: ICMP6, neighbor advertisement, tgt is 2001:db8:1::2, length 24
........


imap is ok with daily-13.0a1 (2012-02-18):
# tcpdump -n  -i eth2 host 2001:db8:1::3
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth2, link-type EN10MB (Ethernet), capture size 65535 bytes
16:41:05.530973 IP6 2001:db8:1::3.63879 > 2001:db8:1::2.imap: Flags [P.], seq 1668524519:1668524527, ack 2394022994, win 65535, options [nop,nop,TS val 746807809 ecr 21685795], length 8
16:41:05.531432 IP6 2001:db8:1::2.imap > 2001:db8:1::3.63879: Flags [P.], seq 1:11, ack 8, win 447, options [nop,nop,TS val 21822673 ecr 746807809], length 10
........
Comment 27 shrek-m 2012-02-19 08:15:16 PST
sorry, not pop3, pop3s
should be smtp (open), smtps (closed)

# nmap -p smtp,smtps 2001:db8:1::2 -6
Starting Nmap 5.51 ( http://nmap.org ) at 2012-02-19 17:13 CET
Nmap scan report for 2001:db8:1::2
Host is up (0.0030s latency).
PORT    STATE  SERVICE
25/tcp  open   smtp
465/tcp closed smtps
Nmap done: 1 IP address (1 host up) scanned in 0.15 seconds
Comment 28 shrek-m 2012-02-19 09:15:06 PST
Under OSX exists as well /etc/hosts
i put the  ipv6:hostname  in it for testing, all is ok
even TB 10.0.2 can handle this correctly.

$ grep ipv6 /etc/hosts
2001:db8:1::2	ipv6.localdomain

$ grep -i smtp11 Library/Thunderbird/Profiles/k2ayfa2h.default/prefs.js 
user_pref("mail.identity.id1.smtpServer", "smtp11");
user_pref("mail.smtpserver.smtp11.authMethod", 3);
user_pref("mail.smtpserver.smtp11.description", "test");
user_pref("mail.smtpserver.smtp11.hostname", "ipv6.localdomain");
user_pref("mail.smtpserver.smtp11.port", 25);
user_pref("mail.smtpserver.smtp11.try_ssl", 0);
user_pref("mail.smtpserver.smtp11.username", "test");
user_pref("mail.smtpservers", "smtp11,smtp5,smtp7,smtp8,smtp1,smtp2,smtp3,smtp4,smtp6,smtp9,smtp10");


smtp  over ipv6 is ok with the ipv6:hostname in /etc/hosts
# tcpdump -n -i eth2 host 2001:db8:1::3
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth2, link-type EN10MB (Ethernet), capture size 65535 bytes
18:06:42.845291 IP6 2001:db8:1::3.64264 > 2001:db8:1::2.smtp: Flags [S], seq 3163769422, win 65535, options [mss 1220,nop,wscale 2,nop,nop,TS val 751927122 ecr 0,sackOK,eol], length 0
18:06:42.916311 IP6 2001:db8:1::3 > 2001:db8:1::2: ICMP6, neighbor advertisement, tgt is 2001:db8:1::3, length 32
18:06:42.916347 IP6 2001:db8:1::2.smtp > 2001:db8:1::3.64264: Flags [S.], seq 2546219358, ack 3163769423, win 14280, options [mss 1440,sackOK,TS val 26959987 ecr 751927122,nop,wscale 5], length 0
18:06:42.918298 IP6 2001:db8:1::3.64264 > 2001:db8:1::2.smtp: Flags [.], ack 1, win 65535, options [nop,nop,TS val 751927194 ecr 26959987], length 0
18:06:42.980121 IP6 2001:db8:1::2.smtp > 2001:db8:1::3.64264: Flags [P.], seq 1:38, ack 1, win 447, options [nop,nop,TS val 26960122 ecr 751927194], length 37
18:06:42.981604 IP6 2001:db8:1::3.64264 > 2001:db8:1::2.smtp: Flags [.], ack 38, win 65535, options [nop,nop,TS val 751927255 ecr 26960122], length 0
18:06:43.101577 IP6 2001:db8:1::3.64264 > 2001:db8:1::2.smtp: Flags [P.], seq 1:21, ack 38, win 65535, options [nop,nop,TS val 751927373 ecr 26960122], length 20
18:06:43.101597 IP6 2001:db8:1::2.smtp > 2001:db8:1::3.64264: Flags [.], ack 21, win 447, options [nop,nop,TS val 26960244 ecr 751927373], length 0
18:06:43.101754 IP6 2001:db8:1::2.smtp > 2001:db8:1::3.64264: Flags [P.], seq 38:164, ack 21, win 447, options [nop,nop,TS val 26960244 ecr 751927373], length 126
18:06:43.103633 IP6 2001:db8:1::3.64264 > 2001:db8:1::2.smtp: Flags [.], ack 164, win 65535, options [nop,nop,TS val 751927375 ecr 26960244], length 0
18:06:43.226683 IP6 2001:db8:1::3.64264 > 2001:db8:1::2.smtp: Flags [P.], seq 21:66, ack 164, win 65535, options [nop,nop,TS val 751927496 ecr 26960244], length 45
18:06:43.238669 IP6 2001:db8:1::2.smtp > 2001:db8:1::3.64264: Flags [P.], seq 164:178, ack 66, win 447, options [nop,nop,TS val 26960381 ecr 751927496], length 14
18:06:43.240762 IP6 2001:db8:1::3.64264 > 2001:db8:1::2.smtp: Flags [.], ack 178, win 65535, options [nop,nop,TS val 751927510 ecr 26960381], length 0
18:06:43.256744 IP6 2001:db8:1::3.64264 > 2001:db8:1::2.smtp: Flags [P.], seq 66:100, ack 178, win 65535, options [nop,nop,TS val 751927525 ecr 26960381], length 34
18:06:43.273039 IP6 2001:db8:1::2.smtp > 2001:db8:1::3.64264: Flags [P.], seq 178:192, ack 100, win 447, options [nop,nop,TS val 26960415 ecr 751927525], length 14
18:06:43.274843 IP6 2001:db8:1::3.64264 > 2001:db8:1::2.smtp: Flags [.], ack 192, win 65535, options [nop,nop,TS val 751927543 ecr 26960415], length 0
18:06:43.276825 IP6 2001:db8:1::3.64264 > 2001:db8:1::2.smtp: Flags [P.], seq 100:106, ack 192, win 65535, options [nop,nop,TS val 751927545 ecr 26960415], length 6
18:06:43.277038 IP6 2001:db8:1::2.smtp > 2001:db8:1::3.64264: Flags [P.], seq 192:229, ack 106, win 447, options [nop,nop,TS val 26960419 ecr 751927545], length 37
18:06:43.278669 IP6 2001:db8:1::3.64264 > 2001:db8:1::2.smtp: Flags [.], ack 229, win 65535, options [nop,nop,TS val 751927546 ecr 26960419], length 0
18:06:43.281933 IP6 2001:db8:1::3.64264 > 2001:db8:1::2.smtp: Flags [P.], seq 106:525, ack 229, win 65535, options [nop,nop,TS val 751927548 ecr 26960419], length 419
18:06:43.281951 IP6 2001:db8:1::3.64264 > 2001:db8:1::2.smtp: Flags [P.], seq 525:528, ack 229, win 65535, options [nop,nop,TS val 751927549 ecr 26960419], length 3
18:06:43.281979 IP6 2001:db8:1::2.smtp > 2001:db8:1::3.64264: Flags [.], ack 528, win 480, options [nop,nop,TS val 26960424 ecr 751927548], length 0
18:06:43.324704 IP6 2001:db8:1::2.smtp > 2001:db8:1::3.64264: Flags [P.], seq 229:263, ack 528, win 480, options [nop,nop,TS val 26960467 ecr 751927548], length 34
18:06:43.326930 IP6 2001:db8:1::3.64264 > 2001:db8:1::2.smtp: Flags [.], ack 263, win 65535, options [nop,nop,TS val 751927593 ecr 26960467], length 0
18:06:43.327810 IP6 2001:db8:1::3.64264 > 2001:db8:1::2.smtp: Flags [P.], seq 528:534, ack 263, win 65535, options [nop,nop,TS val 751927594 ecr 26960467], length 6
18:06:43.328099 IP6 2001:db8:1::2.smtp > 2001:db8:1::3.64264: Flags [P.], seq 263:278, ack 534, win 480, options [nop,nop,TS val 26960470 ecr 751927594], length 15
18:06:43.328126 IP6 2001:db8:1::2.smtp > 2001:db8:1::3.64264: Flags [F.], seq 278, ack 534, win 480, options [nop,nop,TS val 26960470 ecr 751927594], length 0
18:06:43.330012 IP6 2001:db8:1::3.64264 > 2001:db8:1::2.smtp: Flags [.], ack 278, win 65535, options [nop,nop,TS val 751927595 ecr 26960470], length 0
18:06:43.330089 IP6 2001:db8:1::3.64264 > 2001:db8:1::2.smtp: Flags [.], ack 279, win 65535, options [nop,nop,TS val 751927596 ecr 26960470], length 0
18:06:43.333805 IP6 2001:db8:1::3.64264 > 2001:db8:1::2.smtp: Flags [F.], seq 534, ack 279, win 65535, options [nop,nop,TS val 751927599 ecr 26960470], length 0
18:06:43.333909 IP6 2001:db8:1::2.smtp > 2001:db8:1::3.64264: Flags [.], ack 535, win 480, options [nop,nop,TS val 26960476 ecr 751927599], length 0
18:06:47.829537 IP6 2001:db8:1::3 > 2001:db8:1::2: ICMP6, neighbor solicitation, who has 2001:db8:1::2, length 32
18:06:47.829624 IP6 2001:db8:1::2 > 2001:db8:1::3: ICMP6, neighbor advertisement, tgt is 2001:db8:1::2, length 24
---- the mail was sent via ipv6 ----
Comment 29 :aceman 2012-02-19 09:21:38 PST
So if you use server name everything works, if you use direct IPv6 address SMTP does not work.
Comment 30 shrek-m 2012-02-19 09:46:06 PST
Absolutely correct.

TB 10.0.2 can handle IPv6 SMTP, POP3, IMAP correctly with "servernames" but no "direct IPv6".
The same for Earlybird 12.0a2, but not tested in all ways.

Ians Daily-13.0a1 (2012-02-18) can handle IPv6 IMAP, POP3 via "direct IPv6",
IPv6 SMTP only via "servernames".
Creating a new account with "direct IPv6" is not possible - it is mangled after the first ":" - but works with "servernames".

--------
i do not understand why at some point he was trying to connect with the direct IPv6 but not later, i could not reproduce this.
comment #22
> Feb 19 10:39:47 srv01 postfix/smtpd[2296]: disconnect from unknown[unknown]
> Feb 19 10:41:04 srv01 postfix/smtpd[2296]: connect from unknown[2001:db8:1::2]
> Feb 19 10:41:04 srv01 postfix/smtpd[2296]: lost connection after CONNECT from unknown[2001:db8:1::2]
Comment 31 :aceman 2012-02-19 10:37:09 PST
(In reply to shrek-m from comment #30)
> Ians Daily-13.0a1 (2012-02-18) can handle IPv6 IMAP, POP3 via "direct IPv6",
> IPv6 SMTP only via "servernames".
> Creating a new account with "direct IPv6" is not possible - it is mangled
> after the first ":" - but works with "servernames".
With Ians build it should be possible to create account with IPv6 address. At least when using the account manager, I am not sure about the wizard. I have tested giving IPv6 into an existing account.
Comment 32 shrek-m 2012-02-19 11:10:42 PST
sorry, the pop3/imap ipv6 settings were ok with the wizard.
this happened while the smtp ipv6 settings for the new account with the wizard's:
"Please enter a valid hostname."

comment #23
>> i could not change the smtp-server to the IPv6  2001:db8:1::2
>> message: "Please enter a valid hostname."
>> 
> This is expected and will be lifted in bug 80855.

the wizard redirected me forward and backward (test, re-test, get a new account, manual config, advanced config, ...) and at some point - ? advanced config ? - i could enter the smtp "direct ipv6"  2001:db8:1::2  and somehow this ended in the smtp-servername "2001"

if bug # 80855 is solved, i assume that the wizard will do his job for smtp "direct IPv6" too.


Is Ians patch now in the new nightly builds?
"About Daily" will apply an update.
Comment 33 :aceman 2012-02-19 11:23:09 PST
(In reply to shrek-m from comment #32)
> the wizard redirected me forward and backward (test, re-test, get a new
> account, manual config, advanced config, ...) and at some point - ? advanced
> config ? - i could enter the smtp "direct ipv6"  2001:db8:1::2  and somehow
> this ended in the smtp-servername "2001"
> 
> if bug # 80855 is solved, i assume that the wizard will do his job for smtp
> "direct IPv6" too.

Yes, if we determine (with your help) that direct IPv6 addresses are usable now we can enable them in bug 80855 and the Wizard/Account manager will allow them.

> Is Ians patch now in the new nightly builds?
> "About Daily" will apply an update.

It is not in Daily yet. It must pass review. Only the special build in comment 21 has the patch.
Comment 34 shrek-m 2012-02-20 03:37:23 PST
Tested under linux - Fedora 16 - with a new user, new TB profile and only 1 new created ipv6-account.
Exactly the same behavior as under OSX.

"servername (IPv6)" - IMAP, POP3, SMTP = all is ok

"direct IPv6" - IMAP, POP3 = ok
"direct IPv6" - SMTP = absolutely no IPv6 network traffic but immediate message: "Unable to authenticate to SMTP server 2001:db8:1::2. Please check the password, and verify the 'Authentication method' in 'Account Settings | Outgoing server (SMTP)'."
Comment 35 :aceman 2012-02-20 03:46:17 PST
Thanks for the tests. SMTP people should now check it out.
Comment 36 David :Bienvenu 2012-02-24 10:32:41 PST
Comment on attachment 598578 [details] [diff] [review]
Only strip port from string when there is just one colon [Checked in: comm-central Comment 37 , comm-aurora Comment 45]

looks reasonable, thx.
Comment 37 Ian Neal 2012-03-02 13:45:32 PST
Comment on attachment 598578 [details] [diff] [review]
Only strip port from string when there is just one colon [Checked in: comm-central Comment 37 , comm-aurora Comment 45]

>diff --git a/mailnews/base/util/nsMsgIncomingServer.cpp b/mailnews/base/util/nsMsgIncomingServer.cpp
>--- a/mailnews/base/util/nsMsgIncomingServer.cpp
>+++ b/mailnews/base/util/nsMsgIncomingServer.cpp
>@@ -1209,19 +1209,19 @@ nsMsgIncomingServer::GetEditableFilterLi
> 
> // If the hostname contains ':' (like hostname:1431)
> // then parse and set the port number.
> nsresult
> nsMsgIncomingServer::InternalSetHostName(const nsACString& aHostname, const char * prefName)
> {
>   nsCString hostname;
>   hostname = aHostname;
>-  PRInt32 colonPos = hostname.FindChar(':');
>-  if (colonPos != -1)
>+  if (hostname.CountChar(':') == 1)
>   {
>+    PRInt32 colonPos = hostname.FindChar(':');
>     nsCAutoString portString(Substring(hostname, colonPos));
>     hostname.SetLength(colonPos);
>     nsresult err;
>     PRInt32 port = portString.ToInteger(&err);
>     if (NS_SUCCEEDED(err))
>       SetPort(port);
>   }
>   return SetCharValue(prefName, hostname);
>@@ -1291,17 +1291,17 @@ nsMsgIncomingServer::SetRealHostName(con
>   return rv;
> }
> 
> NS_IMETHODIMP
> nsMsgIncomingServer::GetHostName(nsACString& aResult)
> {
>   nsresult rv;
>   rv = GetCharValue("hostname", aResult);
>-  if (aResult.FindChar(':') != -1)
>+  if (aResult.CountChar(':') == 1)
>   {
>     // gack, we need to reformat the hostname - SetHostName will do that
>     SetHostName(aResult);
>     rv = GetCharValue("hostname", aResult);
>   }
>   return rv;
> }
> 
>@@ -1311,17 +1311,17 @@ nsMsgIncomingServer::GetRealHostName(nsA
>   // If 'realhostname' is set (was changed) then use it, otherwise use 'hostname'
>   nsresult rv;
>   rv = GetCharValue("realhostname", aResult);
>   NS_ENSURE_SUCCESS(rv, rv);
>   
>   if (aResult.IsEmpty())
>     return GetHostName(aResult);
> 
>-  if (aResult.FindChar(':') != -1)
>+  if (aResult.CountChar(':') == 1)
>   {
>     SetRealHostName(aResult);
>     rv = GetCharValue("realhostname", aResult);
>   }
> 
>   return rv;
> }
>
Comment 38 Ian Neal 2012-03-02 13:48:26 PST
Comment on attachment 598578 [details] [diff] [review]
Only strip port from string when there is just one colon [Checked in: comm-central Comment 37 , comm-aurora Comment 45]

[Approval Request Comment]
Regression caused by (bug #): n/a
User impact if declined: Only a problem if user sets an IPv6 address manually either via about:config or by editing prefs.js
Testing completed (on c-c, etc.): Yes
Risk to taking this patch (and alternatives if risky): Low risk but also not many users would have been affected by the issue.
Comment 39 :aceman 2012-03-02 14:26:54 PST
shrek-m, the patch was checked in into the official trunk. You can try tomorrow's Daily 13. When you see the fix is there and you still have a problem with the SMTP sending and you still think it is a problem in Thunderbird please file it as a new bug.
At least POP and IMAP were fixed here.
Comment 40 shrek-m 2012-03-03 08:34:20 PST
thanks :)
todays daily works now as aspected with POP3, IMAP

i will file a new bug in the next days or so for the SMTP problem.
i assume that TB is trying smtpserver  "2001" on port ":db8:1::2"
these could explain why i see abolutely no ipv6 traffic on the server from the client (2001:db8:1::3) and absolutely no SMTP:25 traffic on the client-side.
i could probably use an other ipv6 for testing, e.g. 2001::25
i will look for the tcpdump output on host 2001 and port 25  


todays earlybird does not have this patch.
Comment 41 :aceman 2012-03-03 08:55:57 PST
It should be in Daily 13. The Earlybird 12 will gain it after migration in 2 weeks.
Comment 42 neil@parkwaycc.co.uk 2012-03-04 14:01:20 PST
We don't have external API for CountChars yet :-(

[Why do we bother supporting servers with port numbers anyway?]
Comment 43 shrek-m 2012-03-05 16:55:39 PST
i filed a new bug for the SMTP problem
Bug #733210  IPv6 address literal is not usable as SMTP server name
Comment 44 Mark Banner (:standard8) 2012-03-07 04:31:40 PST
Comment on attachment 598578 [details] [diff] [review]
Only strip port from string when there is just one colon [Checked in: comm-central Comment 37 , comm-aurora Comment 45]

So I think we'll take this for 12, but not 11. That still gets it out a release in front of the ipv6 day this year, whilst allowing some testing to happen as well, so I think that works fine.
Comment 45 Ian Neal 2012-03-07 15:11:36 PST
Comment on attachment 598578 [details] [diff] [review]
Only strip port from string when there is just one colon [Checked in: comm-central Comment 37 , comm-aurora Comment 45]

http://hg.mozilla.org/releases/comm-aurora/rev/d30a1377f5bc
Comment 46 Kent James (:rkent) 2012-03-12 15:05:55 PDT
I'm probably the only one compiling using external linkage these days, but just FYI the checkin http://hg.mozilla.org/releases/comm-aurora/rev/d30a1377f5bc broke my aurora compiles with

c:\tb\aurora\src\mailnews\extensions\skinkglue\src\../../../base/util/nsMsgIncomingServer.cpp(1298) : error C2039: 'CountChar' : is not a member of 'nsACString'

I'm not really sure of the status of the external linkage conversion plans these days, so I don't know if this is considered an error or not.
Comment 47 neil@parkwaycc.co.uk 2012-03-12 15:18:01 PDT
(In reply to Kent James from comment #46)
> I'm probably the only one compiling using external linkage these days
I have two external linkage builds myself, thus my obscure comment #42.

> I'm not really sure of the status of the external linkage conversion plans
> these days, so I don't know if this is considered an error or not.
It's not tier-1, but it would be nice to come up with some sort of a fix. Certainly I'd me more than happy to review one should you want to write it.

Note You need to log in before you can comment on or make changes to this bug.