From af873ce08ec27c7e97cdb2df18d92cd11e183d45 Mon Sep 17 00:00:00 2001 From: toby Date: Sat, 23 Feb 2019 05:16:27 +0000 Subject: [PATCH] adding interface length safety --- files/qemu-ifup | 5 +++++ files/qemu-ifup-public | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/files/qemu-ifup b/files/qemu-ifup index b712c8e..c5d6070 100755 --- a/files/qemu-ifup +++ b/files/qemu-ifup @@ -2,6 +2,11 @@ set -Eeuo pipefail IFACE=$1 +if [ ${#IFACE} -gt 14 ]; then + echo "interface name too long, mac 14 char: $IFACE" + exit 10 +fi + source /etc/libvirt/hooks/$IFACE if ! [[ $CLUSTER =~ ^[0-9]+$ ]]; then diff --git a/files/qemu-ifup-public b/files/qemu-ifup-public index 3ec9c30..8216ca7 100755 --- a/files/qemu-ifup-public +++ b/files/qemu-ifup-public @@ -2,6 +2,11 @@ set -Eeuo pipefail IFACE=$1 +if [ ${#IFACE} -gt 14 ]; then + echo "interface name too long, mac 14 char: $IFACE" + exit 10 +fi + source /etc/libvirt/hooks/$IFACE ### I need to keep this for backwards compatibility but PUBLICMAC should always be set since it absolutely needs to match the MAC the VM has been assigned by qemu. otherwise nothign will work