Add the next_hop script.

This script determines the next hop for a packet leaving this machine destined for the given address.
This commit is contained in:
Tom Alexander 2026-03-03 09:33:11 -05:00
parent 04ede4bfee
commit ea133ded21
Signed by: talexander
GPG Key ID: 36C99E8B3C39D85F
2 changed files with 16 additions and 0 deletions

View File

@ -15,6 +15,14 @@
# "2001:4860:4860::8844#dns.google" # "2001:4860:4860::8844#dns.google"
# "2001:4860:4860::8888#dns.google" # "2001:4860:4860::8888#dns.google"
let
patchScriptBin =
filename: contents:
((pkgs.writeScriptBin filename contents).overrideAttrs (old: {
buildCommand = "${old.buildCommand}\n patchShebangs $out";
}));
next_hop = (patchScriptBin "next_hop" (builtins.readFile ./files/next_hop_linux.bash));
in
{ {
imports = [ ]; imports = [ ];
@ -88,6 +96,7 @@
arp-scan # To find devices on the network arp-scan # To find devices on the network
wavemon wavemon
dhcpcd # For Android USB tethering. dhcpcd # For Android USB tethering.
next_hop
]; ];
boot.extraModprobeConfig = '' boot.extraModprobeConfig = ''

View File

@ -0,0 +1,7 @@
#!/usr/bin/env bash
#
set -euo pipefail
IFS=$'\n\t'
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
exec ip route get "${@}"