mirror of
https://github.com/NeoCloud/NeoNetwork
synced 2024-12-26 14:59:25 +08:00
scripts: Added roa.sh
This commit is contained in:
parent
b906c3dd51
commit
66a890ef5c
1 changed files with 33 additions and 0 deletions
33
scripts/roa.sh
Executable file
33
scripts/roa.sh
Executable file
|
@ -0,0 +1,33 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
INET4PFXLEN="29"
|
||||||
|
INET6PFXLEN="64"
|
||||||
|
|
||||||
|
print_record()
|
||||||
|
{
|
||||||
|
printf "route %s max %d as %u;\n" "$1" "$2" "$3"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# PROGRAM BEGIN
|
||||||
|
|
||||||
|
echo "# NeoNetwork ROA Tool"
|
||||||
|
(
|
||||||
|
for i in route*/* ; do
|
||||||
|
source "$i"
|
||||||
|
if [ "$TYPE" != PTP ]; then
|
||||||
|
prefix="${i#route*/}"
|
||||||
|
prefix="${prefix/,/\/}"
|
||||||
|
pfxlen="${i#*,}"
|
||||||
|
|
||||||
|
if [ "$TYPE" = "SUBNET" ]; then
|
||||||
|
if [ "$pfxlen" -le "$INET4PFXLEN" ]||[ "$pfxlen" -ge 32 ]&&[ "$pfxlen" -le "$INET6PFXLEN" ]; then
|
||||||
|
print_record "$prefix" "$INET4PFXLEN" "$ASN"
|
||||||
|
fi
|
||||||
|
elif [ "$TYPE" = "LO" ]; then
|
||||||
|
print_record "$prefix" 32 "$ASN"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
)
|
Loading…
Reference in a new issue