Skip to content

Commit

Permalink
networking.interfaces: Add option to set srcAddress
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucus16 authored and Bart Schuurmans committed Jan 11, 2024
1 parent 749d5f8 commit e560132
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
8 changes: 6 additions & 2 deletions nixos/modules/tasks/network-interfaces-scripted.nix
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,9 @@ let
optionalString (cfg.defaultGatewayWindowSize != null)
"window ${toString cfg.defaultGatewayWindowSize}"} ${
optionalString (cfg.defaultGateway.interface != null)
"dev ${cfg.defaultGateway.interface}"} proto static
"dev ${cfg.defaultGateway.interface}"} proto static ${
optionalString (cfg.defaultGateway.srcAddress != null)
"src ${cfg.defaultGateway.srcAddress}"}
''}
${optionalString (cfg.defaultGateway6 != null && cfg.defaultGateway6.address != "") ''
${optionalString (cfg.defaultGateway6.interface != null) ''
Expand All @@ -154,7 +156,9 @@ let
optionalString (cfg.defaultGatewayWindowSize != null)
"window ${toString cfg.defaultGatewayWindowSize}"} ${
optionalString (cfg.defaultGateway6.interface != null)
"dev ${cfg.defaultGateway6.interface}"} proto static
"dev ${cfg.defaultGateway6.interface}"} proto static ${
optionalString (cfg.defaultGateway6.srcAddress != null)
"src ${cfg.defaultGateway6.srcAddress}"}
''}
'';
};
Expand Down
6 changes: 6 additions & 0 deletions nixos/modules/tasks/network-interfaces.nix
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,12 @@ let
description = lib.mdDoc "The default gateway metric/preference.";
};

srcAddress = mkOption {
type = types.nullOr types.str;
default = null;
description = lib.mdDoc "The default source address for public connections.";
};

};

};
Expand Down

0 comments on commit e560132

Please sign in to comment.