From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Ahern Subject: Re: [PATCH net-next v5 2/9] net: ensure unbound stream socket to be chosen when not in a VRF Date: Wed, 7 Nov 2018 12:06:34 -0700 Message-ID: <23d96640-9d86-c92f-b659-dd765dec1cb0@gmail.com> References: <20181107153610.7526-1-mmanning@vyatta.att-mail.com> <20181107153610.7526-3-mmanning@vyatta.att-mail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit To: Mike Manning , netdev@vger.kernel.org Return-path: Received: from mail-pg1-f195.google.com ([209.85.215.195]:38126 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726440AbeKHEiS (ORCPT ); Wed, 7 Nov 2018 23:38:18 -0500 Received: by mail-pg1-f195.google.com with SMTP id f8-v6so7713493pgq.5 for ; Wed, 07 Nov 2018 11:06:37 -0800 (PST) In-Reply-To: <20181107153610.7526-3-mmanning@vyatta.att-mail.com> Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: On 11/7/18 8:36 AM, Mike Manning wrote: > The commit a04a480d4392 ("net: Require exact match for TCP socket > lookups if dif is l3mdev") only ensures that the correct socket is > selected for packets in a VRF. However, there is no guarantee that > the unbound socket will be selected for packets when not in a VRF. > By checking for a device match in compute_score() also for the case > when there is no bound device and attaching a score to this, the > unbound socket is selected. And if a failure is returned when there > is no device match, this ensures that bound sockets are never selected, > even if there is no unbound socket. > > Signed-off-by: Mike Manning > --- > include/net/inet_hashtables.h | 11 +++++++++++ > include/net/inet_sock.h | 8 ++++++++ > net/ipv4/inet_hashtables.c | 14 ++++++-------- > net/ipv6/inet6_hashtables.c | 14 ++++++-------- > 4 files changed, 31 insertions(+), 16 deletions(-) > Reviewed-by: David Ahern Tested-by: David Ahern