xfrm: fix inbound ipv4/udp/esp packets to UDPv6 dualstack sockets
[platform/kernel/linux-starfive.git] / net / sched / act_api.c
index 9b31a10..b33f88e 100644 (file)
@@ -1581,7 +1581,7 @@ errout:
 
 static int tca_get_fill(struct sk_buff *skb, struct tc_action *actions[],
                        u32 portid, u32 seq, u16 flags, int event, int bind,
-                       int ref)
+                       int ref, struct netlink_ext_ack *extack)
 {
        struct tcamsg *t;
        struct nlmsghdr *nlh;
@@ -1596,6 +1596,10 @@ static int tca_get_fill(struct sk_buff *skb, struct tc_action *actions[],
        t->tca__pad1 = 0;
        t->tca__pad2 = 0;
 
+       if (extack && extack->_msg &&
+           nla_put_string(skb, TCA_ROOT_EXT_WARN_MSG, extack->_msg))
+               goto out_nlmsg_trim;
+
        nest = nla_nest_start_noflag(skb, TCA_ACT_TAB);
        if (!nest)
                goto out_nlmsg_trim;
@@ -1606,6 +1610,7 @@ static int tca_get_fill(struct sk_buff *skb, struct tc_action *actions[],
        nla_nest_end(skb, nest);
 
        nlh->nlmsg_len = skb_tail_pointer(skb) - b;
+
        return skb->len;
 
 out_nlmsg_trim:
@@ -1624,7 +1629,7 @@ tcf_get_notify(struct net *net, u32 portid, struct nlmsghdr *n,
        if (!skb)
                return -ENOBUFS;
        if (tca_get_fill(skb, actions, portid, n->nlmsg_seq, 0, event,
-                        0, 1) <= 0) {
+                        0, 1, NULL) <= 0) {
                NL_SET_ERR_MSG(extack, "Failed to fill netlink attributes while adding TC action");
                kfree_skb(skb);
                return -EINVAL;
@@ -1798,7 +1803,7 @@ tcf_reoffload_del_notify(struct net *net, struct tc_action *action)
        if (!skb)
                return -ENOBUFS;
 
-       if (tca_get_fill(skb, actions, 0, 0, 0, RTM_DELACTION, 0, 1) <= 0) {
+       if (tca_get_fill(skb, actions, 0, 0, 0, RTM_DELACTION, 0, 1, NULL) <= 0) {
                kfree_skb(skb);
                return -EINVAL;
        }
@@ -1885,7 +1890,7 @@ tcf_del_notify(struct net *net, struct nlmsghdr *n, struct tc_action *actions[],
                return -ENOBUFS;
 
        if (tca_get_fill(skb, actions, portid, n->nlmsg_seq, 0, RTM_DELACTION,
-                        0, 2) <= 0) {
+                        0, 2, extack) <= 0) {
                NL_SET_ERR_MSG(extack, "Failed to fill netlink TC action attributes");
                kfree_skb(skb);
                return -EINVAL;
@@ -1964,7 +1969,7 @@ tcf_add_notify(struct net *net, struct nlmsghdr *n, struct tc_action *actions[],
                return -ENOBUFS;
 
        if (tca_get_fill(skb, actions, portid, n->nlmsg_seq, n->nlmsg_flags,
-                        RTM_NEWACTION, 0, 0) <= 0) {
+                        RTM_NEWACTION, 0, 0, extack) <= 0) {
                NL_SET_ERR_MSG(extack, "Failed to fill netlink attributes while adding TC action");
                kfree_skb(skb);
                return -EINVAL;