rename tun device on FreeBSD
I tried using fastd on FreeBSD and it works very nicely until I start renaming the interface. It breaks with the message, that the interface name would be invalid.
Attached you can find a patch to fix that issue, which is based on the works of libifconfig and the taptun library .
If there is anything missing or not to your liking, please tell and I will see how I can fix it.
#2 Updated by Gibheer - over 1 year ago
No problem. Yesterday I finally found the time to put it into production, but hit another problem I can't seem to figure out.
In my case, I will have a couple different tunnel technologies, like openvpn and fastd for internode communication. I want to setup the tun interfaces for fastd beforehand and grant fastd access to the interfaces through the config. But at boot time, I am renaming them, so I end up with tun interfaces foo and bar. But I can't seem to find a function which can translate the interface name foo back to the device path. FreeBSD still keeps them around as /dev/tun*, which makes this kind of a problem.
If possible, I would like to add this functionality to the patch, but for now, I don't seem table to :/
The reason to setup the interfaces at boot time is, that I can't seem to add the IPs on a per peer base, as on establish is not allowed in the peer configuration. So doing the setup in /etc/rc.conf seems better for me.