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 {
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
inter="$1"

View file

@ -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

View file

@ -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
fi
) > /etc/bird.conf
chown root:bird /etc/bird.conf
chmod 640 /etc/bird.conf