Bring an administratively down interface up in AddAddress before writing its addresses and routes. The kernel installs an address's connected route only while its link is up, so adding a gateway to a down interface was rejected as unreachable. A link raised this way is part of the pre-change state AddAddress restores, so it is returned to down on any path that does not complete. Also fix the rollback masking its own error: deleting the address it added takes the default route with it, since that route resolved its nexthop through the address's connected subnet. The following RouteDel then answered ESRCH and was reported in place of "aborted operation due to loss of internet".
30 lines
909 B
Modula-2
30 lines
909 B
Modula-2
module github.com/grmrgecko/go-network-configurator
|
|
|
|
go 1.24.2
|
|
|
|
replace github.com/coreos/go-systemd => github.com/coreos/go-systemd/v22 v22.5.0
|
|
|
|
require (
|
|
dario.cat/mergo v1.0.2
|
|
github.com/Wifx/gonetworkmanager/v3 v3.2.0
|
|
github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf
|
|
github.com/godbus/dbus/v5 v5.1.0
|
|
github.com/kylelemons/godebug v1.1.0
|
|
github.com/prometheus-community/pro-bing v0.7.0
|
|
github.com/sirupsen/logrus v1.9.3
|
|
github.com/stretchr/testify v1.10.0
|
|
github.com/vishvananda/netlink v1.3.1
|
|
github.com/vishvananda/netns v0.0.5
|
|
golang.org/x/sys v0.37.0
|
|
golang.zx2c4.com/wireguard/windows v0.5.3
|
|
gopkg.in/ini.v1 v1.67.0
|
|
gopkg.in/yaml.v3 v3.0.1
|
|
)
|
|
|
|
require (
|
|
github.com/davecgh/go-spew v1.1.1 // indirect
|
|
github.com/google/uuid v1.6.0 // indirect
|
|
github.com/pmezard/go-difflib v1.0.0 // indirect
|
|
golang.org/x/net v0.46.0 // indirect
|
|
golang.org/x/sync v0.17.0 // indirect
|
|
)
|