treewide: move HostInterfaceMAC to a tracked duplicate var
This is required to not accidentally pull-in future qemu runfiles.
Change-Id: I6098900d047f21096c0b1f6b2176d2480f8e6ab0
Reviewed-on: https://review.monogon.dev/c/monogon/+/4054
Tested-by: Jenkins CI
Reviewed-by: Lorenz Brun <lorenz@monogon.tech>
diff --git a/metropolis/test/nanoswitch/BUILD.bazel b/metropolis/test/nanoswitch/BUILD.bazel
index 4cee5ba..d7f9d12 100644
--- a/metropolis/test/nanoswitch/BUILD.bazel
+++ b/metropolis/test/nanoswitch/BUILD.bazel
@@ -16,7 +16,6 @@
"//osbase/bringup",
"//osbase/socksproxy",
"//osbase/supervisor",
- "//osbase/test/qemu",
"@com_github_google_nftables//:nftables",
"@com_github_google_nftables//expr",
"@com_github_insomniacslk_dhcp//dhcpv4",
diff --git a/metropolis/test/nanoswitch/nanoswitch.go b/metropolis/test/nanoswitch/nanoswitch.go
index 59c4b59..c3fde27 100644
--- a/metropolis/test/nanoswitch/nanoswitch.go
+++ b/metropolis/test/nanoswitch/nanoswitch.go
@@ -33,11 +33,18 @@
dhcpcb "source.monogon.dev/metropolis/node/core/network/dhcp4c/callback"
"source.monogon.dev/osbase/bringup"
"source.monogon.dev/osbase/supervisor"
- "source.monogon.dev/osbase/test/qemu"
)
-var switchIP = net.IP{10, 1, 0, 1}
-var switchSubnetMask = net.CIDRMask(24, 32)
+var (
+ // HostInterfaceMAC is the MAC address the host SLIRP network interface has if it
+ // is not disabled (see DisableHostNetworkInterface in MicroVMOptions)
+ // ONCHANGE(//osbase/test/qemu:launch.go): constraints must be kept in sync with
+ // HostInterfaceMAC.
+ HostInterfaceMAC = net.HardwareAddr{0x02, 0x72, 0x82, 0xbf, 0xc3, 0x56}
+
+ switchIP = net.IP{10, 1, 0, 1}
+ switchSubnetMask = net.CIDRMask(24, 32)
+)
// defaultLeaseOptions sets the lease options needed to properly configure
// connectivity to nanoswitch.
@@ -208,7 +215,7 @@
if attrs.Flags&net.FlagUp != net.FlagUp {
netlink.LinkSetUp(link) // Attempt to take up all ethernet links
}
- if bytes.Equal(attrs.HardwareAddr, qemu.HostInterfaceMAC) {
+ if bytes.Equal(attrs.HardwareAddr, HostInterfaceMAC) {
externalLink = link
} else {
vmLinks = append(vmLinks, link)
diff --git a/osbase/test/qemu/launch.go b/osbase/test/qemu/launch.go
index 52a1492..1b063de 100644
--- a/osbase/test/qemu/launch.go
+++ b/osbase/test/qemu/launch.go
@@ -22,6 +22,12 @@
"source.monogon.dev/osbase/freeport"
)
+var (
+ // HostInterfaceMAC is the MAC address the host SLIRP network interface has if it
+ // is not disabled (see DisableHostNetworkInterface in MicroVMOptions)
+ HostInterfaceMAC = net.HardwareAddr{0x02, 0x72, 0x82, 0xbf, 0xc3, 0x56}
+)
+
type QemuValue map[string][]string
// ToOption encodes structured data into a QEMU option. Example: "test", {"key1":
@@ -130,10 +136,6 @@
return fd1, fd2, nil
}
-// HostInterfaceMAC is the MAC address the host SLIRP network interface has if it
-// is not disabled (see DisableHostNetworkInterface in MicroVMOptions)
-var HostInterfaceMAC = net.HardwareAddr{0x02, 0x72, 0x82, 0xbf, 0xc3, 0x56}
-
// MicroVMOptions contains all options to start a MicroVM
type MicroVMOptions struct {
// Name is a human-readable identifier to be used in debug output.