From patchwork Tue Jun 2 05:31:12 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 27931 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@bilbo.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ozlabs.org (ozlabs.org [203.10.76.45]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mx.ozlabs.org", Issuer "CA Cert Signing Authority" (verified OK)) by bilbo.ozlabs.org (Postfix) with ESMTPS id A2AF9B7043 for ; Tue, 2 Jun 2009 15:31:38 +1000 (EST) Received: by ozlabs.org (Postfix) id 94BC4DDDE9; Tue, 2 Jun 2009 15:31:38 +1000 (EST) Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id 3582CDDDE7 for ; Tue, 2 Jun 2009 15:31:38 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755939AbZFBFb0 (ORCPT ); Tue, 2 Jun 2009 01:31:26 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755094AbZFBFbZ (ORCPT ); Tue, 2 Jun 2009 01:31:25 -0400 Received: from gw2.cosmosbay.com ([86.64.20.130]:55009 "EHLO gw2.cosmosbay.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753778AbZFBFbZ convert rfc822-to-8bit (ORCPT ); Tue, 2 Jun 2009 01:31:25 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) by gw2.cosmosbay.com (8.12.11.20060308/8.12.11) with ESMTP id n525VG6x021466; Tue, 2 Jun 2009 07:31:17 +0200 Message-ID: <4A24B920.2010605@cosmosbay.com> Date: Tue, 02 Jun 2009 07:31:12 +0200 From: Eric Dumazet User-Agent: Thunderbird 2.0.0.21 (Windows/20090302) MIME-Version: 1.0 To: David Miller CC: nicolas.dichtel@dev.6wind.com, netdev@vger.kernel.org Subject: Re: [PATCH] ipv4/ipv6: check hop limit field on input References: <4A23F027.3060907@dev.6wind.com> <20090601.190430.80366622.davem@davemloft.net> In-Reply-To: <20090601.190430.80366622.davem@davemloft.net> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-1.6 (gw2.cosmosbay.com [127.0.0.1]); Tue, 02 Jun 2009 07:31:17 +0200 (CEST) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org David Miller a écrit : > From: Nicolas Dichtel > Date: Mon, 01 Jun 2009 17:13:43 +0200 > >> RFC indicates that a router must drop the packet if this field is 0. > > It only must do this when executing the forwarding function. It's an > egress check, not an ingress one. > > I'm not applying this patch, it can even break some applications > out there that use a TTL of zero intentionally to keep traffic > only on a local subnet. I wonder if we then should allow setting ttl to zero. I had to patch my kernel to allow ping to do this... I'll check RFC when time permits. --- 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 --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c index e2d1f87..efe2797 100644 --- a/net/ipv4/ip_sockglue.c +++ b/net/ipv4/ip_sockglue.c @@ -558,7 +558,7 @@ static int do_ip_setsockopt(struct sock *sk, int level, case IP_TTL: if (optlen<1) goto e_inval; - if (val != -1 && (val < 1 || val>255)) + if (val != -1 && (val < 0 || val>255)) goto e_inval; inet->uc_ttl = val; break;