In my previous commit 0349b8779cc9 ("sched: add new attr TCA_EXT_WARN_MSG to report tc extact message") I didn't notice the tc action use different enum with filter. So we can't use TCA_EXT_WARN_MSG directly for tc action. Let's add a TCA_ROOT_EXT_WARN_MSG for tc action specifically and put this param before going to the TCA_ACT_TAB nest.
Unified · Split
| @@ -789,6 +789,7 @@ enum { · 788 unmodified lines | ||
| 789 | 789 | TCA_ROOT_FLAGS, |
| 790 | 790 | TCA_ROOT_COUNT, |
| 791 | 791 | TCA_ROOT_TIME_DELTA, /* in msecs */ |
| 792 | + TCA_ROOT_EXT_WARN_MSG, | |
| 792 | 793 | __TCA_ROOT_MAX, |
| 793 | 794 | #define TCA_ROOT_MAX (__TCA_ROOT_MAX - 1) |
| 794 | 795 | }; |
| @@ -1589,6 +1589,10 @@ static int tca_get_fill(struct sk_buff *skb, struct tc_action *actions[], · 1588 unmodified lines | ||
| 1589 | 1589 | t->tca__pad1 = 0; |
| 1590 | 1590 | t->tca__pad2 = 0; |
| 1591 | 1591 | |
| 1592 | + if (extack && extack->_msg && | |
| 1593 | + nla_put_string(skb, TCA_ROOT_EXT_WARN_MSG, extack->_msg)) | |
| 1594 | + goto out_nlmsg_trim; | |
| 1595 | + | |
| 1592 | 1596 | nest = nla_nest_start_noflag(skb, TCA_ACT_TAB); |
| 1593 | 1597 | if (!nest) |
| 1594 | 1598 | goto out_nlmsg_trim; |
| @@ -1598,10 +1602,6 @@ static int tca_get_fill(struct sk_buff *skb, struct tc_action *actions[], · 3 unmodified lines | ||
| 1598 | 1602 | |
| 1599 | 1603 | nla_nest_end(skb, nest); |
| 1600 | 1604 | |
| 1601 | − if (extack && extack->_msg && | |
| 1602 | − nla_put_string(skb, TCA_EXT_WARN_MSG, extack->_msg)) | |
| 1603 | − goto out_nlmsg_trim; | |
| 1604 | − | |
| 1605 | 1605 | nlh->nlmsg_len = skb_tail_pointer(skb) - b; |
| 1606 | 1606 | |
| 1607 | 1607 | return skb->len; |