From owner-svn-src-head@freebsd.org Tue Mar 21 15:53:17 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 61276D164A4; Tue, 21 Mar 2017 15:53:17 +0000 (UTC) (envelope-from tsoome@me.com) Received: from st13p35im-asmtp002.me.com (st13p35im-asmtp002.me.com [17.164.199.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 362791A0A; Tue, 21 Mar 2017 15:53:17 +0000 (UTC) (envelope-from tsoome@me.com) Received: from process-dkim-sign-daemon.st13p35im-asmtp002.me.com by st13p35im-asmtp002.me.com (Oracle Communications Messaging Server 7.0.5.38.0 64bit (built Feb 26 2016)) id <0ON60040097YIS00@st13p35im-asmtp002.me.com>; Tue, 21 Mar 2017 15:53:15 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=me.com; s=4d515a; t=1490111595; bh=fITmj41mfUOOS2+5wzqbvjXRwmsbMSBrKjXwSdUyUHA=; h=Content-type:MIME-version:Subject:From:Date:Message-id:To; b=Tuu/GmFxhHmtgVrenQ7rXJ8JZUNQP7lEn57ERyvf4M0rFUm4wxuDeBJ48QwnZ8plh Yj/fCnTYw8dwjI7vQw5nIfJX0vAu7aIIU9mhKTNjlF/tjateV5HMYw1APHfWk48cxz IiiRZs7qsnwQyvVw1m4EOCITFj+Pec3FcBYJbY382M8dyXu1hJLftyCDE2EPn+0Zq9 qWzfamPWyrrN4E+k8TRyPrRbnV4+ASWjc5EF9eVr9c6wA3qsBTSEHsEYFYKIrdfEaQ dtxl/P6a2uY8BcGoKda7qLI9MPFHgzGYKUUgWtEFguFpsk3582SaQDrileJiSYSyG4 2XHtarLfnv8lA== Received: from icloud.com ([127.0.0.1]) by st13p35im-asmtp002.me.com (Oracle Communications Messaging Server 7.0.5.38.0 64bit (built Feb 26 2016)) with ESMTPSA id <0ON600N619GOMM20@st13p35im-asmtp002.me.com>; Tue, 21 Mar 2017 15:53:15 +0000 (GMT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-03-21_12:,, signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 clxscore=1034 suspectscore=2 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1701120000 definitions=main-1703210136 Content-type: text/plain; charset=utf-8 MIME-version: 1.0 (Mac OS X Mail 10.2 \(3259\)) Subject: Re: svn commit: r315653 - in head: lib/libstand sys/boot/common sys/boot/i386/libi386 From: Toomas Soome In-reply-to: <1490109312.13094.41.camel@freebsd.org> Date: Tue, 21 Mar 2017 17:53:12 +0200 Cc: Slawa Olhovchenkov , Toomas Soome , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-transfer-encoding: quoted-printable Message-id: References: <201703202220.v2KMKHVP050735@repo.freebsd.org> <20170321123547.GC86500@zxy.spb.ru> <1490109312.13094.41.camel@freebsd.org> To: Ian Lepore X-Mailer: Apple Mail (2.3259) 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:53:17 -0000 > On 21. m=C3=A4rts 2017, at 17:15, Ian Lepore wrote: >=20 > 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: >>=20 >>>=20 >>> Author: tsoome >>> Date: Mon Mar 20 22:20:17 2017 >>> New Revision: 315653 >>> URL: https://svnweb.freebsd.org/changeset/base/315653 >>>=20 >>> Log: >>> loader: verify the value from dhcp.interface-mtu and use snprintf >>> to set mtu >>> =20 >>> 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. >>> =20 >>> + tmp > USHRT_MAX) { >>> + printf("%s: bad value: >>> \"%s\", " >>> + "ignoring\n", >>> + "dhcp.interface-mtu", >>> val); >> =3D=3D=3D >> USHRT_MAX Maximum value for an object of type unsigned short >> int >> 65535 (216-1) or greater* >>=20 >> * the actual value depends on the particular system and library >> implementation, but shall reflect the limits of these types in the >> target platform. >> =3D=3D=3D >>=20 >> I mean IF_MAXMTU more correct. >>=20 >=20 > 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. >=20 Also note the =E2=80=9Cupper=E2=80=9D value is entirely fictional - we = felt we need to pick some =E2=80=9Csane=E2=80=9D default, with current = (common 1Gb/s) ethernet hardware you will be in trouble long before = reaching that value;) rgds, toomas