]> git.ipfire.org Git - thirdparty/openvpn.git/commit
tun: properly handle device interface list
authorLev Stipakov <lev@openvpn.net>
Sun, 14 Aug 2022 21:53:03 +0000 (23:53 +0200)
committerGert Doering <gert@greenie.muc.de>
Tue, 16 Aug 2022 06:00:52 +0000 (08:00 +0200)
commit5c4fa12b0be29dcb18edac62c8c29f91f4ff59b1
tree884385f6a14a4d323577376dd9d1ae5fb71cf6e9
parentcea978bcb60a3b18be6d227466702fb14d6bc490
tun: properly handle device interface list

Device interface is a path which is used by userspace
to access device. A driver can create one or more device
interfaces and specify "reference string", so that userspace
could enumerate all device interfaces in the list and pick
the corrct one which ends with reference string.

Before our code had an assumption that either driver
creates only one device interface or the "right" interface
is alwways first in the list. As it turned out, that assumtion
does not always hold, so here we iterate through all device
interfaces in the list.

In follow-up dco-win patch we pick the device interface
from the list which ends with specific reference string.

v3: change allocation to use regular gc_malloc() instead of buffer.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
Acked-by: Antonio Quartulli <a@unstable.cc>
Message-Id: <20220814215303.305-1-lstipakov@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg24938.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
src/openvpn/tun.c
src/openvpn/tun.h