Commit ad744b22 authored by Matthias Schiffer's avatar Matthias Schiffer Committed by David S. Miller

net: add netlink_ext_ack argument to rtnl_link_ops.changelink

Add support for extended error reporting.
Signed-off-by: default avatarMatthias Schiffer <mschiffer@universe-factory.net>
Acked-by: default avatarDavid Ahern <dsahern@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 7a3f4a18
...@@ -64,8 +64,9 @@ static int ipoib_fill_info(struct sk_buff *skb, const struct net_device *dev) ...@@ -64,8 +64,9 @@ static int ipoib_fill_info(struct sk_buff *skb, const struct net_device *dev)
return -EMSGSIZE; return -EMSGSIZE;
} }
static int ipoib_changelink(struct net_device *dev, static int ipoib_changelink(struct net_device *dev, struct nlattr *tb[],
struct nlattr *tb[], struct nlattr *data[]) struct nlattr *data[],
struct netlink_ext_ack *extack)
{ {
u16 mode, umcast; u16 mode, umcast;
int ret = 0; int ret = 0;
...@@ -134,7 +135,7 @@ static int ipoib_new_child_link(struct net *src_net, struct net_device *dev, ...@@ -134,7 +135,7 @@ static int ipoib_new_child_link(struct net *src_net, struct net_device *dev,
child_pkey, IPOIB_RTNL_CHILD); child_pkey, IPOIB_RTNL_CHILD);
if (!err && data) if (!err && data)
err = ipoib_changelink(dev, tb, data); err = ipoib_changelink(dev, tb, data, extack);
return err; return err;
} }
......
...@@ -156,8 +156,9 @@ static int bond_slave_changelink(struct net_device *bond_dev, ...@@ -156,8 +156,9 @@ static int bond_slave_changelink(struct net_device *bond_dev,
return 0; return 0;
} }
static int bond_changelink(struct net_device *bond_dev, static int bond_changelink(struct net_device *bond_dev, struct nlattr *tb[],
struct nlattr *tb[], struct nlattr *data[]) struct nlattr *data[],
struct netlink_ext_ack *extack)
{ {
struct bonding *bond = netdev_priv(bond_dev); struct bonding *bond = netdev_priv(bond_dev);
struct bond_opt_value newval; struct bond_opt_value newval;
...@@ -443,7 +444,7 @@ static int bond_newlink(struct net *src_net, struct net_device *bond_dev, ...@@ -443,7 +444,7 @@ static int bond_newlink(struct net *src_net, struct net_device *bond_dev,
{ {
int err; int err;
err = bond_changelink(bond_dev, tb, data); err = bond_changelink(bond_dev, tb, data, extack);
if (err < 0) if (err < 0)
return err; return err;
......
...@@ -1352,7 +1352,8 @@ static void cfhsi_netlink_parms(struct nlattr *data[], struct cfhsi *cfhsi) ...@@ -1352,7 +1352,8 @@ static void cfhsi_netlink_parms(struct nlattr *data[], struct cfhsi *cfhsi)
} }
static int caif_hsi_changelink(struct net_device *dev, struct nlattr *tb[], static int caif_hsi_changelink(struct net_device *dev, struct nlattr *tb[],
struct nlattr *data[]) struct nlattr *data[],
struct netlink_ext_ack *extack)
{ {
cfhsi_netlink_parms(data, netdev_priv(dev)); cfhsi_netlink_parms(data, netdev_priv(dev));
netdev_state_change(dev); netdev_state_change(dev);
......
...@@ -880,8 +880,9 @@ static int can_validate(struct nlattr *tb[], struct nlattr *data[]) ...@@ -880,8 +880,9 @@ static int can_validate(struct nlattr *tb[], struct nlattr *data[])
return 0; return 0;
} }
static int can_changelink(struct net_device *dev, static int can_changelink(struct net_device *dev, struct nlattr *tb[],
struct nlattr *tb[], struct nlattr *data[]) struct nlattr *data[],
struct netlink_ext_ack *extack)
{ {
struct can_priv *priv = netdev_priv(dev); struct can_priv *priv = netdev_priv(dev);
int err; int err;
......
...@@ -455,7 +455,8 @@ static const struct ethtool_ops ipvlan_ethtool_ops = { ...@@ -455,7 +455,8 @@ static const struct ethtool_ops ipvlan_ethtool_ops = {
}; };
static int ipvlan_nl_changelink(struct net_device *dev, static int ipvlan_nl_changelink(struct net_device *dev,
struct nlattr *tb[], struct nlattr *data[]) struct nlattr *tb[], struct nlattr *data[],
struct netlink_ext_ack *extack)
{ {
struct ipvl_dev *ipvlan = netdev_priv(dev); struct ipvl_dev *ipvlan = netdev_priv(dev);
struct ipvl_port *port = ipvlan_port_get_rtnl(ipvlan->phy_dev); struct ipvl_port *port = ipvlan_port_get_rtnl(ipvlan->phy_dev);
......
...@@ -3056,7 +3056,8 @@ static void macsec_changelink_common(struct net_device *dev, ...@@ -3056,7 +3056,8 @@ static void macsec_changelink_common(struct net_device *dev,
} }
static int macsec_changelink(struct net_device *dev, struct nlattr *tb[], static int macsec_changelink(struct net_device *dev, struct nlattr *tb[],
struct nlattr *data[]) struct nlattr *data[],
struct netlink_ext_ack *extack)
{ {
if (!data) if (!data)
return 0; return 0;
......
...@@ -1409,7 +1409,8 @@ void macvlan_dellink(struct net_device *dev, struct list_head *head) ...@@ -1409,7 +1409,8 @@ void macvlan_dellink(struct net_device *dev, struct list_head *head)
EXPORT_SYMBOL_GPL(macvlan_dellink); EXPORT_SYMBOL_GPL(macvlan_dellink);
static int macvlan_changelink(struct net_device *dev, static int macvlan_changelink(struct net_device *dev,
struct nlattr *tb[], struct nlattr *data[]) struct nlattr *tb[], struct nlattr *data[],
struct netlink_ext_ack *extack)
{ {
struct macvlan_dev *vlan = netdev_priv(dev); struct macvlan_dev *vlan = netdev_priv(dev);
enum macvlan_mode mode; enum macvlan_mode mode;
......
...@@ -3347,7 +3347,8 @@ static int vxlan_newlink(struct net *src_net, struct net_device *dev, ...@@ -3347,7 +3347,8 @@ static int vxlan_newlink(struct net *src_net, struct net_device *dev,
} }
static int vxlan_changelink(struct net_device *dev, struct nlattr *tb[], static int vxlan_changelink(struct net_device *dev, struct nlattr *tb[],
struct nlattr *data[]) struct nlattr *data[],
struct netlink_ext_ack *extack)
{ {
struct vxlan_dev *vxlan = netdev_priv(dev); struct vxlan_dev *vxlan = netdev_priv(dev);
struct vxlan_rdst *dst = &vxlan->default_dst; struct vxlan_rdst *dst = &vxlan->default_dst;
......
...@@ -72,7 +72,8 @@ struct rtnl_link_ops { ...@@ -72,7 +72,8 @@ struct rtnl_link_ops {
struct netlink_ext_ack *extack); struct netlink_ext_ack *extack);
int (*changelink)(struct net_device *dev, int (*changelink)(struct net_device *dev,
struct nlattr *tb[], struct nlattr *tb[],
struct nlattr *data[]); struct nlattr *data[],
struct netlink_ext_ack *extack);
void (*dellink)(struct net_device *dev, void (*dellink)(struct net_device *dev,
struct list_head *head); struct list_head *head);
......
...@@ -87,8 +87,9 @@ static int vlan_validate(struct nlattr *tb[], struct nlattr *data[]) ...@@ -87,8 +87,9 @@ static int vlan_validate(struct nlattr *tb[], struct nlattr *data[])
return 0; return 0;
} }
static int vlan_changelink(struct net_device *dev, static int vlan_changelink(struct net_device *dev, struct nlattr *tb[],
struct nlattr *tb[], struct nlattr *data[]) struct nlattr *data[],
struct netlink_ext_ack *extack)
{ {
struct ifla_vlan_flags *flags; struct ifla_vlan_flags *flags;
struct ifla_vlan_qos_mapping *m; struct ifla_vlan_qos_mapping *m;
...@@ -154,7 +155,7 @@ static int vlan_newlink(struct net *src_net, struct net_device *dev, ...@@ -154,7 +155,7 @@ static int vlan_newlink(struct net *src_net, struct net_device *dev,
else if (dev->mtu > max_mtu) else if (dev->mtu > max_mtu)
return -EINVAL; return -EINVAL;
err = vlan_changelink(dev, tb, data); err = vlan_changelink(dev, tb, data, extack);
if (err < 0) if (err < 0)
return err; return err;
......
...@@ -960,7 +960,8 @@ static const struct nla_policy br_policy[IFLA_BR_MAX + 1] = { ...@@ -960,7 +960,8 @@ static const struct nla_policy br_policy[IFLA_BR_MAX + 1] = {
}; };
static int br_changelink(struct net_device *brdev, struct nlattr *tb[], static int br_changelink(struct net_device *brdev, struct nlattr *tb[],
struct nlattr *data[]) struct nlattr *data[],
struct netlink_ext_ack *extack)
{ {
struct net_bridge *br = netdev_priv(brdev); struct net_bridge *br = netdev_priv(brdev);
int err; int err;
...@@ -1229,7 +1230,7 @@ static int br_dev_newlink(struct net *src_net, struct net_device *dev, ...@@ -1229,7 +1230,7 @@ static int br_dev_newlink(struct net *src_net, struct net_device *dev,
if (err) if (err)
return err; return err;
err = br_changelink(dev, tb, data); err = br_changelink(dev, tb, data, extack);
if (err) if (err)
unregister_netdevice(dev); unregister_netdevice(dev);
return err; return err;
......
...@@ -485,7 +485,8 @@ static int ipcaif_newlink(struct net *src_net, struct net_device *dev, ...@@ -485,7 +485,8 @@ static int ipcaif_newlink(struct net *src_net, struct net_device *dev,
} }
static int ipcaif_changelink(struct net_device *dev, struct nlattr *tb[], static int ipcaif_changelink(struct net_device *dev, struct nlattr *tb[],
struct nlattr *data[]) struct nlattr *data[],
struct netlink_ext_ack *extack)
{ {
struct chnl_net *caifdev; struct chnl_net *caifdev;
ASSERT_RTNL(); ASSERT_RTNL();
......
...@@ -2620,7 +2620,7 @@ static int rtnl_newlink(struct sk_buff *skb, struct nlmsghdr *nlh, ...@@ -2620,7 +2620,7 @@ static int rtnl_newlink(struct sk_buff *skb, struct nlmsghdr *nlh,
!ops->changelink) !ops->changelink)
return -EOPNOTSUPP; return -EOPNOTSUPP;
err = ops->changelink(dev, tb, data); err = ops->changelink(dev, tb, data, extack);
if (err < 0) if (err < 0)
return err; return err;
status |= DO_SETLINK_NOTIFY; status |= DO_SETLINK_NOTIFY;
......
...@@ -980,7 +980,8 @@ static int ipgre_newlink(struct net *src_net, struct net_device *dev, ...@@ -980,7 +980,8 @@ static int ipgre_newlink(struct net *src_net, struct net_device *dev,
} }
static int ipgre_changelink(struct net_device *dev, struct nlattr *tb[], static int ipgre_changelink(struct net_device *dev, struct nlattr *tb[],
struct nlattr *data[]) struct nlattr *data[],
struct netlink_ext_ack *extack)
{ {
struct ip_tunnel *t = netdev_priv(dev); struct ip_tunnel *t = netdev_priv(dev);
struct ip_tunnel_parm p; struct ip_tunnel_parm p;
......
...@@ -514,7 +514,8 @@ static int vti_newlink(struct net *src_net, struct net_device *dev, ...@@ -514,7 +514,8 @@ static int vti_newlink(struct net *src_net, struct net_device *dev,
} }
static int vti_changelink(struct net_device *dev, struct nlattr *tb[], static int vti_changelink(struct net_device *dev, struct nlattr *tb[],
struct nlattr *data[]) struct nlattr *data[],
struct netlink_ext_ack *extack)
{ {
struct ip_tunnel *t = netdev_priv(dev); struct ip_tunnel *t = netdev_priv(dev);
__u32 fwmark = t->fwmark; __u32 fwmark = t->fwmark;
......
...@@ -489,7 +489,8 @@ static int ipip_newlink(struct net *src_net, struct net_device *dev, ...@@ -489,7 +489,8 @@ static int ipip_newlink(struct net *src_net, struct net_device *dev,
} }
static int ipip_changelink(struct net_device *dev, struct nlattr *tb[], static int ipip_changelink(struct net_device *dev, struct nlattr *tb[],
struct nlattr *data[]) struct nlattr *data[],
struct netlink_ext_ack *extack)
{ {
struct ip_tunnel *t = netdev_priv(dev); struct ip_tunnel *t = netdev_priv(dev);
struct ip_tunnel_parm p; struct ip_tunnel_parm p;
......
...@@ -1404,7 +1404,8 @@ static int ip6gre_newlink(struct net *src_net, struct net_device *dev, ...@@ -1404,7 +1404,8 @@ static int ip6gre_newlink(struct net *src_net, struct net_device *dev,
} }
static int ip6gre_changelink(struct net_device *dev, struct nlattr *tb[], static int ip6gre_changelink(struct net_device *dev, struct nlattr *tb[],
struct nlattr *data[]) struct nlattr *data[],
struct netlink_ext_ack *extack)
{ {
struct ip6_tnl *t, *nt = netdev_priv(dev); struct ip6_tnl *t, *nt = netdev_priv(dev);
struct net *net = nt->net; struct net *net = nt->net;
......
...@@ -2006,7 +2006,8 @@ static int ip6_tnl_newlink(struct net *src_net, struct net_device *dev, ...@@ -2006,7 +2006,8 @@ static int ip6_tnl_newlink(struct net *src_net, struct net_device *dev,
} }
static int ip6_tnl_changelink(struct net_device *dev, struct nlattr *tb[], static int ip6_tnl_changelink(struct net_device *dev, struct nlattr *tb[],
struct nlattr *data[]) struct nlattr *data[],
struct netlink_ext_ack *extack)
{ {
struct ip6_tnl *t = netdev_priv(dev); struct ip6_tnl *t = netdev_priv(dev);
struct __ip6_tnl_parm p; struct __ip6_tnl_parm p;
......
...@@ -967,7 +967,8 @@ static void vti6_dellink(struct net_device *dev, struct list_head *head) ...@@ -967,7 +967,8 @@ static void vti6_dellink(struct net_device *dev, struct list_head *head)
} }
static int vti6_changelink(struct net_device *dev, struct nlattr *tb[], static int vti6_changelink(struct net_device *dev, struct nlattr *tb[],
struct nlattr *data[]) struct nlattr *data[],
struct netlink_ext_ack *extack)
{ {
struct ip6_tnl *t; struct ip6_tnl *t;
struct __ip6_tnl_parm p; struct __ip6_tnl_parm p;
......
...@@ -1574,7 +1574,8 @@ static int ipip6_newlink(struct net *src_net, struct net_device *dev, ...@@ -1574,7 +1574,8 @@ static int ipip6_newlink(struct net *src_net, struct net_device *dev,
} }
static int ipip6_changelink(struct net_device *dev, struct nlattr *tb[], static int ipip6_changelink(struct net_device *dev, struct nlattr *tb[],
struct nlattr *data[]) struct nlattr *data[],
struct netlink_ext_ack *extack)
{ {
struct ip_tunnel *t = netdev_priv(dev); struct ip_tunnel *t = netdev_priv(dev);
struct ip_tunnel_parm p; struct ip_tunnel_parm p;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment