[Bug 277435] [Feature request] Add an option to destroy the tap/tun interface when the descriptor is closed

[email protected]
Newsgroups gmane.os.freebsd.devel.net
Message-ID <[email protected]/bugzilla/>
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=277435

--- Comment #4 from Nikolay Borodin <[email protected]> ---
(In reply to Kyle Evans from comment #3)
> though you can destroy it, you just have to close it first

You can't. If you try to do this via SIOCIFDESTROY inside an application which
uses the descriptor, the application will hang, even if you do ioctl after
close(fd)

The sample code from my application:

JFUNC(void, close) {
    close(getFd(env, this));

    struct ifreq ifr;
    memset(&ifr, 0, sizeof(ifr));
    strcpy(ifr.ifr_name, "tap0");
    int sock = socket(PF_INET, SOCK_STREAM, 0);
    ioctl(sock, SIOCIFDESTROY, &ifr); // hangs
}

After that, you can only terminate the application via kill -9 <pid>.

-- 
You are receiving this mail because:
You are the assignee for the bug.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.