summaryrefslogtreecommitdiff
path: root/agent/discovery.h
diff options
context:
space:
mode:
authorFabrice Bellet <fabrice@bellet.info>2020-04-05 21:18:55 +0200
committerOlivier CrĂȘte <olivier.crete@ocrete.ca>2020-05-04 21:33:11 +0000
commita04fa4d49236c91139f5128ace1f81012e791cbd (patch)
treee845f801ca2040e17ed6e7c4b8868024246c3979 /agent/discovery.h
parent0b80cbbaedc1d327366e994d4e9a653c327900f2 (diff)
downloadlibnice-a04fa4d49236c91139f5128ace1f81012e791cbd.tar.gz
discovery: use different port numbers for every local host candidates
This constraint is added to handle the situation where the agent runs on a box doing SNAT on one of its outgoing network interface. The NAT does usually its best to ensure that source port number is preserved on the external NAT address and port. This is called "port preservation" in RFC 4787. When two local host candidates are allowed to have the same source port number, we increase the risk that a first local host candidate *is* the NAT mapping address and port of a second local host candidate, because of the "port preservation" effect. When it happens, a server reflexive candidate and a host candidate will have the same address and port. For that situation to happen, a stun request must be emitted from the internal address first, the NAT mapping doing the port preservation will be created for the internal address, and when a stun request is sent from the external address thereafter, a new NAT mapping will be created, but without port preservation, because the previous mapping already took that reservation. The problem will occur on the remote agent, when receiving a stun request from this address and port, that has no way to know wheather it comes from the host or the server reflexive candidate, if both have been advertised remotely, resulting in pair type mislabelling. This case may happen more easily when a source port range is reduced.
Diffstat (limited to 'agent/discovery.h')
-rw-r--r--agent/discovery.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/agent/discovery.h b/agent/discovery.h
index 3d71930..3ef99b2 100644
--- a/agent/discovery.h
+++ b/agent/discovery.h
@@ -103,7 +103,8 @@ typedef enum {
HOST_CANDIDATE_SUCCESS,
HOST_CANDIDATE_FAILED,
HOST_CANDIDATE_CANT_CREATE_SOCKET,
- HOST_CANDIDATE_REDUNDANT
+ HOST_CANDIDATE_REDUNDANT,
+ HOST_CANDIDATE_DUPLICATE_PORT
} HostCandidateResult;
HostCandidateResult