* 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 */
| 688 | * -1: set netmask address failed |
| 689 | */ |
| 690 | int 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. |
no outgoing calls