netdev/carrier: check the IF stautus before carrier

Signed-off-by: chao.an <anchao@xiaomi.com>
This commit is contained in:
chao.an 2022-06-25 02:30:10 +08:00 committed by Xiang Xiao
parent 43497df78b
commit 252985fc1d

View File

@ -60,7 +60,7 @@
int netdev_carrier_on(FAR struct net_driver_s *dev)
{
if (dev)
if (dev && !IFF_IS_RUNNING(dev->d_flags))
{
dev->d_flags |= IFF_RUNNING;
netlink_device_notify(dev);
@ -87,7 +87,7 @@ int netdev_carrier_on(FAR struct net_driver_s *dev)
int netdev_carrier_off(FAR struct net_driver_s *dev)
{
if (dev)
if (dev && IFF_IS_RUNNING(dev->d_flags))
{
dev->d_flags &= ~IFF_RUNNING;
netlink_device_notify(dev);