aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/socket.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/tipc/socket.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/tipc/socket.c')
-rw-r--r--net/tipc/socket.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index 1385207a301f..7918f4763fdc 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -3273,7 +3273,7 @@ static int __tipc_nl_add_sk_con(struct sk_buff *skb, struct tipc_sock *tsk)
3273 peer_node = tsk_peer_node(tsk); 3273 peer_node = tsk_peer_node(tsk);
3274 peer_port = tsk_peer_port(tsk); 3274 peer_port = tsk_peer_port(tsk);
3275 3275
3276 nest = nla_nest_start(skb, TIPC_NLA_SOCK_CON); 3276 nest = nla_nest_start_noflag(skb, TIPC_NLA_SOCK_CON);
3277 if (!nest) 3277 if (!nest)
3278 return -EMSGSIZE; 3278 return -EMSGSIZE;
3279 3279
@@ -3332,7 +3332,7 @@ static int __tipc_nl_add_sk(struct sk_buff *skb, struct netlink_callback *cb,
3332 if (!hdr) 3332 if (!hdr)
3333 goto msg_cancel; 3333 goto msg_cancel;
3334 3334
3335 attrs = nla_nest_start(skb, TIPC_NLA_SOCK); 3335 attrs = nla_nest_start_noflag(skb, TIPC_NLA_SOCK);
3336 if (!attrs) 3336 if (!attrs)
3337 goto genlmsg_cancel; 3337 goto genlmsg_cancel;
3338 3338
@@ -3437,7 +3437,7 @@ int tipc_sk_fill_sock_diag(struct sk_buff *skb, struct netlink_callback *cb,
3437 if (!(sk_filter_state & (1 << sk->sk_state))) 3437 if (!(sk_filter_state & (1 << sk->sk_state)))
3438 return 0; 3438 return 0;
3439 3439
3440 attrs = nla_nest_start(skb, TIPC_NLA_SOCK); 3440 attrs = nla_nest_start_noflag(skb, TIPC_NLA_SOCK);
3441 if (!attrs) 3441 if (!attrs)
3442 goto msg_cancel; 3442 goto msg_cancel;
3443 3443
@@ -3455,7 +3455,7 @@ int tipc_sk_fill_sock_diag(struct sk_buff *skb, struct netlink_callback *cb,
3455 TIPC_NLA_SOCK_PAD)) 3455 TIPC_NLA_SOCK_PAD))
3456 goto attr_msg_cancel; 3456 goto attr_msg_cancel;
3457 3457
3458 stat = nla_nest_start(skb, TIPC_NLA_SOCK_STAT); 3458 stat = nla_nest_start_noflag(skb, TIPC_NLA_SOCK_STAT);
3459 if (!stat) 3459 if (!stat)
3460 goto attr_msg_cancel; 3460 goto attr_msg_cancel;
3461 3461
@@ -3512,7 +3512,7 @@ static int __tipc_nl_add_sk_publ(struct sk_buff *skb,
3512 if (!hdr) 3512 if (!hdr)
3513 goto msg_cancel; 3513 goto msg_cancel;
3514 3514
3515 attrs = nla_nest_start(skb, TIPC_NLA_PUBL); 3515 attrs = nla_nest_start_noflag(skb, TIPC_NLA_PUBL);
3516 if (!attrs) 3516 if (!attrs)
3517 goto genlmsg_cancel; 3517 goto genlmsg_cancel;
3518 3518