DragonFlyBSD/src e2d4945sys/net if_clone.c

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).
DeltaFile
+12-16sys/net/if_clone.c
+12-161 files

UnifiedSplitRaw