From 4115f2ab9572dc23acaf4cd0b1a95f67ee38c92b Mon Sep 17 00:00:00 2001 From: Lu Wang Date: Wed, 15 Jan 2025 17:43:54 +0800 Subject: [PATCH] services/enthalpy: enable etx link quality estimation --- flake/nixpkgs.nix | 5 + nixos/modules/services/enthalpy/bird.nix | 1 + .../bird-babel-link-quality-estimation.patch | 135 ++++++++++++++++++ 3 files changed, 141 insertions(+) create mode 100644 patches/bird-babel-link-quality-estimation.patch diff --git a/flake/nixpkgs.nix b/flake/nixpkgs.nix index 21ec8bb..bf9de27 100644 --- a/flake/nixpkgs.nix +++ b/flake/nixpkgs.nix @@ -8,6 +8,11 @@ let inputs.nixpkgs-terraform-providers-bin.overlay (_final: prev: { + bird = prev.bird.overrideAttrs (old: { + patches = (old.patches or [ ]) ++ [ + ../patches/bird-babel-link-quality-estimation.patch + ]; + }); mautrix-telegram = prev.mautrix-telegram.overrideAttrs (old: { patches = (old.patches or [ ]) ++ [ ../patches/mautrix-telegram-sticker.patch diff --git a/nixos/modules/services/enthalpy/bird.nix b/nixos/modules/services/enthalpy/bird.nix index 8e08313..b477c90 100644 --- a/nixos/modules/services/enthalpy/bird.nix +++ b/nixos/modules/services/enthalpy/bird.nix @@ -117,6 +117,7 @@ in randomize router id; interface "enta*" { type tunnel; + link quality etx; rxcost 32; rtt cost 1024; rtt max 1024 ms; diff --git a/patches/bird-babel-link-quality-estimation.patch b/patches/bird-babel-link-quality-estimation.patch new file mode 100644 index 0000000..0c6bcb1 --- /dev/null +++ b/patches/bird-babel-link-quality-estimation.patch @@ -0,0 +1,135 @@ +From 700a4fddd3b554cc1071608cf8d945400ae35c9e Mon Sep 17 00:00:00 2001 +From: Nick Cao +Date: Fri, 23 Jun 2023 10:36:48 +0800 +Subject: [PATCH] Babel: allow choosing link quality estimation algorithm + +ETX link quality estimation algorithm is useful for link types other than wireless, +especially when using babel with tunnels where packet losses do occur. +--- + doc/bird.sgml | 10 ++++++++++ + proto/babel/babel.c | 8 +++----- + proto/babel/babel.h | 8 ++++++++ + proto/babel/config.Y | 8 +++++++- + 4 files changed, 28 insertions(+), 6 deletions(-) + +diff --git a/doc/bird.sgml b/doc/bird.sgml +index 7abb8348c..fb00b9fca 100644 +--- a/doc/bird.sgml ++++ b/doc/bird.sgml +@@ -2320,6 +2320,7 @@ protocol babel [] { + rx buffer ; + tx length ; + check link ; ++ link quality ; + next hop ipv4
; + next hop ipv6
; + extended next hop ; +@@ -2423,6 +2424,15 @@ protocol babel [] { + hardware drivers or platforms do not implement this feature. Default: + yes. + ++ ++ This option specifies the link quality estimation algorithm for computing ++ costs based on Hello history: none or etx. The none (k-out-of-j) algorithm ++ is suitable for wired links that are either up, in which case they only ++ occasionally drop a packet, or down, in which case they drop all packets. ++ The Expected Transmission Cost algorithm, or etx, is suitable for wireless ++ links that exhibit continuous variation of the link quality. Default: etx for ++ wireless interfaces, none otherwise. ++ +