]> git.baikalelectronics.ru Git - kernel.git/commit
tun: support not enabling carrier in TUNSETIFF
authorPatrick Rohr <prohr@google.com>
Tue, 20 Sep 2022 19:48:25 +0000 (12:48 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 23 Sep 2022 11:02:03 +0000 (12:02 +0100)
commit5bd8093e753e3a4fbe3fbd316fa77423e0b06e39
treeb59b33f799ab16cd2bf18fee50074a58f8e2db5b
parentf984bd0ca1d2e17400341ba007b17bb32fcb1cde
tun: support not enabling carrier in TUNSETIFF

This change adds support for not enabling carrier during TUNSETIFF
interface creation by specifying the IFF_NO_CARRIER flag.

Our tests make heavy use of tun interfaces. In some scenarios, the test
process creates the interface but another process brings it up after the
interface is discovered via netlink notification. In that case, it is
not possible to create a tun/tap interface with carrier off without it
racing against the bring up. Immediately setting carrier off via
TUNSETCARRIER is still too late.

Signed-off-by: Patrick Rohr <prohr@google.com>
Cc: Maciej Żenczykowski <maze@google.com>
Cc: Lorenzo Colitti <lorenzo@google.com>
Cc: Jason Wang <jasowang@redhat.com>
Cc: Stephen Hemminger <stephen@networkplumber.org>
Cc: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Reviewed-by: Maciej Żenczykowski <maze@google.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/tun.c
include/uapi/linux/if_tun.h