Skip to content

Commit 40c900a

Browse files
pmachatadavem330
authored andcommitted
net: core: dev: Attach extack to NETDEV_PRE_UP
Drivers may need to validate configuration of a device that's about to be upped. Should the validation fail, there's currently no way to communicate details of the failure to the user, beyond an error number. To mend that, change __dev_open() to take an extack argument and pass it from __dev_change_flags() and dev_open(), where it was propagated in the previous patches. Change __dev_open() to call call_netdevice_notifiers_extack() so that the passed-in extack is attached to the NETDEV_PRE_UP notifier. Signed-off-by: Petr Machata <petrm@mellanox.com> Acked-by: Jiri Pirko <jiri@mellanox.com> Reviewed-by: Ido Schimmel <idosch@mellanox.com> Reviewed-by: David Ahern <dsahern@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 2637260 commit 40c900a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

net/core/dev.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1364,7 +1364,7 @@ void netdev_notify_peers(struct net_device *dev)
13641364
}
13651365
EXPORT_SYMBOL(netdev_notify_peers);
13661366

1367-
static int __dev_open(struct net_device *dev)
1367+
static int __dev_open(struct net_device *dev, struct netlink_ext_ack *extack)
13681368
{
13691369
const struct net_device_ops *ops = dev->netdev_ops;
13701370
int ret;
@@ -1380,7 +1380,7 @@ static int __dev_open(struct net_device *dev)
13801380
*/
13811381
netpoll_poll_disable(dev);
13821382

1383-
ret = call_netdevice_notifiers(NETDEV_PRE_UP, dev);
1383+
ret = call_netdevice_notifiers_extack(NETDEV_PRE_UP, dev, extack);
13841384
ret = notifier_to_errno(ret);
13851385
if (ret)
13861386
return ret;
@@ -1427,7 +1427,7 @@ int dev_open(struct net_device *dev, struct netlink_ext_ack *extack)
14271427
if (dev->flags & IFF_UP)
14281428
return 0;
14291429

1430-
ret = __dev_open(dev);
1430+
ret = __dev_open(dev, extack);
14311431
if (ret < 0)
14321432
return ret;
14331433

@@ -7547,7 +7547,7 @@ int __dev_change_flags(struct net_device *dev, unsigned int flags,
75477547
if (old_flags & IFF_UP)
75487548
__dev_close(dev);
75497549
else
7550-
ret = __dev_open(dev);
7550+
ret = __dev_open(dev, extack);
75517551
}
75527552

75537553
if ((flags ^ dev->gflags) & IFF_PROMISC) {

0 commit comments

Comments
 (0)