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

View File

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

View File

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