From owner-svn-src-all@freebsd.org Tue Apr 21 01:15:16 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A624B2B542D; Tue, 21 Apr 2020 01:15:16 +0000 (UTC) (envelope-from eric@vangyzen.net) Received: from smtp.vangyzen.net (hotblack.vangyzen.net [199.48.133.146]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 495lwz65jbz4SQG; Tue, 21 Apr 2020 01:15:15 +0000 (UTC) (envelope-from eric@vangyzen.net) Received: from disco.vangyzen.net (unknown [70.97.188.230]) by smtp.vangyzen.net (Postfix) with ESMTPSA id 6AEA556468; Mon, 20 Apr 2020 20:15:14 -0500 (CDT) Subject: Re: svn commit: r360068 - in head/sys: kern net sys To: Shawn Webb , Kristof Provost Cc: Ronald Klop , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org References: <202004180750.03I7oUK6032898@repo.freebsd.org> <67B55A62-848B-4876-8367-DE0D32A8B7D4@FreeBSD.org> <20200419142327.nhotyboqubk3vl2l@mutt-hbsd> From: Eric van Gyzen Message-ID: <523895fb-7f30-c4ce-78a7-d16b2ff4954c@vangyzen.net> Date: Mon, 20 Apr 2020 20:15:13 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 MIME-Version: 1.0 In-Reply-To: <20200419142327.nhotyboqubk3vl2l@mutt-hbsd> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 495lwz65jbz4SQG X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of eric@vangyzen.net designates 199.48.133.146 as permitted sender) smtp.mailfrom=eric@vangyzen.net X-Spamd-Result: default: False [-5.40 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+a]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[vangyzen.net]; RCPT_COUNT_FIVE(0.00)[6]; TO_MATCH_ENVRCPT_SOME(0.00)[]; IP_SCORE(-3.10)[ip: (-7.99), ipnet: 199.48.132.0/22(-3.66), asn: 36236(-3.80), country: US(-0.05)]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:36236, ipnet:199.48.132.0/22, country:US]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Apr 2020 01:15:16 -0000 >>>> + sz = asprintf(&buf, M_TEMP, "%s-%s-%s", uuid, if_name(ifp), >>>> + jailname); >>>> + if (sz < 0) { >>>> + /* Fall back to a random mac address. */ >>> >>> >>> I was wondering if it would be valuable to give this fall back something >>> like: >>> >>> printf("%s: unable to create fixed mac address; using random >>> mac address", if_name(ifp)); >>> >>> This will only be printed in rare circumstances. But in that case will >>> provide valuable information. >>> >> That would potentially be valuable, yes. On the other hand, we traditionally >> don???t sprinkle a lot of printf()s around in the kernel. This is extremely >> unlikely to happen, and if it does odds are attaching the interface will >> fail at an earlier or later point, you may struggle to pass packets and run >> into any number of other issues. >> It???s also possible to diagnose absent the printf(), because the MAC >> address will be locally administered rather than within the FreeBSD OUI. >> >> So, in short: not a bad idea. You can argue it both ways, and I find myself >> (weakly) on the opposite side. > > Would displaying the message only when verbose boot mode is enabled be > a suitable compromise? We could completely avoid the problems of dynamic allocation by calling SHA1Update three times, feeding each piece of data separately. For bonus points, use a single char[] to save stack space, too. Maybe use a union, for legibility, and to ensure the proper size without ugly assertions. Eric