From 50a52d79ec2851eb21d582e75bc4769398126e56 Mon Sep 17 00:00:00 2001 From: bol-van Date: Tue, 19 Nov 2024 22:08:48 +0300 Subject: [PATCH] default_route_interfaces helpers --- common/linux_iphelper.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/common/linux_iphelper.sh b/common/linux_iphelper.sh index e22f91a..e29ceb3 100644 --- a/common/linux_iphelper.sh +++ b/common/linux_iphelper.sh @@ -125,3 +125,13 @@ resolve_lower_devices() } } } + +default_route_interfaces6() +{ + sed -nre 's/^00000000000000000000000000000000 00 [0-9a-f]{32} [0-9a-f]{2} [0-9a-f]{32} [0-9a-f]{8} [0-9a-f]{8} [0-9a-f]{8} [0-9a-f]{8} +(.*)$/\1/p' /proc/net/ipv6_route | grep -v lo | sort -u | xargs +} + +default_route_interfaces4() +{ + sed -nre 's/^([^\t]+)\t00000000\t[0-9A-F]{8}\t[0-9A-F]{4}\t[0-9]+\t[0-9]+\t[0-9]+\t00000000.*$/\1/p' /proc/net/route | sort -u | xargs +}