Port Control Protocol (PCP) Extension for Port-Set Allocation
Extracted elements (27)
Idempotence is preserved by the PORT_SET extension, but the order in which overlapping port-set requests arrive determines which mapping is created. Clients are therefore required to prevent overlapping requests rather than relying on server-side deduplication.
No capability-discovery mechanism is defined for PORT_SET because the option code is in the 'optional to process' range, and a client cannot distinguish 'server does not support PORT_SET' from 'server chose to allocate only one port.' Adding discovery would add complexity without solving the ambiguity.
PORT_SET includes a parity-preservation bit (P) because protocols such as RTP assign semantic meaning to port parity (even ports for media, odd for RTCP). Without parity preservation, mapping a port set for RTP/RTCP use would be functionally incorrect.
PORT_SET is preferred over multiple individual MAP requests because it reduces network traffic and latency, enables server-side bulk allocation that improves data-plane efficiency (e.g., CGN bulk port schemes), and allows a single state-table entry per client, greatly improving scalability.
The absence of a PORT_SET option in a server response does not prove the server lacks PORT_SET support; the server may have simply chosen to allocate only one port. Clients wishing more ports MAY send additional MAP requests.
The PORT_SET option code 130 falls in the 'optional to process' range (128–191). A PCP server that does not support PORT_SET will silently ignore the option and process the request as a plain single-port MAP request, ensuring backward compatibility.
A PCP client attempting to refresh or delete a port-set mapping MUST include the PORT_SET option in its request so the server can identify the mapping as a port-set entity.
A PCP client MUST NOT include more than one PORT_SET option in a PCP MAP request. If multiple port sets are needed, the client MUST issue separate MAP requests, each with a distinct Internal Port.
A PCP client SHOULD NOT include a PORT_SET option in single-port PCP MAP requests (creation, renewal, or deletion) because doing so unnecessarily increases server processing load.
If parity preservation is required (even↔even, odd↔odd), the PCP client MUST set the parity bit (P=1) in the PORT_SET option to request that the PCP server preserve port parity.
If the PCP server ends up mapping only a single port for any reason, the PORT_SET option MUST NOT be present in the response. A single-port MAP request with PORT_SET is silently treated as a plain single-port request.
If the requested port set cannot be fully satisfied, the PCP server SHOULD map as many ports as possible and SHOULD map at least one port (equivalent to Port Set Size = 1 behavior).
In a request, the First Internal Port field MUST be set equal to the Internal Port field in the MAP Opcode header. In a response it indicates the first port of the mapped internal port set, which may differ from the requested value.
It is RECOMMENDED to configure the PCP server to assign the maximum allowed Port Set Size in a single response to minimize the number of mapping table entries; this policy SHOULD itself be configurable.
PCP clients MUST ensure that port-set mapping requests do not inadvertently overlap with each other, for example by arbitrating requests through a central PCP client process or by acquiring internal ports from the OS before requesting PCP mappings.
PREFER_FAILURE MUST NOT appear in a PCP MAP request that includes a PORT_SET option; a server receiving such a combination returns a MALFORMED_OPTION error.
The maximum occurrences of the PORT_SET option in a single PCP MAP request MUST be limited to 1, because a second PORT_SET option would imply overlapping Suggested External Port Sets derived from the same MAP Opcode header.
The PCP server MUST NOT map more ports than the client requested. Internal Ports outside the range of Port Set Size ports starting from the First Internal Port MUST NOT be mapped.
The Port Set Size field MUST NOT be zero; a server receiving a zero value returns a MALFORMED_OPTION error.
When the PCP server is configured to allocate multiple port sets to a subscriber, the same Assigned External IP Address SHOULD be assigned across multiple port-set responses to that subscriber.
Port-set mappings are renewed and deleted as a single entity: the Assigned Lifetime applies to all ports in the set simultaneously. Overlap with existing single-port or port-set mappings causes the server to treat the request as independent refresh requests, sending one Mapping Update message per affected mapping.
The Internal Port Set is the contiguous range of Port Set Size ports starting from First Internal Port. The Suggested External Port Set, and correspondingly the Assigned External Port Set, are the Port Set Size ports starting from the Suggested/Assigned External Port respectively.
The PORT_SET option (option code 130) is a new PCP MAP option that allows a client to request a set of ports in a single request. It is valid only for the MAP opcode, has a length of 5 bytes, and may appear at most once per request or response.
IANA has allocated value 130 in the 'PCP Options' registry for the PORT_SET option defined in this document.
A single PORT_SET MAP request can trigger multiple responses (one per overlapping existing mapping). An on-path attacker who eavesdrops a mapping nonce can exploit this to mount an amplification attack. Using PCP authentication (RFC 6887, Section 18) eliminates this vector.
To prevent a PCP client from monopolizing all ports bound to a shared IP address, port quotas SHOULD be configured on the PCP server per RFC 6887, Section 17.2.
The PORT_SET option encodes: Option Code=130 (8-bit), Reserved (8-bit), Option Length=5 (16-bit), Port Set Size (16-bit unsigned integer), First Internal Port (16-bit), Reserved (7-bit), and parity bit P (1-bit). Total encoded length is 8 bytes including the 3-byte option header.