On Sat, May 13, 2017 at 11:13:38AM -0600, David Ahern wrote: > On 5/13/17 4:54 AM, Jan Moskyto Matejka wrote: > >> I see 2 problems: > >> 1. the kernel is not telling the user the supplied buffer is too small > >> (ie., if a single route does not fit in the skb then it should fail and > >> return an error code to the user), > > > > Definitely. I want just to note that this condition usually occurs > > somewhere during route dump. To know it before starting output, we would > > have to walk the FIB once before dump to calculate max route len. > > When adding a route to the skb, track whether it contains at least 1 > route. If not, it means the next route in the dump is larger than the > given buffer. Detect this condition and error out of the dump - > returning an error to the user (-ENOSPC? or EMSGSIZE?)
EMSGSIZE seems OK for me.