From 1b8f24425c25de5d86fc0de7561ea3a7f7dad491 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Fri, 17 Oct 2025 09:43:18 +0200 Subject: ... --- hosts/vidhar/network/pppoe.nix | 72 ++++++++++++++++++++---------------------- 1 file changed, 35 insertions(+), 37 deletions(-) (limited to 'hosts') diff --git a/hosts/vidhar/network/pppoe.nix b/hosts/vidhar/network/pppoe.nix index 381658dc..56c8f3b4 100644 --- a/hosts/vidhar/network/pppoe.nix +++ b/hosts/vidhar/network/pppoe.nix @@ -43,6 +43,7 @@ in { stopIfChanged = true; serviceConfig = { + ExecStart = lib.mkForce "${getBin config.services.pppd.package}/sbin/pppd call telekom up_sdnotify nolog"; PIDFile = "/run/pppd/${pppInterface}.pid"; }; restartTriggers = with config; [ @@ -53,46 +54,43 @@ in { }; environment.etc = { - "ppp/ip-pre-up".source = let - app = pkgs.writeShellApplication { - name = "ip-pre-up"; - runtimeInputs = with pkgs; [ iproute2 ethtool ]; - text = '' - ethtool -K telekom tso off gso off gro off + "ppp/ip-pre-up".source = pkgs.resholve.writeScript "ip-pre-up" { + interpreter = pkgs.runtimeShell; + inputs = [ pkgs.iproute2 pkgs.ethtool ]; + execer = [ + "cannot:${lib.getExe' pkgs.iproute2 "ip"}" + "cannot:${lib.getExe' pkgs.iproute2 "tc"}" + ]; + } '' + ethtool -K telekom tso off gso off gro off - ip link del "ifb4${pppInterface}" || true - ip link add name "ifb4${pppInterface}" type ifb - ip link set "ifb4${pppInterface}" up + ip link del "ifb4${pppInterface}" || true + ip link add name "ifb4${pppInterface}" type ifb + ip link set "ifb4${pppInterface}" up - tc qdisc del dev "ifb4${pppInterface}" root || true - tc qdisc del dev "${pppInterface}" ingress || true - tc qdisc del dev "${pppInterface}" root || true + tc qdisc del dev "ifb4${pppInterface}" root || true + tc qdisc del dev "${pppInterface}" ingress || true + tc qdisc del dev "${pppInterface}" root || true - tc qdisc add dev "${pppInterface}" handle ffff: ingress - tc filter add dev "${pppInterface}" parent ffff: basic action ctinfo dscp 0x0000003f 0x00000040 action mirred egress redirect dev "ifb4${pppInterface}" - tc qdisc replace dev "ifb4${pppInterface}" root cake memlimit 128Mb overhead 35 mpu 74 regional diffserv4 bandwidth ${toString (builtins.floor (177968 * 0.95))}kbit - tc qdisc replace dev "${pppInterface}" root cake memlimit 128Mb overhead 35 mpu 74 regional nat diffserv4 wash bandwidth ${toString (builtins.floor (41216 * 0.95))}kbit - ''; - }; - in "${app}/bin/${app.meta.mainProgram}"; - "ppp/ip-up".source = let - app = pkgs.writeShellApplication { - name = "ip-up"; - runtimeInputs = with pkgs; [ iproute2 ]; - text = '' - ip route add default via "$5" dev "${pppInterface}" metric 512 - ''; - }; - in "${app}/bin/${app.meta.mainProgram}"; - "ppp/ip-down".source = let - app = pkgs.writeShellApplication { - name = "ip-down"; - runtimeInputs = with pkgs; [ iproute2 ]; - text = '' - ip link del "ifb4${pppInterface}" - ''; - }; - in "${app}/bin/${app.meta.mainProgram}"; + tc qdisc add dev "${pppInterface}" handle ffff: ingress + tc filter add dev "${pppInterface}" parent ffff: basic action ctinfo dscp 0x0000003f 0x00000040 action mirred egress redirect dev "ifb4${pppInterface}" + tc qdisc replace dev "ifb4${pppInterface}" root cake memlimit 128Mb overhead 35 mpu 74 regional diffserv4 bandwidth ${toString (builtins.floor (177968 * 0.95))}kbit + tc qdisc replace dev "${pppInterface}" root cake memlimit 128Mb overhead 35 mpu 74 regional nat diffserv4 wash bandwidth ${toString (builtins.floor (41216 * 0.95))}kbit + ''; + "ppp/ip-up".source = pkgs.resholve.writeScript "ip-up" { + interpreter = pkgs.runtimeShell; + inputs = [ pkgs.iproute2 ]; + execer = [ "cannot:${lib.getExe' pkgs.iproute2 "ip"}" ]; + } '' + ip route add default via "$5" dev "${pppInterface}" metric 512 + ''; + "ppp/ip-down".source = pkgs.resholve.writeScript "ip-down" { + interpreter = pkgs.runtimeShell; + inputs = [ pkgs.iproute2 ]; + execer = [ "cannot:${lib.getExe' pkgs.iproute2 "ip"}" ]; + } '' + ip link del "ifb4${pppInterface}" + ''; }; systemd.network.networks.${pppInterface} = { -- cgit v1.2.3