From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1RfKw9-0002fo-3L for garchives@archives.gentoo.org; Tue, 27 Dec 2011 00:30:37 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id B993D21C0A2; Tue, 27 Dec 2011 00:30:29 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 8A4E021C0A2 for ; Tue, 27 Dec 2011 00:30:29 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id D7CFA1B4012 for ; Tue, 27 Dec 2011 00:30:28 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 35F2C80043 for ; Tue, 27 Dec 2011 00:30:28 +0000 (UTC) From: "Robin H. Johnson" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Robin H. Johnson" Message-ID: <9a01f6851533c808ff0665a3749a20f710a3ee57.robbat2@gentoo> Subject: [gentoo-commits] proj/openrc:master commit in: init.d/, doc/ X-VCS-Repository: proj/openrc X-VCS-Files: doc/net.example.Linux.in init.d/net.lo.in X-VCS-Directories: init.d/ doc/ X-VCS-Committer: robbat2 X-VCS-Committer-Name: Robin H. Johnson X-VCS-Revision: 9a01f6851533c808ff0665a3749a20f710a3ee57 Date: Tue, 27 Dec 2011 00:30:28 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: ac910343-9814-451a-a58d-e900838bf3d6 X-Archives-Hash: 4c3867b3f2e3898cccdc3958ccdcf902 commit: 9a01f6851533c808ff0665a3749a20f710a3ee57 Author: Robin H. Johnson gentoo org> AuthorDate: Tue Dec 27 00:27:38 2011 +0000 Commit: Robin H. Johnson gentoo org> CommitDate: Tue Dec 27 00:27:38 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/openrc.git;a=3D= commit;h=3D9a01f685 net: Add up_before_preup variable for CAN devices Historically, we have tried to up interfaces before running preup, so that the kernel setups up the device and makes things like ethtool work (some hardware cannot be correct probed until then). However this ends up breaking other hardware, so a variable has been introduced to allow the up prior to preup to be disabled: up_before_preup_IFVAR=3Dno X-Gentoo-Bug: 389475 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=3D389475 Signed-off-by: Robin H. Johnson gentoo.org> --- doc/net.example.Linux.in | 10 ++++++++++ init.d/net.lo.in | 6 ++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/doc/net.example.Linux.in b/doc/net.example.Linux.in index 0ee83a6..d48983e 100644 --- a/doc/net.example.Linux.in +++ b/doc/net.example.Linux.in @@ -1102,6 +1102,16 @@ # # ${IFACE} is set to the interface being brought up/down # ${IFVAR} is ${IFACE} converted to variable name bash allows +# +# For historical & compatbility reasons, preup is actually normally call= ed in +# the follow sequence: up ; preup ; up +# In that case, the first up causes the kernel to initialize the device,= so +# that it is available for use in the preup function. However, for some= other +# hardware, eg CAN devices, some configuration is needed before trying t= o up +# the interface will actually work. For such harware, there are the +# 'up_before_preup' variables, that skips the first up call. +#up_before_preup_IFVAR=3Dno +#up_before_preup=3Dno =20 #preup() { # # Test for link on the interface prior to bringing it up. This diff --git a/init.d/net.lo.in b/init.d/net.lo.in index ae07b52..02d11a8 100644 --- a/init.d/net.lo.in +++ b/init.d/net.lo.in @@ -488,7 +488,9 @@ start() { local IFACE=3D${RC_SVCNAME#*.} oneworked=3Dfalse fallback=3Dfalse modul= e=3D local IFVAR=3D$(shell_var "${IFACE}") cmd=3D our_metric=3D - local metric=3D0 + local metric=3D0 _up_before_preup + eval _up_before_preup=3D"\$up_before_preup_${IFVAR}" + [ -z "${_up_before_preup}" ] && _up_before_preup=3D$up_before_preup =20 einfo "Bringing up interface ${IFACE}" eindent @@ -502,7 +504,7 @@ start() # available in preup and afterwards incase the user inadvertently # brings it down if [ "$(command -v preup)" =3D "preup" ]; then - _up 2>/dev/null + [ "${_up_before_preup}" =3D "no" ] || _up 2>/dev/null ebegin "Running preup" eindent preup || return 1