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

Function netdev_set_netmask

components/net/netdev/src/netdev.c:690–709  ·  view source on GitHub ↗

* This function will set network interface device netmask address. * * @param netdev the network interface device to change * @param netmask the new netmask address * * @return 0: set netmask address successfully * -1: set netmask address failed */

Source from the content-addressed store, hash-verified

688 * -1: set netmask address failed
689 */
690int netdev_set_netmask(struct netdev *netdev, const ip_addr_t *netmask)
691{
692 RT_ASSERT(netdev);
693 RT_ASSERT(netmask);
694
695 if (!netdev->ops || !netdev->ops->set_addr_info)
696 {
697 LOG_E("The network interface device(%s) not support to set netmask address.", netdev->name);
698 return -RT_ERROR;
699 }
700
701 if (netdev_is_dhcp_enabled(netdev))
702 {
703 LOG_E("The network interface device(%s) DHCP capability is enable, not support set netmask address.", netdev->name);
704 return -RT_ERROR;
705 }
706
707 /* execute network interface device set netmask address operations */
708 return netdev->ops->set_addr_info(netdev, RT_NULL, (ip_addr_t *)netmask, RT_NULL);
709}
710
711/**
712 * This function will set network interface device gateway address.

Callers 4

sal_ioctlsocketFunction · 0.85
test_netdev_config_setFunction · 0.85
utest_tc_cleanupFunction · 0.85
netdev_set_ifFunction · 0.85

Calls

no outgoing calls

Tested by 1

test_netdev_config_setFunction · 0.68