git: if_tap: Disallow to destroy an opened device

Aaron LI aly at crater.dragonflybsd.org
Thu Aug 30 06:41:06 PDT 2018


commit ceddbcf65305e80699502a2797f0ef944f53b3a7
Author: Aaron LI <aly at aaronly.me>
Date:   Thu Aug 30 21:13:27 2018 +0800

    if_tap: Disallow to destroy an opened device
    
    When a tap device (created via 'ifconfig') is opened, disallow to destroy
    it (e.g., ifconfig destroy).  Otherwise, a panic occurs when the caller
    closes the device, since it has been already destroyed.
    
    Test case:
    [A]% ifconfig tap0 create
    [B]% # run a program that opens '/dev/tap0' and keep it running
    [A]% ifconfig tap0 destroy
    [B]% # exit the program which will then close '/dev/tap0'
    => panic!
    
    In addition:
    * Add an assertion to tapclose() to assert the device must exist.
    * Return EINVAL instead of ENOIX when try to destroy an manually created
      tap device.
    * Improve the function description a bit.

Summary of changes:
 sys/net/tap/if_tap.c | 33 ++++++++++++++-------------------
 1 file changed, 14 insertions(+), 19 deletions(-)

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


-- 
DragonFly BSD source repository


More information about the Commits mailing list