[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170513172915.5ram3mlsy4ihzwmw@lopatka.joja.cz>
Date: Sat, 13 May 2017 19:29:15 +0200
From: Jan Moskyto Matejka <mq@....cz>
To: David Ahern <dsahern@...il.com>
Cc: David Miller <davem@...emloft.net>, mq@....cz,
netdev@...r.kernel.org, roopa <roopa@...ulusnetworks.com>
Subject: Re: [PATCH] net: ipv6: Truncate single route when it doesn't fit
into dump buffer.
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.
Powered by blists - more mailing lists