git: DragonFly_RELEASE_5_2 if_clone: Fix if_clone_destroy() with renamed cloned interface

Aaron LI aly at crater.dragonflybsd.org
Sun Aug 5 01:42:36 PDT 2018


commit e2d4945959773df738afe9def357f1efda11428e
Author: Aaron LI <aly at aaronly.me>
Date:   Sat Aug 4 20:30:04 2018 +0800

    if_clone: Fix if_clone_destroy() with renamed cloned interface
    
    Since the interface can be renamed (SIOCSIFNAME), it's very wrong for
    if_clone_destroy() to determine the unit number from interface name,
    which has the following two serious problems:
    
    (1) One may only change the unit number in the interface name, then
    trying to destroy the interface will panic the system. e.g.,
    % ifconfig tap0 create
    % ifconfig tap0 name tap99999999
    % ifconfig tap99999999 destroy
    -> panic: if_clone_destroy: bit is already cleared
    
    (2) The renamed interface cannot be destroyed anymore. e.g.,
    % ifconfig tap0 create
    % ifconfig tap0 name test
    % ifconfig test destroy
    -> ifconfig: SIOCIFDESTROY: Invalid argument
    
    Fix the code to use the 'if_dunit' as the correct interface unit number.
    
    Thanks to Jason A. Donenfeld <jason at zx2c4.com> and Brady O'Brien
    <brady.obrien128 at gmail.com> for pointing out the above problem (1).

Summary of changes:
 sys/net/if_clone.c | 28 ++++++++++++----------------
 1 file changed, 12 insertions(+), 16 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/e2d4945959773df738afe9def357f1efda11428e


-- 
DragonFly BSD source repository


More information about the Commits mailing list