nixos-module/container/upstream: fix DHCP for upstream3, upstream4

This commit is contained in:
Astro 2021-05-22 01:19:16 +02:00
parent 68afa61ca1
commit cfb062063a
3 changed files with 14 additions and 10 deletions

View File

@ -98,6 +98,8 @@ in
upstream2.interfaces.up2.upstream.noNat.subnets6 = [
"2a02:8106:208:e900::/56"
];
upstream3.interfaces.up3.upstream = {};
upstream4.interfaces.up4.upstream = {};
upstream1.ospf.upstreamInstance = 3;
upstream2.ospf.upstreamInstance = 4;
anon1.ospf.upstreamInstance = 5;
@ -164,15 +166,14 @@ in
interfaces =
builtins.mapAttrs (net: interface:
renameAttr "gw" "gw4"
(forceVeth interface) // {
upstream =
if ctPillar ? upstream &&
ctPillar.upstream.interface == net
then {
upBandwidth = ctPillar.upstream.up-bandwidth;
}
else null;
}
(forceVeth interface) // (
if ctPillar ? upstream &&
ctPillar.upstream.interface == net
then {
upstream.upBandwidth = ctPillar.upstream.up-bandwidth;
}
else {}
)
) container.interfaces;
wireguard =

View File

@ -105,6 +105,7 @@ let
upstreamOpts = {
upBandwidth = mkOption {
type = with types; nullOr int;
default = null;
};
noNat.subnets6 = mkOption {
type = with types; listOf str;

View File

@ -40,7 +40,9 @@ in
Parent = root
# DOCSIS overhead
OverheadBytes = 18
Bandwidth = ${toString upstream.upBandwidth}K
${lib.optionalString (upstream.upBandwidth != null) ''
Bandwidth = ${toString upstream.upBandwidth}K
''}
'';
}) upstreamInterfaces;