]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net: Add extack to nlmsg_parse
authorDavid Ahern <dsahern@gmail.com>
Mon, 8 Oct 2018 03:16:24 +0000 (20:16 -0700)
committerDavid S. Miller <davem@davemloft.net>
Mon, 8 Oct 2018 17:39:04 +0000 (10:39 -0700)
Make sure extack is passed to nlmsg_parse where easy to do so.
Most of these are dump handlers and leveraging the extack in
the netlink_callback.

Signed-off-by: David Ahern <dsahern@gmail.com>
Acked-by: Christian Brauner <christian@brauner.io>
Signed-off-by: David S. Miller <davem@davemloft.net>
12 files changed:
net/core/devlink.c
net/core/neighbour.c
net/core/rtnetlink.c
net/ipv4/devinet.c
net/ipv6/addrconf.c
net/ipv6/route.c
net/mpls/af_mpls.c
net/netfilter/ipvs/ip_vs_ctl.c
net/sched/act_api.c
net/sched/cls_api.c
net/sched/sch_api.c
net/xfrm/xfrm_user.c

index 938f68ee92f01c1e0571e8ad6dc1afb64887cd41..6dae81d65d5c4ed958a9044278f4c3b8b9281ca4 100644 (file)
@@ -3504,7 +3504,7 @@ static int devlink_nl_cmd_region_read_dumpit(struct sk_buff *skb,
        start_offset = *((u64 *)&cb->args[0]);
 
        err = nlmsg_parse(cb->nlh, GENL_HDRLEN + devlink_nl_family.hdrsize,
-                         attrs, DEVLINK_ATTR_MAX, ops->policy, NULL);
+                         attrs, DEVLINK_ATTR_MAX, ops->policy, cb->extack);
        if (err)
                goto out;
 
index fb023df48b8301fa3976fa76e5b11cdff206f0d5..b06f794bf91e2220abe00f12e5beb595743bc0a7 100644 (file)
@@ -2445,7 +2445,8 @@ static int neigh_dump_info(struct sk_buff *skb, struct netlink_callback *cb)
            ((struct ndmsg *)nlmsg_data(nlh))->ndm_flags == NTF_PROXY)
                proxy = 1;
 
-       err = nlmsg_parse(nlh, sizeof(struct ndmsg), tb, NDA_MAX, NULL, NULL);
+       err = nlmsg_parse(nlh, sizeof(struct ndmsg), tb, NDA_MAX, NULL,
+                         cb->extack);
        if (!err) {
                if (tb[NDA_IFINDEX]) {
                        if (nla_len(tb[NDA_IFINDEX]) != sizeof(u32))
index 5564eee1e980dcbd155d4d1c2050bcc330fb66b9..4486e8b7d9d0078854b40b27b4d4f68790731eb6 100644 (file)
@@ -1909,7 +1909,7 @@ static int rtnl_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb)
                 sizeof(struct rtgenmsg) : sizeof(struct ifinfomsg);
 
        if (nlmsg_parse(cb->nlh, hdrlen, tb, IFLA_MAX,
-                       ifla_policy, NULL) >= 0) {
+                       ifla_policy, cb->extack) >= 0) {
                if (tb[IFLA_TARGET_NETNSID]) {
                        netnsid = nla_get_s32(tb[IFLA_TARGET_NETNSID]);
                        tgt_net = rtnl_get_net_ns_capable(skb->sk, netnsid);
@@ -3774,7 +3774,7 @@ static int rtnl_fdb_dump(struct sk_buff *skb, struct netlink_callback *cb)
            (nlmsg_len(cb->nlh) != sizeof(struct ndmsg) +
             nla_attr_size(sizeof(u32)))) {
                err = nlmsg_parse(cb->nlh, sizeof(struct ifinfomsg), tb,
-                                 IFLA_MAX, ifla_policy, NULL);
+                                 IFLA_MAX, ifla_policy, cb->extack);
                if (err < 0) {
                        return -EINVAL;
                } else if (err == 0) {
index 44d931a3cd50c1b56cdd1365d84c5a828a9853c3..ab2b11df5ea46688efc956255c001f47105b9e03 100644 (file)
@@ -782,7 +782,8 @@ static void set_ifa_lifetime(struct in_ifaddr *ifa, __u32 valid_lft,
 }
 
 static struct in_ifaddr *rtm_to_ifaddr(struct net *net, struct nlmsghdr *nlh,
-                                      __u32 *pvalid_lft, __u32 *pprefered_lft)
+                                      __u32 *pvalid_lft, __u32 *pprefered_lft,
+                                      struct netlink_ext_ack *extack)
 {
        struct nlattr *tb[IFA_MAX+1];
        struct in_ifaddr *ifa;
@@ -792,7 +793,7 @@ static struct in_ifaddr *rtm_to_ifaddr(struct net *net, struct nlmsghdr *nlh,
        int err;
 
        err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFA_MAX, ifa_ipv4_policy,
-                         NULL);
+                         extack);
        if (err < 0)
                goto errout;
 
@@ -897,7 +898,7 @@ static int inet_rtm_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh,
 
        ASSERT_RTNL();
 
-       ifa = rtm_to_ifaddr(net, nlh, &valid_lft, &prefered_lft);
+       ifa = rtm_to_ifaddr(net, nlh, &valid_lft, &prefered_lft, extack);
        if (IS_ERR(ifa))
                return PTR_ERR(ifa);
 
@@ -1684,7 +1685,7 @@ static int inet_dump_ifaddr(struct sk_buff *skb, struct netlink_callback *cb)
        s_ip_idx = ip_idx = cb->args[2];
 
        if (nlmsg_parse(cb->nlh, sizeof(struct ifaddrmsg), tb, IFA_MAX,
-                       ifa_ipv4_policy, NULL) >= 0) {
+                       ifa_ipv4_policy, cb->extack) >= 0) {
                if (tb[IFA_TARGET_NETNSID]) {
                        fillargs.netnsid = nla_get_s32(tb[IFA_TARGET_NETNSID]);
 
index a9a317322388632b326a40d056c7338a8c3cc328..2f8aa4fd5e55c7d2c0b7c92addf02bdda86c5251 100644 (file)
@@ -5021,7 +5021,7 @@ static int inet6_dump_addr(struct sk_buff *skb, struct netlink_callback *cb,
        s_ip_idx = ip_idx = cb->args[2];
 
        if (nlmsg_parse(cb->nlh, sizeof(struct ifaddrmsg), tb, IFA_MAX,
-                       ifa_ipv6_policy, NULL) >= 0) {
+                       ifa_ipv6_policy, cb->extack) >= 0) {
                if (tb[IFA_TARGET_NETNSID]) {
                        netnsid = nla_get_s32(tb[IFA_TARGET_NETNSID]);
 
index 74d97addf1af20dda0c2b6a2018e88696f9f7d5a..7c38e0e058aeafc065f8790e9d381c2d13b70f47 100644 (file)
@@ -4117,7 +4117,7 @@ static int rtm_to_fib6_config(struct sk_buff *skb, struct nlmsghdr *nlh,
        int err;
 
        err = nlmsg_parse(nlh, sizeof(*rtm), tb, RTA_MAX, rtm_ipv6_policy,
-                         NULL);
+                         extack);
        if (err < 0)
                goto errout;
 
index 8fbe6cdbe255d4d32b790baa22e1431d240f6e7f..55a30ee3d82033e7c2360891de56735213cb53c5 100644 (file)
@@ -1223,7 +1223,7 @@ static int mpls_netconf_get_devconf(struct sk_buff *in_skb,
        int err;
 
        err = nlmsg_parse(nlh, sizeof(*ncm), tb, NETCONFA_MAX,
-                         devconf_mpls_policy, NULL);
+                         devconf_mpls_policy, extack);
        if (err < 0)
                goto errout;
 
index 62eefea489732d6d11195e98388ded730d963283..83395bf6dc35e2a3ea486246e98de99b6e1094da 100644 (file)
@@ -3234,7 +3234,7 @@ static int ip_vs_genl_dump_dests(struct sk_buff *skb,
 
        /* Try to find the service for which to dump destinations */
        if (nlmsg_parse(cb->nlh, GENL_HDRLEN, attrs, IPVS_CMD_ATTR_MAX,
-                       ip_vs_cmd_policy, NULL))
+                       ip_vs_cmd_policy, cb->extack))
                goto out_err;
 
 
index 55153da0027862ab6354ff35bf50455109aa498a..9c1b0729aebf7146db03f534b433e6e871093ca8 100644 (file)
@@ -1452,7 +1452,7 @@ static int tc_dump_action(struct sk_buff *skb, struct netlink_callback *cb)
        u32 act_count = 0;
 
        ret = nlmsg_parse(cb->nlh, sizeof(struct tcamsg), tb, TCA_ROOT_MAX,
-                         tcaa_policy, NULL);
+                         tcaa_policy, cb->extack);
        if (ret < 0)
                return ret;
 
index d670d3066ebd6c2f3cd1220b5447f31d252d97b4..43c8559aca563bbd3b18504c7587c89e877a2779 100644 (file)
@@ -1727,7 +1727,8 @@ static int tc_dump_tfilter(struct sk_buff *skb, struct netlink_callback *cb)
        if (nlmsg_len(cb->nlh) < sizeof(*tcm))
                return skb->len;
 
-       err = nlmsg_parse(cb->nlh, sizeof(*tcm), tca, TCA_MAX, NULL, NULL);
+       err = nlmsg_parse(cb->nlh, sizeof(*tcm), tca, TCA_MAX, NULL,
+                         cb->extack);
        if (err)
                return err;
 
@@ -2054,7 +2055,8 @@ static int tc_dump_chain(struct sk_buff *skb, struct netlink_callback *cb)
        if (nlmsg_len(cb->nlh) < sizeof(*tcm))
                return skb->len;
 
-       err = nlmsg_parse(cb->nlh, sizeof(*tcm), tca, TCA_MAX, NULL, NULL);
+       err = nlmsg_parse(cb->nlh, sizeof(*tcm), tca, TCA_MAX, NULL,
+                         cb->extack);
        if (err)
                return err;
 
index da1963b19dec68d792f0059537094390ff765552..cf5c714ae786c376259a44f8de6f561e848383dc 100644 (file)
@@ -1671,7 +1671,7 @@ static int tc_dump_qdisc(struct sk_buff *skb, struct netlink_callback *cb)
        ASSERT_RTNL();
 
        err = nlmsg_parse(nlh, sizeof(struct tcmsg), tca, TCA_MAX,
-                         rtm_tca_policy, NULL);
+                         rtm_tca_policy, cb->extack);
        if (err < 0)
                return err;
 
index df7ca2dabc48881eb607089bb17a19b1bc6028b1..ca7a207b81a9587c942dd8763e4444cc5675f1ee 100644 (file)
@@ -1007,7 +1007,7 @@ static int xfrm_dump_sa(struct sk_buff *skb, struct netlink_callback *cb)
                int err;
 
                err = nlmsg_parse(cb->nlh, 0, attrs, XFRMA_MAX, xfrma_policy,
-                                 NULL);
+                                 cb->extack);
                if (err < 0)
                        return err;