Subject: Re: [PATCH net-next 04/14] tipc: add sock dump to new netlink api

From: Florian Westphal <[email-masked]>
Date: Mon, 15 Sep 2014 10:51:52 +0200

Richard Alpe <[email-masked]> wrote:
> >You can't just say sometimes you'll partially list the set of nested
> >attributes in an object, you must public the entire object fully in
> >the netlink message or skip the object entirely.
> Ok. I bluntly assumed we could put some reassemble logic in the
> client as the end integrity should still be preserved(?).
> 
> >I would suggest that you instead size the amount of space you'll
> >need for at least the first socket being listed, and if NLMSG_GOODSIZE
> >is insufficient, allocate as much as you will actually need.
> >
> >Then you put full socket netlink blobs in there, including all nested
> >attributes, and then stop and reset back the the most recent full socket
> >published if you run out of space.
> The amount of publications a socket can have is large (~65 000). Do
> you still think this a viable solution?

I suggest to look at nf_conntrack_netlink.c ctnetlink_dump_table() and
ctnetlink_fill_info().

It should be doing something similar to what you want and it handles
the restarts correctly, i.e., cancels all partial nested attributes
on error and resumes at the beginning of said entry on the next dump.