diff --git a/configuration.go b/configuration.go index 419941d..a0b2c14 100644 --- a/configuration.go +++ b/configuration.go @@ -228,8 +228,17 @@ func (t *S6SvcTree) netdevRouteTemplate(iface Iface, route Route) (up, down stri ExeclineXDGConfig(), } ) + for _, v := range []netip.Addr{route.Net.Addr(), route.Via} { + if ipv != 0 { + break + } + if v.IsValid() { + ipv = NetdevIPAddrVer(v) + } + } if ipv == 0 { - ipv = NetdevIPAddrVer(route.Net.Addr()) + // Assume IPv6 if cannot derive + ipv = 6 } svcname = append(svcname, fmt.Sprintf("%d", ipv)) diff --git a/hosts/thetford-mines.canada/main.go b/hosts/thetford-mines.canada/main.go index d529637..8470d25 100644 --- a/hosts/thetford-mines.canada/main.go +++ b/hosts/thetford-mines.canada/main.go @@ -150,6 +150,20 @@ func main() { }, }) + // Wireguard interfaces + ifs.AddIf(&s6netdev.Iface{ + Name: "vultrbgp", + Type: &s6netdev.NetdevIfTypes.Wireguard, + Addresses: []netip.Prefix{ + netip.MustParsePrefix("fe80::2/64"), + }, + Sysctls: s6netdev.Sysctl_IP{ + V6: []s6netdev.Property{ + {Key: "forwarding", Value: "1", Default: "0"}, + }, + }, + }) + for _, m := range []struct { Master string Slaves []string @@ -163,6 +177,7 @@ func main() { { Master: "vrf-v6", Slaves: []string{ + "vultrbgp", "b00b", "f33d", "d00d", @@ -230,6 +245,14 @@ func main() { Metric: 4278198272, }) + // Default router for vrf (defrtr from ra isn't installed if autoconf not enabled) + ifs["b00b"].Routes = append(ifs["b00b"].Routes, s6netdev.Route{ + Default: true, + Via: netip.MustParseAddr("fe80::ff:fe00:b00b"), // Link local of lakewood.united-states + Vrf: ifs["vrf-v6"], + Metric: 4096, + }) + for _, v := range ifs { t.Services(*v) }