From patchwork Mon Oct 19 19:31:30 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Dykstra X-Patchwork-Id: 36417 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org 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 CD0E2B7B74 for ; Tue, 20 Oct 2009 06:31:44 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755731AbZJSTbf (ORCPT ); Mon, 19 Oct 2009 15:31:35 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754132AbZJSTbf (ORCPT ); Mon, 19 Oct 2009 15:31:35 -0400 Received: from gv-out-0910.google.com ([216.239.58.188]:49986 "EHLO gv-out-0910.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753988AbZJSTbe (ORCPT ); Mon, 19 Oct 2009 15:31:34 -0400 Received: by gv-out-0910.google.com with SMTP id r4so485586gve.37 for ; Mon, 19 Oct 2009 12:31:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:subject:from:to:content-type :date:message-id:mime-version:x-mailer:content-transfer-encoding; bh=H+zwv+1Co+WGG8KQ0nmx0g/5y3z7fISHL8f3SzOaOGk=; b=l5YRPXR6jrYOTEz4Ouq/OGUJL29PEnlTUnAGd5qYNPMVojyDn1M/BtHVmFqvNdfBv6 UJBwDS7c4UIYw6+9zowpZXWygQJZX7uHegdDTyD2AdnSXhg2OVPsC6NuDJC93usoFW/x 5lj+SNwlVzvo2a+N592y/8rzibexoSR5YwH9o= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=subject:from:to:content-type:date:message-id:mime-version:x-mailer :content-transfer-encoding; b=vZw/+pUq3yY54v5NI62nZZXE1thoMXaEJNe+drdfge9EKCRpKusGbzcIE+thyqF/b5 /1+tSkORGDJ2KojpWF+h9egs5DQjKiXc1qiG+4irioqVgvNweULtD2GzPxvUtp5G+Hql qC/fYFpolGjgaMkVoFlH56RAY9fnNtK49zyqU= Received: by 10.103.126.9 with SMTP id d9mr2351482mun.103.1255980695953; Mon, 19 Oct 2009 12:31:35 -0700 (PDT) Received: from ?192.168.221.201? ([24.118.80.156]) by mx.google.com with ESMTPS id s10sm108475muh.54.2009.10.19.12.31.33 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 19 Oct 2009 12:31:35 -0700 (PDT) Subject: PATCH [net-next-2.6] IP: Cleanups From: John Dykstra To: netdev Date: Mon, 19 Oct 2009 14:31:30 -0500 Message-Id: <1255980690.20673.5.camel@Maple> Mime-Version: 1.0 X-Mailer: Evolution 2.22.3.1 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org I've been sitting on these waiting to accumulate more, but that isn't likely to happen short-term. --- Use symbols instead of magic constants while checking PMTU discovery setsockopt. Remove redundant test in ip_rt_frag_needed() (done by caller). Signed-off-by: John Dykstra --- net/ipv4/ip_sockglue.c | 2 +- net/ipv4/route.c | 3 --- net/ipv6/ipv6_sockglue.c | 2 +- 3 files changed, 2 insertions(+), 5 deletions(-) 1.5.4.3 -- 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 c602d98..2445fed 100644 --- a/net/ipv4/ip_sockglue.c +++ b/net/ipv4/ip_sockglue.c @@ -575,7 +575,7 @@ static int do_ip_setsockopt(struct sock *sk, int level, inet->hdrincl = val ? 1 : 0; break; case IP_MTU_DISCOVER: - if (val < 0 || val > 3) + if (val < IP_PMTUDISC_DONT || val > IP_PMTUDISC_PROBE) goto e_inval; inet->pmtudisc = val; break; diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c index 39e10ac..68566de 100644 --- a/net/ipv6/ipv6_sockglue.c +++ b/net/ipv6/ipv6_sockglue.c @@ -662,7 +662,7 @@ done: case IPV6_MTU_DISCOVER: if (optlen < sizeof(int)) goto e_inval; - if (val<0 || val>3) + if (val < IP_PMTUDISC_DONT || val > IP_PMTUDISC_PROBE) goto e_inval; np->pmtudisc = val; retv = 0; diff --git a/net/ipv4/route.c b/net/ipv4/route.c index bb41992..68fb227 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c @@ -1628,9 +1628,6 @@ unsigned short ip_rt_frag_needed(struct net *net, struct iphdr *iph, __be32 daddr = iph->daddr; unsigned short est_mtu = 0; - if (ipv4_config.no_pmtu_disc) - return 0; - for (k = 0; k < 2; k++) { for (i = 0; i < 2; i++) { unsigned hash = rt_hash(daddr, skeys[i], ikeys[k],--