[1.1.72] Multiplayer join fails when SRV request is caught by a CNAME record
Posted: Sun Nov 13, 2022 9:03 pm
Factorio 1.1.72 (build 60222, win64, steam)
I'm attempting to host a Factorio server accessed via direct connection, rather than advertised via the public server list. For testing, I'm using the domain zone2.rbarrie.us, which has an A record pointing to my home IP, and a wildcard CNAME record aliasing *.zone2.rbarrie.us to zone2.rbarrie.us. The server is intended to be accessed via factorio.zone2.rbarrie.us
I've found that when the Factorio client attempts to look up the SRV record for _factorio._udp.factorio.zone2.rbarrie.us, since there is no valid SRV record defined, the CNAME record gets returned instead. This appears to be valid behavior per RFC 4592 section 4.5. "SRV RRSet at a Wildcard Domain Name" (https://www.ietf.org/rfc/rfc4592.txt). However, something about this response causes the Factorio client to attempt to connect to the multiplayer server on port 0, rather than falling back to the default port 34197.
By contrast, if I have zone1.rbarrie.us in which the wildcard CNAME is replaced by an explicit CNAME for factorio.zone1.rbarrie.us, the Factorio client correctly identifies that there are no valid SRV records, and defaults to port 34197.
The expected behavior is: if the Factorio client makes a SRV request, and receives a response that does not contain any SRV records, then it should identify that the "DNS SRV lookup for [xyz] didn't return any usable records" and fall back to the default port 34197.
Full factorio-current.log file showing connection attempts to both factorio.zone1.rbarrie.us and factorio.zone2.rbarrie.us:
I'm attempting to host a Factorio server accessed via direct connection, rather than advertised via the public server list. For testing, I'm using the domain zone2.rbarrie.us, which has an A record pointing to my home IP, and a wildcard CNAME record aliasing *.zone2.rbarrie.us to zone2.rbarrie.us. The server is intended to be accessed via factorio.zone2.rbarrie.us
Code: Select all
@ IN A 98.209.243.3
* IN CNAME zone2.rbarrie.us.
Code: Select all
1375.748 Info SocketAddress.cpp:175: DNS SRV lookup returned zone2.rbarrie.us:0 for factorio.zone2.rbarrie.us
1375.792 Joining game IP ADDR:({98.209.243.3:0})
1375.792 Info UDPSocket.cpp:33: Opening socket
1375.792 Info ClientMultiplayerManager.cpp:610: UpdateTick(4294967295) changing state from(Ready) to(Connecting)
1375.792 Verbose RouterBase.cpp:60: Started router thread.
1380.875 Verbose TransmissionControlHelper.cpp:170: Fragment 0000 failed too many times
1381.726 Info ClientMultiplayerManager.cpp:152: Disconnecting multiplayer connection. Reason: Quit.
1381.726 Info ClientMultiplayerManager.cpp:610: UpdateTick(4294967295) changing state from(Connecting) to(Disconnected)
1381.730 Verbose RouterBase.cpp:82: Finishing router thread.
1381.730 Info UDPSocket.cpp:218: Closing socket
1381.730 Info UDPSocket.cpp:248: Socket closed
Domain Name System (response)
Transaction ID: 0xc595
Flags: 0x8180 Standard query response, No error
Questions: 1
Answer RRs: 1
Authority RRs: 1
Additional RRs: 0
Queries
_factorio._udp.factorio.zone2.rbarrie.us: type SRV, class IN
Name: _factorio._udp.factorio.zone2.rbarrie.us
[Name Length: 40]
[Label Count: 6]
Type: SRV (Server Selection) (33)
Class: IN (0x0001)
Answers
_factorio._udp.factorio.zone2.rbarrie.us: type CNAME, class IN, cname zone2.rbarrie.us
Name: _factorio._udp.factorio.zone2.rbarrie.us
Type: CNAME (Canonical NAME for an alias) (5)
Class: IN (0x0001)
Time to live: 60 (1 minute)
Data length: 2
CNAME: zone2.rbarrie.us
Domain Name System (response)
Transaction ID: 0xa1c0
Flags: 0x8180 Standard query response, No error
Questions: 1
Answer RRs: 1
Authority RRs: 0
Additional RRs: 0
Queries
zone2.rbarrie.us: type A, class IN
Name: zone2.rbarrie.us
[Name Length: 16]
[Label Count: 3]
Type: A (Host Address) (1)
Class: IN (0x0001)
Answers
zone2.rbarrie.us: type A, class IN, addr 98.209.243.3
Name: zone2.rbarrie.us
Type: A (Host Address) (1)
Class: IN (0x0001)
Time to live: 60 (1 minute)
Data length: 4
Address: 98.209.243.3
Code: Select all
@ IN A 98.209.243.3
factorio IN CNAME zone1.rbarrie.us.
Code: Select all
1370.377 Verbose SocketAddress.cpp:177: DNS SRV lookup for _factorio._udp.factorio.zone1.rbarrie.us didn't return any usable records
1370.391 Joining game IP ADDR:({98.209.243.3:34197})
1370.391 Info UDPSocket.cpp:33: Opening socket
1370.392 Info ClientMultiplayerManager.cpp:610: UpdateTick(4294967295) changing state from(Ready) to(Connecting)
1370.392 Verbose RouterBase.cpp:60: Started router thread.
1370.408 Info ClientMultiplayerManager.cpp:211: Quitting multiplayer connection.
1370.408 Info ClientMultiplayerManager.cpp:610: UpdateTick(4294967295) changing state from(Connecting) to(Disconnected)
1370.412 Verbose RouterBase.cpp:82: Finishing router thread.
1370.412 Info UDPSocket.cpp:218: Closing socket
1370.412 Info UDPSocket.cpp:248: Socket closed
Domain Name System (response)
Transaction ID: 0x928a
Flags: 0x8183 Standard query response, No such name
Questions: 1
Answer RRs: 0
Authority RRs: 1
Additional RRs: 0
Queries
_factorio._udp.factorio.zone1.rbarrie.us: type SRV, class IN
Name: _factorio._udp.factorio.zone1.rbarrie.us
[Name Length: 40]
[Label Count: 6]
Type: SRV (Server Selection) (33)
Class: IN (0x0001)
Domain Name System (response)
Transaction ID: 0xdee3
Flags: 0x8180 Standard query response, No error
Questions: 1
Answer RRs: 2
Authority RRs: 0
Additional RRs: 0
Queries
factorio.zone1.rbarrie.us: type A, class IN
Name: factorio.zone1.rbarrie.us
[Name Length: 25]
[Label Count: 4]
Type: A (Host Address) (1)
Class: IN (0x0001)
Answers
factorio.zone1.rbarrie.us: type CNAME, class IN, cname zone1.rbarrie.us
Name: factorio.zone1.rbarrie.us
Type: CNAME (Canonical NAME for an alias) (5)
Class: IN (0x0001)
Time to live: 40 (40 seconds)
Data length: 2
CNAME: zone1.rbarrie.us
zone1.rbarrie.us: type A, class IN, addr 98.209.243.3
Name: zone1.rbarrie.us
Type: A (Host Address) (1)
Class: IN (0x0001)
Time to live: 40 (40 seconds)
Data length: 4
Address: 98.209.243.3
Full factorio-current.log file showing connection attempts to both factorio.zone1.rbarrie.us and factorio.zone2.rbarrie.us: