net/tun: Update IFF_RUNNING flag by netdev_carrier_on and netdev_carrier_off

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2021-12-21 16:32:23 +08:00 committed by Gustavo Henrique Nihei
parent 500d8541fa
commit e63e083a2f
1 changed files with 3 additions and 0 deletions

View File

@ -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 */