Re: [PATCH net-next] rtnetlink: Honour NLM_F_ECHO flag in rtnl_{new, set}link
From: Hangbin Liu <hidden>
Date: 2022-09-22 10:14:14
On Wed, Sep 21, 2022 at 03:56:40PM -0700, Jakub Kicinski wrote:
Looking closer at the code it seems like what NLM_F_ECHO does in most places is to loop notifications resulting from the command back onto the requesting socket. See nlmsg_notify(), report is usually passed as nlmsg_report(req). I guess that answers Hangbin's question - yes, I'd vote that we just pass the nlh to rtnl_notify() and let the netlink core do its thing.
Thanks, I will update the patch by using rtnl_notify().
In general I still don't think NLM_F_ECHO makes for a reasonable API. It may seem okay to those who are willing to write manual netlink parsers but for a normal programmer the ability to receive directly notifications resulting from a API call they made is going to mean.. nothing they can have prior experience with. NEWLINK should have reported the allocated handle / ifindex from the start :( The "give me back the notifications" semantics match well your use case to log what the command has done, in that case there is no need to "return" all the notifications from the API call.
I didn't get what you mean about "no need to return all the notifications from the API call"? Do you ask for some update of the patch, or just talking about your propose of NEWLINK? Thanks Hangbin