netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Patch] net: prevent setting ttl=0 via IP_TTL
@ 2013-01-08  7:17 Cong Wang
  2013-01-08 15:07 ` Eric Dumazet
  2013-01-09  1:57 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Cong Wang @ 2013-01-08  7:17 UTC (permalink / raw)
  To: netdev; +Cc: nitin padalia, Eric Dumazet, David S. Miller, Cong Wang

From: Cong Wang <xiyou.wangcong@gmail.com>

A regression is introduced by the following commit:

	commit 4d52cfbef6266092d535237ba5a4b981458ab171
	Author: Eric Dumazet <eric.dumazet@gmail.com>
	Date:   Tue Jun 2 00:42:16 2009 -0700

	    net: ipv4/ip_sockglue.c cleanups
	    
	    Pure cleanups

but it is not a pure cleanup...

	-               if (val != -1 && (val < 1 || val>255))
	+               if (val != -1 && (val < 0 || val > 255))

Since there is no reason provided to allow ttl=0, change it back.

Reported-by: nitin padalia <padalia.nitin@gmail.com>
Cc: nitin padalia <padalia.nitin@gmail.com>
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>

---
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c
index 3c9d208..d9c4f11 100644
--- a/net/ipv4/ip_sockglue.c
+++ b/net/ipv4/ip_sockglue.c
@@ -590,7 +590,7 @@ static int do_ip_setsockopt(struct sock *sk, int level,
 	case IP_TTL:
 		if (optlen < 1)
 			goto e_inval;
-		if (val != -1 && (val < 0 || val > 255))
+		if (val != -1 && (val < 1 || val > 255))
 			goto e_inval;
 		inet->uc_ttl = val;
 		break;

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Patch] net: prevent setting ttl=0 via IP_TTL
  2013-01-08  7:17 [Patch] net: prevent setting ttl=0 via IP_TTL Cong Wang
@ 2013-01-08 15:07 ` Eric Dumazet
  2013-01-09  1:57 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Dumazet @ 2013-01-08 15:07 UTC (permalink / raw)
  To: Cong Wang; +Cc: netdev, nitin padalia, David S. Miller

On Tue, 2013-01-08 at 15:17 +0800, Cong Wang wrote:

> ---
> diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c
> index 3c9d208..d9c4f11 100644
> --- a/net/ipv4/ip_sockglue.c
> +++ b/net/ipv4/ip_sockglue.c
> @@ -590,7 +590,7 @@ static int do_ip_setsockopt(struct sock *sk, int level,
>  	case IP_TTL:
>  		if (optlen < 1)
>  			goto e_inval;
> -		if (val != -1 && (val < 0 || val > 255))
> +		if (val != -1 && (val < 1 || val > 255))
>  			goto e_inval;
>  		inet->uc_ttl = val;
>  		break;

Hmm, I wonder why I did this, indeed ....

Thanks !

Acked-by: Eric Dumazet <edumazet@google.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Patch] net: prevent setting ttl=0 via IP_TTL
  2013-01-08  7:17 [Patch] net: prevent setting ttl=0 via IP_TTL Cong Wang
  2013-01-08 15:07 ` Eric Dumazet
@ 2013-01-09  1:57 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2013-01-09  1:57 UTC (permalink / raw)
  To: xiyou.wangcong; +Cc: netdev, padalia.nitin, eric.dumazet

From: Cong Wang <xiyou.wangcong@gmail.com>
Date: Tue,  8 Jan 2013 15:17:00 +0800

> From: Cong Wang <xiyou.wangcong@gmail.com>
> 
> A regression is introduced by the following commit:
> 
> 	commit 4d52cfbef6266092d535237ba5a4b981458ab171
> 	Author: Eric Dumazet <eric.dumazet@gmail.com>
> 	Date:   Tue Jun 2 00:42:16 2009 -0700
> 
> 	    net: ipv4/ip_sockglue.c cleanups
> 	    
> 	    Pure cleanups
> 
> but it is not a pure cleanup...
> 
> 	-               if (val != -1 && (val < 1 || val>255))
> 	+               if (val != -1 && (val < 0 || val > 255))
> 
> Since there is no reason provided to allow ttl=0, change it back.
> 
> Reported-by: nitin padalia <padalia.nitin@gmail.com>
> Cc: nitin padalia <padalia.nitin@gmail.com>
> Cc: Eric Dumazet <eric.dumazet@gmail.com>
> Cc: David S. Miller <davem@davemloft.net>
> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>

Applied and queued up for -stable, thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-01-09  1:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-08  7:17 [Patch] net: prevent setting ttl=0 via IP_TTL Cong Wang
2013-01-08 15:07 ` Eric Dumazet
2013-01-09  1:57 ` David Miller

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).