# When i try to construct tun device from supplied fd in wireguard, how to get the correct interface port number in ubuntu?



## davidmurali (Jun 29, 2022)

I was trying to create tunnel using wireguard. 
syscall.SetNonblock throws an error of "Bad file number".
May i know, how to get the interface number, which needs to passed to setNonBlock function


----------



## SirDice (Jun 30, 2022)

Ubuntu is not supported here. This is a FreeBSD forum.


----------



## davidmurali (Jun 30, 2022)

my Question is regarding wireguard.


----------



## SirDice (Jun 30, 2022)

davidmurali said:


> my Question is regarding wireguard.


Running on FreeBSD? Or on Ubuntu?


----------



## zirias@ (Jun 30, 2022)

Ok let's see what we have here:

There's "Ubuntu" and "wireguard" mentioned, but no trace of them in the question. Of course, no trace of FreeBSD either.
Then there's a very tiny snippet of "Go" code in a picture, without any context.

This question is clearly in the wrong place here. From this code snippet, I'd assume it's about programming, so it would be wrong on some generic Ubuntu forum as well. And for a programming question, _any_ context is missing, so nobody could answer it anyways.


----------



## kpedersen (Jun 30, 2022)

Besides, that function looks to take a file descriptor, not an interface number.
It makes sense because "non-blocking" is an attribute that is set on FDs.

Try looking further up the call stack.


----------

