linux-api.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger-ZtmgI6mnKB3QT0dZR+AlfA@public.gmane.org>
To: Eric Dumazet <eric.dumazet-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: David Miller <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>,
	netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH] tcp: Generalized TTL Security Mechanism
Date: Mon, 11 Jan 2010 08:25:29 -0800	[thread overview]
Message-ID: <20100111082529.3d5cdae3@nehalam> (raw)
In-Reply-To: <4B4B0AA3.6010207-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

On Mon, 11 Jan 2010 12:25:23 +0100
Eric Dumazet <eric.dumazet-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:

> Le 11/01/2010 07:00, Stephen Hemminger a écrit :
> > This patch adds the kernel portions needed to implement
> > RFC 5082 Generalized TTL Security Mechanism (GTSM).
> > It is a lightweight security measure against forged
> > packets causing DoS attacks (for BGP). 
> > 
> > This is already implemented the same way in BSD kernels.
> > For the necessary Quagga patch 
> >   http://www.gossamer-threads.com/lists/quagga/dev/17389
> > 
> > Description from Cisco
> >   http://www.cisco.com/en/US/docs/ios/12_3t/12_3t7/feature/guide/gt_btsh.html
> > 
> > It does add one byte to each socket structure, but I did
> > a little rearrangement to reuse a hole (on 64 bit), but it
> > does grow the structure on 32 bit
> > 
> > This should be documented on ip(4) man page and the Glibc in.h
> > file also needs update.  IPV6_MINHOPLIMIT should also be added
> > (although BSD doesn't support that).  
> > 
> > Only TCP is supported, but could also be added to UDP, DCCP, SCTP
> > if desired.
> > 
> > Signed-off-by: Stephen Hemminger <shemminger-ZtmgI6mnKB3QT0dZR+AlfA@public.gmane.org>
> > 
> 
> > --- a/net/ipv4/tcp_ipv4.c	2010-01-10 21:06:42.931093698 -0800
> > +++ b/net/ipv4/tcp_ipv4.c	2010-01-10 21:08:21.537513427 -0800
> > @@ -1649,6 +1649,9 @@ int tcp_v4_rcv(struct sk_buff *skb)
> >  	if (!sk)
> >  		goto no_tcp_socket;
> >  
> > +	if (iph->ttl < inet_sk(sk)->min_ttl)
> > +		goto discard_and_relse;
> > +
> >  process:
> >  	if (sk->sk_state == TCP_TIME_WAIT)
> >  		goto do_time_wait;
> 
> Just wondering if perfoming the check at connection establishment time
> (SYN or SYN-ACK packet) instead of every received packet would be enough ?

We could but:
  1. GTSM is trying to protect against Man in the Middle attacks to existing
     BGP connections
  2. That is not what BSD (or other vendors) do.

> Of course, for listeners waiting for connexions from different peers (and different
> ttl values), it would be tricky.
> 
> Check should be done at user level, if we store ttl value of SYN packet and let
> user application read its value by a getsockopt()

I think IP_RECVTTL would work for that idea.

  parent reply	other threads:[~2010-01-11 16:25 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-11  6:00 [PATCH] tcp: Generalized TTL Security Mechanism Stephen Hemminger
2010-01-11 11:25 ` Eric Dumazet
     [not found]   ` <4B4B0AA3.6010207-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2010-01-11 16:25     ` Stephen Hemminger [this message]
2010-01-11 17:04       ` Eric Dumazet
2010-01-11 17:10         ` Eric Dumazet
     [not found]           ` <4B4B5B84.3090409-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2010-01-12  0:27             ` David Miller
2010-01-12  0:28 ` David Miller
2010-01-14 10:58 ` Andi Kleen
     [not found]   ` <873a29eywq.fsf-3rXA9MLqAseW/qJFnhkgxti2O/JbrIOy@public.gmane.org>
2010-01-14 11:04     ` David Miller
     [not found]       ` <20100114.030454.16178889.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2010-01-14 11:22         ` Andi Kleen
     [not found]           ` <20100114112216.GK12241-u0/ZJuX+froe6aEkudXLsA@public.gmane.org>
2010-01-14 11:27             ` David Miller
2010-01-14 12:38               ` William Allen Simpson
     [not found]                 ` <4B4F1044.8080500-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2010-01-14 13:14                   ` Eric Dumazet

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100111082529.3d5cdae3@nehalam \
    --to=shemminger-ztmgi6mnkb3qt0dzr+alfa@public.gmane.org \
    --cc=davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org \
    --cc=eric.dumazet-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).