lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Wed, 12 Apr 2017 12:13:42 +0800
From:   "Gao Feng" <gfree.wind@...mail.com>
To:     "'Joe Perches'" <joe@...ches.com>, <davem@...emloft.net>,
        <kuznet@....inr.ac.ru>, <jmorris@...ei.org>,
        <netdev@...r.kernel.org>
Cc:     "'Gao Feng'" <fgao@...ai8.com>
Subject: RE: [PATCH net-next v2 1/1] net: ipv4: Refine the ipv4_default_advmss

> -----Original Message-----
> From: netdev-owner@...r.kernel.org [mailto:netdev-owner@...r.kernel.org]
> On Behalf Of Joe Perches
> Sent: Wednesday, April 12, 2017 11:57 AM
> To: gfree.wind@...mail.com; davem@...emloft.net; kuznet@....inr.ac.ru;
> jmorris@...ei.org; netdev@...r.kernel.org
> Cc: Gao Feng <fgao@...ai8.com>
> Subject: Re: [PATCH net-next v2 1/1] net: ipv4: Refine the
ipv4_default_advmss
> 
> On Wed, 2017-04-12 at 10:32 +0800, gfree.wind@...mail.com wrote:
> > diff --git a/net/ipv4/route.c b/net/ipv4/route.c
> 
> more trivia:
> 
> > @@ -1250,14 +1250,11 @@ static void set_class_tag(struct rtable *rt,
> > u32 tag)
> >
> >  static unsigned int ipv4_default_advmss(const struct dst_entry *dst)
> > {
> > -	unsigned int advmss = dst_metric_raw(dst, RTAX_ADVMSS);
> > +	unsigned int header_size = sizeof(struct tcphdr) + sizeof(struct
iphdr);
> > +	unsigned int advmss = max_t(unsigned int, dst->dev->mtu -
header_size,
> > +				    ip_rt_min_advmss);
> >
> > -	if (advmss == 0) {
> > -		advmss = max_t(unsigned int, dst->dev->mtu - 40,
> > -			       ip_rt_min_advmss);
> > -		if (advmss > 65535 - 40)
> > -			advmss = 65535 - 40;
> > -	}
> > +	advmss = min(advmss, IPV4_MAX_PMTU - header_size);
> >  	return advmss;
> >  }
> 
> This would probably be simpler to read as:
> 
> 	return min(advmss, IPV4_MAX_PMTU - header_size);
> 
> though it's almost certain that the compiler emits identical object code.

Yes. I thought about writing it with the way you mentioned, but gave up.
But i could follow you this time.

Best Regards
Feng



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ