Don’t hardcode MAC addresses

This commit is contained in:
Demi Marie Obenour 2020-11-10 22:31:18 -05:00
parent 0a322958e4
commit 377add43d1
No known key found for this signature in database
GPG Key ID: 28A45C93B0B5B6E0

View File

@ -112,8 +112,8 @@ case "$command" in
;; ;;
esac esac
domid=${vif/vif/} [[ $vif =~ ^vif([0-9]+)\.([0-9]+)$ ]] || exit 1
domid=${domid/.*/} domid=${BASH_REMATCH[1]} sub=${BASH_REMATCH[2]}
# metric must be possitive, but prefer later interface # metric must be possitive, but prefer later interface
# 32752 is max XID aka domid # 32752 is max XID aka domid
metric=$(( 32752 - domid )) metric=$(( 32752 - domid ))
@ -135,8 +135,9 @@ if [ "${ip}" ]; then
"COMMIT" | \ "COMMIT" | \
${cmdprefix} $ipt --noflush $ipt_arg ${cmdprefix} $ipt --noflush $ipt_arg
if [[ "$command" = 'online' ]]; then if [[ "$command" = 'online' ]]; then
ip neighbour "${ipcmd}" to "${addr}" \ mac=$(xenstore-read "backend/vif/$domid/$sub/mac") &&
dev "${vif}" lladdr 00:16:3e:5e:6c:6c:00 nud permanent ip -- neighbour "${ipcmd}" to "${addr}" \
dev "${vif}" lladdr "$mac" nud permanent
fi fi
done done
# if no IPv6 is assigned, block all IPv6 traffic on that interface # if no IPv6 is assigned, block all IPv6 traffic on that interface