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

net: add netlink_ext_ack argument to rtnl_link_ops.newlink

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 dacdbb4d
...@@ -93,7 +93,8 @@ static int ipoib_changelink(struct net_device *dev, ...@@ -93,7 +93,8 @@ static int ipoib_changelink(struct net_device *dev,
} }
static int ipoib_new_child_link(struct net *src_net, struct net_device *dev, static int ipoib_new_child_link(struct net *src_net, struct net_device *dev,
struct nlattr *tb[], struct nlattr *data[]) struct nlattr *tb[], struct nlattr *data[],
struct netlink_ext_ack *extack)
{ {
struct net_device *pdev; struct net_device *pdev;
struct ipoib_dev_priv *ppriv; struct ipoib_dev_priv *ppriv;
......
...@@ -438,7 +438,8 @@ static int bond_changelink(struct net_device *bond_dev, ...@@ -438,7 +438,8 @@ static int bond_changelink(struct net_device *bond_dev,
} }
static int bond_newlink(struct net *src_net, struct net_device *bond_dev, static int bond_newlink(struct net *src_net, struct net_device *bond_dev,
struct nlattr *tb[], struct nlattr *data[]) struct nlattr *tb[], struct nlattr *data[],
struct netlink_ext_ack *extack)
{ {
int err; int err;
......
...@@ -1399,7 +1399,8 @@ static int caif_hsi_fill_info(struct sk_buff *skb, const struct net_device *dev) ...@@ -1399,7 +1399,8 @@ static int caif_hsi_fill_info(struct sk_buff *skb, const struct net_device *dev)
} }
static int caif_hsi_newlink(struct net *src_net, struct net_device *dev, static int caif_hsi_newlink(struct net *src_net, struct net_device *dev,
struct nlattr *tb[], struct nlattr *data[]) struct nlattr *tb[], struct nlattr *data[],
struct netlink_ext_ack *extack)
{ {
struct cfhsi *cfhsi = NULL; struct cfhsi *cfhsi = NULL;
struct cfhsi_ops *(*get_ops)(void); struct cfhsi_ops *(*get_ops)(void);
......
...@@ -1146,7 +1146,8 @@ static int can_fill_xstats(struct sk_buff *skb, const struct net_device *dev) ...@@ -1146,7 +1146,8 @@ static int can_fill_xstats(struct sk_buff *skb, const struct net_device *dev)
} }
static int can_newlink(struct net *src_net, struct net_device *dev, static int can_newlink(struct net *src_net, struct net_device *dev,
struct nlattr *tb[], struct nlattr *data[]) struct nlattr *tb[], struct nlattr *data[],
struct netlink_ext_ack *extack)
{ {
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
......
...@@ -163,7 +163,8 @@ static void vxcan_setup(struct net_device *dev) ...@@ -163,7 +163,8 @@ static void vxcan_setup(struct net_device *dev)
static struct rtnl_link_ops vxcan_link_ops; static struct rtnl_link_ops vxcan_link_ops;
static int vxcan_newlink(struct net *net, struct net_device *dev, static int vxcan_newlink(struct net *net, struct net_device *dev,
struct nlattr *tb[], struct nlattr *data[]) struct nlattr *tb[], struct nlattr *data[],
struct netlink_ext_ack *extack)
{ {
struct vxcan_priv *priv; struct vxcan_priv *priv;
struct net_device *peer; struct net_device *peer;
......
...@@ -1181,7 +1181,8 @@ static void init_tnl_info(struct ip_tunnel_info *info, __u16 dst_port) ...@@ -1181,7 +1181,8 @@ static void init_tnl_info(struct ip_tunnel_info *info, __u16 dst_port)
} }
static int geneve_newlink(struct net *net, struct net_device *dev, static int geneve_newlink(struct net *net, struct net_device *dev,
struct nlattr *tb[], struct nlattr *data[]) struct nlattr *tb[], struct nlattr *data[],
struct netlink_ext_ack *extack)
{ {
bool use_udp6_rx_checksums = false; bool use_udp6_rx_checksums = false;
struct ip_tunnel_info info; struct ip_tunnel_info info;
......
...@@ -636,7 +636,8 @@ static void gtp_hashtable_free(struct gtp_dev *gtp); ...@@ -636,7 +636,8 @@ static void gtp_hashtable_free(struct gtp_dev *gtp);
static int gtp_encap_enable(struct gtp_dev *gtp, struct nlattr *data[]); static int gtp_encap_enable(struct gtp_dev *gtp, struct nlattr *data[]);
static int gtp_newlink(struct net *src_net, struct net_device *dev, static int gtp_newlink(struct net *src_net, struct net_device *dev,
struct nlattr *tb[], struct nlattr *data[]) struct nlattr *tb[], struct nlattr *data[],
struct netlink_ext_ack *extack)
{ {
struct gtp_dev *gtp; struct gtp_dev *gtp;
struct gtp_net *gn; struct gtp_net *gn;
......
...@@ -140,7 +140,8 @@ unsigned int ipvlan_nf_input(void *priv, struct sk_buff *skb, ...@@ -140,7 +140,8 @@ unsigned int ipvlan_nf_input(void *priv, struct sk_buff *skb,
void ipvlan_count_rx(const struct ipvl_dev *ipvlan, void ipvlan_count_rx(const struct ipvl_dev *ipvlan,
unsigned int len, bool success, bool mcast); unsigned int len, bool success, bool mcast);
int ipvlan_link_new(struct net *src_net, struct net_device *dev, int ipvlan_link_new(struct net *src_net, struct net_device *dev,
struct nlattr *tb[], struct nlattr *data[]); struct nlattr *tb[], struct nlattr *data[],
struct netlink_ext_ack *extack);
void ipvlan_link_delete(struct net_device *dev, struct list_head *head); void ipvlan_link_delete(struct net_device *dev, struct list_head *head);
void ipvlan_link_setup(struct net_device *dev); void ipvlan_link_setup(struct net_device *dev);
int ipvlan_link_register(struct rtnl_link_ops *ops); int ipvlan_link_register(struct rtnl_link_ops *ops);
......
...@@ -508,7 +508,8 @@ static int ipvlan_nl_fillinfo(struct sk_buff *skb, ...@@ -508,7 +508,8 @@ static int ipvlan_nl_fillinfo(struct sk_buff *skb,
} }
int ipvlan_link_new(struct net *src_net, struct net_device *dev, int ipvlan_link_new(struct net *src_net, 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; struct ipvl_port *port;
......
...@@ -73,10 +73,9 @@ static void ipvtap_update_features(struct tap_dev *tap, ...@@ -73,10 +73,9 @@ static void ipvtap_update_features(struct tap_dev *tap,
netdev_update_features(vlan->dev); netdev_update_features(vlan->dev);
} }
static int ipvtap_newlink(struct net *src_net, static int ipvtap_newlink(struct net *src_net, struct net_device *dev,
struct net_device *dev, struct nlattr *tb[], struct nlattr *data[],
struct nlattr *tb[], struct netlink_ext_ack *extack)
struct nlattr *data[])
{ {
struct ipvtap_dev *vlantap = netdev_priv(dev); struct ipvtap_dev *vlantap = netdev_priv(dev);
int err; int err;
...@@ -98,7 +97,7 @@ static int ipvtap_newlink(struct net *src_net, ...@@ -98,7 +97,7 @@ static int ipvtap_newlink(struct net *src_net,
/* Don't put anything that may fail after macvlan_common_newlink /* Don't put anything that may fail after macvlan_common_newlink
* because we can't undo what it does. * because we can't undo what it does.
*/ */
err = ipvlan_link_new(src_net, dev, tb, data); err = ipvlan_link_new(src_net, dev, tb, data, extack);
if (err) { if (err) {
netdev_rx_handler_unregister(dev); netdev_rx_handler_unregister(dev);
return err; return err;
......
...@@ -3203,7 +3203,8 @@ static int macsec_add_dev(struct net_device *dev, sci_t sci, u8 icv_len) ...@@ -3203,7 +3203,8 @@ static int macsec_add_dev(struct net_device *dev, sci_t sci, u8 icv_len)
} }
static int macsec_newlink(struct net *net, struct net_device *dev, static int macsec_newlink(struct net *net, struct net_device *dev,
struct nlattr *tb[], struct nlattr *data[]) struct nlattr *tb[], struct nlattr *data[],
struct netlink_ext_ack *extack)
{ {
struct macsec_dev *macsec = macsec_priv(dev); struct macsec_dev *macsec = macsec_priv(dev);
struct net_device *real_dev; struct net_device *real_dev;
......
...@@ -1390,7 +1390,8 @@ int macvlan_common_newlink(struct net *src_net, struct net_device *dev, ...@@ -1390,7 +1390,8 @@ int macvlan_common_newlink(struct net *src_net, struct net_device *dev,
EXPORT_SYMBOL_GPL(macvlan_common_newlink); EXPORT_SYMBOL_GPL(macvlan_common_newlink);
static int macvlan_newlink(struct net *src_net, struct net_device *dev, static int macvlan_newlink(struct net *src_net, struct net_device *dev,
struct nlattr *tb[], struct nlattr *data[]) struct nlattr *tb[], struct nlattr *data[],
struct netlink_ext_ack *extack)
{ {
return macvlan_common_newlink(src_net, dev, tb, data); return macvlan_common_newlink(src_net, dev, tb, data);
} }
......
...@@ -77,10 +77,9 @@ static void macvtap_update_features(struct tap_dev *tap, ...@@ -77,10 +77,9 @@ static void macvtap_update_features(struct tap_dev *tap,
netdev_update_features(vlan->dev); netdev_update_features(vlan->dev);
} }
static int macvtap_newlink(struct net *src_net, static int macvtap_newlink(struct net *src_net, struct net_device *dev,
struct net_device *dev, struct nlattr *tb[], struct nlattr *data[],
struct nlattr *tb[], struct netlink_ext_ack *extack)
struct nlattr *data[])
{ {
struct macvtap_dev *vlantap = netdev_priv(dev); struct macvtap_dev *vlantap = netdev_priv(dev);
int err; int err;
......
...@@ -1075,7 +1075,8 @@ static int ppp_nl_validate(struct nlattr *tb[], struct nlattr *data[]) ...@@ -1075,7 +1075,8 @@ static int ppp_nl_validate(struct nlattr *tb[], struct nlattr *data[])
} }
static int ppp_nl_newlink(struct net *src_net, struct net_device *dev, static int ppp_nl_newlink(struct net *src_net, struct net_device *dev,
struct nlattr *tb[], struct nlattr *data[]) struct nlattr *tb[], struct nlattr *data[],
struct netlink_ext_ack *extack)
{ {
struct ppp_config conf = { struct ppp_config conf = {
.unit = -1, .unit = -1,
......
...@@ -2101,7 +2101,8 @@ static void team_setup(struct net_device *dev) ...@@ -2101,7 +2101,8 @@ static void team_setup(struct net_device *dev)
} }
static int team_newlink(struct net *src_net, struct net_device *dev, static int team_newlink(struct net *src_net, struct net_device *dev,
struct nlattr *tb[], struct nlattr *data[]) struct nlattr *tb[], struct nlattr *data[],
struct netlink_ext_ack *extack)
{ {
if (tb[IFLA_ADDRESS] == NULL) if (tb[IFLA_ADDRESS] == NULL)
eth_hw_addr_random(dev); eth_hw_addr_random(dev);
......
...@@ -347,7 +347,8 @@ static int veth_validate(struct nlattr *tb[], struct nlattr *data[]) ...@@ -347,7 +347,8 @@ static int veth_validate(struct nlattr *tb[], struct nlattr *data[])
static struct rtnl_link_ops veth_link_ops; static struct rtnl_link_ops veth_link_ops;
static int veth_newlink(struct net *src_net, struct net_device *dev, static int veth_newlink(struct net *src_net, struct net_device *dev,
struct nlattr *tb[], struct nlattr *data[]) struct nlattr *tb[], struct nlattr *data[],
struct netlink_ext_ack *extack)
{ {
int err; int err;
struct net_device *peer; struct net_device *peer;
......
...@@ -1389,7 +1389,8 @@ static void vrf_dellink(struct net_device *dev, struct list_head *head) ...@@ -1389,7 +1389,8 @@ static void vrf_dellink(struct net_device *dev, struct list_head *head)
} }
static int vrf_newlink(struct net *src_net, struct net_device *dev, static int vrf_newlink(struct net *src_net, struct net_device *dev,
struct nlattr *tb[], struct nlattr *data[]) struct nlattr *tb[], struct nlattr *data[],
struct netlink_ext_ack *extack)
{ {
struct net_vrf *vrf = netdev_priv(dev); struct net_vrf *vrf = netdev_priv(dev);
bool *add_fib_rules; bool *add_fib_rules;
......
...@@ -3333,7 +3333,8 @@ static int vxlan_nl2conf(struct nlattr *tb[], struct nlattr *data[], ...@@ -3333,7 +3333,8 @@ static int vxlan_nl2conf(struct nlattr *tb[], struct nlattr *data[],
} }
static int vxlan_newlink(struct net *src_net, struct net_device *dev, static int vxlan_newlink(struct net *src_net, struct net_device *dev,
struct nlattr *tb[], struct nlattr *data[]) struct nlattr *tb[], struct nlattr *data[],
struct netlink_ext_ack *extack)
{ {
struct vxlan_config conf; struct vxlan_config conf;
int err; int err;
......
...@@ -68,7 +68,8 @@ struct rtnl_link_ops { ...@@ -68,7 +68,8 @@ struct rtnl_link_ops {
int (*newlink)(struct net *src_net, int (*newlink)(struct net *src_net,
struct net_device *dev, struct net_device *dev,
struct nlattr *tb[], struct nlattr *tb[],
struct nlattr *data[]); struct nlattr *data[],
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[]);
......
...@@ -115,7 +115,8 @@ static int vlan_changelink(struct net_device *dev, ...@@ -115,7 +115,8 @@ static int vlan_changelink(struct net_device *dev,
} }
static int vlan_newlink(struct net *src_net, struct net_device *dev, static int vlan_newlink(struct net *src_net, struct net_device *dev,
struct nlattr *tb[], struct nlattr *data[]) struct nlattr *tb[], struct nlattr *data[],
struct netlink_ext_ack *extack)
{ {
struct vlan_dev_priv *vlan = vlan_dev_priv(dev); struct vlan_dev_priv *vlan = vlan_dev_priv(dev);
struct net_device *real_dev; struct net_device *real_dev;
......
...@@ -1213,7 +1213,8 @@ static int br_changelink(struct net_device *brdev, struct nlattr *tb[], ...@@ -1213,7 +1213,8 @@ static int br_changelink(struct net_device *brdev, struct nlattr *tb[],
} }
static int br_dev_newlink(struct net *src_net, struct net_device *dev, static int br_dev_newlink(struct net *src_net, struct net_device *dev,
struct nlattr *tb[], struct nlattr *data[]) struct nlattr *tb[], struct nlattr *data[],
struct netlink_ext_ack *extack)
{ {
struct net_bridge *br = netdev_priv(dev); struct net_bridge *br = netdev_priv(dev);
int err; int err;
......
...@@ -461,7 +461,8 @@ static void caif_netlink_parms(struct nlattr *data[], ...@@ -461,7 +461,8 @@ static void caif_netlink_parms(struct nlattr *data[],
} }
static int ipcaif_newlink(struct net *src_net, struct net_device *dev, static int ipcaif_newlink(struct net *src_net, struct net_device *dev,
struct nlattr *tb[], struct nlattr *data[]) struct nlattr *tb[], struct nlattr *data[],
struct netlink_ext_ack *extack)
{ {
int ret; int ret;
struct chnl_net *caifdev; struct chnl_net *caifdev;
......
...@@ -2705,7 +2705,8 @@ static int rtnl_newlink(struct sk_buff *skb, struct nlmsghdr *nlh, ...@@ -2705,7 +2705,8 @@ static int rtnl_newlink(struct sk_buff *skb, struct nlmsghdr *nlh,
dev->ifindex = ifm->ifi_index; dev->ifindex = ifm->ifi_index;
if (ops->newlink) { if (ops->newlink) {
err = ops->newlink(link_net ? : net, dev, tb, data); err = ops->newlink(link_net ? : net, dev, tb, data,
extack);
/* Drivers should call free_netdev() in ->destructor /* Drivers should call free_netdev() in ->destructor
* and unregister it on failure after registration * and unregister it on failure after registration
* so that device could be finally freed in rtnl_unlock. * so that device could be finally freed in rtnl_unlock.
......
...@@ -33,7 +33,8 @@ static const struct nla_policy hsr_policy[IFLA_HSR_MAX + 1] = { ...@@ -33,7 +33,8 @@ static const struct nla_policy hsr_policy[IFLA_HSR_MAX + 1] = {
* hsr_dev_setup routine has been executed. Nice! * hsr_dev_setup routine has been executed. Nice!
*/ */
static int hsr_newlink(struct net *src_net, struct net_device *dev, static int hsr_newlink(struct net *src_net, struct net_device *dev,
struct nlattr *tb[], struct nlattr *data[]) struct nlattr *tb[], struct nlattr *data[],
struct netlink_ext_ack *extack)
{ {
struct net_device *link[2]; struct net_device *link[2];
unsigned char multicast_spec, hsr_version; unsigned char multicast_spec, hsr_version;
......
...@@ -121,7 +121,8 @@ static int lowpan_validate(struct nlattr *tb[], struct nlattr *data[]) ...@@ -121,7 +121,8 @@ static int lowpan_validate(struct nlattr *tb[], struct nlattr *data[])
} }
static int lowpan_newlink(struct net *src_net, struct net_device *ldev, static int lowpan_newlink(struct net *src_net, struct net_device *ldev,
struct nlattr *tb[], struct nlattr *data[]) struct nlattr *tb[], struct nlattr *data[],
struct netlink_ext_ack *extack)
{ {
struct net_device *wdev; struct net_device *wdev;
int ret; int ret;
......
...@@ -957,7 +957,8 @@ static void ipgre_tap_setup(struct net_device *dev) ...@@ -957,7 +957,8 @@ static void ipgre_tap_setup(struct net_device *dev)
} }
static int ipgre_newlink(struct net *src_net, struct net_device *dev, static int ipgre_newlink(struct net *src_net, struct net_device *dev,
struct nlattr *tb[], struct nlattr *data[]) struct nlattr *tb[], struct nlattr *data[],
struct netlink_ext_ack *extack)
{ {
struct ip_tunnel_parm p; struct ip_tunnel_parm p;
struct ip_tunnel_encap ipencap; struct ip_tunnel_encap ipencap;
...@@ -1155,7 +1156,7 @@ struct net_device *gretap_fb_dev_create(struct net *net, const char *name, ...@@ -1155,7 +1156,7 @@ struct net_device *gretap_fb_dev_create(struct net *net, const char *name,
t = netdev_priv(dev); t = netdev_priv(dev);
t->collect_md = true; t->collect_md = true;
err = ipgre_newlink(net, dev, tb, NULL); err = ipgre_newlink(net, dev, tb, NULL, NULL);
if (err < 0) { if (err < 0) {
free_netdev(dev); free_netdev(dev);
return ERR_PTR(err); return ERR_PTR(err);
......
...@@ -503,7 +503,8 @@ static void vti_netlink_parms(struct nlattr *data[], ...@@ -503,7 +503,8 @@ static void vti_netlink_parms(struct nlattr *data[],
} }
static int vti_newlink(struct net *src_net, struct net_device *dev, static int vti_newlink(struct net *src_net, struct net_device *dev,
struct nlattr *tb[], struct nlattr *data[]) struct nlattr *tb[], struct nlattr *data[],
struct netlink_ext_ack *extack)
{ {
struct ip_tunnel_parm parms; struct ip_tunnel_parm parms;
__u32 fwmark = 0; __u32 fwmark = 0;
......
...@@ -469,7 +469,8 @@ static bool ipip_netlink_encap_parms(struct nlattr *data[], ...@@ -469,7 +469,8 @@ static bool ipip_netlink_encap_parms(struct nlattr *data[],
} }
static int ipip_newlink(struct net *src_net, struct net_device *dev, static int ipip_newlink(struct net *src_net, struct net_device *dev,
struct nlattr *tb[], struct nlattr *data[]) struct nlattr *tb[], 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;
......
...@@ -1342,7 +1342,8 @@ static bool ip6gre_netlink_encap_parms(struct nlattr *data[], ...@@ -1342,7 +1342,8 @@ static bool ip6gre_netlink_encap_parms(struct nlattr *data[],
} }
static int ip6gre_newlink(struct net *src_net, struct net_device *dev, static int ip6gre_newlink(struct net *src_net, struct net_device *dev,
struct nlattr *tb[], struct nlattr *data[]) struct nlattr *tb[], struct nlattr *data[],
struct netlink_ext_ack *extack)
{ {
struct ip6_tnl *nt; struct ip6_tnl *nt;
struct net *net = dev_net(dev); struct net *net = dev_net(dev);
......
...@@ -1974,7 +1974,8 @@ static bool ip6_tnl_netlink_encap_parms(struct nlattr *data[], ...@@ -1974,7 +1974,8 @@ static bool ip6_tnl_netlink_encap_parms(struct nlattr *data[],
} }
static int ip6_tnl_newlink(struct net *src_net, struct net_device *dev, static int ip6_tnl_newlink(struct net *src_net, struct net_device *dev,
struct nlattr *tb[], struct nlattr *data[]) struct nlattr *tb[], struct nlattr *data[],
struct netlink_ext_ack *extack)
{ {
struct net *net = dev_net(dev); struct net *net = dev_net(dev);
struct ip6_tnl_net *ip6n = net_generic(net, ip6_tnl_net_id); struct ip6_tnl_net *ip6n = net_generic(net, ip6_tnl_net_id);
......
...@@ -940,7 +940,8 @@ static void vti6_netlink_parms(struct nlattr *data[], ...@@ -940,7 +940,8 @@ static void vti6_netlink_parms(struct nlattr *data[],
} }
static int vti6_newlink(struct net *src_net, struct net_device *dev, static int vti6_newlink(struct net *src_net, struct net_device *dev,
struct nlattr *tb[], struct nlattr *data[]) struct nlattr *tb[], struct nlattr *data[],
struct netlink_ext_ack *extack)
{ {
struct net *net = dev_net(dev); struct net *net = dev_net(dev);
struct ip6_tnl *nt; struct ip6_tnl *nt;
......
...@@ -1537,7 +1537,8 @@ static bool ipip6_netlink_6rd_parms(struct nlattr *data[], ...@@ -1537,7 +1537,8 @@ static bool ipip6_netlink_6rd_parms(struct nlattr *data[],
#endif #endif
static int ipip6_newlink(struct net *src_net, struct net_device *dev, static int ipip6_newlink(struct net *src_net, struct net_device *dev,
struct nlattr *tb[], struct nlattr *data[]) struct nlattr *tb[], struct nlattr *data[],
struct netlink_ext_ack *extack)
{ {
struct net *net = dev_net(dev); struct net *net = dev_net(dev);
struct ip_tunnel *nt; struct ip_tunnel *nt;
......
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