git works
This commit is contained in:
parent
8b7fe69ca3
commit
f87d98dfd6
4 changed files with 28 additions and 19 deletions
|
@ -1,4 +1,4 @@
|
|||
#!/run/current-system/profile/bin/awk -f
|
||||
#!/usr/bin/awk -f
|
||||
|
||||
BEGIN {
|
||||
FS = "[ ]"; # use a single space as field separator and don't trim input
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env sh
|
||||
#!/bin/sh
|
||||
# args: /path/to/interface-config /path/to/output.conf
|
||||
|
||||
inter="$1"
|
||||
|
|
11
inet2.initd
11
inet2.initd
|
@ -25,7 +25,18 @@ runscripts() {
|
|||
fi
|
||||
}
|
||||
|
||||
|
||||
|
||||
start() {
|
||||
|
||||
for file in /sys/class/net/*; do # Clear all wireguard interfaces
|
||||
type=$(cat "$file/type")
|
||||
if [ "$type" = "65534" ]; then
|
||||
ifname="$(basename $file)"
|
||||
ip link del "$ifname"
|
||||
fi
|
||||
done
|
||||
|
||||
rm -rf /run/inet2/config 2>/dev/null
|
||||
rm -rf /run/inet2/wg 2>/dev/null
|
||||
cp /config/inet2.conf /run/inet2/inet2.conf
|
||||
|
|
30
setup.sh
30
setup.sh
|
@ -39,7 +39,7 @@ run sysctl net.ipv6.conf.all.disable_ipv6=0 net.ipv6.conf.default.disable_ipv6=0
|
|||
ospf="$(haskey OSPF)"
|
||||
|
||||
escapebird() {
|
||||
sed -e 's/\\/\\\\/g;s/"/\\"/g'
|
||||
sed -e 's/\\/\\\\/g;s/"/\\"/g'
|
||||
}
|
||||
|
||||
if [ -n "$ospf" ]; then
|
||||
|
@ -56,21 +56,13 @@ log "/var/log/bird.log" all;
|
|||
$(getval RouterID | while read -r line; do echo "router id $line;"; done)
|
||||
|
||||
protocol kernel {
|
||||
ipv4 {
|
||||
export filter { if source ~ [RTS_BGP, RTS_OSPF, RTS_OSPF_IA, RTS_OSPF_EXT1, RTS_OSPF_EXT2] then accept; else reject; };
|
||||
import all;
|
||||
};
|
||||
learn;
|
||||
scan time 10;
|
||||
ipv4 { export all; };
|
||||
}
|
||||
|
||||
protocol kernel {
|
||||
ipv6 {
|
||||
export filter { if source ~ [RTS_BGP, RTS_OSPF, RTS_OSPF_IA, RTS_OSPF_EXT1, RTS_OSPF_EXT2] then accept; else reject; };
|
||||
import all;
|
||||
};
|
||||
learn;
|
||||
scan time 10;
|
||||
ipv6 { export all; };
|
||||
}
|
||||
|
||||
protocol device {
|
||||
}
|
||||
|
||||
|
@ -79,6 +71,9 @@ protocol direct {
|
|||
ipv6;
|
||||
}
|
||||
|
||||
protocol static {
|
||||
ipv4;
|
||||
}
|
||||
|
||||
EOF
|
||||
if [ -n "$ospf" ]; then
|
||||
|
@ -89,6 +84,7 @@ EOF
|
|||
val="$(getval "interface $inter" OSPF)"
|
||||
if [ "$?" = "0" ]; then
|
||||
echo " interface \"$(printf "%s" "$inter" | escapebird)\" {"
|
||||
echo " type ptp;"
|
||||
if [ -n "$val" ]; then
|
||||
echo " $val;";
|
||||
fi
|
||||
|
@ -102,19 +98,21 @@ EOF
|
|||
protocol ospf v3 ospf4 {
|
||||
ipv4 {
|
||||
import all;
|
||||
export filter { if source ~ [RTS_DEVICE, RTS_INHERIT] then accept; else reject; };
|
||||
export filter { if source ~ [RTS_DEVICE, RTS_INHERIT] && net ~ [$(getval "Subnet" | grep -v ':' | while read -r line; do printf "%s+," "$line"; done | sed 's/,$//')] then accept; else reject; };
|
||||
};
|
||||
$interfacelist
|
||||
}
|
||||
protocol ospf v3 ospf6 {
|
||||
ipv6 {
|
||||
import all;
|
||||
export filter { if source ~ [RTS_DEVICE, RTS_INHERIT] then accept; else reject; };
|
||||
export filter { if source ~ [RTS_DEVICE, RTS_INHERIT] && net ~ [$(getval "Subnet" | grep ':' | while read -r line; do printf "%s+," "$line"; done | sed 's/,$//')] then accept; else reject; };
|
||||
};
|
||||
$interfacelist
|
||||
}
|
||||
EOF
|
||||
) > /etc/bird.conf
|
||||
fi
|
||||
) > /etc/bird.conf
|
||||
|
||||
chown root:bird /etc/bird.conf
|
||||
chmod 640 /etc/bird.conf
|
||||
|
||||
|
|
Loading…
Reference in a new issue