From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id E294A1381F3 for ; Mon, 8 Apr 2013 17:50:38 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 4B104E0985; Mon, 8 Apr 2013 17:50:38 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id CF2FEE0985 for ; Mon, 8 Apr 2013 17:50:37 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 95CB333DC46 for ; Mon, 8 Apr 2013 17:50:36 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 31E12E4073 for ; Mon, 8 Apr 2013 17:50:35 +0000 (UTC) From: "William Hubbs" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "William Hubbs" Message-ID: <1365443211.56f1752ce1899c455b9e97ac73da9bd68fbab2b9.WilliamH@OpenRC> Subject: [gentoo-commits] proj/openrc:master commit in: runlevels/, init.d/ X-VCS-Repository: proj/openrc X-VCS-Files: init.d/Makefile init.d/loopback.in init.d/network.in runlevels/Makefile X-VCS-Directories: runlevels/ init.d/ X-VCS-Committer: WilliamH X-VCS-Committer-Name: William Hubbs X-VCS-Revision: 56f1752ce1899c455b9e97ac73da9bd68fbab2b9 X-VCS-Branch: master Date: Mon, 8 Apr 2013 17:50:35 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 32ddb5f0-b294-4701-afa0-8ce2671d8666 X-Archives-Hash: 95f071dac4bda9cb598f6456340e2463 commit: 56f1752ce1899c455b9e97ac73da9bd68fbab2b9 Author: William Hubbs gmail com> AuthorDate: Mon Apr 8 17:46:51 2013 +0000 Commit: William Hubbs gentoo org> CommitDate: Mon Apr 8 17:46:51 2013 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=56f1752c create loopback service The loopback service handles the basic settings for the loopback interface, regardless of the network manager you are using. --- init.d/Makefile | 4 ++-- init.d/loopback.in | 35 +++++++++++++++++++++++++++++++++++ init.d/network.in | 13 ++++--------- runlevels/Makefile | 2 +- 4 files changed, 42 insertions(+), 12 deletions(-) diff --git a/init.d/Makefile b/init.d/Makefile index 04e09a7..e7e2d86 100644 --- a/init.d/Makefile +++ b/init.d/Makefile @@ -1,6 +1,6 @@ DIR= ${INITDIR} -SRCS= bootmisc.in fsck.in hostname.in local.in localmount.in netmount.in \ - root.in savecache.in swap.in swapfiles.in \ +SRCS= bootmisc.in fsck.in hostname.in local.in localmount.in loopback.in \ + netmount.in root.in savecache.in swap.in swapfiles.in \ tmpfiles.setup.in swclock.in sysctl.in urandom.in ${SRCS-${OS}} BIN= ${OBJS} diff --git a/init.d/loopback.in b/init.d/loopback.in new file mode 100644 index 0000000..e5cc118 --- /dev/null +++ b/init.d/loopback.in @@ -0,0 +1,35 @@ +#!@SBINDIR@/runscript +# Copyright (c) 2013 William Hubbs +# Released under the 2-clause BSD license. + +description="Configures the loopback interface." + +depend() +{ + return 0 +} + +start() +{ + if [ "$RC_UNAME" = Linux ]; then + ebegin "Bringing up network interface lo" + if type ip > /dev/null 2>&1; then + ip addr add 127.0.0.1/8 dev lo brd + scope host + ip route add 127.0.0.0/8 dev lo scope host + ip link set lo up + else + ifconfig lo 127.0.0.1 netmask 255.0.0.0 + route add -net 127.0.0.0 netmask 255.0.0.0 gw 127.0.0.1 + fi + else + ebegin "Bringing up network interface lo0" + ifconfig lo0 127.0.0.1 netmask 255.0.0.0 + route -q add -inet 127.0.0.0 -netmask 255.0.0.0 127.0.0.1 + fi + eend $? +} + +stop() +{ + return 0 +} diff --git a/init.d/network.in b/init.d/network.in index 898b0a8..5a87a84 100644 --- a/init.d/network.in +++ b/init.d/network.in @@ -223,15 +223,6 @@ start() einfo "Starting network" routeflush - if [ "$RC_UNAME" = "Linux" ]; then - ifconfig lo 127.0.0.1 netmask 255.0.0.0 || cr=1 - route add -net 127.0.0.0 netmask 255.0.0.0 \ - gw 127.0.0.1 reject 2>/dev/null - else - ifconfig lo0 127.0.0.1 netmask 255.0.0.0 || cr=1 - route -q add -inet 127.0.0.0 -netmask 255.0.0.0 \ - 127.0.0.1 -reject || cr=1 - fi eindent for int in $(interfaces); do local func= cf= @@ -330,6 +321,10 @@ stop() routeflush eindent for int in $(reverse $(interfaces u)); do + case "$int" in + lo|lo0) continue ;; + *) ;; + esac intv=$(shell_var "$int") eval downcmd=\$ifdown_$intv eval cmd=\$ip_$intv diff --git a/runlevels/Makefile b/runlevels/Makefile index 7bcf29f..6eb84ca 100644 --- a/runlevels/Makefile +++ b/runlevels/Makefile @@ -1,4 +1,4 @@ -BOOT= bootmisc fsck hostname localmount \ +BOOT= bootmisc fsck hostname localmount loopback \ root swap swapfiles sysctl urandom ${BOOT-${OS}} DEFAULT= local netmount SHUTDOWN= savecache ${SHUTDOWN-${OS}}