ipv4OnlyDomains breaks ipv6
Categories
(Core :: Networking: DNS, defect)
Tracking
()
People
(Reporter: k, Unassigned, NeedInfo)
References
(Blocks 1 open bug)
Details
User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:67.0) Gecko/20100101 Firefox/67.0
Steps to reproduce:
About:config
enter any domain in network.dns.ipv4OnlyDomains
Actual results:
now everything connects only using ipv4
set network.dns.ipv4OnlyDomains to blank, and sites again connect using ipv6
found it looking at F12->Network
Expected results:
only listed domains should connect ipv4 only
Comment 1•6 years ago
|
||
Hi @K, for now what can I do for this issue is only setting a component, further someone from dev's team could give us a hand.
Thanks.
Comment 2•6 years ago
|
||
I can't reproduce this at my side.
Could you share how did you set network.dns.ipv4OnlyDomains? Maybe we have a bug regarding parsing the ipv4OnlyDomains string.
I can reproduce it on windows and linux with FF 67
Set anything
For example, it reproduces with "vk.com,vk.me,youtube.com,googlevideo.com"
After setting/unsetting the value clear cache and close tab with the test site or restart browser
After additional tests it looks like only http is affected, not https
Test it on http://afraid.org
this domain has both A and AAAA
check unsecure requests in F12->Network page
Comment 5•6 years ago
|
||
(In reply to k from comment #4)
After additional tests it looks like only http is affected, not https
Test it on http://afraid.org
this domain has both A and AAAA
check unsecure requests in F12->Network page
I think this should has nothing to do with http and https.
Could you use about:networking to reproduce again? Please see my steps below.
- In address bar, type about:networking.
- Go to DNS Lookup
- Type afraid.org and do resolve.
- I see one ipv6 address (2604:8b80:2:8::2) and one ipv4 address (204.140.20.21).
- Go to about:config and set network.dns.ipv4OnlyDomains to afraid.org.
- Go back to about:networking and do resolve again.
- You should only see one ipv4 address.
- Change the domain to google.com and do resolve again.
- I can see both ipv6 and ipv4 address.
Yes it works as you say.
but.. look at screenshots
IF
https://c.radikal.ru/c31/1907/12/6ea4e11ae0e1.jpg
THEN
https://c.radikal.ru/c37/1907/97/02e78e6d73d7.jpg
IF
https://c.radikal.ru/c34/1907/a2/591e18984eae.jpg
THEN
https://d.radikal.ru/d40/1907/fd/89c13f049274.jpg
Comment 7•6 years ago
•
|
||
May be UB causes something impossible?
https://searchfox.org/mozilla-central/rev/f372470e10c8cb0691681603a1d6324dee5b3b8a/netwerk/dns/nsDNSService2.cpp#1175,1182
hostTail - 1
will point before hostStart
if hostLen == domainLen
anddomain
will point after domainEnd
if it is the last element of the mIPv4OnlyDomains
list. Both are UB.
Comment 8•6 years ago
•
|
||
hostTail - 1
will point beforehostStart
ifhostLen == domainLen
Sorry, hostTail - 1
will never be evaluated when hostLen == domainLen
due to short-circuit evaluation. But the latter is still UB.
![]() |
||
Comment 9•6 years ago
|
||
(In reply to Masatoshi Kimura [:emk] from comment #8)
hostTail - 1
will point beforehostStart
ifhostLen == domainLen
Sorry,
hostTail - 1
will never be evaluated whenhostLen == domainLen
due to short-circuit evaluation. But the latter is still UB.
So you suggest a parser error? Rewrite with Tokenizer then?
![]() |
||
Updated•6 years ago
|
Comment 10•6 years ago
|
||
@k, Could you test whether this build fixes your issue?
https://tools.taskcluster.net/groups/SmTPWv4dS7iX5iskDXza0A/tasks/AjVr9FJbRl69RvSzQ3Y0yA/runs/0/artifacts
Reporter | ||
Comment 11•6 years ago
|
||
(In reply to Masatoshi Kimura [:emk] from comment #10)
@k, Could you test whether this build fixes your issue?
https://tools.taskcluster.net/groups/SmTPWv4dS7iX5iskDXza0A/tasks/AjVr9FJbRl69RvSzQ3Y0yA/runs/0/artifacts
Nothing changed
Comment 12•6 years ago
|
||
Hi @Kershaw Chang, I've followed your scenario(using ff 67.0 version) but still cannot reproduce the issue. On my end at step 4 it shows only ipv4 address.
Thanks
Comment 13•6 years ago
|
||
If I understand comment #6 correctly, the string parser works as expected. The reporter said that both ipv6 and ipv4 addresses can be seen in about:networking.
@k, I think maybe http log can help us figure out the problem.
Could you try to capture the log after you set the ipv4OnlyDomains?
Thanks.
Reporter | ||
Comment 14•6 years ago
|
||
(In reply to Kershaw Chang [:kershaw] from comment #13)
If I understand comment #6 correctly, the string parser works as expected. The reporter said that both ipv6 and ipv4 addresses can be seen in about:networking.
@k, I think maybe http log can help us figure out the problem.
Could you try to capture the log after you set the ipv4OnlyDomains?
Thanks.
Comment 16•6 years ago
|
||
(In reply to Honza Bambas (:mayhemer) from comment #15)
Kershaw, will you find time to look at the log?
The log looks all correct to me.
The log shows that we get both ipv6 and ipv4 addresses for afraid.org.
- 2019-07-15 08:52:50.909000 UTC - [Parent 5244: DNS Resolver #14]: D/nsHostResolver CompleteLookup: afraid.org has 2604:8b80:2:8::2
- 2019-07-15 08:52:50.909000 UTC - [Parent 5244: DNS Resolver #14]: D/nsHostResolver CompleteLookup: afraid.org has 204.140.20.21
The socket uses the address 2604:8b80:2:8::2 to connect.
- 2019-07-15 08:52:50.909000 UTC - [Parent 5244: Socket Thread]: E/nsSocketTransport nsSocketTransport::SendStatus [this=000001B0CC24F000 status=804b0007]
- 2019-07-15 08:52:50.909000 UTC - [Parent 5244: Socket Thread]: V/nsHttp nsHalfOpenSocket::SetupBackupTimer() [this=000001B0C9D546B0]
- 2019-07-15 08:52:50.909000 UTC - [Parent 5244: Socket Thread]: D/nsSocketTransport trying address: 2604:8b80:2:8::2
The socket connects to the server successfully.
- 2019-07-15 08:52:51.086000 UTC - [Parent 5244: Socket Thread]: E/nsSocketTransport nsSocketTransport::OnSocketReady [this=000001B0CC24F000 outFlags=2]
- 2019-07-15 08:52:51.086000 UTC - [Parent 5244: Socket Thread]: D/nsSocketTransport advancing to STATE_TRANSFERRING
- 2019-07-15 08:52:51.086000 UTC - [Parent 5244: Socket Thread]: E/nsSocketTransport nsSocketTransport::SendStatus [this=000001B0CC24F000 status=804b0004]
The log shows that firefox did use address 2604:8b80:2:8::2 to connect to afraid.org.
Honza, what do you think? Is there any points that I need to check?
Thanks.
![]() |
||
Comment 17•6 years ago
|
||
(In reply to k from comment #14)
(In reply to Kershaw Chang [:kershaw] from comment #13)
If I understand comment #6 correctly, the string parser works as expected. The reporter said that both ipv6 and ipv4 addresses can be seen in about:networking.
@k, I think maybe http log can help us figure out the problem.
Could you try to capture the log after you set the ipv4OnlyDomains?
Thanks.
And what was the value of the prefence?
![]() |
||
Comment 18•6 years ago
|
||
I see nothing wrong in the log. We try the first address the resolver (apparently native) returns. First attempts per-host are w/o family restrictions:
2019-07-15 08:52:50.907000 UTC - [Parent 5244: DNS Resolver #14]: D/nsHostResolver CompleteLookup: afraid.org has 2604:8b80:2:8::2
2019-07-15 08:52:50.907000 UTC - [Parent 5244: DNS Resolver #14]: D/nsHostResolver CompleteLookup: afraid.org has 204.140.20.21
ipv6 wins here. Note that we don't re-sort (afaik) the records we get. then, we have a racy and kinda non-deterministic algorithm that tries the first address in the list and if there is no SYN/ACK in 250ms, we try (in parallel) IP from the opposite family. If the second conn attempt wins over the first one, we remember the ip family preference and all other connection attempts go via that preferred family.
then note that http2 (=https + http/2.0) connections are coalesced when the certificate provided is also valid for different hosts. so if vk.com and afraid.org happen to share servers, they may both go via the ipv4, if you already have https://vk.com connection.
I think this is INVALID unless I'm missing something or more resilient prove that this could be a firefox bug is presented.
Comment 19•6 years ago
|
||
Close this as INVALID, since the log shows that firefox actually did nothing wrong and ipv6 address can be also seen in about:networking.
Feel free to reopen this if you have more information to provide.
Description
•