Re: [PATCH] net: ipv6: Truncate single route when it doesn't fit into dump buffer.

2017-05-14 Thread Johannes Berg
On Sun, 2017-05-14 at 16:14 -0600, David Ahern wrote: > On 5/14/17 3:00 PM, Johannes Berg wrote: > > On Sat, 2017-05-13 at 19:29 +0200, Jan Moskyto Matejka wrote: > > > > > > > When adding a route to the skb, track whether it contains at > > > > least > > > > 1 > > > > route. If not, it means the

Re: [PATCH] net: ipv6: Truncate single route when it doesn't fit into dump buffer.

2017-05-14 Thread David Ahern
On 5/14/17 3:00 PM, Johannes Berg wrote: > On Sat, 2017-05-13 at 19:29 +0200, Jan Moskyto Matejka wrote: >> >>> 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 condit

Re: [PATCH] net: ipv6: Truncate single route when it doesn't fit into dump buffer.

2017-05-14 Thread Johannes Berg
On Sat, 2017-05-13 at 19:29 +0200, Jan Moskyto Matejka wrote: > > > 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 - > > returni

Re: [PATCH] net: ipv6: Truncate single route when it doesn't fit into dump buffer.

2017-05-13 Thread Jan Moskyto Matejka
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 a

Re: [PATCH] net: ipv6: Truncate single route when it doesn't fit into dump buffer.

2017-05-13 Thread David Ahern
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 th

Re: [PATCH] net: ipv6: Truncate single route when it doesn't fit into dump buffer.

2017-05-13 Thread Jan Moskyto Matejka
On Sat, May 13, 2017 at 12:52:47AM -0600, David Ahern wrote: > On 5/12/17 3:41 PM, Jan Moskyto Matejka wrote: > > On Fri, May 12, 2017 at 10:26:08AM -0700, David Ahern wrote: > >> On 5/12/17 8:24 AM, David Miller wrote: > >>> From: Jan Moskyto Matejka > >>> Date: Fri, 12 May 2017 13:15:10 +0200 >

Re: [PATCH] net: ipv6: Truncate single route when it doesn't fit into dump buffer.

2017-05-12 Thread David Ahern
On 5/12/17 3:41 PM, Jan Moskyto Matejka wrote: > On Fri, May 12, 2017 at 10:26:08AM -0700, David Ahern wrote: >> On 5/12/17 8:24 AM, David Miller wrote: >>> From: Jan Moskyto Matejka >>> Date: Fri, 12 May 2017 13:15:10 +0200 >>> -int rt6_dump_route(struct rt6_info *rt, void *p_arg); +int

Re: [PATCH] net: ipv6: Truncate single route when it doesn't fit into dump buffer.

2017-05-12 Thread Jan Moskyto Matejka
On Fri, May 12, 2017 at 11:34:04PM +0200, Jan Moskyto Matejka wrote: > On Fri, May 12, 2017 at 11:24:47AM -0400, David Miller wrote: > > From: Jan Moskyto Matejka > > Date: Fri, 12 May 2017 13:15:10 +0200 > > > > > -int rt6_dump_route(struct rt6_info *rt, void *p_arg); > > > +int rt6_dump_route(s

Re: [PATCH] net: ipv6: Truncate single route when it doesn't fit into dump buffer.

2017-05-12 Thread Jan Moskyto Matejka
On Fri, May 12, 2017 at 10:26:08AM -0700, David Ahern wrote: > On 5/12/17 8:24 AM, David Miller wrote: > > From: Jan Moskyto Matejka > > Date: Fri, 12 May 2017 13:15:10 +0200 > > > >> -int rt6_dump_route(struct rt6_info *rt, void *p_arg); > >> +int rt6_dump_route(struct rt6_info *rt, void *p_arg,

Re: [PATCH] net: ipv6: Truncate single route when it doesn't fit into dump buffer.

2017-05-12 Thread Jan Moskyto Matejka
On Fri, May 12, 2017 at 11:24:47AM -0400, David Miller wrote: > From: Jan Moskyto Matejka > Date: Fri, 12 May 2017 13:15:10 +0200 > > > -int rt6_dump_route(struct rt6_info *rt, void *p_arg); > > +int rt6_dump_route(struct rt6_info *rt, void *p_arg, int truncate); > > Please use "bool" and "true"

Re: [PATCH] net: ipv6: Truncate single route when it doesn't fit into dump buffer.

2017-05-12 Thread David Miller
From: David Ahern Date: Fri, 12 May 2017 10:26:08 -0700 > On 5/12/17 8:24 AM, David Miller wrote: >> From: Jan Moskyto Matejka >> Date: Fri, 12 May 2017 13:15:10 +0200 >> >>> -int rt6_dump_route(struct rt6_info *rt, void *p_arg); >>> +int rt6_dump_route(struct rt6_info *rt, void *p_arg, int tru

Re: [PATCH] net: ipv6: Truncate single route when it doesn't fit into dump buffer.

2017-05-12 Thread David Ahern
On 5/12/17 8:24 AM, David Miller wrote: > From: Jan Moskyto Matejka > Date: Fri, 12 May 2017 13:15:10 +0200 > >> -int rt6_dump_route(struct rt6_info *rt, void *p_arg); >> +int rt6_dump_route(struct rt6_info *rt, void *p_arg, int truncate); > > Please use "bool" and "true"/"false" for boolean val

Re: [PATCH] net: ipv6: Truncate single route when it doesn't fit into dump buffer.

2017-05-12 Thread David Miller
From: Jan Moskyto Matejka Date: Fri, 12 May 2017 13:15:10 +0200 > -int rt6_dump_route(struct rt6_info *rt, void *p_arg); > +int rt6_dump_route(struct rt6_info *rt, void *p_arg, int truncate); Please use "bool" and "true"/"false" for boolean values. What does ipv4 do in this situation? I'm hesi

[PATCH] net: ipv6: Truncate single route when it doesn't fit into dump buffer.

2017-05-12 Thread Jan Moskyto Matejka
When rt6_fill_node() fails to fit the route into the buffer, it drops the route, returns -EMSGSIZE and waits for buffer flush. This condition is detected by non-null return value and non-empty buffer; the buffer is flushed and rt6_fill_node() restarted. However, when a single route generates such