wireguard trouble

James Cook falsifian at falsifian.org
Wed Jun 9 14:36:31 PDT 2021

On Sun, Jun 06, 2021 at 07:54:30PM -0400, Justin Sherrill wrote:
> On Sun, Jun 6, 2021 at 5:20 PM James Cook <falsifian at falsifian.org> wrote:
> > Question, for anyone who knows: was there some time in the past when
> > opening /dev/tun0 would create the tun0 interface?
> >
> Going by the last note I have, it should be autocreated when opening it, so
> as of 2019, yes.  And still now?
> https://www.dragonflydigest.com/2019/08/14/23310.html

daftaupe on IRC pointed to commit f1e9a4ff which changed the behaviour.
It looks like previously /dev/tun0 through /dev/tun3 were auto-created.

Current status:

I've made a local change to wireguard-go that opens /dev/tun instead of
looking for /dev/tunX. Now there's another problem: the call to
net.InterfaceByName("tun0") in Go is returning an error "route ip+net:
no such network interface". Maybe this is related to the original
problem Aaron mentioned.

I will keep digging. So far I've tried inserting a C call to
if_nametoindex("tun0") near where net.InterfaceByName("tun0") is
called, and observed that it returns a positive number: the interface
does exist at that point. This reinforces my impression that it's the
fault of the Go net library.


More information about the Users mailing list