Re: [PATCH v2 net-next 05/13] ipv6: Create init helper for fib6_nh

2019-03-27 Thread Alexei Starovoitov
On Wed, Mar 27, 2019 at 08:50:19PM -0600, David Ahern wrote: > On 3/27/19 8:29 PM, Alexei Starovoitov wrote:]\ > > that was a typo. I meant fib6_flags. > > why mess with cfg and use it as weird side effect only to > > get rt->fib6_flags = cfg->fc_flags; working after fib6_nh_init() returns? > > Why

Re: [PATCH v2 net-next 05/13] ipv6: Create init helper for fib6_nh

2019-03-27 Thread David Ahern
On 3/27/19 8:29 PM, Alexei Starovoitov wrote:]\ > that was a typo. I meant fib6_flags. > why mess with cfg and use it as weird side effect only to > get rt->fib6_flags = cfg->fc_flags; working after fib6_nh_init() returns? > Why not to move that fib6_flags = fc_flags assignment into fib6_nh_init ?

Re: [PATCH v2 net-next 05/13] ipv6: Create init helper for fib6_nh

2019-03-27 Thread Alexei Starovoitov
On Wed, Mar 27, 2019 at 08:05:03PM -0600, David Ahern wrote: > On 3/27/19 7:30 PM, Alexei Starovoitov wrote: > >>> > >>> imo it would be cleaner not to mess with cfg. > >>> Ideally it should be marked 'const'. > >> > >> Existing code sets those flags but on a fib6_info. This is not used for > >> ne

Re: [PATCH v2 net-next 05/13] ipv6: Create init helper for fib6_nh

2019-03-27 Thread David Ahern
On 3/27/19 7:30 PM, Alexei Starovoitov wrote: > cfg should really be const. and BTW, it is not const now to ip6_route_info_create and making it const affects a long list of helper functions invoked by now fib6_nh_init.

Re: [PATCH v2 net-next 05/13] ipv6: Create init helper for fib6_nh

2019-03-27 Thread David Ahern
On 3/27/19 7:30 PM, Alexei Starovoitov wrote: >>> >>> imo it would be cleaner not to mess with cfg. >>> Ideally it should be marked 'const'. >> >> Existing code sets those flags but on a fib6_info. This is not used for >> nexthop objects and is kept here to not duplicate this if branch in the >> cr

Re: [PATCH v2 net-next 05/13] ipv6: Create init helper for fib6_nh

2019-03-27 Thread Alexei Starovoitov
On Wed, Mar 27, 2019 at 06:47:23PM -0600, David Ahern wrote: > On 3/27/19 4:52 PM, Alexei Starovoitov wrote: > >> + > >> + /* We cannot add true routes via loopback here, > >> + * they would result in kernel looping; promote them to reject routes > >> + */ > >> + addr_type = ipv6_addr_type(&c

Re: [PATCH v2 net-next 05/13] ipv6: Create init helper for fib6_nh

2019-03-27 Thread David Ahern
On 3/27/19 4:52 PM, Alexei Starovoitov wrote: >> + >> +/* We cannot add true routes via loopback here, >> + * they would result in kernel looping; promote them to reject routes >> + */ >> +addr_type = ipv6_addr_type(&cfg->fc_dst); >> +if ((cfg->fc_flags & RTF_REJECT) || >> +

Re: [PATCH v2 net-next 05/13] ipv6: Create init helper for fib6_nh

2019-03-27 Thread Alexei Starovoitov
On Wed, Mar 27, 2019 at 11:23:21AM -0700, David Ahern wrote: > From: David Ahern > > Similar to IPv4, consolidate the fib6_nh initialization into a helper. > > Signed-off-by: David Ahern > --- > include/net/ip6_fib.h | 4 + > net/ipv6/route.c | 235 > +++

[PATCH v2 net-next 05/13] ipv6: Create init helper for fib6_nh

2019-03-27 Thread David Ahern
From: David Ahern Similar to IPv4, consolidate the fib6_nh initialization into a helper. Signed-off-by: David Ahern --- include/net/ip6_fib.h | 4 + net/ipv6/route.c | 235 +++--- 2 files changed, 131 insertions(+), 108 deletions(-) diff --gi