From e63e083a2f46f1dd1d83deffc045931c6b096880 Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Tue, 21 Dec 2021 16:32:23 +0800 Subject: [PATCH] net/tun: Update IFF_RUNNING flag by netdev_carrier_on and netdev_carrier_off Signed-off-by: Xiang Xiao --- drivers/net/tun.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/tun.c b/drivers/net/tun.c index 9feb370310..c83741dfc6 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c @@ -883,6 +883,7 @@ static int tun_ifup(FAR struct net_driver_s *dev) wd_start(&priv->txpoll, TUN_WDDELAY, tun_poll_expiry, (wdparm_t)priv); priv->bifup = true; + netdev_carrier_on(dev); return OK; } @@ -907,6 +908,8 @@ static int tun_ifdown(FAR struct net_driver_s *dev) FAR struct tun_device_s *priv = (FAR struct tun_device_s *)dev->d_private; irqstate_t flags; + netdev_carrier_off(dev); + flags = enter_critical_section(); /* Cancel the TX poll timer */