Message ID | 20240822093334.1687011-12-shaojijie@huawei.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | Add support of HIBMCGE Ethernet Driver | expand |
On Thu, Aug 22, 2024 at 05:33:34PM +0800, Jijie Shao wrote: > If driver implements ndo_validate_addr, > core should check the mac address before ndo_set_mac_address. > > Signed-off-by: Jijie Shao <shaojijie@huawei.com> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Andrew
diff --git a/net/core/dev.c b/net/core/dev.c index e7260889d4cb..7e9c3017e705 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -9087,6 +9087,11 @@ int dev_set_mac_address(struct net_device *dev, struct sockaddr *sa, return -EOPNOTSUPP; if (sa->sa_family != dev->type) return -EINVAL; + if (ops->ndo_validate_addr) { + err = ops->ndo_validate_addr(dev); + if (err) + return err; + } if (!netif_device_present(dev)) return -ENODEV; err = dev_pre_changeaddr_notify(dev, sa->sa_data, extack);
If driver implements ndo_validate_addr, core should check the mac address before ndo_set_mac_address. Signed-off-by: Jijie Shao <shaojijie@huawei.com> --- net/core/dev.c | 5 +++++ 1 file changed, 5 insertions(+)