From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joe Stringer Subject: Re: netns_id in bpf_sk_lookup_{tcp,udp} Date: Mon, 19 Nov 2018 10:36:26 -0800 Message-ID: References: <15bf5496-523f-564f-443e-f3262bb9e668@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Cc: Joe Stringer , netdev , daniel@iogearbox.net To: David Ahern Return-path: Received: from mail-it1-f172.google.com ([209.85.166.172]:52662 "EHLO mail-it1-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725722AbeKTFBY (ORCPT ); Tue, 20 Nov 2018 00:01:24 -0500 Received: by mail-it1-f172.google.com with SMTP id i7so3634246iti.2 for ; Mon, 19 Nov 2018 10:36:38 -0800 (PST) In-Reply-To: <15bf5496-523f-564f-443e-f3262bb9e668@gmail.com> Sender: netdev-owner@vger.kernel.org List-ID: Hi David, thanks for pointing this out. This is more of an oversight through iterations, the runtime lookup will fail to find a socket if the netns value is greater than the range of a uint32 so I think it would actually make more sense to drop the parameter size to u32 rather than u64 so that this would be validated at load time rather than silently returning NULL because of a bad parameter. I'll send a patch to bpf tree. Cheers, Joe On Sun, 18 Nov 2018 at 19:27, David Ahern wrote: > > Hi Joe: > > The netns_id to the bpf_sk_lookup_{tcp,udp} functions in > net/core/filter.c is a u64, yet the APIs in include/uapi/linux/bpf.h > shows a u32. Is that intentional or an oversight through the iterations? > > David