Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .builds/openbsd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,5 @@ tasks:
GOARCH=386 go build ./...
go test -c .
doas bash -c 'WGCTRL_INTEGRATION=yesreallydoit ./wgctrl.test -test.v -test.run TestIntegration'
# TODO: re-enable once Go 1.19 is available in openbsd/latest and wireguard-go can be built
exit 0
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this change necessary? Seems unrelated to the purpose of the PR?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont remember that I've committed these changes, @mdlayher might have the answer

# Use wireguard-go for additional testing.
doas /usr/local/bin/wireguard-go tun0
6 changes: 1 addition & 5 deletions .cibuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ if [ "${KERNEL}" == "OpenBSD" ]; then
# Configure a WireGuard interface.
doas ifconfig wg0 create
doas ifconfig wg0 up

# TODO: wireguard-go only builds using Go 1.19+. However, openbsd/latest
# currently has an older version.
exit 0
fi

if [ "${KERNEL}" == "FreeBSD" ]; then
Expand All @@ -33,7 +29,7 @@ if [ "${KERNEL}" == "Linux" ]; then
fi

# Set up wireguard-go on all OSes.
git clone git://git.zx2c4.com/wireguard-go
git clone https://git.zx2c4.com/wireguard-go
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same, is this a local change you made that snuck in?

cd wireguard-go

if [ "${KERNEL}" == "Linux" ]; then
Expand Down
14 changes: 7 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ module golang.zx2c4.com/wireguard/wgctrl
go 1.20

require (
github.com/google/go-cmp v0.5.9
github.com/google/go-cmp v0.6.0
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is go.mod getting updated?

github.com/mdlayher/genetlink v1.3.2
github.com/mdlayher/netlink v1.7.2
github.com/mikioh/ipaddr v0.0.0-20190404000644-d465c8ab6721
golang.org/x/crypto v0.8.0
golang.org/x/sys v0.7.0
golang.zx2c4.com/wireguard v0.0.0-20230325221338-052af4a8072b
golang.org/x/crypto v0.31.0
golang.org/x/sys v0.28.0
golang.zx2c4.com/wireguard v0.0.0-20231211153847-12269c276173
)

require (
github.com/josharian/native v1.1.0 // indirect
github.com/mdlayher/socket v0.4.1 // indirect
golang.org/x/net v0.9.0 // indirect
golang.org/x/sync v0.1.0 // indirect
github.com/mdlayher/socket v0.5.1 // indirect
golang.org/x/net v0.33.0 // indirect
golang.org/x/sync v0.10.0 // indirect
)
28 changes: 14 additions & 14 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/josharian/native v1.1.0 h1:uuaP0hAbW7Y4l0ZRQ6C9zfb7Mg1mbFKry/xzDAfmtLA=
github.com/josharian/native v1.1.0/go.mod h1:7X/raswPFr05uY3HiLlYeyQntB6OO7E/d2Cu7qoaN2w=
github.com/mdlayher/genetlink v1.3.2 h1:KdrNKe+CTu+IbZnm/GVUMXSqBBLqcGpRDa0xkQy56gw=
github.com/mdlayher/genetlink v1.3.2/go.mod h1:tcC3pkCrPUGIKKsCsp0B3AdaaKuHtaxoJRz3cc+528o=
github.com/mdlayher/netlink v1.7.2 h1:/UtM3ofJap7Vl4QWCPDGXY8d3GIY2UGSDbK+QWmY8/g=
github.com/mdlayher/netlink v1.7.2/go.mod h1:xraEF7uJbxLhc5fpHL4cPe221LI2bdttWlU+ZGLfQSw=
github.com/mdlayher/socket v0.4.1 h1:eM9y2/jlbs1M615oshPQOHZzj6R6wMT7bX5NPiQvn2U=
github.com/mdlayher/socket v0.4.1/go.mod h1:cAqeGjoufqdxWkD7DkpyS+wcefOtmu5OQ8KuoJGIReA=
github.com/mdlayher/socket v0.5.1 h1:VZaqt6RkGkt2OE9l3GcC6nZkqD3xKeQLyfleW/uBcos=
github.com/mdlayher/socket v0.5.1/go.mod h1:TjPLHI1UgwEv5J1B5q0zTZq12A/6H7nKmtTanQE37IQ=
github.com/mikioh/ipaddr v0.0.0-20190404000644-d465c8ab6721 h1:RlZweED6sbSArvlE924+mUcZuXKLBHA35U7LN621Bws=
github.com/mikioh/ipaddr v0.0.0-20190404000644-d465c8ab6721/go.mod h1:Ickgr2WtCLZ2MDGd4Gr0geeCH5HybhRJbonOgQpvSxc=
golang.org/x/crypto v0.8.0 h1:pd9TJtTueMTVQXzk8E2XESSMQDj/U7OUu0PqJqPXQjQ=
golang.org/x/crypto v0.8.0/go.mod h1:mRqEX+O9/h5TFCrQhkgjo2yKi0yYA+9ecGkdQoHrywE=
golang.org/x/net v0.9.0 h1:aWJ/m6xSmxWBx+V0XRHTlrYrPG56jKsLdTFmsSsCzOM=
golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns=
golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU=
golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.zx2c4.com/wireguard v0.0.0-20230325221338-052af4a8072b h1:J1CaxgLerRR5lgx3wnr6L04cJFbWoceSK9JWBdglINo=
golang.zx2c4.com/wireguard v0.0.0-20230325221338-052af4a8072b/go.mod h1:tqur9LnfstdR9ep2LaJT4lFUl0EjlHtge+gAjmsHUG4=
golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U=
golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk=
golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I=
golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4=
golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ=
golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA=
golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.zx2c4.com/wireguard v0.0.0-20231211153847-12269c276173 h1:/jFs0duh4rdb8uIfPMv78iAJGcPKDeqAFnaLBropIC4=
golang.zx2c4.com/wireguard v0.0.0-20231211153847-12269c276173/go.mod h1:tkCQ4FQXmpAgYVh++1cq16/dH4QJtmvpRv19DWGAHSA=
2 changes: 1 addition & 1 deletion internal/wgfreebsd/client_freebsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ func (c *Client) ConfigureDevice(name string, cfg wgtypes.Config) error {
data := wgh.WGDataIO{
Name: dname,
Data: mem,
Size: uint64(sz),
Size: wgh.SizeT(sz),
}

if err := c.ioctlWGDataIO(wgh.SIOCSWG, &data); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion internal/wgfreebsd/internal/nv/decode.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (

// Unmarshal decodes a FreeBSD name-value list (nv(9)) to a Go map
func Unmarshal(d []byte, out List) error {
sz := C.ulong(len(d))
sz := C.size_t(len(d))
dp := unsafe.Pointer(&d[0])
nvl := C.nvlist_unpack(dp, sz, 0)

Expand Down
5 changes: 3 additions & 2 deletions internal/wgfreebsd/internal/nv/encode.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func marshal(m List) (nvl *C.struct_nvlist, err error) {
C.nvlist_add_bool(nvl, ckey, C.bool(value))

case uint64:
C.nvlist_add_number(nvl, ckey, C.ulong(value))
C.nvlist_add_number(nvl, ckey, C.uint64_t(value))

case []byte:
sz := len(value)
Expand All @@ -55,7 +55,8 @@ func marshal(m List) (nvl *C.struct_nvlist, err error) {
case []List:
sz := len(value)
buf := C.malloc(C.size_t(C.sizeof_nvlist_ptr * sz))
items := (*[1<<30 - 1]*C.struct_nvlist)(buf)
p := (**C.struct_nvlist)(buf)
items := unsafe.Slice(p, sz)

for i, val := range value {
if items[i], err = marshal(val); err != nil {
Expand Down
4 changes: 4 additions & 0 deletions internal/wgfreebsd/internal/wgh/defs.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,7 @@ type Ifgroupreq C.struct_go_ifgroupreq
type Ifgreq C.struct_ifg_req

type WGDataIO C.struct_wg_data_io

func SizeT(i int) C.size_t {
return C.size_t(i)
}
4 changes: 4 additions & 0 deletions internal/wgfreebsd/internal/wgh/defs_freebsd_386.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions internal/wgfreebsd/internal/wgh/defs_freebsd_amd64.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions internal/wgfreebsd/internal/wgh/defs_freebsd_arm.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions internal/wgfreebsd/internal/wgh/defs_freebsd_arm64.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions internal/wgopenbsd/client_openbsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,7 @@ func ioctlWGDataIO(fd int) func(*wgh.WGDataIO) error {

// ioctl is a raw wrapper for the ioctl system call.
func ioctl(fd int, req uint, arg unsafe.Pointer) error {
//lint:ignore SA1019 temporarily permitted until we switch to a libc wrapper
_, _, errno := unix.Syscall(unix.SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg))
if errno != 0 {
return os.NewSyscallError("ioctl", errno)
Expand Down