diff mbox

TCP: check min TTL on received ICMP packets

Message ID 20100318142732.4de0f8d7@nehalam
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

stephen hemminger March 18, 2010, 9:27 p.m. UTC
This adds RFC5082 checks for TTL on received ICMP packets.
It adds some security against spoofed ICMP packets
disrupting GTSM protected sessions.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

---
Please apply to 2.6.33 since it basically a "follow correct RFC"
fix to original GTSM patch.

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

David Miller March 20, 2010, 4:08 a.m. UTC | #1
From: Stephen Hemminger <shemminger@vyatta.com>
Date: Thu, 18 Mar 2010 14:27:32 -0700

> This adds RFC5082 checks for TTL on received ICMP packets.
> It adds some security against spoofed ICMP packets
> disrupting GTSM protected sessions.
> 
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
  
Applied.

> Please apply to 2.6.33 since it basically a "follow correct RFC"
> fix to original GTSM patch.

Queued up for -stable, thanks!
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Stephen Hemminger March 21, 2010, 12:05 a.m. UTC | #2
----- "David Miller" <davem@davemloft.net> wrote:

> From: Stephen Hemminger <shemminger@vyatta.com>
> Date: Thu, 18 Mar 2010 14:27:32 -0700
> 
> > This adds RFC5082 checks for TTL on received ICMP packets.
> > It adds some security against spoofed ICMP packets
> > disrupting GTSM protected sessions.
> > 
> > Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
>   
> Applied.
> 
> > Please apply to 2.6.33 since it basically a "follow correct RFC"
> > fix to original GTSM patch.
> 

I meant 2.6.34... min_ttl is not in 2.6.33
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller March 22, 2010, 1:12 a.m. UTC | #3
From: Stephen Hemminger <stephen.hemminger@vyatta.com>
Date: Sat, 20 Mar 2010 17:05:14 -0700 (PDT)

>> From: Stephen Hemminger <shemminger@vyatta.com>
>> Date: Thu, 18 Mar 2010 14:27:32 -0700
>> 
>> > Please apply to 2.6.33 since it basically a "follow correct RFC"
>> > fix to original GTSM patch.
>> 
> 
> I meant 2.6.34... min_ttl is not in 2.6.33

Gotcha.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

--- a/net/ipv4/tcp_ipv4.c	2010-03-18 11:10:14.396384060 -0700
+++ b/net/ipv4/tcp_ipv4.c	2010-03-18 11:13:09.115759682 -0700
@@ -370,6 +370,11 @@  void tcp_v4_err(struct sk_buff *icmp_skb
 	if (sk->sk_state == TCP_CLOSE)
 		goto out;
 
+	if (unlikely(iph->ttl < inet_sk(sk)->min_ttl)) {
+		NET_INC_STATS_BH(net, LINUX_MIB_TCPMINTTLDROP);
+		goto out;
+	}
+
 	icsk = inet_csk(sk);
 	tp = tcp_sk(sk);
 	seq = ntohl(th->seq);