Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752373AbdLKCZ0 (ORCPT ); Sun, 10 Dec 2017 21:25:26 -0500 Received: from tama500.ecl.ntt.co.jp ([129.60.39.148]:52506 "EHLO tama500.ecl.ntt.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752189AbdLKCZX (ORCPT ); Sun, 10 Dec 2017 21:25:23 -0500 Subject: Re: [PATCH net-next] libbpf: add function to setup XDP References: <20171209144315.25890-1-eric@regit.org> From: Toshiaki Makita Message-ID: Date: Mon, 11 Dec 2017 11:24:12 +0900 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: <20171209144315.25890-1-eric@regit.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit To: Eric Leblond , netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, ast@kernel.org, daniel@iogearbox.net X-TM-AS-MML: disable Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 662 Lines: 22 On 2017/12/09 23:43, Eric Leblond wrote: > Most of the code is taken from set_link_xdp_fd() in bpf_load.c and > slightly modified to be library compliant. > > Signed-off-by: Eric Leblond ... > +int bpf_set_link_xdp_fd(int ifindex, int fd, __u32 flags) ... > + for (nh = (struct nlmsghdr *)buf; NLMSG_OK(nh, len); > + nh = NLMSG_NEXT(nh, len)) { > + if (nh->nlmsg_pid != getpid()) { Generally nlmsg_pid should not be compared with process id. See man netlink and https://github.com/iovisor/bcc/pull/1275/commits/69ce96a54c55960c8de3392061254c97b6306a6d > + ret = -LIBBPF_ERRNO__WRNGPID; > + goto cleanup; > + } -- Toshiaki Makita