Commit Graph

48 Commits

Author SHA1 Message Date
William Hubbs
5bfebbecea Rename shutdown_network setting to keep_network
We were telling users that setting shutdown_network=YES would shut down
the network interfaces during shutdown, but this was exactly the
opposite of what we were doing. The default was YES, which was keeping
the interfaces active.

This keeps the default behavior, but renames the setting to keep_network
which more accurately describes its function, and instructs users to set
it to NO if they want the network interfaces to go down.
2013-02-11 09:45:14 -06:00
William Hubbs
1280b97749 oldnet: add support for shutdown_network from newnet
This setting, already in use in newnet, allows the user to control
whether network interfaces are stopped when the system shuts down. By
default, under newnet, they are not, so I am making oldnet have the same
default.

A side-affect of this is that in the default configuration this fixes
bugs like the one below.

Reported-by: jerryfleming2006@gmail.com
X-Gentoo-Bug: 259183
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=259183
2013-02-11 09:08:34 -06:00
William Hubbs
bbc6b96a40 oldnet: accomodate rkhunter false positive
rkhunter thinks OpenRC is a rootkit because of the hidefirstrout
variable. This has been renamed to hideFirstroute in order to get past
rkhunter.

I realize this is not an openrc bug. In this case though I do not have a
problem renaming the variable.

Reported-by: ago@gentoo.org
X-Gentoo-Bug: 339714
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=339714
2013-02-09 17:39:32 -06:00
Alexander Tsoy
2b0ff6f669 net.lo: add ipv6 net and host patterns
X-Gentoo-Bug: 442594
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=442594
2012-12-21 14:24:27 -06:00
Mihai Moldovan
a61fdd019e net.lo: allow address families to be set on routes
X-Gentoo-Bug: 447310
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?d=447310
2012-12-20 16:02:11 -06:00
Mike Frysinger
7557d62870 net.lo: sleep *after* carrier check
For devices that are always connected (e.g. ethernet cards), the current
carrier always wastes time by sleeping for 1 second.  This is because the
code sleeps first, then checks for carrier.  Invert the order so that we
return quickly for devices already active.  For devices which are not yet
up, there shouldn't be any real difference.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-12-18 00:24:02 -05:00
William Hubbs
8d17c634db oldnet: make the default carrier timeout 0
Some types of interfaces do not have a carrier, so it doesn't make sense
to automatically wait for one.

Reported-by: <rose@rz.uni-potsdam.de>
X-Gentoo-Bug: 438970
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=438970
2012-10-22 09:23:04 -05:00
William Hubbs
6d84a4aed8 Oldnet: the loopback interface does not need sysfs 2012-10-16 20:56:34 -05:00
William Hubbs
1f01157354 do not provide a virtual for the loopback
The loopback interface is active on all systems, so there is no need to
provide a virtual for it.
2012-08-25 17:09:04 -05:00
William Hubbs
e641b43849 Bring Back prefix support
We now have a team member who is interested in OpenRC on prefix, so I am
bringing it back to the main tree.
2012-07-26 10:54:48 -05:00
William Hubbs
be5de328e9 network scripts need sysfs on linux systems
Adjust the previous commit so that on linux systems the network scripts
need sysfs.
2012-04-03 20:01:23 -05:00
William Hubbs
3247184d86 Remove prefix support
I spoke with the prefix team sometime back and was told that they do not
have an interest in using OpenRC on prefix systems.
2012-02-21 07:27:16 -06:00
William Hubbs
dd2b4a067a net: add deprecation warning for old style net dependency variables 2012-02-18 17:23:28 -06:00
William Hubbs
bc581530e5 Fix meaning of "provide net"
I was informed that "provide net" should mean that there is network
communication outside the local computer. In this case, the loopback
interface can't "provide net", but there needs to be a way for other
processes to know that the loopback interface is active.

To this end, this commit makes the loopback "provide lo" and all other
interfaces "provide net".
2012-02-18 13:48:11 -06:00
William Hubbs
0ff23f20e8 Revert "Net: do not bring down interfaces during shutdown"
This reverts commit 6d5a2d5f9e.
There are interfaces, such as adsl and ppp interfaces which need to be
brought down. Also, the WOL setting is a good case for bringingdown
interfaces.
2012-01-30 12:06:46 -06:00
Robin H. Johnson
380752f4e0 net: allow parameters to a single address config
In the case of a single line of configuration, where the address has
parameters, the parameters were being treated as seperate addresses.
Eg:
config_eth0="4321:0:1:2:3:4:567:89ab/64 nodad home preferred_lft 0"

Also document usage of parameters in the net example, and note that
multiple addresses on a single line cannot be mixed with parameters.
Newlines are required to seperate the addresses.

X-Gentoo-Bug: 398827
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=398827

Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
2012-01-13 15:57:22 -08:00
Robin H. Johnson
4255ba175b net: net.lo, lots of scripts
The program function in depend blocks is now able to search paths by
itself. If passed multiple arguments or multiple calls, at least one of
the arguments passed must be a program or a shell builtin (eg ip built
into busybox). If a qualified path is specified, only that path will be
checked, otherwise it will be checked as a builtin, then $PATH will be
checked for the named binary (via type).

Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
2012-01-08 16:24:10 -08:00
William Hubbs
f2e404ab66 net.lo: Add the ability to find the full path of a binary
Some of the networking tools, such as iproute2, can be stored in one of
several locations. This function gives us a standard way to find these
tools.

I would like to thankRobin Johnson <robbat2@gentoo.org> for his input on
this function.
2012-01-07 13:09:17 -06:00
William Hubbs
6d5a2d5f9e Net: do not bring down interfaces during shutdown 2011-12-30 10:44:56 -06:00
William Hubbs
20f612080c net: use yesno to test up_before_preup 2011-12-27 17:59:39 -06:00
Robin H. Johnson
9a01f68515 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=no

X-Gentoo-Bug: 389475
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=389475
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
2011-12-26 16:27:38 -08:00
William Hubbs
46b96eb80d Network: start interfaces after dbus
This is needed to allow auto-connect at boot.

Reported-by: David J Cozatt <ygdrasil@comcast.net>
X-Gentoo-Bug: 390955
X-Gentoo-Bug-URL: http://bugs.gentoo.org/show_bug.cgi?id=390955
2011-12-12 19:46:03 -06:00
Mike Frysinger
cc45abb77b net.lo: fix typo in previous math commit
x-Gentoo-Bug: 391671
x-Gentoo-Bug-URL: http://bugs.gentoo.org/391671
Reported-by: Duncan <1i5t5.duncan@cox.net>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-11-23 13:17:20 -05:00
Mike Frysinger
ef1ff1b4f2 make shell math operations style more succulent
Convert the style:
	var=$((${var} + 1))
to:
	: $(( var += 1 ))

The latter is easier to read imo.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-11-19 02:25:36 -05:00
William Hubbs
9175534752 Small style change 2011-10-02 12:21:17 -05:00
Christian Ruppert
930f4021b1 Add a new helper functions for _{flatten,get}_array
A new helper function (_array_helper) since both, the _flatten_array and
_get_array function share partially the same code.
We also reduce multiple whitespace to a single space, remove leading newlines
as well as skipping "empty" lines.

This makes the data returned by _{flatten,get}_array much nicer than before.
It also fixes bug 366677 where net-tools having trouble with the whitespace
mentioned above. iproute2 was not affected.

Reported-by: Andrew Maltsev <am@ejelta.com>
X-Gentoo-Bug: 366677
X-Gentoo-Bug-URL: https://bugs.gentoo.org/366677
2011-09-21 00:21:43 +02:00
Yun Zheng Hu
a029dee59b Do not print "null" or "noop" when configuring an interface
Note by william hubbs:

I modified the patch to compare "null" and "noop" with $1 instead of
${config}.

Reported-by:    Yun Zheng Hu <hu@fox-it.com>
X-Gentoo-Bug: 379577
X-Gentoo-Bug-URL: http://bugs.gentoo.org/show_bug.cgi?id=379577
2011-08-20 14:10:07 -05:00
William Hubbs
e3b02abd7a Add warnings for the use of bash arrays
Currently, we allow the use of bash arrays for some configuration settings.
This is undocumented, so I want to remove the support from openrc.

The first phase of this removal will be this commit which adds warnings
to encourage people not to use bash arrays.

X-Gentoo-Bug: 374875
X-Gentoo-Bug-URL: http://bugs.gentoo.org/show_bug.cgi?id=374875
2011-07-14 01:26:29 -05:00
Mike Frysinger
d0bc4f20ad drop useless "All rights reserved" notice
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-06-29 19:46:31 -04:00
William Hubbs
de0ded4ed0 revert changes for bug #292894
This is being done because these dependency changes caused a regression.
We will need to revisit the previously mentioned bug.

X-Gentoo-Bug: 363693
X-Gentoo-Bug-URL: http://bugs.gentoo.org/show_bug.cgi?id=363693
2011-04-15 19:21:20 -05:00
William Hubbs
03cd55aa19 start loopback interface before mtab
X-Gentoo-Bug: 292894
X-Gentoo-Bug-URL: http://bugs.gentoo.org/show_bug.cgi?id=292894
2011-04-11 15:33:41 -05:00
William Hubbs
85827d474c remove "after bootmisc" dependency from loopback interface 2011-04-10 17:24:44 -05:00
William Hubbs
8e925368b7 bring up the loopback interface earlier
For most situations, the loopback interface can depend on root instead
of localmount, so this patch makes that happen. It also adds comments to
the net.example files explaining when a user might want to change this
and giving an example.

I would like to thank Robin Johnson for the original patch and suggested
examples.

X-Gentoo-Bug: 292894
X-Gentoo-Bug-URL: http://bugs.gentoo.org/show_bug.cgi?id=292894

Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
2011-04-10 16:10:47 -05:00
William Hubbs
15660dbbfc add fallback_routes support to network scripts
Add support for optional fallback_routes_* variables in the network scripts.
This is similar to the fallback_route_* support in baselayout-1.
However, if you do not have fallback_routes set for an interface but you
do have routes set, that setting will be used, so you do not need this
variable unless you want the fallback routes to be different from the
primary routes.

X-Gentoo-Bug: 250978
X-Gentoo-Bug-URL: http://bugs.gentoo.org/show_bug.cgi?id=250978
2011-04-09 13:54:01 -05:00
Ed Wildgoose
60d8d4f5bb do not delete addresses when stopping a ppp interface.
This is important in situations where ppp is being used in a demand
dialing setup.

X-Gentoo-Bug: 359069
X-Gentoo-Bug-URL: http://bugs.gentoo.org/show_bug.cgi?id=359069
2011-03-21 23:55:55 -05:00
Mike Frysinger
faa2df1159 more whitespace cleanup
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-01-17 04:49:12 -05:00
Robin H. Johnson
7f7baa6c3c Bug #266659: we really need to allow peer, pointtopoint in parsing config lines. 2010-12-11 18:29:34 -08:00
Roy Marples
b4104957b1 We should use -feature instead of nofeature.
This matches the ifconfig and Gentoo USE flag syntax and is hopefully
easier to read.
Fixes #178.
2009-07-01 00:07:32 +01:00
Roy Marples
aaced3face Update copyright 2009-06-05 09:20:10 +01:00
Roy Marples
60134ddec5 Only delete addresses for interfaces that exist. 2009-05-29 15:23:23 +01:00
Roy Marples
c0fd1b49e4 Move non compiled libraries from /lib/rc to /libexec/rc
OpenRC version is now stored as plaintext in /libexec/rc/version

Plugins (cursplash, splashutils) will have to be re-compiled to pickup
the new directories. State data needs to be moved from /lib/rc/init.d
to /libexec/rc/init.d as well.
2009-05-23 20:38:12 +01:00
Roy Marples
658a220638 Add (c) to Copyright 2009-05-01 15:11:40 +01:00
Roy Marples
22959c3963 Fix working on zsh 2008-12-30 00:05:17 +00:00
Roy Marples
0786141026 Restore interface_exists, interface_up and interface_exists, #123. 2008-11-10 12:31:20 +00:00
Roy Marples
c18c74e816 Fix adding just the default route, #119 thanks to pva. 2008-10-14 15:27:52 +00:00
Roy Marples
f2ea7ca514 Let ifdown control all interfaces. 2008-06-03 11:51:36 +00:00
Roy Marples
766ec96e3d Add ifdown_eth0=NO so that the interface stays up for WakeOnLan, Gentoo #220875 2008-05-09 10:29:06 +00:00
Roy Marples
5ba6f0a628 We need to ensure that the init script started is correct, translating symlinks. This has a new rule - multiplexed services must exist in the same dir as the master sript. So we need to ensuret that net.lo(0) is the real script and not a symlink itself. This fixes Gentoo #219526. 2008-04-29 10:25:45 +00:00