Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753005AbdL1ITN (ORCPT ); Thu, 28 Dec 2017 03:19:13 -0500 Received: from tama500.ecl.ntt.co.jp ([129.60.39.148]:51193 "EHLO tama500.ecl.ntt.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752404AbdL1ITL (ORCPT ); Thu, 28 Dec 2017 03:19:11 -0500 Subject: Re: [PATCH bpf-next v3 1/3] libbpf: add function to setup XDP References: <20171228080437.16933-1-eric@regit.org> <20171228080437.16933-2-eric@regit.org> From: Toshiaki Makita Message-ID: <9ec8def5-a24f-a4ff-d0ae-fb8f11e4acdc@lab.ntt.co.jp> Date: Thu, 28 Dec 2017 17:18:28 +0900 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <20171228080437.16933-2-eric@regit.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit To: Eric Leblond , daniel@iogearbox.net Cc: Alexei Starovoitov , netdev@vger.kernel.org, linux-kernel@vger.kernel.org X-TM-AS-MML: disable Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 726 Lines: 34 On 2017/12/28 17:04, 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 > Acked-by: Alexei Starovoitov > --- ... > +int bpf_set_link_xdp_fd(int ifindex, int fd, __u32 flags) ... > + if (bind(sock, (struct sockaddr *)&sa, sizeof(sa)) < 0) { > + ret = -errno; > + goto cleanup; > + } > + > + addrlen = sizeof(sa); > + if (getsockname(sock, (struct sockaddr *)&sa, &addrlen) < 0) { > + ret = errno; Still errno is not inverted, > + goto cleanup; > + } > + > + if (addrlen != sizeof(sa)) { > + ret = errno; And not set here. > + goto cleanup; > + } -- Toshiaki Makita