From 377add43d19c0ac93d9e060675f6de4ce1eb42c5 Mon Sep 17 00:00:00 2001 From: Demi Marie Obenour Date: Tue, 10 Nov 2020 22:31:18 -0500 Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20hardcode=20MAC=20addresses?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- network/vif-route-qubes | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/network/vif-route-qubes b/network/vif-route-qubes index 82c0549..ec33462 100755 --- a/network/vif-route-qubes +++ b/network/vif-route-qubes @@ -112,8 +112,8 @@ case "$command" in ;; esac -domid=${vif/vif/} -domid=${domid/.*/} +[[ $vif =~ ^vif([0-9]+)\.([0-9]+)$ ]] || exit 1 +domid=${BASH_REMATCH[1]} sub=${BASH_REMATCH[2]} # metric must be possitive, but prefer later interface # 32752 is max XID aka domid metric=$(( 32752 - domid )) @@ -135,8 +135,9 @@ if [ "${ip}" ]; then "COMMIT" | \ ${cmdprefix} $ipt --noflush $ipt_arg if [[ "$command" = 'online' ]]; then - ip neighbour "${ipcmd}" to "${addr}" \ - dev "${vif}" lladdr 00:16:3e:5e:6c:6c:00 nud permanent + mac=$(xenstore-read "backend/vif/$domid/$sub/mac") && + ip -- neighbour "${ipcmd}" to "${addr}" \ + dev "${vif}" lladdr "$mac" nud permanent fi done # if no IPv6 is assigned, block all IPv6 traffic on that interface