mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-02-07 12:44:20 +00:00
Merge pull request #11896 from mayflower/upstream-networkd
networkd: add IPForward IPMasquerade options, DHCPServer section
This commit is contained in:
commit
eac8cb1ce1
@ -93,11 +93,13 @@ let
|
|||||||
|
|
||||||
checkNetwork = checkUnitConfig "Network" [
|
checkNetwork = checkUnitConfig "Network" [
|
||||||
(assertOnlyFields [
|
(assertOnlyFields [
|
||||||
"Description" "DHCP" "DHCPServer" "IPv4LL" "IPv4LLRoute"
|
"Description" "DHCP" "DHCPServer" "IPForward" "IPMasquerade" "IPv4LL" "IPv4LLRoute"
|
||||||
"LLMNR" "Domains" "Bridge" "Bond"
|
"LLMNR" "Domains" "Bridge" "Bond"
|
||||||
])
|
])
|
||||||
(assertValueOneOf "DHCP" ["both" "none" "v4" "v6"])
|
(assertValueOneOf "DHCP" ["both" "none" "v4" "v6"])
|
||||||
(assertValueOneOf "DHCPServer" boolValues)
|
(assertValueOneOf "DHCPServer" boolValues)
|
||||||
|
(assertValueOneOf "IPForward" ["yes" "no" "ipv4" "ipv6"])
|
||||||
|
(assertValueOneOf "IPMasquerade" boolValues)
|
||||||
(assertValueOneOf "IPv4LL" boolValues)
|
(assertValueOneOf "IPv4LL" boolValues)
|
||||||
(assertValueOneOf "IPv4LLRoute" boolValues)
|
(assertValueOneOf "IPv4LLRoute" boolValues)
|
||||||
(assertValueOneOf "LLMNR" boolValues)
|
(assertValueOneOf "LLMNR" boolValues)
|
||||||
@ -129,6 +131,16 @@ let
|
|||||||
(assertValueOneOf "RequestBroadcast" boolValues)
|
(assertValueOneOf "RequestBroadcast" boolValues)
|
||||||
];
|
];
|
||||||
|
|
||||||
|
checkDhcpServer = checkUnitConfig "DHCPServer" [
|
||||||
|
(assertOnlyFields [
|
||||||
|
"PoolOffset" "PoolSize" "DefaultLeaseTimeSec" "MaxLeaseTimeSec"
|
||||||
|
"EmitDNS" "DNS" "EmitNTP" "NTP" "EmitTimezone" "Timezone"
|
||||||
|
])
|
||||||
|
(assertValueOneOf "EmitDNS" boolValues)
|
||||||
|
(assertValueOneOf "EmitNTP" boolValues)
|
||||||
|
(assertValueOneOf "EmitTimezone" boolValues)
|
||||||
|
];
|
||||||
|
|
||||||
commonNetworkOptions = {
|
commonNetworkOptions = {
|
||||||
|
|
||||||
enable = mkOption {
|
enable = mkOption {
|
||||||
@ -341,6 +353,18 @@ let
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
dhcpServerConfig = mkOption {
|
||||||
|
default = {};
|
||||||
|
example = { PoolOffset = 50; EmitDNS = false; };
|
||||||
|
type = types.addCheck (types.attrsOf unitOption) checkDhcpServer;
|
||||||
|
description = ''
|
||||||
|
Each attribute in this set specifies an option in the
|
||||||
|
<literal>[DHCPServer]</literal> section of the unit. See
|
||||||
|
<citerefentry><refentrytitle>systemd.network</refentrytitle>
|
||||||
|
<manvolnum>5</manvolnum></citerefentry> for details.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
name = mkOption {
|
name = mkOption {
|
||||||
type = types.nullOr types.str;
|
type = types.nullOr types.str;
|
||||||
default = null;
|
default = null;
|
||||||
@ -565,6 +589,11 @@ let
|
|||||||
[DHCP]
|
[DHCP]
|
||||||
${attrsToSection def.dhcpConfig}
|
${attrsToSection def.dhcpConfig}
|
||||||
|
|
||||||
|
''}
|
||||||
|
${optionalString (def.dhcpServerConfig != { }) ''
|
||||||
|
[DHCPServer]
|
||||||
|
${attrsToSection def.dhcpServerConfig}
|
||||||
|
|
||||||
''}
|
''}
|
||||||
${flip concatMapStrings def.addresses (x: ''
|
${flip concatMapStrings def.addresses (x: ''
|
||||||
[Address]
|
[Address]
|
||||||
|
Loading…
Reference in New Issue
Block a user