network/netdev: introduce netdev_can_set_mac/mtu() helper functions

Several netdevs cannot set IFLA_ADDRESS or IFLA_MTU attribute on update.
Currently, the vtable field is unused, as we do not support updating
existing netdevs. Preparation for later commits.
This commit is contained in:
Yu Watanabe
2024-10-31 01:06:25 +09:00
parent 58ada3eab2
commit 17c5337f7b
2 changed files with 33 additions and 2 deletions
+6
View File
@@ -179,6 +179,12 @@ typedef struct NetDevVTable {
/* get ifindex of the netdev. */
int (*get_ifindex)(NetDev *netdev, const char *name);
/* provides if MAC address can be set. If this is not set, assumed to be yes. */
bool (*can_set_mac)(NetDev *netdev, const struct hw_addr_data *hw_addr);
/* provides if MTU can be set. If this is not set, assumed to be yes. */
bool (*can_set_mtu)(NetDev *netdev, uint32_t mtu);
/* expected iftype, e.g. ARPHRD_ETHER. */
uint16_t iftype;