git: if_clone: Fix if_clone_destroy() with renamed cloned interface
Aaron LI
aly at crater.dragonflybsd.org
Sat Aug 4 20:59:17 PDT 2018
commit 3b1300daa841e3b20ed7417394ab6039c5f2506b
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 OBrien
<brady.obrien128 at gmail.com> for pointing out the above problem (1).
Summary of changes:
sys/net/if_clone.c | 36 +++++++++++++++---------------------
1 file changed, 15 insertions(+), 21 deletions(-)
http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/3b1300daa841e3b20ed7417394ab6039c5f2506b
--
DragonFly BSD source repository
More information about the Commits
mailing list