Open fpagliughi opened 1 year ago
Hi @fpagliughi, sorry for the delay. I don't support this right now, but this is actually very interesting to me mainly because if we can set the buffer size to a lower value than MAX_NL_LEN
, we can simplify some of the parallel buffer code a bit by only allocating buffers that are rcvbuf
size. This would also eliminate an environment variable that I thought was a little bit clunky.
Does this mean that the data from .recv()
is guaranteed to be less than or equal to rcvbuf
?
Honestly, I have no idea. I'm still brand new to Netlink as a whole. I was just going through a number of different C libraries and examples for the SocketCAN use of Netlink to figure out the calls, and all of them set the socket buffer length. Like here: https://github.com/lalten/libsocketcan/blob/b464485031b6f2a4e53d3ef1b3d405f9ba159c07/src/libsocketcan.c#L305-L307
My random guess was that it was a performance thing to reduce the trips across the user/kernel barrier if you were transferring large amounts of data.
I've been looking through some C examples for some SocketCAN Netlink communications, and they all seem to set the socket buffer sizes. Like:
Is there a way to do this easily with this library - other than getting the socket file handle and doing it manually with libc functions? If it doesn't already exist, I can give it a try and send over a PR.