diff --git a/configuration.go b/configuration.go index e8f7c15..380cc1b 100644 --- a/configuration.go +++ b/configuration.go @@ -182,7 +182,7 @@ func (t *S6SvcTree) NetdevIfaceDHCP(iface Iface, ipv int) *S6Svc { NETDEV_EXECLINE_HEADER, ExeclineDefine("INTERFACE", iface.Name), "fdmove -c 2 1", - fmt.Sprintf("%s -i $INTERFACE -f -S", daemon), + fmt.Sprintf("%s -i $INTERFACE -f -S -R", daemon), }, "\n") l.ProducerFor = t.S6New("logger.udhcpc", &S6SvcTypes.Longrun) @@ -192,7 +192,7 @@ func (t *S6SvcTree) NetdevIfaceDHCP(iface Iface, ipv int) *S6Svc { return l } -func (t *S6SvcTree) NetdevIfaceWPASupplicant(iface Iface, ipv int) *S6Svc { +func (t *S6SvcTree) NetdevIfaceWPASupplicant(iface Iface) *S6Svc { svc_name := S6SvcName(fmt.Sprintf("interface.%s.wpa_supplicant", iface.Name)).Sanitize() l := t.S6New(svc_name, &S6SvcTypes.Longrun) @@ -205,11 +205,11 @@ func (t *S6SvcTree) NetdevIfaceWPASupplicant(iface Iface, ipv int) *S6Svc { ExeclineDefine("INTERFACE", iface.Name), ExeclineImportas("CONFIG", false, "${XDG_CONFIG_HOME}/wpa_supplicant/wpa_supplicant.conf"), "fdmove -c 2 1", - fmt.Sprintf("%s -i $INTERFACE -dd -C $CONFIG", daemon), + fmt.Sprintf("%s -i $INTERFACE -dd -c $CONFIG", daemon), }, "\n") l.ProducerFor = t.S6New("logger.wpa_supplicant", &S6SvcTypes.Longrun) - l.S6Children(t.LinkIfaceService(iface.Name)) + l.S6Children(t.LinkIfaceService(iface.Name), t.S6New("bundle.wpa_supplicant.deps", &S6SvcTypes.Bundle)) t.NetdevDependBundleStage(iface.Name, "ready", l) return l @@ -299,7 +299,11 @@ func (t *S6SvcTree) netdevRouteTemplate(iface Iface, route Route) (up, down stri cmd = append(cmd, "metric", "$METRIC") } - if route.Vrf != nil && route.Vrf.Type == &NetdevIfTypes.Vrf { + // Table overrides VRF if defined + if route.Table != 0 { + lines = append(lines, ExeclineImportas("TABLE", false, fmt.Sprintf("%d", route.Table))) + cmd = append(cmd, "table", "$TABLE") + } else if route.Vrf != nil && route.Vrf.Type == &NetdevIfTypes.Vrf { // Parent is VRF lines = append(lines, ExeclineImportas("VRF", false, route.Vrf.Name)) cmd = append(cmd, "vrf", "$VRF") diff --git a/interfaces.go b/interfaces.go index 3aadde9..03f949e 100644 --- a/interfaces.go +++ b/interfaces.go @@ -23,7 +23,7 @@ func (i *Iface) NetdevIfaceAddAddr(addr string) (err error) { return } -func (i *Iface) NetdevIfaceAddRoute(def bool, route, r_type, via string, vrf *Iface, table *RouteTable, metric Metric) (err error) { +func (i *Iface) NetdevIfaceAddRoute(def bool, route, r_type, via string, vrf *Iface, table RouteTable, metric Metric) (err error) { var ( r = Route{ Default: def, diff --git a/misc.go b/misc.go index 6dfdc29..3142ebe 100644 --- a/misc.go +++ b/misc.go @@ -9,15 +9,17 @@ import ( var ( dummy_svc_blacklist = map[S6SvcName]interface{}{ - "bundle.hw-coldplug": nil, - "module.8021q": nil, - "module.bonding": nil, - "module.bridge": nil, - "module.vrf": nil, - "module.ipv6": nil, - "module.wireguard": nil, - "mount.proc": nil, - "logger.udhcpc": nil, + "bundle.hw-coldplug": nil, + "module.8021q": nil, + "module.bonding": nil, + "module.bridge": nil, + "module.vrf": nil, + "module.ipv6": nil, + "module.wireguard": nil, + "mount.proc": nil, + "logger.udhcpc": nil, + "logger.wpa_supplicant": nil, + "bundle.wpa_supplicant.deps": nil, } ) diff --git a/services.go b/services.go index 34b5adc..cb11ac2 100644 --- a/services.go +++ b/services.go @@ -99,7 +99,7 @@ func (t *S6SvcTree) ConfigureServices(i Iface) (r []*S6Svc) { r = append(r, t.NetdevIfaceDHCP(i, 6)) } if i.WPA_Supplicant { - r = append(r, t.NetdevIfaceWpaSupplicant(i)) + r = append(r, t.NetdevIfaceWPASupplicant(i)) } for _, v := range i.Sysctls.V4 { diff --git a/types.go b/types.go index 6d8661a..e4f8e09 100644 --- a/types.go +++ b/types.go @@ -38,8 +38,8 @@ type Iface struct { Addresses []netip.Prefix // Addresses to be assigned to interface Routes []Route // Routes to be assigned to interface - DHCP DHCP_IP // Should we start dhcp on this interface? - WPA_Supplicant bool // Should we start wpa_supplicant on this interface? + DHCP DHCP_IP // Should we start dhcp on this interface? + WPA_Supplicant bool // Should we start wpa_supplicant on this interface? Properties []Property // List of properties of the interface, valid for many Sysctls Sysctl_IP // Sysctls associated with this interface @@ -53,7 +53,7 @@ type Route struct { Net netip.Prefix Via netip.Addr Vrf *Iface - Table *RouteTable + Table RouteTable Metric Metric // Should be explicitly initialised to 1024 }