git: tun/tap: Use if_clone framework to clone from autoclone device

Aaron LI aly at crater.dragonflybsd.org
Sat Jun 27 07:11:38 PDT 2020


commit 6289934442f4e1766483d8f59459764c5cfeaea0
Author: Aaron LI <aly at aaronly.me>
Date:   Sat Jun 27 21:11:50 2020 +0800

    tun/tap: Use if_clone framework to clone from autoclone device
    
    Before this change, the clone methods from autoclone device and if_clone
    is quite different, so the allocated device unit numbers are not synced
    between them, and the default interface group is not added for the
    interfaces created via the autoclone device.
    
    For example: tinc/openvpn will open '/dev/tun' to clone a device
    '/dev/tun0' and an interface 'tun0', but the 'tun0' interface doesn't
    own the 'tun' default group.  And then, 'ifconfig tun create' will fail
    with 'SIOCIFCREATE2: File exists'.
    
    Fix the above conflicts/inconsistencies by using the same if_clone logic
    for device cloning from the autoclone device.  Now the two clone methods
    are consistent and can be mix used.
    
    Bug: https://bugs.dragonflybsd.org/issues/3230

Summary of changes:
 sys/net/tap/if_tap.c | 22 ++++++++++++++++------
 sys/net/tun/if_tun.c | 21 +++++++++++++++------
 2 files changed, 31 insertions(+), 12 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/6289934442f4e1766483d8f59459764c5cfeaea0


-- 
DragonFly BSD source repository



More information about the Commits mailing list