netfilter: conntrack: add sctp DATA_SENT state
Subsystems (2)
PATCH v3 1/1 netfilter: conntrack: add sctp DATA_SENT state
Changes since v2:
- Abandoned the sctp no_random_port patch from the series
SCTP conntrack currently assumes that the SCTP endpoints will probe secondary paths using HEARTBEAT before sending traffic.
But, according to RFC 9260, SCTP endpoints can send any traffic on any of the confirmed paths after SCTP association is up. SCTP endpoints that sends INIT will confirm all peer addresses that upper layer configures, and the SCTP endpoint that receives COOKIE_ECHO will only confirm the address it sent the INIT_ACK to.
So, we can have a situation where the INIT sender can start to use secondary paths without the need to send HEARTBEAT. This patch allows DATA/SACK packets to create new connection tracking entry.
A new state has been added to indicate that a DATA/SACK chunk has been seen in the original direction - SCTP_CONNTRACK_DATA_SENT. State transitions mostly follows the HEARTBEAT_SENT, except on receiving HEARTBEAT/HEARTBEAT_ACK/DATA/SACK in the reply direction.
State transitions in original direction:
- DATA_SENT behaves similar to HEARTBEAT_SENT for all chunks, except that it remains in DATA_SENT on receving HEARTBEAT, HEARTBEAT_ACK/DATA/SACK chunks
State transitions in reply direction:
- DATA_SENT behaves similar to HEARTBEAT_SENT for all chunks, except that it moves to HEARTBEAT_ACKED on receiving HEARTBEAT/HEARTBEAT_ACK/DATA/SACK chunks
Note: This patch still doesn't solve the problem when the SCTP endpoint decides to use primary paths for association establishment but uses a secondary path for association shutdown. We still have to depend on timeout for connections to expire in such a case.
--- .../uapi/linux/netfilter/nf_conntrack_sctp.h | 1 + .../linux/netfilter/nfnetlink_cttimeout.h | 1 + net/netfilter/nf_conntrack_proto_sctp.c | 104 ++++++++++-------- net/netfilter/nf_conntrack_standalone.c | 8 ++ 4 files changed, 71 insertions(+), 43 deletions(-)
include/uapi/linux/netfilter/nf_conntrack_sctp.h +1 -0
@@ -16,6 +16,7 @@ enum sctp_conntrack {SCTP_CONNTRACK_SHUTDOWN_ACK_SENT ,SCTP_CONNTRACK_HEARTBEAT_SENT ,SCTP_CONNTRACK_HEARTBEAT_ACKED , +SCTP_CONNTRACK_DATA_SENT , SCTP_CONNTRACK_MAX };
include/uapi/linux/netfilter/nfnetlink_cttimeout.h +1 -0
@@ -95,6 +95,7 @@ enum ctattr_timeout_sctp {CTA_TIMEOUT_SCTP_SHUTDOWN_ACK_SENT ,CTA_TIMEOUT_SCTP_HEARTBEAT_SENT ,CTA_TIMEOUT_SCTP_HEARTBEAT_ACKED , +CTA_TIMEOUT_SCTP_DATA_SENT , __CTA_TIMEOUT_SCTP_MAX };#define CTA_TIMEOUT_SCTP_MAX (__CTA_TIMEOUT_SCTP_MAX - 1)
net/netfilter/nf_conntrack_proto_sctp.c +61 -43
168 lines not on this page · raw message
net/netfilter/nf_conntrack_standalone.c +8 -0
@@ -602,6 +602,7 @@ enum nf_ct_sysctl_index {NF_SYSCTL_CT_PROTO_TIMEOUT_SCTP_SHUTDOWN_ACK_SENT ,NF_SYSCTL_CT_PROTO_TIMEOUT_SCTP_HEARTBEAT_SENT ,NF_SYSCTL_CT_PROTO_TIMEOUT_SCTP_HEARTBEAT_ACKED , +NF_SYSCTL_CT_PROTO_TIMEOUT_SCTP_DATA_SENT , #endif #ifdef CONFIG_NF_CT_PROTO_DCCP NF_SYSCTL_CT_PROTO_TIMEOUT_DCCP_REQUEST,
@@ -892,6 +893,12 @@ static struct ctl_table nf_ct_sysctl_table[] = { .mode = 0644, .proc_handler = proc_dointvec_jiffies, }, + [NF_SYSCTL_CT_PROTO_TIMEOUT_SCTP_DATA_SENT] = { + .procname = "nf_conntrack_sctp_timeout_data_sent", + .maxlen = sizeof(unsigned int), + .mode = 0644, + .proc_handler = proc_dointvec_jiffies, + },#endif #ifdef CONFIG_NF_CT_PROTO_DCCP [NF_SYSCTL_CT_PROTO_TIMEOUT_DCCP_REQUEST] = {
@@ -1036,6 +1043,7 @@ static void nf_conntrack_standalone_init_sctp_sysctl(struct net *net,XASSIGN (SHUTDOWN_ACK_SENT , sn);XASSIGN (HEARTBEAT_SENT , sn);XASSIGN (HEARTBEAT_ACKED , sn); +XASSIGN (DATA_SENT , sn);#undef XASSIGN#endif }
Signature · 1 line
2.34.1
Quoted 30 lines · Sriram Yagnaraman
Changes since v2:
- Abandoned the sctpno_random_portpatch from the seriesSCTP conntrack currently assumes that the SCTP endpoints will probe secondary paths using HEARTBEAT before sending traffic.
But, according to RFC 9260, SCTP endpoints can send any traffic on any of the confirmed paths after SCTP association is up. SCTP endpoints that sends INIT will confirm all peer addresses that upper layer configures, and the SCTP endpoint that receives
COOKIE_ECHOwill only confirm the address it sent theINIT_ACKto.So, we can have a situation where the INIT sender can start to use secondary paths without the need to send HEARTBEAT. This patch allows DATA/SACK packets to create new connection tracking entry.
A new state has been added to indicate that a DATA/SACK chunk has been seen in the original direction -
SCTP_CONNTRACK_DATA_SENT. State transitions mostly follows theHEARTBEAT_SENT, except on receiving HEARTBEAT/HEARTBEAT_ACK/DATA/SACK in the reply direction.State transitions in original direction:
-DATA_SENTbehaves similar toHEARTBEAT_SENTfor all chunks, except that it remains inDATA_SENTon receving HEARTBEAT, HEARTBEAT_ACK/DATA/SACK chunks
State transitions in reply direction:
-DATA_SENTbehaves similar toHEARTBEAT_SENTfor all chunks, except that it moves toHEARTBEAT_ACKEDon receiving HEARTBEAT/HEARTBEAT_ACK/DATA/SACK chunks
Quoted 4 lines
Note: This patch still doesn't solve the problem when the SCTP endpoint decides to use primary paths for association establishment but uses a secondary path for association shutdown. We still have to depend on timeout for connections to expire in such a case.
Applied, thanks
One request of mine: Would you send a patch to extend
Documentation/networking/nf_conntrack-sysctl.rst
to document sctp timeouts?
Thanks.
Quoted 37 lines · Pablo Neira Ayuso
Quoted 30 lines · Sriram Yagnaraman
Changes since v2:
- Abandoned the sctpno_random_portpatch from the seriesSCTP conntrack currently assumes that the SCTP endpoints will probe secondary paths using HEARTBEAT before sending traffic.
But, according to RFC 9260, SCTP endpoints can send any traffic on any of the confirmed paths after SCTP association is up. SCTP endpoints that sends INIT will confirm all peer addresses that upper layer configures, and the SCTP endpoint that receives
COOKIE_ECHOwill only confirm the address it sent theINIT_ACKto.So, we can have a situation where the INIT sender can start to use secondary paths without the need to send HEARTBEAT. This patch allows DATA/SACK packets to create new connection tracking entry.
A new state has been added to indicate that a DATA/SACK chunk has been seen in the original direction -
SCTP_CONNTRACK_DATA_SENT. State transitions mostly follows theHEARTBEAT_SENT, except on receiving HEARTBEAT/HEARTBEAT_ACK/DATA/SACK in the reply direction.State transitions in original direction:
-DATA_SENTbehaves similar toHEARTBEAT_SENTfor all chunks, except that it remains inDATA_SENTon receving HEARTBEAT, HEARTBEAT_ACK/DATA/SACK chunks
State transitions in reply direction:
-DATA_SENTbehaves similar toHEARTBEAT_SENTfor all chunks, except that it moves toHEARTBEAT_ACKEDon receiving HEARTBEAT/HEARTBEAT_ACK/DATA/SACK chunksQuoted 4 lines
Note: This patch still doesn't solve the problem when the SCTP endpoint decides to use primary paths for association establishment but uses a secondary path for association shutdown. We still have to depend on timeout for connections to expire in such a case.
Applied, thanks
Quoted 7 lines
One request of mine: Would you send a patch to extend
Documentation/networking/nf_conntrack-sysctl.rstto document sctp timeouts?
Thanks.
Yes, sure will do.