aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/dev.c
diff options
context:
space:
mode:
authorPetr Machata <petrm@mellanox.com>2018-12-06 12:05:47 -0500
committerDavid S. Miller <davem@davemloft.net>2018-12-06 16:26:07 -0500
commit40c900aa1ff580afe941ff77f327f004546f0ce7 (patch)
tree1c995f3a70442b748ee8a9231f8047296ac9d7d9 /net/core/dev.c
parent263726053400b9c6671df8e87d3db9728199da13 (diff)
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>
Diffstat (limited to 'net/core/dev.c')
-rw-r--r--net/core/dev.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index 4b033af8e6cd..068b60db35ae 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1364,7 +1364,7 @@ void netdev_notify_peers(struct net_device *dev)
1364} 1364}
1365EXPORT_SYMBOL(netdev_notify_peers); 1365EXPORT_SYMBOL(netdev_notify_peers);
1366 1366
1367static int __dev_open(struct net_device *dev) 1367static int __dev_open(struct net_device *dev, struct netlink_ext_ack *extack)
1368{ 1368{
1369 const struct net_device_ops *ops = dev->netdev_ops; 1369 const struct net_device_ops *ops = dev->netdev_ops;
1370 int ret; 1370 int ret;
@@ -1380,7 +1380,7 @@ static int __dev_open(struct net_device *dev)
1380 */ 1380 */
1381 netpoll_poll_disable(dev); 1381 netpoll_poll_disable(dev);
1382 1382
1383 ret = call_netdevice_notifiers(NETDEV_PRE_UP, dev); 1383 ret = call_netdevice_notifiers_extack(NETDEV_PRE_UP, dev, extack);
1384 ret = notifier_to_errno(ret); 1384 ret = notifier_to_errno(ret);
1385 if (ret) 1385 if (ret)
1386 return ret; 1386 return ret;
@@ -1427,7 +1427,7 @@ int dev_open(struct net_device *dev, struct netlink_ext_ack *extack)
1427 if (dev->flags & IFF_UP) 1427 if (dev->flags & IFF_UP)
1428 return 0; 1428 return 0;
1429 1429
1430 ret = __dev_open(dev); 1430 ret = __dev_open(dev, extack);
1431 if (ret < 0) 1431 if (ret < 0)
1432 return ret; 1432 return ret;
1433 1433
@@ -7547,7 +7547,7 @@ int __dev_change_flags(struct net_device *dev, unsigned int flags,
7547 if (old_flags & IFF_UP) 7547 if (old_flags & IFF_UP)
7548 __dev_close(dev); 7548 __dev_close(dev);
7549 else 7549 else
7550 ret = __dev_open(dev); 7550 ret = __dev_open(dev, extack);
7551 } 7551 }
7552 7552
7553 if ((flags ^ dev->gflags) & IFF_PROMISC) { 7553 if ((flags ^ dev->gflags) & IFF_PROMISC) {