blob: 94437c389e1862ddfca486f5de47b4e882e73fdc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
# Copyright (c) 2015 Gentoo Foundation
# All rights reserved. Released under the 2-clause BSD license.
# shellcheck shell=sh disable=SC1008
dummy_depend()
{
program ip
after interface
before dhcp macchanger
}
_is_dummy() {
is_interface_type dummy
}
_ip()
{
veinfo ip "${@}"
_netns ip "${@}"
}
dummy_pre_start()
{
local dummy=
eval dummy="\$type_${IFVAR}"
[ "${dummy}" = "dummy" ] || return 0
if ! test -d /sys/module/dummy && ! modprobe dummy; then
eerror "Couldn't load the dummy module (perhaps the CONFIG_DUMMY kernel option is disabled)"
return 1
fi
if ! _exists ; then
ebegin "Creating dummy interface ${IFACE}"
_ip link add name "${IFACE}" type dummy
eend $?
fi
_up && set_interface_type dummy
}
dummy_post_stop()
{
_is_dummy || return 0
ebegin "Removing dummy ${IFACE}"
_ip link delete "${IFACE}" type dummy
eend $?
}
|