From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Ahern Subject: Re: [PATCH net-next v5 5/9] net: fix raw socket lookup device bind matching with VRFs Date: Wed, 7 Nov 2018 12:07:17 -0700 Message-ID: References: <20181107153610.7526-1-mmanning@vyatta.att-mail.com> <20181107153610.7526-6-mmanning@vyatta.att-mail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: Duncan Eastoe To: Mike Manning , netdev@vger.kernel.org Return-path: Received: from mail-pf1-f193.google.com ([209.85.210.193]:35195 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726440AbeKHEjA (ORCPT ); Wed, 7 Nov 2018 23:39:00 -0500 Received: by mail-pf1-f193.google.com with SMTP id v9-v6so5799066pff.2 for ; Wed, 07 Nov 2018 11:07:19 -0800 (PST) In-Reply-To: <20181107153610.7526-6-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: > From: Duncan Eastoe > > When there exist a pair of raw sockets one unbound and one bound > to a VRF but equal in all other respects, when a packet is received > in the VRF context, __raw_v4_lookup() matches on both sockets. > > This results in the packet being delivered over both sockets, > instead of only the raw socket bound to the VRF. The bound device > checks in __raw_v4_lookup() are replaced with a call to > raw_sk_bound_dev_eq() which correctly handles whether the packet > should be delivered over the unbound socket in such cases. > > In __raw_v6_lookup() the match on the device binding of the socket is > similarly updated to use raw_sk_bound_dev_eq() which matches the > handling in __raw_v4_lookup(). > > Importantly raw_sk_bound_dev_eq() takes the raw_l3mdev_accept sysctl > into account. > > Signed-off-by: Duncan Eastoe > Signed-off-by: Mike Manning > --- > include/net/raw.h | 13 ++++++++++++- > net/ipv4/raw.c | 3 +-- > net/ipv6/raw.c | 5 ++--- > 3 files changed, 15 insertions(+), 6 deletions(-) > Reviewed-by: David Ahern Tested-by: David Ahern