From fbe8dce54e434189b94686f7a7ac5ef76a29b540 Mon Sep 17 00:00:00 2001 From: Quentin McGaw Date: Fri, 23 Aug 2024 06:46:29 +0000 Subject: [PATCH] chore(deps): upgrade vishvananda/netlink from v1.2.1-beta.2 to v1.2.1 --- go.mod | 4 ++-- go.sum | 12 ++++++------ internal/netlink/rule.go | 2 +- internal/netlink/types.go | 2 +- internal/wireguard/config.go | 2 +- internal/wireguard/route.go | 6 +++--- internal/wireguard/rule.go | 6 +++--- internal/wireguard/settings.go | 2 +- 8 files changed, 18 insertions(+), 18 deletions(-) diff --git a/go.mod b/go.mod index 5e86fddbf..73b059a28 100644 --- a/go.mod +++ b/go.mod @@ -17,7 +17,7 @@ require ( github.com/qdm12/ss-server v0.6.0 github.com/stretchr/testify v1.9.0 github.com/ulikunitz/xz v0.5.11 - github.com/vishvananda/netlink v1.2.1-beta.2 + github.com/vishvananda/netlink v1.2.1 github.com/youmark/pkcs8 v0.0.0-20201027041543-1326539a0a0a golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa golang.org/x/net v0.28.0 @@ -48,7 +48,7 @@ require ( github.com/prometheus/common v0.42.0 // indirect github.com/prometheus/procfs v0.10.1 // indirect github.com/riobard/go-bloom v0.0.0-20200614022211-cdc8013cb5b3 // indirect - github.com/vishvananda/netns v0.0.0-20200728191858-db3c7e526aae // indirect + github.com/vishvananda/netns v0.0.4 // indirect golang.org/x/crypto v0.26.0 // indirect golang.org/x/mod v0.17.0 // indirect golang.org/x/sync v0.8.0 // indirect diff --git a/go.sum b/go.sum index a2604f0ca..acbfc6aeb 100644 --- a/go.sum +++ b/go.sum @@ -79,10 +79,10 @@ github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsT github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/ulikunitz/xz v0.5.11 h1:kpFauv27b6ynzBNT/Xy+1k+fK4WswhN/6PN5WhFAGw8= github.com/ulikunitz/xz v0.5.11/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= -github.com/vishvananda/netlink v1.2.1-beta.2 h1:Llsql0lnQEbHj0I1OuKyp8otXp0r3q0mPkuhwHfStVs= -github.com/vishvananda/netlink v1.2.1-beta.2/go.mod h1:twkDnbuQxJYemMlGd4JFIcuhgX83tXhKS2B/PRMpOho= -github.com/vishvananda/netns v0.0.0-20200728191858-db3c7e526aae h1:4hwBBUfQCFe3Cym0ZtKyq7L16eZUtYKs+BaHDN6mAns= -github.com/vishvananda/netns v0.0.0-20200728191858-db3c7e526aae/go.mod h1:DD4vA1DwXk04H54A1oHXtwZmA0grkVMdPxx/VGLCah0= +github.com/vishvananda/netlink v1.2.1 h1:pfLv/qlJUwOTPvtWREA7c3PI4u81YkqZw1DYhI2HmLA= +github.com/vishvananda/netlink v1.2.1/go.mod h1:i6NetklAujEcC6fK0JPjT8qSwWyO0HLn4UKG+hGqeJs= +github.com/vishvananda/netns v0.0.4 h1:Oeaw1EM2JMxD51g9uhtC0D7erkIjgmj8+JZc26m1YX8= +github.com/vishvananda/netns v0.0.4/go.mod h1:SpkAiCQRtJ6TvvxPnOSyH3BMl6unz3xZlaprSwhNNJM= github.com/youmark/pkcs8 v0.0.0-20201027041543-1326539a0a0a h1:fZHgsYlfvtyqToslyjUt3VOPF4J7aK/3MPcK7xp3PDk= github.com/youmark/pkcs8 v0.0.0-20201027041543-1326539a0a0a/go.mod h1:ul22v+Nro/R083muKhosV54bj5niojjWZvU8xrevuH4= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= @@ -108,13 +108,13 @@ golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200217220822-9197077df867/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200728102440-3e129f6d46b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= diff --git a/internal/netlink/rule.go b/internal/netlink/rule.go index df0d2928b..e52b25e76 100644 --- a/internal/netlink/rule.go +++ b/internal/netlink/rule.go @@ -12,7 +12,7 @@ func NewRule() Rule { // to a `netlink.Rule` return Rule{ Priority: -1, - Mark: -1, + Mark: 0, } } diff --git a/internal/netlink/types.go b/internal/netlink/types.go index e074a259a..19ccb9efd 100644 --- a/internal/netlink/types.go +++ b/internal/netlink/types.go @@ -36,7 +36,7 @@ type Rule struct { Priority int Family int Table int - Mark int + Mark uint32 Src netip.Prefix Dst netip.Prefix Invert bool diff --git a/internal/wireguard/config.go b/internal/wireguard/config.go index 189bb134a..735a59736 100644 --- a/internal/wireguard/config.go +++ b/internal/wireguard/config.go @@ -50,7 +50,7 @@ func makeDeviceConfig(settings Settings) (config wgtypes.Config, err error) { *persistentKeepaliveInterval = settings.PersistentKeepaliveInterval } - firewallMark := settings.FirewallMark + firewallMark := int(settings.FirewallMark) config = wgtypes.Config{ PrivateKey: &privateKey, diff --git a/internal/wireguard/route.go b/internal/wireguard/route.go index 9fcfedae0..e8e0beb51 100644 --- a/internal/wireguard/route.go +++ b/internal/wireguard/route.go @@ -9,7 +9,7 @@ import ( ) func (w *Wireguard) addRoutes(link netlink.Link, destinations []netip.Prefix, - firewallMark int) (err error) { + firewallMark uint32) (err error) { for _, dst := range destinations { err = w.addRoute(link, dst, firewallMark) if err == nil { @@ -29,11 +29,11 @@ func (w *Wireguard) addRoutes(link netlink.Link, destinations []netip.Prefix, } func (w *Wireguard) addRoute(link netlink.Link, dst netip.Prefix, - firewallMark int) (err error) { + firewallMark uint32) (err error) { route := netlink.Route{ LinkIndex: link.Index, Dst: dst, - Table: firewallMark, + Table: int(firewallMark), } err = w.netlink.RouteAdd(route) diff --git a/internal/wireguard/rule.go b/internal/wireguard/rule.go index ce977883f..79febd3c1 100644 --- a/internal/wireguard/rule.go +++ b/internal/wireguard/rule.go @@ -6,13 +6,13 @@ import ( "github.com/qdm12/gluetun/internal/netlink" ) -func (w *Wireguard) addRule(rulePriority, firewallMark, family int) ( - cleanup func() error, err error) { +func (w *Wireguard) addRule(rulePriority int, firewallMark uint32, + family int) (cleanup func() error, err error) { rule := netlink.NewRule() rule.Invert = true rule.Priority = rulePriority rule.Mark = firewallMark - rule.Table = firewallMark + rule.Table = int(firewallMark) rule.Family = family if err := w.netlink.RuleAdd(rule); err != nil { return nil, fmt.Errorf("adding rule %s: %w", rule, err) diff --git a/internal/wireguard/settings.go b/internal/wireguard/settings.go index 32d2d328e..5b0806131 100644 --- a/internal/wireguard/settings.go +++ b/internal/wireguard/settings.go @@ -35,7 +35,7 @@ type Settings struct { PersistentKeepaliveInterval time.Duration // FirewallMark to be used in routing tables and IP rules. // It defaults to 51820 if left to 0. - FirewallMark int + FirewallMark uint32 // Maximum Transmission Unit (MTU) setting for the network interface. // It defaults to device.DefaultMTU from wireguard-go which is 1420 MTU uint16