diff options
author | Robin H. Johnson <robbat2@gentoo.org> | 2015-11-08 06:16:08 -0800 |
---|---|---|
committer | Robin H. Johnson <robbat2@gentoo.org> | 2015-11-08 06:29:17 -0800 |
commit | 15cd79dc46303988464d962ad6bf59050feba801 (patch) | |
tree | 705e46243e3ed906a644f6bd3aaab2d044fc42fb /net | |
parent | TODO: Document more interface types we need to support. (diff) | |
download | netifrc-15cd79dc46303988464d962ad6bf59050feba801.tar.gz netifrc-15cd79dc46303988464d962ad6bf59050feba801.tar.bz2 netifrc-15cd79dc46303988464d962ad6bf59050feba801.zip |
New interface type: dummy.
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
Diffstat (limited to 'net')
-rw-r--r-- | net/dummy.sh | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/net/dummy.sh b/net/dummy.sh new file mode 100644 index 0000000..3050216 --- /dev/null +++ b/net/dummy.sh @@ -0,0 +1,41 @@ +# Copyright (c) 2015 Gentoo Foundation +# All rights reserved. Released under the 2-clause BSD license. + +dummy_depend() +{ + program ip + after interface + before dhcp macchanger +} + +_is_dummy() { + is_interface_type dummy +} + +dummy_pre_start() +{ + local dummy= + eval dummy=\$type_${IFVAR} + [ "${dummy}" = "dummy" ] || return 0 + + ebegin "Creating dummy interface ${IFACE}" + cmd="ip link add name "${IFACE}" type dummy" + veinfo $cmd + if $cmd ; then + eend 0 && _up && set_interface_type dummy + else + eend 1 + fi +} + + +dummy_post_stop() +{ + _is_dummy || return 0 + + ebegin "Removing dummy ${IFACE}" + cmd="ip link delete "${IFACE}" type dummy" + veinfo "$cmd" + $cmd + eend $? +} |