diff options
author | Bas van Dijk <v.dijk.bas@gmail.com> | 2020-04-20 22:06:02 +0200 |
---|---|---|
committer | Bas van Dijk <v.dijk.bas@gmail.com> | 2020-07-20 13:09:27 +0200 |
commit | e15815e885db42e642ed67527df76bbcc35f3e91 (patch) | |
tree | 6bf8d25c1ed41229faa3198b842d78a206bee796 /nixos/lib | |
parent | 0410f5dff9ff952bfe129e522933c4c4ef6b3815 (diff) |
nixos/tests/networking.nix: test the services.dhcpd4.machines option
This modifies the `router` to not give out a range of IP addresses but
only give out a fixed address based on the MAC address using the
`services.dhcpd4.machines` option.
To get access to the MAC address the `qemuNicMac` function is defined
and exported from `qemu-flags.nix`.
Diffstat (limited to 'nixos/lib')
-rw-r--r-- | nixos/lib/qemu-flags.nix | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/nixos/lib/qemu-flags.nix b/nixos/lib/qemu-flags.nix index b310914d36cc..4774fd231683 100644 --- a/nixos/lib/qemu-flags.nix +++ b/nixos/lib/qemu-flags.nix @@ -9,10 +9,11 @@ let else pkgs.lib.toHex n); in -{ +rec { + qemuNicMac = net: machine: "52:54:00:12:${zeroPad net}:${zeroPad machine}"; qemuNICFlags = nic: net: machine: - [ "-device virtio-net-pci,netdev=vlan${toString nic},mac=52:54:00:12:${zeroPad net}:${zeroPad machine}" + [ "-device virtio-net-pci,netdev=vlan${toString nic},mac=${qemuNicMac net machine}" "-netdev vde,id=vlan${toString nic},sock=$QEMU_VDE_SOCKET_${toString net}" ]; |