aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched/act_api.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2019-04-27 17:03:44 -0400
committerDavid S. Miller <davem@davemloft.net>2019-04-27 17:03:44 -0400
commitf6ad55a6a184ebdf3d98a90eab0895f73ce9797e (patch)
treeb49e3af8f5cac309bae80ad390ee8fc3b3679065 /net/sched/act_api.c
parentc7881b4a97e21b617b8243094dfa4b62028b956c (diff)
parentf78c6032c4cb89b408190afd4feb61ff4461a114 (diff)
Merge branch 'nla_nest_start'
Michal Kubecek says: ==================== make nla_nest_start() add NLA_F_NESTED flag One of the comments in recent review of the ethtool netlink series pointed out that proposed ethnl_nest_start() helper which adds NLA_F_NESTED to second argument of nla_nest_start() is not really specific to ethtool netlink code. That is hard to argue with as closer inspection revealed that exactly the same helper already exists in ipset code (except it's a macro rather than an inline function). Another observation was that even if NLA_F_NESTED flag was introduced in 2007, only few netlink based interfaces set it in kernel generated messages and even many recently added APIs omit it. That is unfortunate as without the flag, message parsers not familiar with attribute semantics cannot recognize nested attributes and do not see message structure; this affects e.g. wireshark dissector or mnl_nlmsg_fprintf() from libmnl. This is why I'm suggesting to rename existing nla_nest_start() to different name (nla_nest_start_noflag) and reintroduce nla_nest_start() as a wrapper adding NLA_F_NESTED flag. This is implemented in first patch which is mostly generated by spatch. Second patch drops ipset helper macros which lose their purpose. Third patch cleans up minor coding style issues found by checkpatch.pl in first patch. We could leave nla_nest_start() untouched and simply add a wrapper adding NLA_F_NESTED but that would probably preserve the state when even most new code doesn't set the flag. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/act_api.c')
-rw-r--r--net/sched/act_api.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/net/sched/act_api.c b/net/sched/act_api.c
index 5a87e271d35a..641ad7575f24 100644
--- a/net/sched/act_api.c
+++ b/net/sched/act_api.c
@@ -242,7 +242,7 @@ static int tcf_dump_walker(struct tcf_idrinfo *idrinfo, struct sk_buff *skb,
242 (unsigned long)p->tcfa_tm.lastuse)) 242 (unsigned long)p->tcfa_tm.lastuse))
243 continue; 243 continue;
244 244
245 nest = nla_nest_start(skb, n_i); 245 nest = nla_nest_start_noflag(skb, n_i);
246 if (!nest) { 246 if (!nest) {
247 index--; 247 index--;
248 goto nla_put_failure; 248 goto nla_put_failure;
@@ -299,7 +299,7 @@ static int tcf_del_walker(struct tcf_idrinfo *idrinfo, struct sk_buff *skb,
299 struct tc_action *p; 299 struct tc_action *p;
300 unsigned long id = 1; 300 unsigned long id = 1;
301 301
302 nest = nla_nest_start(skb, 0); 302 nest = nla_nest_start_noflag(skb, 0);
303 if (nest == NULL) 303 if (nest == NULL)
304 goto nla_put_failure; 304 goto nla_put_failure;
305 if (nla_put_string(skb, TCA_KIND, ops->kind)) 305 if (nla_put_string(skb, TCA_KIND, ops->kind))
@@ -776,7 +776,7 @@ tcf_action_dump_1(struct sk_buff *skb, struct tc_action *a, int bind, int ref)
776 } 776 }
777 rcu_read_unlock(); 777 rcu_read_unlock();
778 778
779 nest = nla_nest_start(skb, TCA_OPTIONS); 779 nest = nla_nest_start_noflag(skb, TCA_OPTIONS);
780 if (nest == NULL) 780 if (nest == NULL)
781 goto nla_put_failure; 781 goto nla_put_failure;
782 err = tcf_action_dump_old(skb, a, bind, ref); 782 err = tcf_action_dump_old(skb, a, bind, ref);
@@ -800,7 +800,7 @@ int tcf_action_dump(struct sk_buff *skb, struct tc_action *actions[],
800 800
801 for (i = 0; i < TCA_ACT_MAX_PRIO && actions[i]; i++) { 801 for (i = 0; i < TCA_ACT_MAX_PRIO && actions[i]; i++) {
802 a = actions[i]; 802 a = actions[i];
803 nest = nla_nest_start(skb, a->order); 803 nest = nla_nest_start_noflag(skb, a->order);
804 if (nest == NULL) 804 if (nest == NULL)
805 goto nla_put_failure; 805 goto nla_put_failure;
806 err = tcf_action_dump_1(skb, a, bind, ref); 806 err = tcf_action_dump_1(skb, a, bind, ref);
@@ -1052,7 +1052,7 @@ static int tca_get_fill(struct sk_buff *skb, struct tc_action *actions[],
1052 t->tca__pad1 = 0; 1052 t->tca__pad1 = 0;
1053 t->tca__pad2 = 0; 1053 t->tca__pad2 = 0;
1054 1054
1055 nest = nla_nest_start(skb, TCA_ACT_TAB); 1055 nest = nla_nest_start_noflag(skb, TCA_ACT_TAB);
1056 if (!nest) 1056 if (!nest)
1057 goto out_nlmsg_trim; 1057 goto out_nlmsg_trim;
1058 1058
@@ -1176,7 +1176,7 @@ static int tca_action_flush(struct net *net, struct nlattr *nla,
1176 t->tca__pad1 = 0; 1176 t->tca__pad1 = 0;
1177 t->tca__pad2 = 0; 1177 t->tca__pad2 = 0;
1178 1178
1179 nest = nla_nest_start(skb, TCA_ACT_TAB); 1179 nest = nla_nest_start_noflag(skb, TCA_ACT_TAB);
1180 if (!nest) { 1180 if (!nest) {
1181 NL_SET_ERR_MSG(extack, "Failed to add new netlink message"); 1181 NL_SET_ERR_MSG(extack, "Failed to add new netlink message");
1182 goto out_module_put; 1182 goto out_module_put;
@@ -1508,7 +1508,7 @@ static int tc_dump_action(struct sk_buff *skb, struct netlink_callback *cb)
1508 if (!count_attr) 1508 if (!count_attr)
1509 goto out_module_put; 1509 goto out_module_put;
1510 1510
1511 nest = nla_nest_start(skb, TCA_ACT_TAB); 1511 nest = nla_nest_start_noflag(skb, TCA_ACT_TAB);
1512 if (nest == NULL) 1512 if (nest == NULL)
1513 goto out_module_put; 1513 goto out_module_put;
1514 1514