From owner-svn-src-head@freebsd.org Tue Mar 21 15:15:22 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1288BD1681F for ; Tue, 21 Mar 2017 15:15:22 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound1b.ore.mailhop.org (outbound1b.ore.mailhop.org [54.200.247.200]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E47D71D5 for ; Tue, 21 Mar 2017 15:15:21 +0000 (UTC) (envelope-from ian@freebsd.org) X-MHO-User: 2f72926c-0e49-11e7-bfb5-0d159cd3c324 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 73.78.92.27 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [73.78.92.27]) by outbound1.ore.mailhop.org (Halon) with ESMTPSA id 2f72926c-0e49-11e7-bfb5-0d159cd3c324; Tue, 21 Mar 2017 15:15:15 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id v2LFFCYm003800; Tue, 21 Mar 2017 09:15:12 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: <1490109312.13094.41.camel@freebsd.org> Subject: Re: svn commit: r315653 - in head: lib/libstand sys/boot/common sys/boot/i386/libi386 From: Ian Lepore To: Slawa Olhovchenkov , Toomas Soome Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Tue, 21 Mar 2017 09:15:12 -0600 In-Reply-To: <20170321123547.GC86500@zxy.spb.ru> References: <201703202220.v2KMKHVP050735@repo.freebsd.org> <20170321123547.GC86500@zxy.spb.ru> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.18.5.1 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Mar 2017 15:15:22 -0000 On Tue, 2017-03-21 at 15:35 +0300, Slawa Olhovchenkov wrote: > On Mon, Mar 20, 2017 at 10:20:17PM +0000, Toomas Soome wrote: > > > > > Author: tsoome > > Date: Mon Mar 20 22:20:17 2017 > > New Revision: 315653 > > URL: https://svnweb.freebsd.org/changeset/base/315653 > > > > Log: > >   loader: verify the value from dhcp.interface-mtu and use snprintf > > to set mtu > >    > >   Since the uset can set dhcp.interface-mtu, we need to try to > > validate the > >   value. So we verify if the conversion to int is successful and we > > will not > >   allow to set value greater than max IPv4 packet size. > >    > > +     tmp > USHRT_MAX) { > > + printf("%s: bad value: > > \"%s\", " > > +     "ignoring\n", > > +     "dhcp.interface-mtu", > > val); > === > USHRT_MAX Maximum value for an object of type unsigned short > int > 65535 (216-1) or greater* > > * the actual value depends on the particular system and library > implementation, but shall reflect the limits of these types in the > target platform. > === > > I mean IF_MAXMTU more correct. > The context here is libstand; because it is standalone by design, the code doesn't have access to IF_MAXMTU or other kernel/userland constants.  There is also no question that a short is 16 bits or that USHRT_MAX will be anything other than 65535 in that environment.  If some platform did appear that had a different-sized short by default, we would add whatever flags are necessary to force it back to 16 bits in src/share/mk/bsd.stand.mk. -- Ian