netdev/carrier: check the IF stautus before carrier
Signed-off-by: chao.an <anchao@xiaomi.com>
This commit is contained in:
parent
43497df78b
commit
252985fc1d
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user