On 6/19/19 5:59 PM, Stefano Brivio wrote:
> In the next patch, we're going to use rt_fill_info() to dump exception
> routes upon RTM_GETROUTE with NLM_F_ROOT, meaning userspace is requesting
> a dump and not a specific route selection, which in turn implies the input
> interface is not relevant. Update rt_fill_info() to handle a NULL
> flowinfo.
>
> Suggested-by: David Ahern <[email protected]>
> Signed-off-by: Stefano Brivio <[email protected]>
> ---
> v6: New patch
>
> net/ipv4/route.c | 57 ++++++++++++++++++++++++++----------------------
> 1 file changed, 31 insertions(+), 26 deletions(-)
>
> diff --git a/net/ipv4/route.c b/net/ipv4/route.c
> index 66cbe8a7a168..052a80373b1d 100644
> --- a/net/ipv4/route.c
> +++ b/net/ipv4/route.c
> @@ -2699,7 +2699,8 @@ static int rt_fill_info(struct net *net, __be32 dst,
> __be32 src,
> r->rtm_family = AF_INET;
> r->rtm_dst_len = 32;
> r->rtm_src_len = 0;
> - r->rtm_tos = fl4->flowi4_tos;
> + if (fl4)
> + r->rtm_tos = fl4->flowi4_tos;
tracing back to the alloc_skb it does not appear to be initialized to 0,
so this should be:
r->rtm_tos = fl4 ? fl4->flowi4_tos : 0;
other than that it looks fine to me.
Reviewed-by: David Ahern <[email protected]>