Subject: Re: Netlink messages without NLM_F_REQUEST flag

From: Leon Romanovsky <[email-masked]>
Date: Wed, 7 Jun 2017 20:00:37 +0300

On Wed, Jun 07, 2017 at 10:47:50AM -0600, Jason Gunthorpe wrote:
> On Wed, Jun 07, 2017 at 07:43:44PM +0300, Leon Romanovsky wrote:
> > On Wed, Jun 7, 2017 at 7:37 PM, Jason Gunthorpe
> > <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org> wrote:
> > > On Wed, Jun 07, 2017 at 07:19:01PM +0300, Leon Romanovsky wrote:
> > >> It makes me wonder if it is expected behavior for
> > >> ibnl_rcv_reply_skb() to handle !NLM_F_REQUEST messages and do we
> > >> really need it? What are the scenarios?  In my use case, which is
> > >> for sure different from yours, I'm always setting NLM_F_REQUEST
> > >> while communicating with kernel.
> > >
> > > If I recall the user space SA code issues REQUESTS from the kernel to
> > > userspace, so userspace returns with the response format. This is
> > > abnormal for netlink hence the special function.
> >
> > In netlink semantics, kernel side is supposed to send netlink
> > notification message and userspace is supposed to send REQUEST.
>
> That pattern is for async communications, the SA stuff needs a sync
> protocol, unfortunately.

There is special flag NLM_F_ACK for it and userspace will set
NLM_F_REQUEST | NLM_F_ACK once synchronization is needed.

> Jason