netlink: make nla_nest_start() add NLA_F_NESTED flag
authorMichal Kubecek <mkubecek@suse.cz>
Fri, 26 Apr 2019 09:13:06 +0000 (11:13 +0200)
committerDavid S. Miller <davem@davemloft.net>
Sat, 27 Apr 2019 21:03:44 +0000 (17:03 -0400)
commitae0be8de9a53cda3505865c11826d8ff0640237c
tree43bc8a0d58965d57e4ed1bedf8d892c3fe72e8b5
parentc7881b4a97e21b617b8243094dfa4b62028b956c
netlink: make nla_nest_start() add NLA_F_NESTED flag

Even if the NLA_F_NESTED flag was introduced more than 11 years ago, most
netlink based interfaces (including recently added ones) are still not
setting it in kernel generated messages. Without the flag, message parsers
not aware of attribute semantics (e.g. wireshark dissector or libmnl's
mnl_nlmsg_fprintf()) cannot recognize nested attributes and won't display
the structure of their contents.

Unfortunately we cannot just add the flag everywhere as there may be
userspace applications which check nlattr::nla_type directly rather than
through a helper masking out the flags. Therefore the patch renames
nla_nest_start() to nla_nest_start_noflag() and introduces nla_nest_start()
as a wrapper adding NLA_F_NESTED. The calls which add NLA_F_NESTED manually
are rewritten to use nla_nest_start().

Except for changes in include/net/netlink.h, the patch was generated using
this semantic patch:

@@ expression E1, E2; @@
-nla_nest_start(E1, E2)
+nla_nest_start_noflag(E1, E2)

@@ expression E1, E2; @@
-nla_nest_start_noflag(E1, E2 | NLA_F_NESTED)
+nla_nest_start(E1, E2)

Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Acked-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
111 files changed:
drivers/block/drbd/drbd_nl.c
drivers/block/nbd.c
drivers/infiniband/core/nldev.c
drivers/infiniband/hw/cxgb4/restrack.c
drivers/net/bonding/bond_netlink.c
drivers/net/ieee802154/mac802154_hwsim.c
drivers/net/macsec.c
drivers/net/macvlan.c
drivers/net/team/team.c
drivers/net/wireless/ath/wil6210/cfg80211.c
include/linux/netfilter/ipset/ip_set.h
include/net/netlink.h
kernel/taskstats.c
net/8021q/vlan_netlink.c
net/bridge/br_mdb.c
net/bridge/br_netlink.c
net/bridge/br_netlink_tunnel.c
net/core/devlink.c
net/core/lwt_bpf.c
net/core/lwtunnel.c
net/core/neighbour.c
net/core/rtnetlink.c
net/dcb/dcbnl.c
net/decnet/dn_table.c
net/ieee802154/nl802154.c
net/ipv4/fib_semantics.c
net/ipv4/ipmr.c
net/ipv4/ipmr_base.c
net/ipv4/tcp_metrics.c
net/ipv6/addrconf.c
net/ipv6/route.c
net/ipv6/seg6_local.c
net/l2tp/l2tp_netlink.c
net/mpls/af_mpls.c
net/ncsi/ncsi-netlink.c
net/netfilter/ipvs/ip_vs_ctl.c
net/netfilter/nf_conntrack_netlink.c
net/netfilter/nf_conntrack_proto_dccp.c
net/netfilter/nf_conntrack_proto_sctp.c
net/netfilter/nf_conntrack_proto_tcp.c
net/netfilter/nf_tables_api.c
net/netfilter/nfnetlink_cthelper.c
net/netfilter/nfnetlink_cttimeout.c
net/netfilter/nfnetlink_queue.c
net/netfilter/nft_ct.c
net/netfilter/nft_tunnel.c
net/netlabel/netlabel_cipso_v4.c
net/netlabel/netlabel_mgmt.c
net/netlink/genetlink.c
net/nfc/netlink.c
net/openvswitch/conntrack.c
net/openvswitch/datapath.c
net/openvswitch/flow_netlink.c
net/openvswitch/meter.c
net/openvswitch/vport-vxlan.c
net/openvswitch/vport.c
net/packet/diag.c
net/sched/act_api.c
net/sched/act_ife.c
net/sched/act_pedit.c
net/sched/act_tunnel_key.c
net/sched/cls_api.c
net/sched/cls_basic.c
net/sched/cls_bpf.c
net/sched/cls_cgroup.c
net/sched/cls_flow.c
net/sched/cls_flower.c
net/sched/cls_fw.c
net/sched/cls_matchall.c
net/sched/cls_route.c
net/sched/cls_rsvp.h
net/sched/cls_tcindex.c
net/sched/cls_u32.c
net/sched/ematch.c
net/sched/sch_api.c
net/sched/sch_atm.c
net/sched/sch_cake.c
net/sched/sch_cbq.c
net/sched/sch_cbs.c
net/sched/sch_choke.c
net/sched/sch_codel.c
net/sched/sch_drr.c
net/sched/sch_dsmark.c
net/sched/sch_etf.c
net/sched/sch_fq.c
net/sched/sch_fq_codel.c
net/sched/sch_gred.c
net/sched/sch_hfsc.c
net/sched/sch_hhf.c
net/sched/sch_htb.c
net/sched/sch_ingress.c
net/sched/sch_mqprio.c
net/sched/sch_netem.c
net/sched/sch_pie.c
net/sched/sch_qfq.c
net/sched/sch_red.c
net/sched/sch_sfb.c
net/sched/sch_taprio.c
net/sched/sch_tbf.c
net/tipc/bearer.c
net/tipc/group.c
net/tipc/link.c
net/tipc/monitor.c
net/tipc/name_table.c
net/tipc/net.c
net/tipc/netlink_compat.c
net/tipc/node.c
net/tipc/socket.c
net/tipc/udp_media.c
net/wireless/nl80211.c
net/wireless/pmsr.c