libdir=$(prefix)/lib
sysconfdir=/etc
localstatedir=/var
+systemdunitdir=$(prefix)/lib/systemd/system
# File to store the version number in.
VERSION_FILE = $(DESTDIR)$(libdir)/network/version
-mkdir -pv $(DESTDIR)$(libdir)/{network,sysctl.d,udev}
-mkdir -pv $(DESTDIR)$(localstatedir)/log/network
-mkdir -pv $(DESTDIR)$(sbindir)
+ -mkdir -pv $(DESTDIR)$(systemdunitdir)
install -m 755 -v network $(DESTDIR)$(sbindir)
cp -fv sysctl.d/* $(DESTDIR)$(libdir)/sysctl.d/
cp -rfv udev/* $(DESTDIR)$(libdir)/udev
cp -rfv network-* $(DESTDIR)$(libdir)/network/
+ cp -vf systemd/*.service $(DESTDIR)$(systemdunitdir)
# Install bridge-stp.
install -m 755 bridge-stp $(DESTDIR)$(sbindir)/
# Install dhclient script and helper.
- install -m 755 dhclient-helper $(DESTDIR)/usr/lib/network/
- install -m 755 dhclient-script $(DESTDIR)/sbin/
+ install -m 755 dhclient-helper $(DESTDIR)$(libdir)/network/
+ install -m 755 dhclient-script $(DESTDIR)$(sbindir)/
install -m 755 -v ppp/ip-updown $(DESTDIR)$(sysconfdir)/ppp
ln -svf ip-updown $(DESTDIR)$(sysconfdir)/ppp/ip-pre-up
}
function bonding_remove() {
- local device=$(devicify ${1})
-
+ local device=${1}
assert isset device
log INFO "Remove bonding device '${device}'."
}
function bonding_enslave_device() {
- local device=$(devicify ${1})
- local slave=$(devicify ${2})
+ local device=${1}
+ local slave=${2}
shift 2
assert isset device
local zone
for zone in ${zones}; do
- zone_up ${zone}
+ zone_start ${zone} &
done
+
+ wait # until everything is settled
}
function cli_stop() {
local zone
for zone in ${zones}; do
- zone_down ${zone}
+ zone_stop ${zone} &
done
+
+ wait # until everything is settled
}
function cli_restart() {
# Check if the device is a loopback device
function device_is_loopback() {
- local device=$(devicify ${1})
+ local device=${1}
+
[ "${device}" = "lo" ]
}
# Get the device type
function device_get_type() {
- local device=$(devicify ${1})
+ local device=${1}
if device_is_virtual ${device}; then
echo "vlan"
# Check if a device has a cable plugged in
function device_has_carrier() {
- local device=$(devicify ${1})
+ local device=${1}
+ assert isset device
+
[ "$(<${SYS_CLASS_NET}/${device}/carrier)" = "1" ]
}
# Check if the device is used
function device_is_used() {
- local device=$(devicify ${1})
+ local device=${1}
device_has_virtuals ${device} && \
return ${EXIT_OK}
# Set device up
function device_set_up() {
- local device=$(devicify ${1})
+ local device=${1}
# Silently fail if device was not found
[ -z "${device}" ] && return ${EXIT_ERROR}
# Set device down
function device_set_down() {
- local device=$(devicify ${1})
+ local device=${1}
+ assert isset device
local ret=${EXIT_OK}
init_register virtual_init
function virtual_create() {
- local port=$(devicify ${1})
+ local port=${1}
local vid=${2}
local mac=${3}
local newport=${port}v${vid}
}
function virtual_remove() {
- local device=$(devicify ${1})
+ local device=${1}
log INFO "Removing virtual device '${device}' with address '$(macify ${device})'."
config_get_hook $(zone_dir ${zone})/settings
}
+function zone_start() {
+ # This function will bring up the zone
+ # 'asynchronously' with help of systemd.
+
+ local zone=${1}
+ assert zone_exists ${zone}
+
+ service_start "network@${zone}"
+}
+
+function zone_stop() {
+ # This function will bring down the zone
+ # 'asynchronously' with help of systemd.
+
+ local zone=${1}
+ assert zone_exists ${zone}
+
+ service_stop "network@${zone}"
+}
+
function zone_create() {
local zone=${1}
local hook=${2}