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

Function netdev_set_default

components/net/netdev/src/netdev.c:480–499  ·  view source on GitHub ↗

* This function will set default network interface device. * * @param netdev the network interface device to change */

Source from the content-addressed store, hash-verified

478 * @param netdev the network interface device to change
479 */
480void netdev_set_default(struct netdev *netdev)
481{
482 if (netdev && (netdev != netdev_default))
483 {
484 netdev_default = netdev;
485
486 /* execture the default network interface device in the current network stack */
487 if (netdev->ops && netdev->ops->set_default)
488 {
489 netdev->ops->set_default(netdev);
490 }
491
492 /* execture application netdev default change callback */
493 if (g_netdev_default_change_callback)
494 {
495 g_netdev_default_change_callback(netdev, NETDEV_CB_DEFAULT_CHANGE);
496 }
497 LOG_D("Setting default network interface device name(%s) successfully.", netdev->name);
498 }
499}
500
501/**
502 * This function will set defalut netdev change callback

Callers 7

utest_tc_initFunction · 0.85
utest_tc_cleanupFunction · 0.85
netdev_registerFunction · 0.85
netdev_unregisterFunction · 0.85

Calls

no outgoing calls

Tested by 2