Skip to content

Commit

Permalink
Fix ids-vm
Browse files Browse the repository at this point in the history
- change 'cloud-hypervisor' to qemu
- fix gateway settings

Signed-off-by: Manuel Bluhm <[email protected]>
  • Loading branch information
mbssrc authored and brianmcgillion committed Aug 25, 2024
1 parent 1d6f269 commit 17f418a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
10 changes: 8 additions & 2 deletions modules/microvm/virtualization/microvm/common/vm-networking.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,17 @@
vmName,
macAddress,
internalIP,
gateway ? [ "192.168.100.1" ],
isGateway ? false,
...
}:
let
networkName = "ethint0";
netVmEntry = builtins.filter (x: x.name == "net-vm") config.ghaf.networking.hosts.entries;
netVmAddress = builtins.map (x: x.ip) netVmEntry;
isIdsvmEnabled = config.ghaf.virtualization.microvm.idsvm.enable;
idsVmEntry = builtins.filter (x: x.name == "ids-vm") config.ghaf.networking.hosts.entries;
idsVmAddress = lib.optionals isIdsvmEnabled (builtins.map (x: x.ip) idsVmEntry);
gateway = if isIdsvmEnabled && (vmName != "ids-vm") then idsVmAddress else netVmAddress;
in
{
networking = {
Expand Down Expand Up @@ -53,7 +59,7 @@ in
];
linkConfig.RequiredForOnline = "routable";
linkConfig.ActivationPolicy = "always-up";
} // lib.optionalAttrs (gateway != [ ]) { inherit gateway; };
} // lib.optionalAttrs (!isGateway) { inherit gateway; };
};

# systemd-resolved does not support local names resolution
Expand Down
2 changes: 1 addition & 1 deletion modules/microvm/virtualization/microvm/idsvm/idsvm.nix
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ let
nixpkgs.buildPlatform.system = configHost.nixpkgs.buildPlatform.system;
nixpkgs.hostPlatform.system = configHost.nixpkgs.hostPlatform.system;

microvm.hypervisor = "cloud-hypervisor";
microvm.hypervisor = "qemu";

environment.systemPackages = [
pkgs.snort # TODO: put into separate module
Expand Down
2 changes: 1 addition & 1 deletion modules/microvm/virtualization/microvm/netvm.nix
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ let
macAddress
;
internalIP = 1;
gateway = [ ];
isGateway = true;
})
# To push logs to central location
../../../common/logging/client.nix
Expand Down

0 comments on commit 17f418a

Please sign in to comment.