lol

nixos/sing-box: test iproute2_table_index and iproute2_rule_index

+12 -5
+12 -5
nixos/tests/sing-box.nix
··· 49 49 "fd00::1/126" 50 50 ]; 51 51 auto_route = true; 52 + iproute2_table_index = 2024; 53 + iproute2_rule_index = 9001; 52 54 route_address = [ 53 55 "${hosts."${target_host}"}/32" 54 56 ]; ··· 515 517 516 518 with subtest("tun"): 517 519 tun.wait_for_unit("sing-box.service") 518 - tun.wait_for_unit("sys-devices-virtual-net-tun0.device") 519 - tun.wait_until_succeeds("ip route get ${hosts."${target_host}"} | grep 'dev tun0'") 520 - tun.succeed("ip addr show tun0") 520 + tun.wait_for_unit("sys-devices-virtual-net-${tunInbound.interface_name}.device") 521 + tun.wait_until_succeeds("ip route get ${hosts."${target_host}"} | grep 'dev ${tunInbound.interface_name}'") 522 + tun.succeed("ip addr show ${tunInbound.interface_name}") 523 + tun.succeed("ip route show table ${toString tunInbound.iproute2_table_index} | grep ${tunInbound.interface_name}") 524 + assert ( 525 + tun.succeed("ip rule list table ${toString tunInbound.iproute2_table_index} | sort | head -1 | awk -F: '{print $1}' | tr -d '\n'") 526 + == "${toString tunInbound.iproute2_rule_index}" 527 + ) 521 528 test_curl(tun) 522 529 523 530 with subtest("wireguard"): ··· 532 539 533 540 with subtest("fakeip"): 534 541 fakeip.wait_for_unit("sing-box.service") 535 - fakeip.wait_for_unit("sys-devices-virtual-net-tun0.device") 536 - fakeip.wait_until_succeeds("ip route get ${hosts."${target_host}"} | grep 'dev tun0'") 542 + fakeip.wait_for_unit("sys-devices-virtual-net-${tunInbound.interface_name}.device") 543 + fakeip.wait_until_succeeds("ip route get ${hosts."${target_host}"} | grep 'dev ${tunInbound.interface_name}'") 537 544 fakeip.succeed("dig +short A ${target_host} @${target_host} | grep '^198.18.'") 538 545 ''; 539 546