diff options
author | Brad Fitzpatrick <bradfitz@tailscale.com> | 2020-03-18 13:23:00 -0700 |
---|---|---|
committer | David Crawshaw <david@zentus.com> | 2020-04-02 15:17:05 +1100 |
commit | 40c3530006f24794ab80f100818a28ac93645d6c (patch) | |
tree | 42b7284e588241d08798469415b94d8fb792431f /tun | |
parent | 825dfdbe2406283d23e93c84358def1684edba64 (diff) | |
download | wireguard-go-40c3530006f24794ab80f100818a28ac93645d6c.tar.gz wireguard-go-40c3530006f24794ab80f100818a28ac93645d6c.zip |
tun: return a better error message if /dev/net/tun doesn't exist
It was just returning "no such file or directory" (the String of the
syscall.Errno returned by CreateTUN).
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
Diffstat (limited to 'tun')
-rw-r--r-- | tun/tun_linux.go | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/tun/tun_linux.go b/tun/tun_linux.go index 1e44b59..cc90c45 100644 --- a/tun/tun_linux.go +++ b/tun/tun_linux.go @@ -392,6 +392,9 @@ func (tun *NativeTun) Close() error { func CreateTUN(name string, mtu int) (Device, error) { nfd, err := unix.Open(cloneDevicePath, os.O_RDWR, 0) if err != nil { + if os.IsNotExist(err) { + return nil, fmt.Errorf("CreateTUN(%q) failed; tuntap %s does not exist", name, cloneDevicePath) + } return nil, err } |