MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / netdev_set_down

Function netdev_set_down

components/net/netdev/src/netdev.c:556–582  ·  view source on GitHub ↗

* This function will disable network interface device. * * @param netdev the network interface device to change * * @return 0: set status successfully * -1: set sttaus failed */

Source from the content-addressed store, hash-verified

554 * -1: set sttaus failed
555 */
556int netdev_set_down(struct netdev *netdev)
557{
558 int err;
559
560 RT_ASSERT(netdev);
561
562 if (!netdev->ops || !netdev->ops->set_down)
563 {
564 LOG_E("The network interface device(%s) not support to set status.", netdev->name);
565 return -RT_ERROR;
566 }
567
568 /* network interface device status flags check */
569 if (!netdev_is_up(netdev))
570 {
571 return RT_EOK;
572 }
573
574 /* execute disable network interface device operations by network interface driver */
575 err = netdev->ops->set_down(netdev);
576#if defined(SAL_USING_AF_NETLINK)
577 if (err)
578 rtnl_ip_notify(netdev, RTM_NEWLINK);
579#endif
580
581 return err;
582}
583
584#ifdef RT_LWIP_DHCP
585/**

Callers 2

sal_ioctlsocketFunction · 0.85
test_netdev_status_setFunction · 0.85

Calls

no outgoing calls

Tested by 1

test_netdev_status_setFunction · 0.68