-
Improvement
-
Resolution: Unresolved
-
Medium
-
None
-
None
-
None
-
3
-
9223372036854775807
SockLND identifies a remote peer using the NID supplied in its HELLO (kshm_src_nid). Currently, this NID is not validated against the remote address of the underlying TCP connection.
- Passive: For connections from a reserved source port (accept=secure, the default), ksocknal_recv_hello() uses kshm_src_nid directly. The accept=all branch instead derives the peer identity from the socket address.
- Active: ksocknal_recv_hello() checks that the HELLO NID matches the requested peer NID, but does not verify its consistency with the connection's remote address.
- The advertised NID's network is not checked against the receiving NI's network.
- lnet_connect() currently selects a source address using choose_ipv4_src() on the interface, which may differ from the NI's configured address.
The advertised NID is subsequently used as the key for SockLND peer lookup and connection management. Inconsistent NID and transport-address information can therefore lead to unexpected peer associations, connection replacement, or traffic delivery over unintended connections.
Proposal
Introduce an optional SockLND connection-address validation policy, disabled by default, with three modes:
- off: Preserve current behavior.
- warn: Log and count connections with inconsistent NID and transport-address information, without rejecting them or changing outgoing source-address selection.
- enforce: Bind outgoing connections to the NI's configured address and reject connections whose advertised NID does not match the observed TCP peer address.
A connection passes validation when both conditions hold:
- The advertised NID's network matches the receiving NI's network.
- The advertised NID's address matches the connection's remote IP address.
Validation applies to both active and passive connections and takes place before the connection is associated with a SockLND peer.
The policy is exposed as a read-only (0444) module parameter, ensuring consistent behavior throughout the module's lifetime.
Compatibility
The default off mode preserves existing behavior.
In enforce mode, configurations that use a TCP source address different from the NI's configured NID address, including some secondary-address and NAT configurations, may no longer establish connections.
The warn mode allows administrators to identify address inconsistencies before enabling enforcement.
The change is limited to SockLND connection identity validation. It does not alter LNet message-header source handling, peer discovery, or Multi-Rail membership management.