link executor: Add support for veth interfaces
Signed-off-by: Maximilian Wilhelm <max@sdn.clinic>
This commit is contained in:
parent
044d8307f9
commit
f708bb1465
2 changed files with 19 additions and 3 deletions
|
@ -73,6 +73,13 @@ the system will only respond to certain keywords by default:
|
||||||
*link-type* _link-type_
|
*link-type* _link-type_
|
||||||
Denotes the link-type of the interface. When set to _dummy_,
|
Denotes the link-type of the interface. When set to _dummy_,
|
||||||
the interface is created as a virtual dummy interfaces.
|
the interface is created as a virtual dummy interfaces.
|
||||||
|
When set to _veth_ the interface is created as virtual veth
|
||||||
|
interface (pair).
|
||||||
|
|
||||||
|
*veth-peer-name* _peer-name_
|
||||||
|
Denotes the name of the veth peer interfaces. If not set
|
||||||
|
the kernel will name the veth peer interface as _vethN_
|
||||||
|
with N being an integer number.
|
||||||
|
|
||||||
*alias* _alias_
|
*alias* _alias_
|
||||||
Sets the given alias on the interface.
|
Sets the given alias on the interface.
|
||||||
|
|
|
@ -39,9 +39,18 @@ create)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
${MOCK} ip link add "${IFACE}" type dummy
|
${MOCK} ip link add "${IFACE}" type dummy
|
||||||
|
|
||||||
|
elif [ "${IF_LINK_TYPE}" = "veth" ]; then
|
||||||
|
if [ ! -d "/sys/class/net/${IFACE}" ]; then
|
||||||
|
ARGS=""
|
||||||
|
if [ "${IF_VETH_PEER_NAME}" ]; then
|
||||||
|
ARGS="peer ${IF_VETH_PEER_NAME}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if is_vlan; then
|
${MOCK} ip link add "${IFACE}" type veth ${ARGS}
|
||||||
|
fi
|
||||||
|
|
||||||
|
elif is_vlan; then
|
||||||
if [ -d "/sys/class/net/${IFACE}" ]; then
|
if [ -d "/sys/class/net/${IFACE}" ]; then
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
@ -77,7 +86,7 @@ down)
|
||||||
${MOCK} ip link set down dev "${IFACE}"
|
${MOCK} ip link set down dev "${IFACE}"
|
||||||
;;
|
;;
|
||||||
destroy)
|
destroy)
|
||||||
if [ "${IF_LINK_TYPE}" = "dummy" ] || is_vlan; then
|
if [ "${IF_LINK_TYPE}" = "dummy" ] || [ "${IF_LINK_TYPE}" = "veth" ] || is_vlan; then
|
||||||
if [ -z "${MOCK}" -a ! -d "/sys/class/net/${IFACE}" ]; then
|
if [ -z "${MOCK}" -a ! -d "/sys/class/net/${IFACE}" ]; then
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue