Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: rtnetlink: plumb extended ack to doit function

Add netlink_ext_ack arg to rtnl_doit_func. Pass extack arg to nlmsg_parse
for doit functions that call it directly.

This is the first step to using extended error reporting in rtnetlink.
>From here individual subsystems can be updated to set netlink_ext_ack as
needed.

Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

David Ahern and committed by
David S. Miller
c21ef3e3 af3b5158

+162 -99
+2 -2
drivers/net/vrf.c
··· 1282 1282 /* fib_nl_{new,del}rule handling looks for net from skb->sk */ 1283 1283 skb->sk = dev_net(dev)->rtnl; 1284 1284 if (add_it) { 1285 - err = fib_nl_newrule(skb, nlh); 1285 + err = fib_nl_newrule(skb, nlh, NULL); 1286 1286 if (err == -EEXIST) 1287 1287 err = 0; 1288 1288 } else { 1289 - err = fib_nl_delrule(skb, nlh); 1289 + err = fib_nl_delrule(skb, nlh, NULL); 1290 1290 if (err == -ENOENT) 1291 1291 err = 0; 1292 1292 }
+4 -2
include/net/fib_rules.h
··· 143 143 u32 flags); 144 144 bool fib_rule_matchall(const struct fib_rule *rule); 145 145 146 - int fib_nl_newrule(struct sk_buff *skb, struct nlmsghdr *nlh); 147 - int fib_nl_delrule(struct sk_buff *skb, struct nlmsghdr *nlh); 146 + int fib_nl_newrule(struct sk_buff *skb, struct nlmsghdr *nlh, 147 + struct netlink_ext_ack *extack); 148 + int fib_nl_delrule(struct sk_buff *skb, struct nlmsghdr *nlh, 149 + struct netlink_ext_ack *extack); 148 150 #endif
+2 -1
include/net/rtnetlink.h
··· 4 4 #include <linux/rtnetlink.h> 5 5 #include <net/netlink.h> 6 6 7 - typedef int (*rtnl_doit_func)(struct sk_buff *, struct nlmsghdr *); 7 + typedef int (*rtnl_doit_func)(struct sk_buff *, struct nlmsghdr *, 8 + struct netlink_ext_ack *); 8 9 typedef int (*rtnl_dumpit_func)(struct sk_buff *, struct netlink_callback *); 9 10 typedef u16 (*rtnl_calcit_func)(struct sk_buff *, struct nlmsghdr *); 10 11
+4 -2
net/bridge/br_mdb.c
··· 569 569 return ret; 570 570 } 571 571 572 - static int br_mdb_add(struct sk_buff *skb, struct nlmsghdr *nlh) 572 + static int br_mdb_add(struct sk_buff *skb, struct nlmsghdr *nlh, 573 + struct netlink_ext_ack *extack) 573 574 { 574 575 struct net *net = sock_net(skb->sk); 575 576 struct net_bridge_vlan_group *vg; ··· 664 663 return err; 665 664 } 666 665 667 - static int br_mdb_del(struct sk_buff *skb, struct nlmsghdr *nlh) 666 + static int br_mdb_del(struct sk_buff *skb, struct nlmsghdr *nlh, 667 + struct netlink_ext_ack *extack) 668 668 { 669 669 struct net *net = sock_net(skb->sk); 670 670 struct net_bridge_vlan_group *vg;
+4 -2
net/can/gw.c
··· 809 809 return 0; 810 810 } 811 811 812 - static int cgw_create_job(struct sk_buff *skb, struct nlmsghdr *nlh) 812 + static int cgw_create_job(struct sk_buff *skb, struct nlmsghdr *nlh, 813 + struct netlink_ext_ack *extack) 813 814 { 814 815 struct rtcanmsg *r; 815 816 struct cgw_job *gwj; ··· 922 921 } 923 922 } 924 923 925 - static int cgw_remove_job(struct sk_buff *skb, struct nlmsghdr *nlh) 924 + static int cgw_remove_job(struct sk_buff *skb, struct nlmsghdr *nlh, 925 + struct netlink_ext_ack *extack) 926 926 { 927 927 struct cgw_job *gwj = NULL; 928 928 struct hlist_node *nx;
+6 -4
net/core/fib_rules.c
··· 368 368 return 0; 369 369 } 370 370 371 - int fib_nl_newrule(struct sk_buff *skb, struct nlmsghdr *nlh) 371 + int fib_nl_newrule(struct sk_buff *skb, struct nlmsghdr *nlh, 372 + struct netlink_ext_ack *extack) 372 373 { 373 374 struct net *net = sock_net(skb->sk); 374 375 struct fib_rule_hdr *frh = nlmsg_data(nlh); ··· 387 386 goto errout; 388 387 } 389 388 390 - err = nlmsg_parse(nlh, sizeof(*frh), tb, FRA_MAX, ops->policy, NULL); 389 + err = nlmsg_parse(nlh, sizeof(*frh), tb, FRA_MAX, ops->policy, extack); 391 390 if (err < 0) 392 391 goto errout; 393 392 ··· 562 561 } 563 562 EXPORT_SYMBOL_GPL(fib_nl_newrule); 564 563 565 - int fib_nl_delrule(struct sk_buff *skb, struct nlmsghdr *nlh) 564 + int fib_nl_delrule(struct sk_buff *skb, struct nlmsghdr *nlh, 565 + struct netlink_ext_ack *extack) 566 566 { 567 567 struct net *net = sock_net(skb->sk); 568 568 struct fib_rule_hdr *frh = nlmsg_data(nlh); ··· 582 580 goto errout; 583 581 } 584 582 585 - err = nlmsg_parse(nlh, sizeof(*frh), tb, FRA_MAX, ops->policy, NULL); 583 + err = nlmsg_parse(nlh, sizeof(*frh), tb, FRA_MAX, ops->policy, extack); 586 584 if (err < 0) 587 585 goto errout; 588 586
+9 -6
net/core/neighbour.c
··· 1590 1590 return tbl; 1591 1591 } 1592 1592 1593 - static int neigh_delete(struct sk_buff *skb, struct nlmsghdr *nlh) 1593 + static int neigh_delete(struct sk_buff *skb, struct nlmsghdr *nlh, 1594 + struct netlink_ext_ack *extack) 1594 1595 { 1595 1596 struct net *net = sock_net(skb->sk); 1596 1597 struct ndmsg *ndm; ··· 1649 1648 return err; 1650 1649 } 1651 1650 1652 - static int neigh_add(struct sk_buff *skb, struct nlmsghdr *nlh) 1651 + static int neigh_add(struct sk_buff *skb, struct nlmsghdr *nlh, 1652 + struct netlink_ext_ack *extack) 1653 1653 { 1654 1654 int flags = NEIGH_UPDATE_F_ADMIN | NEIGH_UPDATE_F_OVERRIDE; 1655 1655 struct net *net = sock_net(skb->sk); ··· 1663 1661 int err; 1664 1662 1665 1663 ASSERT_RTNL(); 1666 - err = nlmsg_parse(nlh, sizeof(*ndm), tb, NDA_MAX, NULL, NULL); 1664 + err = nlmsg_parse(nlh, sizeof(*ndm), tb, NDA_MAX, NULL, extack); 1667 1665 if (err < 0) 1668 1666 goto out; 1669 1667 ··· 1938 1936 [NDTPA_LOCKTIME] = { .type = NLA_U64 }, 1939 1937 }; 1940 1938 1941 - static int neightbl_set(struct sk_buff *skb, struct nlmsghdr *nlh) 1939 + static int neightbl_set(struct sk_buff *skb, struct nlmsghdr *nlh, 1940 + struct netlink_ext_ack *extack) 1942 1941 { 1943 1942 struct net *net = sock_net(skb->sk); 1944 1943 struct neigh_table *tbl; ··· 1949 1946 int err, tidx; 1950 1947 1951 1948 err = nlmsg_parse(nlh, sizeof(*ndtmsg), tb, NDTA_MAX, 1952 - nl_neightbl_policy, NULL); 1949 + nl_neightbl_policy, extack); 1953 1950 if (err < 0) 1954 1951 goto errout; 1955 1952 ··· 1987 1984 int i, ifindex = 0; 1988 1985 1989 1986 err = nla_parse_nested(tbp, NDTPA_MAX, tb[NDTA_PARMS], 1990 - nl_ntbl_parm_policy, NULL); 1987 + nl_ntbl_parm_policy, extack); 1991 1988 if (err < 0) 1992 1989 goto errout_tbl_lock; 1993 1990
+6 -4
net/core/net_namespace.c
··· 571 571 [NETNSA_FD] = { .type = NLA_U32 }, 572 572 }; 573 573 574 - static int rtnl_net_newid(struct sk_buff *skb, struct nlmsghdr *nlh) 574 + static int rtnl_net_newid(struct sk_buff *skb, struct nlmsghdr *nlh, 575 + struct netlink_ext_ack *extack) 575 576 { 576 577 struct net *net = sock_net(skb->sk); 577 578 struct nlattr *tb[NETNSA_MAX + 1]; ··· 580 579 int nsid, err; 581 580 582 581 err = nlmsg_parse(nlh, sizeof(struct rtgenmsg), tb, NETNSA_MAX, 583 - rtnl_net_policy, NULL); 582 + rtnl_net_policy, extack); 584 583 if (err < 0) 585 584 return err; 586 585 if (!tb[NETNSA_NSID]) ··· 645 644 return -EMSGSIZE; 646 645 } 647 646 648 - static int rtnl_net_getid(struct sk_buff *skb, struct nlmsghdr *nlh) 647 + static int rtnl_net_getid(struct sk_buff *skb, struct nlmsghdr *nlh, 648 + struct netlink_ext_ack *extack) 649 649 { 650 650 struct net *net = sock_net(skb->sk); 651 651 struct nlattr *tb[NETNSA_MAX + 1]; ··· 655 653 int err, id; 656 654 657 655 err = nlmsg_parse(nlh, sizeof(struct rtgenmsg), tb, NETNSA_MAX, 658 - rtnl_net_policy, NULL); 656 + rtnl_net_policy, extack); 659 657 if (err < 0) 660 658 return err; 661 659 if (tb[NETNSA_PID])
+26 -16
net/core/rtnetlink.c
··· 2213 2213 return err; 2214 2214 } 2215 2215 2216 - static int rtnl_setlink(struct sk_buff *skb, struct nlmsghdr *nlh) 2216 + static int rtnl_setlink(struct sk_buff *skb, struct nlmsghdr *nlh, 2217 + struct netlink_ext_ack *extack) 2217 2218 { 2218 2219 struct net *net = sock_net(skb->sk); 2219 2220 struct ifinfomsg *ifm; ··· 2223 2222 struct nlattr *tb[IFLA_MAX+1]; 2224 2223 char ifname[IFNAMSIZ]; 2225 2224 2226 - err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFLA_MAX, ifla_policy, NULL); 2225 + err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFLA_MAX, ifla_policy, 2226 + extack); 2227 2227 if (err < 0) 2228 2228 goto errout; 2229 2229 ··· 2308 2306 } 2309 2307 EXPORT_SYMBOL_GPL(rtnl_delete_link); 2310 2308 2311 - static int rtnl_dellink(struct sk_buff *skb, struct nlmsghdr *nlh) 2309 + static int rtnl_dellink(struct sk_buff *skb, struct nlmsghdr *nlh, 2310 + struct netlink_ext_ack *extack) 2312 2311 { 2313 2312 struct net *net = sock_net(skb->sk); 2314 2313 struct net_device *dev; ··· 2318 2315 struct nlattr *tb[IFLA_MAX+1]; 2319 2316 int err; 2320 2317 2321 - err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFLA_MAX, ifla_policy, NULL); 2318 + err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFLA_MAX, ifla_policy, extack); 2322 2319 if (err < 0) 2323 2320 return err; 2324 2321 ··· 2429 2426 return 0; 2430 2427 } 2431 2428 2432 - static int rtnl_newlink(struct sk_buff *skb, struct nlmsghdr *nlh) 2429 + static int rtnl_newlink(struct sk_buff *skb, struct nlmsghdr *nlh, 2430 + struct netlink_ext_ack *extack) 2433 2431 { 2434 2432 struct net *net = sock_net(skb->sk); 2435 2433 const struct rtnl_link_ops *ops; ··· 2448 2444 #ifdef CONFIG_MODULES 2449 2445 replay: 2450 2446 #endif 2451 - err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFLA_MAX, ifla_policy, NULL); 2447 + err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFLA_MAX, ifla_policy, extack); 2452 2448 if (err < 0) 2453 2449 return err; 2454 2450 ··· 2682 2678 } 2683 2679 } 2684 2680 2685 - static int rtnl_getlink(struct sk_buff *skb, struct nlmsghdr* nlh) 2681 + static int rtnl_getlink(struct sk_buff *skb, struct nlmsghdr *nlh, 2682 + struct netlink_ext_ack *extack) 2686 2683 { 2687 2684 struct net *net = sock_net(skb->sk); 2688 2685 struct ifinfomsg *ifm; ··· 2694 2689 int err; 2695 2690 u32 ext_filter_mask = 0; 2696 2691 2697 - err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFLA_MAX, ifla_policy, NULL); 2692 + err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFLA_MAX, ifla_policy, extack); 2698 2693 if (err < 0) 2699 2694 return err; 2700 2695 ··· 2965 2960 return 0; 2966 2961 } 2967 2962 2968 - static int rtnl_fdb_add(struct sk_buff *skb, struct nlmsghdr *nlh) 2963 + static int rtnl_fdb_add(struct sk_buff *skb, struct nlmsghdr *nlh, 2964 + struct netlink_ext_ack *extack) 2969 2965 { 2970 2966 struct net *net = sock_net(skb->sk); 2971 2967 struct ndmsg *ndm; ··· 2976 2970 u16 vid; 2977 2971 int err; 2978 2972 2979 - err = nlmsg_parse(nlh, sizeof(*ndm), tb, NDA_MAX, NULL, NULL); 2973 + err = nlmsg_parse(nlh, sizeof(*ndm), tb, NDA_MAX, NULL, extack); 2980 2974 if (err < 0) 2981 2975 return err; 2982 2976 ··· 3066 3060 } 3067 3061 EXPORT_SYMBOL(ndo_dflt_fdb_del); 3068 3062 3069 - static int rtnl_fdb_del(struct sk_buff *skb, struct nlmsghdr *nlh) 3063 + static int rtnl_fdb_del(struct sk_buff *skb, struct nlmsghdr *nlh, 3064 + struct netlink_ext_ack *extack) 3070 3065 { 3071 3066 struct net *net = sock_net(skb->sk); 3072 3067 struct ndmsg *ndm; ··· 3080 3073 if (!netlink_capable(skb, CAP_NET_ADMIN)) 3081 3074 return -EPERM; 3082 3075 3083 - err = nlmsg_parse(nlh, sizeof(*ndm), tb, NDA_MAX, NULL, NULL); 3076 + err = nlmsg_parse(nlh, sizeof(*ndm), tb, NDA_MAX, NULL, extack); 3084 3077 if (err < 0) 3085 3078 return err; 3086 3079 ··· 3510 3503 return err; 3511 3504 } 3512 3505 3513 - static int rtnl_bridge_setlink(struct sk_buff *skb, struct nlmsghdr *nlh) 3506 + static int rtnl_bridge_setlink(struct sk_buff *skb, struct nlmsghdr *nlh, 3507 + struct netlink_ext_ack *extack) 3514 3508 { 3515 3509 struct net *net = sock_net(skb->sk); 3516 3510 struct ifinfomsg *ifm; ··· 3585 3577 return err; 3586 3578 } 3587 3579 3588 - static int rtnl_bridge_dellink(struct sk_buff *skb, struct nlmsghdr *nlh) 3580 + static int rtnl_bridge_dellink(struct sk_buff *skb, struct nlmsghdr *nlh, 3581 + struct netlink_ext_ack *extack) 3589 3582 { 3590 3583 struct net *net = sock_net(skb->sk); 3591 3584 struct ifinfomsg *ifm; ··· 3954 3945 return size; 3955 3946 } 3956 3947 3957 - static int rtnl_stats_get(struct sk_buff *skb, struct nlmsghdr *nlh) 3948 + static int rtnl_stats_get(struct sk_buff *skb, struct nlmsghdr *nlh, 3949 + struct netlink_ext_ack *extack) 3958 3950 { 3959 3951 struct net *net = sock_net(skb->sk); 3960 3952 struct net_device *dev = NULL; ··· 4117 4107 if (doit == NULL) 4118 4108 return -EOPNOTSUPP; 4119 4109 4120 - return doit(skb, nlh); 4110 + return doit(skb, nlh, extack); 4121 4111 } 4122 4112 4123 4113 static void rtnetlink_rcv(struct sk_buff *skb)
+3 -2
net/dcb/dcbnl.c
··· 1696 1696 [DCB_CMD_CEE_GET] = { RTM_GETDCB, dcbnl_cee_get }, 1697 1697 }; 1698 1698 1699 - static int dcb_doit(struct sk_buff *skb, struct nlmsghdr *nlh) 1699 + static int dcb_doit(struct sk_buff *skb, struct nlmsghdr *nlh, 1700 + struct netlink_ext_ack *extack) 1700 1701 { 1701 1702 struct net *net = sock_net(skb->sk); 1702 1703 struct net_device *netdev; ··· 1713 1712 return -EPERM; 1714 1713 1715 1714 ret = nlmsg_parse(nlh, sizeof(*dcb), tb, DCB_ATTR_MAX, 1716 - dcbnl_rtnl_policy, NULL); 1715 + dcbnl_rtnl_policy, extack); 1717 1716 if (ret < 0) 1718 1717 return ret; 1719 1718
+8 -4
net/decnet/dn_dev.c
··· 565 565 [IFA_FLAGS] = { .type = NLA_U32 }, 566 566 }; 567 567 568 - static int dn_nl_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh) 568 + static int dn_nl_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh, 569 + struct netlink_ext_ack *extack) 569 570 { 570 571 struct net *net = sock_net(skb->sk); 571 572 struct nlattr *tb[IFA_MAX+1]; ··· 582 581 if (!net_eq(net, &init_net)) 583 582 goto errout; 584 583 585 - err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFA_MAX, dn_ifa_policy, NULL); 584 + err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFA_MAX, dn_ifa_policy, 585 + extack); 586 586 if (err < 0) 587 587 goto errout; 588 588 ··· 611 609 return err; 612 610 } 613 611 614 - static int dn_nl_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh) 612 + static int dn_nl_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh, 613 + struct netlink_ext_ack *extack) 615 614 { 616 615 struct net *net = sock_net(skb->sk); 617 616 struct nlattr *tb[IFA_MAX+1]; ··· 628 625 if (!net_eq(net, &init_net)) 629 626 return -EINVAL; 630 627 631 - err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFA_MAX, dn_ifa_policy, NULL); 628 + err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFA_MAX, dn_ifa_policy, 629 + extack); 632 630 if (err < 0) 633 631 return err; 634 632
+6 -4
net/decnet/dn_fib.c
··· 501 501 return table; 502 502 } 503 503 504 - static int dn_fib_rtm_delroute(struct sk_buff *skb, struct nlmsghdr *nlh) 504 + static int dn_fib_rtm_delroute(struct sk_buff *skb, struct nlmsghdr *nlh, 505 + struct netlink_ext_ack *extack) 505 506 { 506 507 struct net *net = sock_net(skb->sk); 507 508 struct dn_fib_table *tb; ··· 517 516 return -EINVAL; 518 517 519 518 err = nlmsg_parse(nlh, sizeof(*r), attrs, RTA_MAX, rtm_dn_policy, 520 - NULL); 519 + extack); 521 520 if (err < 0) 522 521 return err; 523 522 ··· 528 527 return tb->delete(tb, r, attrs, nlh, &NETLINK_CB(skb)); 529 528 } 530 529 531 - static int dn_fib_rtm_newroute(struct sk_buff *skb, struct nlmsghdr *nlh) 530 + static int dn_fib_rtm_newroute(struct sk_buff *skb, struct nlmsghdr *nlh, 531 + struct netlink_ext_ack *extack) 532 532 { 533 533 struct net *net = sock_net(skb->sk); 534 534 struct dn_fib_table *tb; ··· 544 542 return -EINVAL; 545 543 546 544 err = nlmsg_parse(nlh, sizeof(*r), attrs, RTA_MAX, rtm_dn_policy, 547 - NULL); 545 + extack); 548 546 if (err < 0) 549 547 return err; 550 548
+4 -2
net/decnet/dn_route.c
··· 1640 1640 /* 1641 1641 * This is called by both endnodes and routers now. 1642 1642 */ 1643 - static int dn_cache_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh) 1643 + static int dn_cache_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh, 1644 + struct netlink_ext_ack *extack) 1644 1645 { 1645 1646 struct net *net = sock_net(in_skb->sk); 1646 1647 struct rtmsg *rtm = nlmsg_data(nlh); ··· 1655 1654 if (!net_eq(net, &init_net)) 1656 1655 return -EINVAL; 1657 1656 1658 - err = nlmsg_parse(nlh, sizeof(*rtm), tb, RTA_MAX, rtm_dn_policy, NULL); 1657 + err = nlmsg_parse(nlh, sizeof(*rtm), tb, RTA_MAX, rtm_dn_policy, 1658 + extack); 1659 1659 if (err < 0) 1660 1660 return err; 1661 1661
+8 -5
net/ipv4/devinet.c
··· 571 571 return ret; 572 572 } 573 573 574 - static int inet_rtm_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh) 574 + static int inet_rtm_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh, 575 + struct netlink_ext_ack *extack) 575 576 { 576 577 struct net *net = sock_net(skb->sk); 577 578 struct nlattr *tb[IFA_MAX+1]; ··· 584 583 ASSERT_RTNL(); 585 584 586 585 err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFA_MAX, ifa_ipv4_policy, 587 - NULL); 586 + extack); 588 587 if (err < 0) 589 588 goto errout; 590 589 ··· 846 845 return NULL; 847 846 } 848 847 849 - static int inet_rtm_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh) 848 + static int inet_rtm_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh, 849 + struct netlink_ext_ack *extack) 850 850 { 851 851 struct net *net = sock_net(skb->sk); 852 852 struct in_ifaddr *ifa; ··· 1873 1871 }; 1874 1872 1875 1873 static int inet_netconf_get_devconf(struct sk_buff *in_skb, 1876 - struct nlmsghdr *nlh) 1874 + struct nlmsghdr *nlh, 1875 + struct netlink_ext_ack *extack) 1877 1876 { 1878 1877 struct net *net = sock_net(in_skb->sk); 1879 1878 struct nlattr *tb[NETCONFA_MAX+1]; ··· 1887 1884 int err; 1888 1885 1889 1886 err = nlmsg_parse(nlh, sizeof(*ncm), tb, NETCONFA_MAX, 1890 - devconf_ipv4_policy, NULL); 1887 + devconf_ipv4_policy, extack); 1891 1888 if (err < 0) 1892 1889 goto errout; 1893 1890
+4 -2
net/ipv4/fib_frontend.c
··· 710 710 return err; 711 711 } 712 712 713 - static int inet_rtm_delroute(struct sk_buff *skb, struct nlmsghdr *nlh) 713 + static int inet_rtm_delroute(struct sk_buff *skb, struct nlmsghdr *nlh, 714 + struct netlink_ext_ack *extack) 714 715 { 715 716 struct net *net = sock_net(skb->sk); 716 717 struct fib_config cfg; ··· 733 732 return err; 734 733 } 735 734 736 - static int inet_rtm_newroute(struct sk_buff *skb, struct nlmsghdr *nlh) 735 + static int inet_rtm_newroute(struct sk_buff *skb, struct nlmsghdr *nlh, 736 + struct netlink_ext_ack *extack) 737 737 { 738 738 struct net *net = sock_net(skb->sk); 739 739 struct fib_config cfg;
+6 -4
net/ipv4/ipmr.c
··· 2430 2430 /* returns < 0 on error, 0 for ADD_MFC and 1 for ADD_MFC_PROXY */ 2431 2431 static int rtm_to_ipmr_mfcc(struct net *net, struct nlmsghdr *nlh, 2432 2432 struct mfcctl *mfcc, int *mrtsock, 2433 - struct mr_table **mrtret) 2433 + struct mr_table **mrtret, 2434 + struct netlink_ext_ack *extack) 2434 2435 { 2435 2436 struct net_device *dev = NULL; 2436 2437 u32 tblid = RT_TABLE_DEFAULT; ··· 2441 2440 int ret, rem; 2442 2441 2443 2442 ret = nlmsg_validate(nlh, sizeof(*rtm), RTA_MAX, rtm_ipmr_policy, 2444 - NULL); 2443 + extack); 2445 2444 if (ret < 0) 2446 2445 goto out; 2447 2446 rtm = nlmsg_data(nlh); ··· 2500 2499 } 2501 2500 2502 2501 /* takes care of both newroute and delroute */ 2503 - static int ipmr_rtm_route(struct sk_buff *skb, struct nlmsghdr *nlh) 2502 + static int ipmr_rtm_route(struct sk_buff *skb, struct nlmsghdr *nlh, 2503 + struct netlink_ext_ack *extack) 2504 2504 { 2505 2505 struct net *net = sock_net(skb->sk); 2506 2506 int ret, mrtsock, parent; ··· 2510 2508 2511 2509 mrtsock = 0; 2512 2510 tbl = NULL; 2513 - ret = rtm_to_ipmr_mfcc(net, nlh, &mfcc, &mrtsock, &tbl); 2511 + ret = rtm_to_ipmr_mfcc(net, nlh, &mfcc, &mrtsock, &tbl, extack); 2514 2512 if (ret < 0) 2515 2513 return ret; 2516 2514
+3 -2
net/ipv4/route.c
··· 2629 2629 return -EMSGSIZE; 2630 2630 } 2631 2631 2632 - static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh) 2632 + static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh, 2633 + struct netlink_ext_ack *extack) 2633 2634 { 2634 2635 struct net *net = sock_net(in_skb->sk); 2635 2636 struct rtmsg *rtm; ··· 2647 2646 kuid_t uid; 2648 2647 2649 2648 err = nlmsg_parse(nlh, sizeof(*rtm), tb, RTA_MAX, rtm_ipv4_policy, 2650 - NULL); 2649 + extack); 2651 2650 if (err < 0) 2652 2651 goto errout; 2653 2652
+12 -8
net/ipv6/addrconf.c
··· 611 611 }; 612 612 613 613 static int inet6_netconf_get_devconf(struct sk_buff *in_skb, 614 - struct nlmsghdr *nlh) 614 + struct nlmsghdr *nlh, 615 + struct netlink_ext_ack *extack) 615 616 { 616 617 struct net *net = sock_net(in_skb->sk); 617 618 struct nlattr *tb[NETCONFA_MAX+1]; ··· 625 624 int err; 626 625 627 626 err = nlmsg_parse(nlh, sizeof(*ncm), tb, NETCONFA_MAX, 628 - devconf_ipv6_policy, NULL); 627 + devconf_ipv6_policy, extack); 629 628 if (err < 0) 630 629 goto errout; 631 630 ··· 4414 4413 }; 4415 4414 4416 4415 static int 4417 - inet6_rtm_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh) 4416 + inet6_rtm_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh, 4417 + struct netlink_ext_ack *extack) 4418 4418 { 4419 4419 struct net *net = sock_net(skb->sk); 4420 4420 struct ifaddrmsg *ifm; ··· 4425 4423 int err; 4426 4424 4427 4425 err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFA_MAX, ifa_ipv6_policy, 4428 - NULL); 4426 + extack); 4429 4427 if (err < 0) 4430 4428 return err; 4431 4429 ··· 4525 4523 } 4526 4524 4527 4525 static int 4528 - inet6_rtm_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh) 4526 + inet6_rtm_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh, 4527 + struct netlink_ext_ack *extack) 4529 4528 { 4530 4529 struct net *net = sock_net(skb->sk); 4531 4530 struct ifaddrmsg *ifm; ··· 4539 4536 int err; 4540 4537 4541 4538 err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFA_MAX, ifa_ipv6_policy, 4542 - NULL); 4539 + extack); 4543 4540 if (err < 0) 4544 4541 return err; 4545 4542 ··· 4889 4886 return inet6_dump_addr(skb, cb, type); 4890 4887 } 4891 4888 4892 - static int inet6_rtm_getaddr(struct sk_buff *in_skb, struct nlmsghdr *nlh) 4889 + static int inet6_rtm_getaddr(struct sk_buff *in_skb, struct nlmsghdr *nlh, 4890 + struct netlink_ext_ack *extack) 4893 4891 { 4894 4892 struct net *net = sock_net(in_skb->sk); 4895 4893 struct ifaddrmsg *ifm; ··· 4902 4898 int err; 4903 4899 4904 4900 err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFA_MAX, ifa_ipv6_policy, 4905 - NULL); 4901 + extack); 4906 4902 if (err < 0) 4907 4903 goto errout; 4908 4904
+8 -4
net/ipv6/addrlabel.c
··· 404 404 [IFAL_LABEL] = { .len = sizeof(u32), }, 405 405 }; 406 406 407 - static int ip6addrlbl_newdel(struct sk_buff *skb, struct nlmsghdr *nlh) 407 + static int ip6addrlbl_newdel(struct sk_buff *skb, struct nlmsghdr *nlh, 408 + struct netlink_ext_ack *extack) 408 409 { 409 410 struct net *net = sock_net(skb->sk); 410 411 struct ifaddrlblmsg *ifal; ··· 414 413 u32 label; 415 414 int err = 0; 416 415 417 - err = nlmsg_parse(nlh, sizeof(*ifal), tb, IFAL_MAX, ifal_policy, NULL); 416 + err = nlmsg_parse(nlh, sizeof(*ifal), tb, IFAL_MAX, ifal_policy, 417 + extack); 418 418 if (err < 0) 419 419 return err; 420 420 ··· 523 521 + nla_total_size(4); /* IFAL_LABEL */ 524 522 } 525 523 526 - static int ip6addrlbl_get(struct sk_buff *in_skb, struct nlmsghdr *nlh) 524 + static int ip6addrlbl_get(struct sk_buff *in_skb, struct nlmsghdr *nlh, 525 + struct netlink_ext_ack *extack) 527 526 { 528 527 struct net *net = sock_net(in_skb->sk); 529 528 struct ifaddrlblmsg *ifal; ··· 535 532 struct ip6addrlbl_entry *p; 536 533 struct sk_buff *skb; 537 534 538 - err = nlmsg_parse(nlh, sizeof(*ifal), tb, IFAL_MAX, ifal_policy, NULL); 535 + err = nlmsg_parse(nlh, sizeof(*ifal), tb, IFAL_MAX, ifal_policy, 536 + extack); 539 537 if (err < 0) 540 538 return err; 541 539
+7 -4
net/ipv6/route.c
··· 3260 3260 return last_err; 3261 3261 } 3262 3262 3263 - static int inet6_rtm_delroute(struct sk_buff *skb, struct nlmsghdr *nlh) 3263 + static int inet6_rtm_delroute(struct sk_buff *skb, struct nlmsghdr *nlh, 3264 + struct netlink_ext_ack *extack) 3264 3265 { 3265 3266 struct fib6_config cfg; 3266 3267 int err; ··· 3278 3277 } 3279 3278 } 3280 3279 3281 - static int inet6_rtm_newroute(struct sk_buff *skb, struct nlmsghdr *nlh) 3280 + static int inet6_rtm_newroute(struct sk_buff *skb, struct nlmsghdr *nlh, 3281 + struct netlink_ext_ack *extack) 3282 3282 { 3283 3283 struct fib6_config cfg; 3284 3284 int err; ··· 3567 3565 NLM_F_MULTI); 3568 3566 } 3569 3567 3570 - static int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh) 3568 + static int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh, 3569 + struct netlink_ext_ack *extack) 3571 3570 { 3572 3571 struct net *net = sock_net(in_skb->sk); 3573 3572 struct nlattr *tb[RTA_MAX+1]; ··· 3579 3576 int err, iif = 0, oif = 0; 3580 3577 3581 3578 err = nlmsg_parse(nlh, sizeof(*rtm), tb, RTA_MAX, rtm_ipv6_policy, 3582 - NULL); 3579 + extack); 3583 3580 if (err < 0) 3584 3581 goto errout; 3585 3582
+6 -3
net/mpls/af_mpls.c
··· 1110 1110 }; 1111 1111 1112 1112 static int mpls_netconf_get_devconf(struct sk_buff *in_skb, 1113 - struct nlmsghdr *nlh) 1113 + struct nlmsghdr *nlh, 1114 + struct netlink_ext_ack *extack) 1114 1115 { 1115 1116 struct net *net = sock_net(in_skb->sk); 1116 1117 struct nlattr *tb[NETCONFA_MAX + 1]; ··· 1747 1746 return err; 1748 1747 } 1749 1748 1750 - static int mpls_rtm_delroute(struct sk_buff *skb, struct nlmsghdr *nlh) 1749 + static int mpls_rtm_delroute(struct sk_buff *skb, struct nlmsghdr *nlh, 1750 + struct netlink_ext_ack *extack) 1751 1751 { 1752 1752 struct mpls_route_config *cfg; 1753 1753 int err; ··· 1769 1767 } 1770 1768 1771 1769 1772 - static int mpls_rtm_newroute(struct sk_buff *skb, struct nlmsghdr *nlh) 1770 + static int mpls_rtm_newroute(struct sk_buff *skb, struct nlmsghdr *nlh, 1771 + struct netlink_ext_ack *extack) 1773 1772 { 1774 1773 struct mpls_route_config *cfg; 1775 1774 int err;
+6 -4
net/phonet/pn_netlink.c
··· 61 61 [IFA_LOCAL] = { .type = NLA_U8 }, 62 62 }; 63 63 64 - static int addr_doit(struct sk_buff *skb, struct nlmsghdr *nlh) 64 + static int addr_doit(struct sk_buff *skb, struct nlmsghdr *nlh, 65 + struct netlink_ext_ack *extack) 65 66 { 66 67 struct net *net = sock_net(skb->sk); 67 68 struct nlattr *tb[IFA_MAX+1]; ··· 80 79 ASSERT_RTNL(); 81 80 82 81 err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFA_MAX, ifa_phonet_policy, 83 - NULL); 82 + extack); 84 83 if (err < 0) 85 84 return err; 86 85 ··· 228 227 [RTA_OIF] = { .type = NLA_U32 }, 229 228 }; 230 229 231 - static int route_doit(struct sk_buff *skb, struct nlmsghdr *nlh) 230 + static int route_doit(struct sk_buff *skb, struct nlmsghdr *nlh, 231 + struct netlink_ext_ack *extack) 232 232 { 233 233 struct net *net = sock_net(skb->sk); 234 234 struct nlattr *tb[RTA_MAX+1]; ··· 247 245 ASSERT_RTNL(); 248 246 249 247 err = nlmsg_parse(nlh, sizeof(*rtm), tb, RTA_MAX, rtm_phonet_policy, 250 - NULL); 248 + extack); 251 249 if (err < 0) 252 250 return err; 253 251
+3 -2
net/qrtr/qrtr.c
··· 943 943 [IFA_LOCAL] = { .type = NLA_U32 }, 944 944 }; 945 945 946 - static int qrtr_addr_doit(struct sk_buff *skb, struct nlmsghdr *nlh) 946 + static int qrtr_addr_doit(struct sk_buff *skb, struct nlmsghdr *nlh, 947 + struct netlink_ext_ack *extack) 947 948 { 948 949 struct nlattr *tb[IFA_MAX + 1]; 949 950 struct ifaddrmsg *ifm; ··· 958 957 959 958 ASSERT_RTNL(); 960 959 961 - rc = nlmsg_parse(nlh, sizeof(*ifm), tb, IFA_MAX, qrtr_policy, NULL); 960 + rc = nlmsg_parse(nlh, sizeof(*ifm), tb, IFA_MAX, qrtr_policy, extack); 962 961 if (rc < 0) 963 962 return rc; 964 963
+3 -2
net/sched/act_api.c
··· 993 993 return tcf_add_notify(net, n, &actions, portid); 994 994 } 995 995 996 - static int tc_ctl_action(struct sk_buff *skb, struct nlmsghdr *n) 996 + static int tc_ctl_action(struct sk_buff *skb, struct nlmsghdr *n, 997 + struct netlink_ext_ack *extack) 997 998 { 998 999 struct net *net = sock_net(skb->sk); 999 1000 struct nlattr *tca[TCA_ACT_MAX + 1]; ··· 1006 1005 return -EPERM; 1007 1006 1008 1007 ret = nlmsg_parse(n, sizeof(struct tcamsg), tca, TCA_ACT_MAX, NULL, 1009 - NULL); 1008 + extack); 1010 1009 if (ret < 0) 1011 1010 return ret; 1012 1011
+3 -2
net/sched/cls_api.c
··· 201 201 202 202 /* Add/change/delete/get a filter node */ 203 203 204 - static int tc_ctl_tfilter(struct sk_buff *skb, struct nlmsghdr *n) 204 + static int tc_ctl_tfilter(struct sk_buff *skb, struct nlmsghdr *n, 205 + struct netlink_ext_ack *extack) 205 206 { 206 207 struct net *net = sock_net(skb->sk); 207 208 struct nlattr *tca[TCA_MAX + 1]; ··· 230 229 replay: 231 230 tp_created = 0; 232 231 233 - err = nlmsg_parse(n, sizeof(*t), tca, TCA_MAX, NULL, NULL); 232 + err = nlmsg_parse(n, sizeof(*t), tca, TCA_MAX, NULL, extack); 234 233 if (err < 0) 235 234 return err; 236 235
+9 -6
net/sched/sch_api.c
··· 1125 1125 * Delete/get qdisc. 1126 1126 */ 1127 1127 1128 - static int tc_get_qdisc(struct sk_buff *skb, struct nlmsghdr *n) 1128 + static int tc_get_qdisc(struct sk_buff *skb, struct nlmsghdr *n, 1129 + struct netlink_ext_ack *extack) 1129 1130 { 1130 1131 struct net *net = sock_net(skb->sk); 1131 1132 struct tcmsg *tcm = nlmsg_data(n); ··· 1141 1140 !netlink_ns_capable(skb, net->user_ns, CAP_NET_ADMIN)) 1142 1141 return -EPERM; 1143 1142 1144 - err = nlmsg_parse(n, sizeof(*tcm), tca, TCA_MAX, NULL, NULL); 1143 + err = nlmsg_parse(n, sizeof(*tcm), tca, TCA_MAX, NULL, extack); 1145 1144 if (err < 0) 1146 1145 return err; 1147 1146 ··· 1195 1194 * Create/change qdisc. 1196 1195 */ 1197 1196 1198 - static int tc_modify_qdisc(struct sk_buff *skb, struct nlmsghdr *n) 1197 + static int tc_modify_qdisc(struct sk_buff *skb, struct nlmsghdr *n, 1198 + struct netlink_ext_ack *extack) 1199 1199 { 1200 1200 struct net *net = sock_net(skb->sk); 1201 1201 struct tcmsg *tcm; ··· 1211 1209 1212 1210 replay: 1213 1211 /* Reinit, just in case something touches this. */ 1214 - err = nlmsg_parse(n, sizeof(*tcm), tca, TCA_MAX, NULL, NULL); 1212 + err = nlmsg_parse(n, sizeof(*tcm), tca, TCA_MAX, NULL, extack); 1215 1213 if (err < 0) 1216 1214 return err; 1217 1215 ··· 1569 1567 1570 1568 1571 1569 1572 - static int tc_ctl_tclass(struct sk_buff *skb, struct nlmsghdr *n) 1570 + static int tc_ctl_tclass(struct sk_buff *skb, struct nlmsghdr *n, 1571 + struct netlink_ext_ack *extack) 1573 1572 { 1574 1573 struct net *net = sock_net(skb->sk); 1575 1574 struct tcmsg *tcm = nlmsg_data(n); ··· 1589 1586 !netlink_ns_capable(skb, net->user_ns, CAP_NET_ADMIN)) 1590 1587 return -EPERM; 1591 1588 1592 - err = nlmsg_parse(n, sizeof(*tcm), tca, TCA_MAX, NULL, NULL); 1589 + err = nlmsg_parse(n, sizeof(*tcm), tca, TCA_MAX, NULL, extack); 1593 1590 if (err < 0) 1594 1591 return err; 1595 1592