#!/usr/bin/openrc-run # Copyright (C) 2018 Márcio Silva # Released under the 2-clause BSD license description="Virtual ethernet interfaces" depend() { need sysfs localmount after modules bootmisc net.lo net.lo0 dbus keyword -jail -prefix -vserver provide net } start() { ebegin "Add $IFSRC and $IFDST Virtual ethernet interfaces" case $RC_UNAME in GNU/Linux|Linux) ip link add $IFSRC type veth peer name $IFDST && \ ip link set $IFSRC $IFCTS up && \ ip link set $IFDST $IFCTD up eend $? ;; *) eerror "The $RC_UNAME doesn't support Virtual ethernet interfaces" eend 1 ;; esac } stop() { ebegin "Delete $IFSRC and $IFDST Virtual ethernet interfaces" case $RC_UNAME in GNU/Linux|Linux) ip link delete dev $IFDST || exit 0 ;; esac eend $? }