git works

This commit is contained in:
Freya Murphy 2023-11-14 23:25:25 -05:00
parent 8b7fe69ca3
commit f87d98dfd6
No known key found for this signature in database
GPG key ID: 988032A5638EE799
4 changed files with 28 additions and 19 deletions

View file

@ -1,4 +1,4 @@
#!/run/current-system/profile/bin/awk -f #!/usr/bin/awk -f
BEGIN { BEGIN {
FS = "[ ]"; # use a single space as field separator and don't trim input FS = "[ ]"; # use a single space as field separator and don't trim input

View file

@ -1,4 +1,4 @@
#!/usr/bin/env sh #!/bin/sh
# args: /path/to/interface-config /path/to/output.conf # args: /path/to/interface-config /path/to/output.conf
inter="$1" inter="$1"

View file

@ -25,7 +25,18 @@ runscripts() {
fi fi
} }
start() { 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/config 2>/dev/null
rm -rf /run/inet2/wg 2>/dev/null rm -rf /run/inet2/wg 2>/dev/null
cp /config/inet2.conf /run/inet2/inet2.conf cp /config/inet2.conf /run/inet2/inet2.conf

View file

@ -39,7 +39,7 @@ run sysctl net.ipv6.conf.all.disable_ipv6=0 net.ipv6.conf.default.disable_ipv6=0
ospf="$(haskey OSPF)" ospf="$(haskey OSPF)"
escapebird() { escapebird() {
sed -e 's/\\/\\\\/g;s/"/\\"/g' sed -e 's/\\/\\\\/g;s/"/\\"/g'
} }
if [ -n "$ospf" ]; then if [ -n "$ospf" ]; then
@ -47,7 +47,7 @@ if [ -n "$ospf" ]; then
touch /var/log/bird.log touch /var/log/bird.log
chown bird:bird /var/log/bird.log chown bird:bird /var/log/bird.log
selfas=$(getval AS) selfas=$(getval AS)
( (
cat <<EOF cat <<EOF
@ -56,21 +56,13 @@ log "/var/log/bird.log" all;
$(getval RouterID | while read -r line; do echo "router id $line;"; done) $(getval RouterID | while read -r line; do echo "router id $line;"; done)
protocol kernel { protocol kernel {
ipv4 { ipv4 { export all; };
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;
} }
protocol kernel { protocol kernel {
ipv6 { ipv6 { export all; };
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;
} }
protocol device { protocol device {
} }
@ -79,6 +71,9 @@ protocol direct {
ipv6; ipv6;
} }
protocol static {
ipv4;
}
EOF EOF
if [ -n "$ospf" ]; then if [ -n "$ospf" ]; then
@ -89,6 +84,7 @@ EOF
val="$(getval "interface $inter" OSPF)" val="$(getval "interface $inter" OSPF)"
if [ "$?" = "0" ]; then if [ "$?" = "0" ]; then
echo " interface \"$(printf "%s" "$inter" | escapebird)\" {" echo " interface \"$(printf "%s" "$inter" | escapebird)\" {"
echo " type ptp;"
if [ -n "$val" ]; then if [ -n "$val" ]; then
echo " $val;"; echo " $val;";
fi fi
@ -102,19 +98,21 @@ EOF
protocol ospf v3 ospf4 { protocol ospf v3 ospf4 {
ipv4 { ipv4 {
import all; 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 $interfacelist
} }
protocol ospf v3 ospf6 { protocol ospf v3 ospf6 {
ipv6 { ipv6 {
import all; 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 $interfacelist
} }
EOF EOF
) > /etc/bird.conf fi
) > /etc/bird.conf
chown root:bird /etc/bird.conf chown root:bird /etc/bird.conf
chmod 640 /etc/bird.conf chmod 640 /etc/bird.conf