WireGuard / wgctrl-go

Package wgctrl enables control of WireGuard interfaces on multiple platforms.
https://godoc.org/golang.zx2c4.com/wireguard/wgctrl
MIT License
727 stars 85 forks source link

internal/wglinux: send and receive NLA_F_NESTED as appropriate for ne… #69

Closed mdlayher closed 4 years ago

mdlayher commented 4 years ago

…w kernels

This seems to work on both pre-5.2 and 5.2+ kernels on my machines.

Fixes #64.

mdlayher commented 4 years ago
root@wgdebug:~/wgctrl-go# sudo wg show
interface: wg0
root@wgdebug:~/wgctrl-go# uname -a
Linux wgdebug 5.2.0-050200-generic #201907231526 SMP Tue Jul 23 15:29:02 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
root@wgdebug:~/wgctrl-go# WGCTRL_INTEGRATION=yesreallydoit /usr/local/go/bin/go test -v -run TestIntegration .
=== RUN   TestIntegrationClient
=== RUN   TestIntegrationClient/get
=== RUN   TestIntegrationClient/get/wg0
=== RUN   TestIntegrationClient/configure
=== RUN   TestIntegrationClient/configure/wg0
=== RUN   TestIntegrationClient/configure_many_IPs
=== RUN   TestIntegrationClient/configure_many_IPs/wg0
=== RUN   TestIntegrationClient/configure_many_peers
=== RUN   TestIntegrationClient/configure_many_peers/wg0
=== RUN   TestIntegrationClient/reset
=== RUN   TestIntegrationClient/reset/wg0
--- PASS: TestIntegrationClient (4.29s)
    --- PASS: TestIntegrationClient/get (0.02s)
        --- PASS: TestIntegrationClient/get/wg0 (0.02s)
            client_integration_test.go:125: device: wg0: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
    --- PASS: TestIntegrationClient/configure (0.03s)
        --- PASS: TestIntegrationClient/configure/wg0 (0.03s)
            client_integration_test.go:149: before: wg0: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
            client_integration_test.go:195:  after: wg0: KVR5iSx7XK2SIDYKH0eq1qU62MznUwHH3Isk3+CaL30=
                - peer: RRKOoIsYB/vG+zL3CWfyoJ+vCAvWisHe59pnEK0KTRU=, IPs: 192.0.2.0/32, 2001:db8::/128

    --- PASS: TestIntegrationClient/configure_many_IPs (0.04s)
        --- PASS: TestIntegrationClient/configure_many_IPs/wg0 (0.04s)
            client_integration_test.go:255: device: wg0: 1022 IPs
    --- PASS: TestIntegrationClient/configure_many_peers (4.01s)
        --- PASS: TestIntegrationClient/configure_many_peers/wg0 (4.01s)
            client_integration_test.go:315: device: wg0: 256 peers, 512 IPs
    --- PASS: TestIntegrationClient/reset (0.18s)
        --- PASS: TestIntegrationClient/reset/wg0 (0.18s)
=== RUN   TestIntegrationClientIsNotExist
--- PASS: TestIntegrationClientIsNotExist (0.00s)
PASS
ok      golang.zx2c4.com/wireguard/wgctrl       4.303s