[ovs-dev] [PATCH] netlink-socket: Exit NL transaction loop when EINVAL is returned
Nithin Raju
nithin at vmware.com
Tue Apr 14 21:46:35 UTC 2015
> On Apr 14, 2015, at 2:39 PM, Ben Pfaff <blp at nicira.com> wrote:
>
>>
>> What is the genetlink semantics for returning an error from the OVS
>> module in Linux. I looked at the OVS code, and it returns -EINVAL if
>> it runs into a condition of invalid input (eg. flow with key & UFID
>> missing). If OVS module returns -EINVAL, does Linux???s netlink
>> layer massage the message to insert the error into a ???struct
>> nlmsgerr???, and return 0?
>
> The netlink code turns that sort of return value into an
> nlmsghdr+nlmsgerr.
>
>> We have a little confusion about that. We currently return the error
>> (and also the struct nlmsgerr) in the equivalent of recvmsg().
>
> Linux would only return an error from recvmsg() if something really
> bad happened. You can think of the difference between these two types
> of errors as being like a "real" network connection. Suppose you're
> running a Netlink-like RPC protocol over a TCP socket instead of a
> Netlink socket. You only get an error from recvmsg() if something
> really bad happens like the TCP connection dropping. If the remote
> process wants to send you an error reply to your request, you get it
> as a message encapsulated inside the TCP connection data, not as an
> error returned by recvmsg().
Sounds good. Thanks for the clarifications Ben.
In addition to Sorin’s patch, we also need changes in the kernel to return STATUS_SUCCESS, and populate the ‘struct nlmsghdr+nlmsgerr’ appropriately.
thanks,
-- Nithin
More information about the dev
mailing list