Re: [PATCH wireguard-go] tun: use ByteSliceToString from golang.org/x/sys/unix

2022-06-01 Thread Tobias Klauser
On 2022-06-01 at 11:33:54 +0200, Tobias Klauser wrote: > Use unix.ByteSliceToString in (*NativeTun).nameSloce to convert the ^- this should say `nameSlow` I can fix it up in a v2 patch if needed.

[PATCH wireguard-go] tun: use ByteSliceToString from golang.org/x/sys/unix

2022-06-01 Thread Tobias Klauser
Use unix.ByteSliceToString in (*NativeTun).nameSloce to convert the TUNGETIFF ioctl result []byte to a string. Signed-off-by: Tobias Klauser --- tun/tun_linux.go | 7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/tun/tun_linux.go b/tun/tun_linux.go index 89b716d9c70b

Re: [PATCH wireguard-go] tun: avoid leaking sock fd in CreateTUN error cases

2021-09-24 Thread Tobias Klauser
On 2021-09-23 at 17:54:20 +0200, Jason A. Donenfeld wrote: > Applied, thanks! I'm curious: is this a bug you ran into somewhere? I've not seen this causing problems with wireguard-go specifically, but have seen issues with leaked fds elsewhere. So by now I'm attentive of the pattern and send

Re: [PATCH wireguard-go] tun: make operateonfd.go build tags more specific

2021-09-24 Thread Tobias Klauser
On 2021-09-23 at 17:54:59 +0200, Jason A. Donenfeld wrote: > I've applied this. Thanks for the patch. Though I do wonder: it's > functionally the same as before, right? What instances lead to this > being an issue? Or did this way just seem more correct? Thanks. Functionally it's the same, yes.

[PATCH wireguard-go] tun: make operateonfd.go build tags more specific

2021-09-23 Thread Tobias Klauser
(*NativeTun).operateOnFd is only used on darwin and freebsd. Adjust the build tags accordingly. Signed-off-by: Tobias Klauser --- tun/operateonfd.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tun/operateonfd.go b/tun/operateonfd.go index aab71161f27c..bc804539169f

[PATCH wireguard-go] tun: avoid leaking sock fd in CreateTUN error cases

2021-09-23 Thread Tobias Klauser
At these points, the socket file descriptor is not yet wrapped in an *os.File, so it needs to be closed explicitly on error. Signed-off-by: Tobias Klauser --- tun/tun_darwin.go | 6 -- tun/tun_linux.go | 11 +++ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/tun

[PATCH] device: use RTMGRP_IPV4_ROUTE to specify multicast groups mask

2020-07-13 Thread Tobias Klauser
Use the RTMGRP_IPV4_ROUTE const from x/sys/unix instead of using the corresponding RTNLGRP_IPV4_ROUTE const to create the multicast groups mask. Signed-off-by: Tobias Klauser --- device/sticky_linux.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/device/sticky_linux.go b

[PATCH wireguard-go] global: use RTMGRP_* consts from x/sys/unix

2020-03-04 Thread Tobias Klauser
Update the golang.org/x/sys/unix dependency and use the newly introduced RTMGRP_* consts instead of using the corresponding RTNLGRP_* const to create a mask. Signed-off-by: Tobias Klauser --- device/conn_linux.go | 2 +- go.mod | 2 +- go.sum | 4 ++-- tun

[PATCH] global: use RTMGRP_* consts from x/sys/unix

2020-02-24 Thread Tobias Klauser
Update the golang.org/x/sys/unix dependency and use the newly introduced RTMGRP_* consts instead of using the corresponding RTNLGRP_* const to create a mask. Signed-off-by: Tobias Klauser --- device/conn_linux.go | 2 +- go.mod | 2 +- go.sum | 4 ++-- tun