Skip to contentSkip to conversation

tcp: ipv6: support RFC 6069 (TCP-LD)

PATCH Applied Eric Dumazet 4 participants 4 messages May 28, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tcp: ipv6: support RFC 6069 (TCP-LD)

Make tcp_ld_RTO_revert() helper available to IPv6, and implement RFC 6069 :

Quoting this RFC :

3. Connectivity Disruption Indication

For Internet Protocol version 6 (IPv6) [RFC2460], the counterpart of the ICMP destination unreachable message of code 0 (net unreachable) and of code 1 (host unreachable) is the ICMPv6 destination unreachable message of code 0 (no route to destination) [RFC4443]. As with IPv4, a router should generate an ICMPv6 destination unreachable message of code 0 in response to a packet that cannot be delivered to its destination address because it lacks a matching entry in its routing table.

---
 include/net/tcp.h   | 1 +
 net/ipv4/tcp_ipv4.c | 3 ++-
 net/ipv6/tcp_ipv6.c | 9 +++++++++
 3 files changed, 12 insertions(+), 1 deletion(-)
include/net/tcp.h +1 -0
index b681338a8320b55a32004b4d9d88c33ca28e8d29..66e4b8331850623515fade891a2e9feb79c49061 100644
@@ -437,6 +437,7 @@ u16 tcp_get_syncookie_mss(struct request_sock_ops *rsk_ops,
 void tcp_v4_send_check(struct sock *sk, struct sk_buff *skb);
 void tcp_v4_mtu_reduced(struct sock *sk);
 void tcp_req_err(struct sock *sk, u32 seq, bool abort);
+void tcp_ld_RTO_revert(struct sock *sk, u32 seq);
 int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb);
 struct sock *tcp_create_openreq_child(const struct sock *sk,
 				      struct request_sock *req,
net/ipv4/tcp_ipv4.c +2 -1
index 3a1e2becb1e8d1e0513e87bdfc0e1d5769ffc8e8..615de2d62d8b9b005a9a31b679d253fd2e5c12a8 100644
@@ -404,7 +404,7 @@ void tcp_req_err(struct sock *sk, u32 seq, bool abort)
 EXPORT_SYMBOL(tcp_req_err);
 
 /* TCP-LD (RFC 6069) logic */
-static void tcp_ld_RTO_revert(struct sock *sk, u32 seq)
+void tcp_ld_RTO_revert(struct sock *sk, u32 seq)
 {
 	struct inet_connection_sock *icsk = inet_csk(sk);
 	struct tcp_sock *tp = tcp_sk(sk);
@@ -441,6 +441,7 @@ static void tcp_ld_RTO_revert(struct sock *sk, u32 seq)
 		tcp_retransmit_timer(sk);
 	}
 }
+EXPORT_SYMBOL(tcp_ld_RTO_revert);
 
 /*
  * This routine is called by the ICMP module when it gets some
net/ipv6/tcp_ipv6.c +9 -0
index c403e955fde1288fe781a3f5664de768642b0a7e..00f81817b378911aad3c905160218e964657e730 100644
@@ -473,6 +473,15 @@ static int tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
 		} else
 			sk->sk_err_soft = err;
 		goto out;
+	case TCP_LISTEN:
+		break;
+	default:
+		/* check if this ICMP message allows revert of backoff.
+		 * (see RFC 6069)
+		 */
+		if (!fastopen && type == ICMPV6_DEST_UNREACH &&
+		    code == ICMPV6_NOROUTE)
+			tcp_ld_RTO_revert(sk, seq);
 	}
 
 	if (!sock_owned_by_user(sk) && np->recverr) {
Signature · 1 line
2.27.0.rc0.183.gde8f92d652-goog
Acked-by on v1 1/1
#1 lore raw
Quoted 17 lines · Eric Dumazet

Make tcp_ld_RTO_revert() helper available to IPv6, and implement RFC 6069 :

Quoting this RFC :

3. Connectivity Disruption Indication

For Internet Protocol version 6 (IPv6) [RFC2460], the counterpart of the ICMP destination unreachable message of code 0 (net unreachable) and of code 1 (host unreachable) is the ICMPv6 destination unreachable message of code 0 (no route to destination) [RFC4443]. As with IPv4, a router should generate an ICMPv6 destination unreachable message of code 0 in response to a packet that cannot be delivered to its destination address because it lacks a matching entry in its routing table.

Quoted 1 line
Quoted 62 lines
---
 include/net/tcp.h   | 1 +
 net/ipv4/tcp_ipv4.c | 3 ++-
 net/ipv6/tcp_ipv6.c | 9 +++++++++
 3 files changed, 12 insertions(+), 1 deletion(-)
include/net/tcp.h +1 -0
index b681338a8320b55a32004b4d9d88c33ca28e8d29..66e4b8331850623515fade891a2e9feb79c49061 100644
@@ -437,6 +437,7 @@ u16 tcp_get_syncookie_mss(struct request_sock_ops *rsk_ops,
 void tcp_v4_send_check(struct sock *sk, struct sk_buff *skb);
 void tcp_v4_mtu_reduced(struct sock *sk);
 void tcp_req_err(struct sock *sk, u32 seq, bool abort);
+void tcp_ld_RTO_revert(struct sock *sk, u32 seq);
 int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb);
 struct sock *tcp_create_openreq_child(const struct sock *sk,
                                      struct request_sock *req,
net/ipv4/tcp_ipv4.c +2 -1
index 3a1e2becb1e8d1e0513e87bdfc0e1d5769ffc8e8..615de2d62d8b9b005a9a31b679d253fd2e5c12a8 100644
@@ -404,7 +404,7 @@ void tcp_req_err(struct sock *sk, u32 seq, bool abort)
 EXPORT_SYMBOL(tcp_req_err);
 
 /* TCP-LD (RFC 6069) logic */
-static void tcp_ld_RTO_revert(struct sock *sk, u32 seq)
+void tcp_ld_RTO_revert(struct sock *sk, u32 seq)
 {
        struct inet_connection_sock *icsk = inet_csk(sk);
        struct tcp_sock *tp = tcp_sk(sk);
@@ -441,6 +441,7 @@ static void tcp_ld_RTO_revert(struct sock *sk, u32 seq)
                tcp_retransmit_timer(sk);
        }
 }
+EXPORT_SYMBOL(tcp_ld_RTO_revert);
 
 /*
  * This routine is called by the ICMP module when it gets some
net/ipv6/tcp_ipv6.c +9 -1
index c403e955fde1288fe781a3f5664de768642b0a7e..00f81817b378911aad3c905160218e964657e730 100644
@@ -473,6 +473,15 @@ static int tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
                } else
                        sk->sk_err_soft = err;
                goto out;
+       case TCP_LISTEN:
+               break;
+       default:
+               /* check if this ICMP message allows revert of backoff.
+                * (see RFC 6069)
+                */
+               if (!fastopen && type == ICMPV6_DEST_UNREACH &&
+                   code == ICMPV6_NOROUTE)
+                       tcp_ld_RTO_revert(sk, seq);
        }
 
        if (!sock_owned_by_user(sk) && np->recverr) {
--

2.27.0.rc0.183.gde8f92d652-goog

maintainer Acked-by on v1 1/1
#2 lore raw
In reply to Eric Dumazet
Quoted 17 lines · Eric Dumazet

Make tcp_ld_RTO_revert() helper available to IPv6, and implement RFC 6069 :

Quoting this RFC :

3. Connectivity Disruption Indication

For Internet Protocol version 6 (IPv6) [RFC2460], the counterpart of the ICMP destination unreachable message of code 0 (net unreachable) and of code 1 (host unreachable) is the ICMPv6 destination unreachable message of code 0 (no route to destination) [RFC4443]. As with IPv4, a router should generate an ICMPv6 destination unreachable message of code 0 in response to a packet that cannot be delivered to its destination address because it lacks a matching entry in its routing table.

Quoted 1 line

Thanks, Eric!

neal

maintainer Applied
#3 lore raw
In reply to Eric Dumazet

From: Eric Dumazet <[email protected]>
Date: Wed, 27 May 2020 17:34:58 -0700

Quoted 16 lines

Make tcp_ld_RTO_revert() helper available to IPv6, and implement RFC 6069 :

Quoting this RFC :

3. Connectivity Disruption Indication

For Internet Protocol version 6 (IPv6) [RFC2460], the counterpart of the ICMP destination unreachable message of code 0 (net unreachable) and of code 1 (host unreachable) is the ICMPv6 destination unreachable message of code 0 (no route to destination) [RFC4443]. As with IPv4, a router should generate an ICMPv6 destination unreachable message of code 0 in response to a packet that cannot be delivered to its destination address because it lacks a matching entry in its routing table.

Quoted 1 line

Applied, thanks Eric.