Here's a sample shell session: > # ifconfig | grep tap0 > # ifconfig tap create name tap0 > ifconfig: ioctl SIOCSIFNAME (set name): File exists > tap0 > # ifconfig | grep tap0 > tap0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500 FWIW, I am getting unexpected system hangs requiring hard reset when I'm destroying tap devices. I am running FreeBSD 13.0-CURRENT r351819 GENERIC amd64.
It makes some sense, actually. If you don't have any tap devices, `ifconfig tap create name tap0` would first create 'tap0', and then try to rename it to 'tap0' (which, of course, already exists at that time). There could be a check if original and new name are the same, I guess. Also, you could just create it as `ifconfig tap0 create`.
I've thrown up a review to just let the rename succeed if the name isn't changing, because I think EEXIST is perhaps misleading: https://reviews.freebsd.org/D21618 For the "system hang" -- is it just the destroy command that's hanging? Double check that `ifconfig tap0` doesn't claim "Opened by PID ...", as the controlling process needs to properly release (close) the tun/tap device before the interface can be destroyed.
A commit references this bug: Author: kevans Date: Thu Sep 12 15:36:49 UTC 2019 New revision: 352246 URL: https://svnweb.freebsd.org/changeset/base/352246 Log: SIOCSIFNAME: Do nothing if we're not actually changing Instead of throwing EEXIST, just succeed if the name isn't actually changing. We don't need to trigger departure or any of that because there's no change from consumers' perspective. PR: 240539 Reviewed by: brooks MFC after: 5 days Differential Revision: https://reviews.freebsd.org/D21618 Changes: head/sys/net/if.c
Take, add net@ to CC; will MFC to stable/11 and stable/12 in ~1 week
(In reply to Kyle Evans from comment #2) I'll keep an eye on the destroying part. I'll open a separate PR if discover something.
^Triage: Remain in progress until MFC's complete (please reference PR:'s in commit message)
A commit references this bug: Author: kevans Date: Fri Sep 20 21:27:42 UTC 2019 New revision: 352565 URL: https://svnweb.freebsd.org/changeset/base/352565 Log: MFC r352246: SIOCSIFNAME: Do nothing if we're not actually changing Instead of throwing EEXIST, just succeed if the name isn't actually changing. We don't need to trigger departure or any of that because there's no change from consumers' perspective. PR: 240539 Changes: _U stable/11/ stable/11/sys/net/if.c _U stable/12/ stable/12/sys/net/if.c
A commit references this bug: Author: kevans Date: Sat Sep 21 01:39:50 UTC 2019 New revision: 352571 URL: https://svnweb.freebsd.org/changeset/base/352571 Log: MFS r352565: SIOCSIFNAME: Do nothing if we're not actually changing Instead of throwing EEXIST, just succeed if the name isn't actually changing. We don't need to trigger departure or any of that because there's no change from consumers' perspective. PR: 240539 Approved by: re (gjb) Changes: _U releng/12.1/ releng/12.1/sys/net/if.c
Merged to stable and releng/12.1. Thanks for the report!