Update to latest

This commit is contained in:
Alex D. 2023-12-27 06:02:58 +00:00
parent d9e8db91d3
commit 6128b07ac4
Signed by: caskd
GPG Key ID: F92BA85F61F4C173
7 changed files with 331 additions and 45 deletions

39
hosts/izmaylovo.russia.sh Executable file
View File

@ -0,0 +1,39 @@
#!/bin/sh
. "$(dirname -- "$0")/../netdev.sh"
# Bridges
BRIDGE="br-v6"
new_if_bridge "$BRIDGE"
if_bridge_property 'stp_state' "$BRIDGE"
if_bridge_property 'mcast_router' "$BRIDGE"
if_bridge_property 'mcast_snooping' "$BRIDGE" '0' '' # TODO: Remove such entries when bridges play well with multicasting
if_bridge_property 'mcast_querier' "$BRIDGE"
if_bridge_property 'mcast_mld_version' "$BRIDGE" '2' ''
IFACE="phys4-66"
if_slave "$BRIDGE" "$IFACE"
new_if_vlan "$IFACE"
BRIDGE="br0"
new_if_bridge "$BRIDGE"
if_bridge_property 'stp_state' "$BRIDGE"
if_bridge_property 'mcast_router' "$BRIDGE"
if_bridge_property 'mcast_snooping' "$BRIDGE" '0' '' # TODO: Remove such entries when bridges play well with multicasting
if_bridge_property 'mcast_querier' "$BRIDGE"
if_bridge_property 'mcast_mld_version' "$BRIDGE" '2' ''
if_dhcp "$BRIDGE"
IFACE="phys4"
if_slave "$BRIDGE" "$IFACE"
new_if_phys "$IFACE"
IFACE="shared"
if_slave "$BRIDGE" "$IFACE"
new_if_phys "$IFACE"
# Wireguard
IFACE="wg-tunnel"
new_if_wg "$IFACE"
if_ip_addr "$IFACE" "172.22.12.7/32"
if_ip_addr "$IFACE" "fd42:42:42::2:7/128"
if_route_addr "$IFACE" "172.22.12.0/24"
if_route_addr "$IFACE" "fd42:42:42::2:0/120"

View File

@ -1,11 +1,8 @@
#!/bin/sh
. "$(dirname -- "$0")/netdev.sh"
# Unallocated (yet)
new_if_phys "phys0"
new_if_phys "phys1"
. "$(dirname -- "$0")/../netdev.sh"
# VRFs
VRF="vrf-dn42"
new_if_vrf "$VRF" 20
if_route_vrf_default_unreach "$VRF"
@ -13,7 +10,21 @@ new_if_vrf "$VRF" 20
BRIDGE="br-dn42"
if_slave "$VRF" "$BRIDGE"
new_if_bridge "$BRIDGE"
if_bridge_property 'stp_state' "$BRIDGE"
if_bridge_property 'mcast_router' "$BRIDGE"
if_bridge_property 'mcast_snooping' "$BRIDGE" '0' '' # TODO: Remove such entries when bridges play well with multicasting
if_bridge_property 'mcast_querier' "$BRIDGE"
if_bridge_property 'mcast_mld_version' "$BRIDGE" '2' ''
IFACE="phys2-42"
if_linkdepend "$IFACE" "${IFACE%-*}"
if_slave "$BRIDGE" "$IFACE"
new_if_vlan "$IFACE"
IFACE="phys4-42"
if_linkdepend "$IFACE" "${IFACE%-*}"
if_slave "$BRIDGE" "$IFACE"
new_if_vlan "$IFACE"
IFACE="phys5-42"
if_linkdepend "$IFACE" "${IFACE%-*}"
if_slave "$BRIDGE" "$IFACE"
new_if_vlan "$IFACE"
@ -84,6 +95,17 @@ new_if_vrf "$VRF" 10
new_if_phys "$IFACE"
IFACE="phys2-66"
if_linkdepend "$IFACE" "${IFACE%-*}"
if_slave "$BRIDGE" "$IFACE"
new_if_vlan "$IFACE"
IFACE="phys4-66"
if_linkdepend "$IFACE" "${IFACE%-*}"
if_slave "$BRIDGE" "$IFACE"
new_if_vlan "$IFACE"
IFACE="phys5-66"
if_linkdepend "$IFACE" "${IFACE%-*}"
if_slave "$BRIDGE" "$IFACE"
new_if_vlan "$IFACE"
@ -102,6 +124,16 @@ new_if_vrf "$VRF" 10
if_slave "$BRIDGE" "$IFACE"
new_if_phys "$IFACE"
IFACE="phys4-100"
if_linkdepend "$IFACE" "${IFACE%-*}"
if_slave "$BRIDGE" "$IFACE"
new_if_vlan "$IFACE"
IFACE="phys5-100"
if_linkdepend "$IFACE" "${IFACE%-*}"
if_slave "$BRIDGE" "$IFACE"
new_if_vlan "$IFACE"
BRIDGE="d00d"
if_slave "$VRF" "$BRIDGE"
new_if_bridge "$BRIDGE"
@ -117,6 +149,16 @@ new_if_vrf "$VRF" 10
if_slave "$BRIDGE" "$IFACE"
new_if_phys "$IFACE"
IFACE="phys4-101"
if_linkdepend "$IFACE" "${IFACE%-*}"
if_slave "$BRIDGE" "$IFACE"
new_if_vlan "$IFACE"
IFACE="phys5-101"
if_linkdepend "$IFACE" "${IFACE%-*}"
if_slave "$BRIDGE" "$IFACE"
new_if_vlan "$IFACE"
# NO-vrf
BRIDGE="home"
@ -140,3 +182,11 @@ new_if_bridge "$BRIDGE"
IFACE="phys3"
if_slave "$BRIDGE" "$IFACE"
new_if_phys "$IFACE"
IFACE="phys4"
if_slave "$BRIDGE" "$IFACE"
new_if_phys "$IFACE"
IFACE="phys5"
if_slave "$BRIDGE" "$IFACE"
new_if_phys "$IFACE"

View File

@ -1,6 +1,6 @@
#!/bin/sh
. "$(dirname -- "$0")/netdev.sh"
. "$(dirname -- "$0")/../netdev.sh"
# VRFs
VRF="vrf-wgate"
@ -36,6 +36,13 @@ new_if_vrf "$VRF" 20
if_ip_addr "$IFACE" "fe80::1/64"
if_route_vrf_addr "$VRF" "$IFACE" "2a04:5b81:2010::/48"
IFACE="tristan-travel"
if_slave "$VRF" "$IFACE"
new_if_wg "$IFACE"
if_forward "$IFACE"
if_ip_addr "$IFACE" "fe80::1/64"
if_route_vrf_addr "$VRF" "$IFACE" "2a04:5b81:201f::/48"
IFACE="gustav"
if_slave "$VRF" "$IFACE"
new_if_wg "$IFACE"

33
hosts/tarui.japan.sh Executable file
View File

@ -0,0 +1,33 @@
#!/bin/sh
. "$(dirname -- "$0")/../netdev.sh"
# Bridges
BRIDGE="br-v6"
new_if_bridge "$BRIDGE"
if_bridge_property 'stp_state' "$BRIDGE"
if_bridge_property 'mcast_router' "$BRIDGE"
if_bridge_property 'mcast_snooping' "$BRIDGE" '0' '' # TODO: Remove such entries when bridges play well with multicasting
if_bridge_property 'mcast_querier' "$BRIDGE"
if_bridge_property 'mcast_mld_version' "$BRIDGE" '2' ''
BRIDGE="home"
new_if_bridge "$BRIDGE"
if_bridge_property 'stp_state' "$BRIDGE"
if_bridge_property 'mcast_router' "$BRIDGE"
if_bridge_property 'mcast_snooping' "$BRIDGE" '0' '' # TODO: Remove such entries when bridges play well with multicasting
if_bridge_property 'mcast_querier' "$BRIDGE"
if_bridge_property 'mcast_mld_version' "$BRIDGE" '2' ''
if_dhcp "$BRIDGE"
IFACE="shared"
if_slave "$BRIDGE" "$IFACE"
new_if_phys "$IFACE"
# Wireguard
IFACE="wg-tunnel"
new_if_wg "$IFACE"
if_ip_addr "$IFACE" "172.22.12.5/32"
if_ip_addr "$IFACE" "fd42:42:42::2:5/128"
if_route_addr "$IFACE" "172.22.12.0/24"
if_route_addr "$IFACE" "fd42:42:42::2:0/120"

126
hosts/thetford-mines.canada.sh Executable file
View File

@ -0,0 +1,126 @@
#!/bin/sh
. "$(dirname -- "$0")/../netdev.sh"
VRF="vrf-dn42"
new_if_vrf "$VRF" 20
if_route_vrf_default_unreach "$VRF"
BRIDGE="br-dn42"
if_slave "$VRF" "$BRIDGE"
new_if_bridge "$BRIDGE"
if_bridge_property 'stp_state' "$BRIDGE"
if_bridge_property 'mcast_router' "$BRIDGE"
if_bridge_property 'mcast_snooping' "$BRIDGE" '0' '' # TODO: Remove such entries when bridges play well with multicasting
if_bridge_property 'mcast_querier' "$BRIDGE"
if_bridge_property 'mcast_mld_version' "$BRIDGE" '2' ''
IFACE="vnet4"
if_slave "$BRIDGE" "$IFACE"
new_if_phys "$IFACE"
IFACE="phys0-42"
if_linkdepend "$IFACE" "${IFACE%-*}"
if_slave "$BRIDGE" "$IFACE"
new_if_vlan "$IFACE"
IFACE="phys1-42"
if_linkdepend "$IFACE" "${IFACE%-*}"
if_slave "$BRIDGE" "$IFACE"
new_if_vlan "$IFACE"
VRF="vrf-v6"
new_if_vrf "$VRF" 10
if_route_vrf_default_unreach "$VRF"
BRIDGE="b00b"
if_slave "$VRF" "$BRIDGE"
new_if_bridge "$BRIDGE"
if_bridge_property 'stp_state' "$BRIDGE"
if_bridge_property 'mcast_router' "$BRIDGE"
if_bridge_property 'mcast_snooping' "$BRIDGE" '0' '' # TODO: Remove such entries when bridges play well with multicasting
if_bridge_property 'mcast_querier' "$BRIDGE"
if_bridge_property 'mcast_mld_version' "$BRIDGE" '2' ''
IFACE="vnet0"
if_slave "$BRIDGE" "$IFACE"
new_if_phys "$IFACE"
IFACE="phys0-66"
if_linkdepend "$IFACE" "${IFACE%-*}"
if_slave "$BRIDGE" "$IFACE"
new_if_vlan "$IFACE"
IFACE="phys1-66"
if_linkdepend "$IFACE" "${IFACE%-*}"
if_slave "$BRIDGE" "$IFACE"
new_if_vlan "$IFACE"
BRIDGE="f33d"
if_slave "$VRF" "$BRIDGE"
new_if_bridge "$BRIDGE"
if_bridge_property 'stp_state' "$BRIDGE"
if_bridge_property 'mcast_router' "$BRIDGE"
if_bridge_property 'mcast_snooping' "$BRIDGE" '0' '' # TODO: Remove such entries when bridges play well with multicasting
if_bridge_property 'mcast_querier' "$BRIDGE"
if_bridge_property 'mcast_mld_version' "$BRIDGE" '2' ''
IFACE="vnet3"
if_slave "$BRIDGE" "$IFACE"
new_if_phys "$IFACE"
IFACE="phys0-100"
if_linkdepend "$IFACE" "${IFACE%-*}"
if_slave "$BRIDGE" "$IFACE"
new_if_vlan "$IFACE"
IFACE="phys1-100"
if_linkdepend "$IFACE" "${IFACE%-*}"
if_slave "$BRIDGE" "$IFACE"
new_if_vlan "$IFACE"
BRIDGE="d00d"
if_slave "$VRF" "$BRIDGE"
new_if_bridge "$BRIDGE"
if_bridge_property 'stp_state' "$BRIDGE"
if_bridge_property 'mcast_router' "$BRIDGE"
if_bridge_property 'mcast_snooping' "$BRIDGE" '0' '' # TODO: Remove such entries when bridges play well with multicasting
if_bridge_property 'mcast_querier' "$BRIDGE"
if_bridge_property 'mcast_mld_version' "$BRIDGE" '2' ''
IFACE="vnet2"
if_slave "$BRIDGE" "$IFACE"
new_if_phys "$IFACE"
IFACE="phys0-101"
if_linkdepend "$IFACE" "${IFACE%-*}"
if_slave "$BRIDGE" "$IFACE"
new_if_vlan "$IFACE"
IFACE="phys1-101"
if_linkdepend "$IFACE" "${IFACE%-*}"
if_slave "$BRIDGE" "$IFACE"
new_if_vlan "$IFACE"
BRIDGE="home"
new_if_bridge "$BRIDGE"
if_bridge_property 'stp_state' "$BRIDGE"
if_ether_address "$BRIDGE" '52:54:00:81:cb:62'
if_bridge_property 'mcast_router' "$BRIDGE"
if_bridge_property 'mcast_snooping' "$BRIDGE" '0' '' # TODO: Remove such entries when bridges play well with multicasting
if_bridge_property 'mcast_querier' "$BRIDGE"
if_bridge_property 'mcast_mld_version' "$BRIDGE" '2' ''
if_dhcp "$BRIDGE"
if_forward "$BRIDGE"
IFACE="vnet1"
if_slave "$BRIDGE" "$IFACE"
new_if_phys "$IFACE"
IFACE="phys0"
if_slave "$BRIDGE" "$IFACE"
new_if_phys "$IFACE"
IFACE="phys1"
if_slave "$BRIDGE" "$IFACE"
new_if_phys "$IFACE"

View File

@ -1,34 +0,0 @@
#!/bin/sh
. "$(dirname -- "$0")/netdev.sh"
# Physical
new_if_phys "phys0"
new_if_phys "phys1"
new_if_phys "phys2"
new_if_phys "phys3"
new_if_phys "phys4"
new_if_phys "phys5"
# Bridges
IFACE="br-v6"
new_if_bridge "$IFACE"
if_bridge_property 'stp_state' "$IFACE"
if_bridge_property 'mcast_router' "$IFACE"
if_bridge_property 'mcast_snooping' "$IFACE" '0' '' # TODO: Remove such entries when bridges play well with multicasting
if_bridge_property 'mcast_querier' "$IFACE"
if_bridge_property 'mcast_mld_version' "$IFACE" '2' ''
IFACE="br0"
new_if_bridge "$IFACE"
if_bridge_property 'stp_state' "$IFACE"
if_bridge_property 'mcast_router' "$IFACE"
if_bridge_property 'mcast_snooping' "$IFACE" '0' '' # TODO: Remove such entries when bridges play well with multicasting
if_bridge_property 'mcast_querier' "$IFACE"
if_bridge_property 'mcast_mld_version' "$IFACE" '2' ''
# Wireguard
IFACE="wg-tunnel"
new_if_wg "$IFACE"
if_ip_addr "$IFACE" "172.22.12.5/32"
if_ip_addr "$IFACE" "fd42:42:42::2:5/128"

View File

@ -157,6 +157,7 @@ bundle_stage_step_ready() {
new_link() {
local if="${1:?missing if}"
shift 1
local sname="interface.$if.link"
bundle_stage_step_ready "$if" "$sname"
@ -213,7 +214,7 @@ new_if_phys() {
) rc/"$sname"/up
install -Dm644 <(echo oneshot) rc/"$sname"/type
depends "$sname" mdevd.coldplug
depends "$sname" bundle.hw-coldplug
}
new_if_wg() {
@ -288,6 +289,26 @@ new_if_vlan() {
new_link "$if"
}
new_if_bond() {
local if="${1:?missing if}"
local sname="interface.$if.create"
bundle_stage_step_configure "$if" "$sname"
install -Dm644 <(
header_eb
header_path
header_if "$if"
echo 'ip link add name $INTERFACE type bond'
) rc/"$sname"/up
install -Dm644 <(linkdel "$if") rc/"$sname"/down
install -Dm644 <(echo oneshot) rc/"$sname"/type
depends "$sname" module.bonding interface."$parent".create
new_link "$if"
}
#
# Interface configuration and properties
#
@ -468,8 +489,9 @@ udhcpc -i \$INTERFACE -f -S
EOF
) rc/"$sname"/run
install -Dm644 <(echo longrun) rc/"$sname"/type
install -Dm644 <(echo logger.udhcpc) rc/"$sname"/producer-for
depends "$sname" interface."$if".link syslogd logger.udhcpc
depends "$sname" interface."$if".link syslogd
}
if_ip_addr() {
@ -502,11 +524,41 @@ if_ip_addr() {
depends "$sname" interface."$if".link
}
if_route_addr() {
local if="${1:?missing if}"
local addr="${2:?missing addr}"
local fam="${3:-$(addrfam "$addr")}"
local addrn="$(echo "$addr" | sed 's/\//_/g')"
local sname="interface.$if.route.$fam.$addrn"
bundle_stage_step_ready "$if" "$sname" # Interface route may be added only if it's up
install -Dm644 <(
header_eb
header_path
header_if "$if"
header_addr "$addr"
header_fam "$fam"
echo 'ip -${FAMILY} route add to $ADDR dev $INTERFACE'
) rc/"$sname"/up
install -Dm644 <(
header_eb
header_path
header_if "$if"
header_addr "$addr"
header_fam "$fam"
echo 'ip -${FAMILY} route del to $ADDR dev $INTERFACE'
) rc/"$sname"/down
install -Dm644 <(echo oneshot) rc/"$sname"/type
depends "$sname" interface."$if".link
}
if_route_vrf_addr() {
local vrf="${1:?missing vrf}"
local if="${2:?missing if}"
local addr="${3:?missing addr}"
local fam="${4:-6}"
local fam="${4:-$(addrfam "$addr")}"
local addrn="$(echo "$addr" | sed 's/\//_/g')"
local sname="interface.$if.route.$vrf.$fam.$addrn"
@ -540,7 +592,7 @@ if_route_vrf_addr_gateway() {
local if="${2:?missing if}"
local gateway="${3:?missing gw}"
local addr="${4:?missing addr}"
local fam="${5:-6}"
local fam="${5:-$(addrfam "$addr")}"
local gatewayn="$(echo "$gateway" | sed 's/\//_/g')"
local addrn="$(echo "$addr" | sed 's/\//_/g')"
@ -628,7 +680,7 @@ if_route_vrf_default_unreach() {
if_route_vrf_sink_unreach() {
local if="${1:?missing if}"
local addr="${2:?missing addr}"
local fam="${3:-6}"
local fam="${3:-$(addrfam "$addr")}"
local addrn="$(echo "$addr" | sed 's/\//_/g')"
local sname="interface.$if.route.$fam.sink.$addrn"
@ -654,3 +706,16 @@ if_route_vrf_sink_unreach() {
depends "$sname" interface."$if".create
}
#
# Misc functionality
#
if_linkdepend() {
local master="${1:?missing master}"
local slave="${2:?missing slave}"
local sname="interface.$master.link"
depends "$sname" interface."$slave".link
}