1
0

add bandwidth as a service option for ppp (l2tp, pppoe)

This commit is contained in:
Daniel Barlow 2025-03-27 20:23:26 +00:00
parent dd44fbaec1
commit 46ed8f0199
5 changed files with 12 additions and 1 deletions

View File

@ -71,6 +71,7 @@ rec {
interface = config.hardware.networkInterfaces.wan; interface = config.hardware.networkInterfaces.wan;
username = secrets.l2tp.name; username = secrets.l2tp.name;
password = secrets.l2tp.password; password = secrets.l2tp.password;
bandwidth = 70 * 1000 * 1000;
}; };
# once the wan has ipv4 connnectivity, should we run dhcp6 # once the wan has ipv4 connnectivity, should we run dhcp6
# client to potentially get an address range ("prefix # client to potentially get an address range ("prefix

View File

@ -13,6 +13,7 @@
username, username,
password, password,
lcpEcho, lcpEcho,
bandwidth,
ppp-options, ppp-options,
dependencies ? [ ], dependencies ? [ ],
}: }:
@ -115,7 +116,7 @@ let
${command} ${command}
''; '';
notification-fd = 10; notification-fd = 10;
# properties.bandwidth = 3 * 1000 * 1000; properties.bandwidth = bandwidth;
timeout-up = timeout-up =
if lcpEcho.failure != null then (10 + lcpEcho.failure * lcpEcho.interval) * 1000 else 60 * 1000; if lcpEcho.failure != null then (10 + lcpEcho.failure * lcpEcho.interval) * 1000 else 60 * 1000;
inherit dependencies; inherit dependencies;

View File

@ -56,6 +56,11 @@ in
default = null; default = null;
description = "password"; description = "password";
}; };
bandwidth = mkOption {
type = types.nullOr (types.int);
default = null;
description = "approximate bandwidth in bytes/second. Used to calculate rate limits for ICMP";
};
lcpEcho = { lcpEcho = {
adaptive = mkOption { adaptive = mkOption {
description = "send LCP echo-request frames only if no traffic was received from the peer since the last echo-request was sent"; description = "send LCP echo-request frames only if no traffic was received from the peer since the last echo-request was sent";

View File

@ -13,6 +13,7 @@
lns, lns,
ppp-options, ppp-options,
lcpEcho, lcpEcho,
bandwidth,
username, username,
password, password,
debug, debug,
@ -40,6 +41,7 @@ common {
username username
password password
lcpEcho lcpEcho
bandwidth
ppp-options ppp-options
; ;
command = '' command = ''

View File

@ -13,6 +13,7 @@
interface, interface,
ppp-options, ppp-options,
lcpEcho, lcpEcho,
bandwidth,
username, username,
password, password,
debug, debug,
@ -31,6 +32,7 @@ common {
username username
password password
lcpEcho lcpEcho
bandwidth
ppp-options ppp-options
; ;
command = '' command = ''