Merge pull request #50 from BarbarossaTM/link-type

Add support for dummy interfaces
This commit is contained in:
Maximilian Wilhelm 2020-08-27 00:49:47 +02:00 committed by GitHub
commit 1f21d2bb45
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 4 deletions

View file

@ -66,6 +66,10 @@ the system will only respond to certain keywords by default:
is for backwards compatibility and should not be used in new is for backwards compatibility and should not be used in new
deployments. deployments.
*link-type* _link-type_
Denotes the link-type of the interface. When set to _dummy_,
the interface is created as a virtual dummy interfaces.
*requires* _interfaces_... *requires* _interfaces_...
Designates one or more required interfaces that must be Designates one or more required interfaces that must be
brought up before configuration of the parent interface. brought up before configuration of the parent interface.
@ -165,3 +169,4 @@ iface eth0
# AUTHORS # AUTHORS
Ariadne Conill <ariadne@dereferenced.org> Ariadne Conill <ariadne@dereferenced.org>
Maximilian Wilhelm <max@sdn.clinic>

View file

@ -32,6 +32,11 @@ is_vlan() {
} }
case "$PHASE" in case "$PHASE" in
pre-up)
if [ "${IF_LINK_TYPE}" = "dummy" ]; then
ip link add "${IFACE}" type dummy
fi
;;
up|down) up|down)
if is_vlan; then if is_vlan; then
ADD_DEL="add" ADD_DEL="add"
@ -55,11 +60,9 @@ up|down)
${MOCK} ip link $ADD_DEL link "$IF_VLAN_RAW_DEVICE" name "$IFACE" type vlan id "$IF_VLAN_ID" ${MOCK} ip link $ADD_DEL link "$IF_VLAN_RAW_DEVICE" name "$IFACE" type vlan id "$IF_VLAN_ID"
[ "$PHASE" = "down" ] && exit 0 [ "$PHASE" = "down" ] && exit 0
fi
${MOCK} ip link set $PHASE dev $IFACE $IF_LINK_OPTIONS ${MOCK} ip link set $PHASE dev $IFACE $IF_LINK_OPTIONS
else
${MOCK} ip link set $PHASE dev $IFACE $IF_LINK_OPTIONS
fi
;; ;;
depend) depend)
if is_vlan; then if is_vlan; then