Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp3268673rwe; Mon, 29 Aug 2022 08:33:44 -0700 (PDT) X-Google-Smtp-Source: AA6agR60p8klwlNdhu9AsA1JcGWLRFzcVa+ZqvlqI2FR+yys9GUu/Cy8Aga3DVjMSYMJZLLZ67pB X-Received: by 2002:aa7:c585:0:b0:448:24ee:b202 with SMTP id g5-20020aa7c585000000b0044824eeb202mr8464505edq.167.1661787224135; Mon, 29 Aug 2022 08:33:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661787224; cv=none; d=google.com; s=arc-20160816; b=ssIznWKKOILgDeZUKPQflFqKI+ITu1Ay5WBPV2rc6Yw12/QUeUfxkgV9H2bc3PbuCP vcvxiS23DsHsShBlBqqIGx9I+sSnx416uouN2tRiq1VqDKcAhSo/RXH8fwp25HulLG95 OF9DqcIhtKjYyr1vL72gtIXqruvuK/HpUlBvdoyCbrDzDMvp/UU15zUHJagz2Qcx5yeN cC/OpX83nJIg9w5WpBoQ/OIc1J8nLsRP7RACe+o2AuWnT2QNTursEohBN9Vgh2wG0bIV r7ucdX9imsXQNEd9QCnuIeywpF9gdx8vkqZaJKOr5bfnLQDU70o9k7VJiM3G9pOSz0uN 2B7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=ecR+6rQwnfa6RpwccsFiYOIeHlAuYAbYdwGh2y5vVBw=; b=rRKdWGsn3vIQIYjHinLOCRlf20ZZIT68aN1RyiUFPieez2C88QqCS9jmgoBH6s71mA Qvyd9cmZOO0X9h9bkhTE7uzNEMnTJY1HNCU4BXyguTwa3cCXft6zL74FQ7xPOWyaraAn HTM9iL+61x37byJW9yw5CH4DubX/mmanAkFihZdmEroo2BFXAd+Oiv8+dSSip1tXiWsa dAQG5ZHhWULKXYyBSKFBCpgscKih9VXqthsfN1Hk2QMIkk761Gyg6/lwz/KX36i7/k6I iq3lphY2fCMzKeWsPy5Udw9kdLcf+EaXBjtgG+pkiRq9vwBEEdlfMNujZLvDuXatOdTM Ik5Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qw9-20020a1709066a0900b007414f1bf78dsi4972784ejc.832.2022.08.29.08.33.18; Mon, 29 Aug 2022 08:33:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230084AbiH2PLx (ORCPT + 99 others); Mon, 29 Aug 2022 11:11:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229494AbiH2PLv (ORCPT ); Mon, 29 Aug 2022 11:11:51 -0400 Received: from www62.your-server.de (www62.your-server.de [213.133.104.62]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 018A57F138; Mon, 29 Aug 2022 08:11:49 -0700 (PDT) Received: from sslproxy06.your-server.de ([78.46.172.3]) by www62.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92.3) (envelope-from ) id 1oSgQV-0007xd-AO; Mon, 29 Aug 2022 17:11:47 +0200 Received: from [85.1.206.226] (helo=linux-4.home) by sslproxy06.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oSgQU-000Qpj-RB; Mon, 29 Aug 2022 17:11:46 +0200 Subject: Re: [PATCH] selftests/bpf: Fix connect4_prog tcp/socket header type conflict To: James Hilliard , bpf@vger.kernel.org Cc: Alexei Starovoitov , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Mykola Lysenko , Shuah Khan , Dave Marchevsky , linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org References: <20220826055025.1018491-1-james.hilliard1@gmail.com> From: Daniel Borkmann Message-ID: Date: Mon, 29 Aug 2022 17:11:46 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: <20220826055025.1018491-1-james.hilliard1@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Authenticated-Sender: daniel@iogearbox.net X-Virus-Scanned: Clear (ClamAV 0.103.6/26642/Mon Aug 29 09:54:26 2022) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/26/22 7:50 AM, James Hilliard wrote: [...] > diff --git a/tools/testing/selftests/bpf/progs/connect4_prog.c b/tools/testing/selftests/bpf/progs/connect4_prog.c > index b241932911db..0f68b8d756b3 100644 > --- a/tools/testing/selftests/bpf/progs/connect4_prog.c > +++ b/tools/testing/selftests/bpf/progs/connect4_prog.c > @@ -7,8 +7,7 @@ > #include > #include > #include > -#include > -#include > +#include > #include > #include Can't we just add: #include "bpf_tcp_helpers.h" It does define SOL_TCP already and is used also in other prog tests. I presume this would avoid the need the change all the below. > @@ -52,7 +51,7 @@ static __inline int verify_cc(struct bpf_sock_addr *ctx, > char buf[TCP_CA_NAME_MAX]; > int i; > > - if (bpf_getsockopt(ctx, SOL_TCP, TCP_CONGESTION, &buf, sizeof(buf))) > + if (bpf_getsockopt(ctx, IPPROTO_TCP, TCP_CONGESTION, &buf, sizeof(buf))) > return 1; > > for (i = 0; i < TCP_CA_NAME_MAX; i++) { > @@ -70,12 +69,12 @@ static __inline int set_cc(struct bpf_sock_addr *ctx) > char reno[TCP_CA_NAME_MAX] = "reno"; > char cubic[TCP_CA_NAME_MAX] = "cubic"; > > - if (bpf_setsockopt(ctx, SOL_TCP, TCP_CONGESTION, &reno, sizeof(reno))) > + if (bpf_setsockopt(ctx, IPPROTO_TCP, TCP_CONGESTION, &reno, sizeof(reno))) > return 1; > if (verify_cc(ctx, reno)) > return 1; > > - if (bpf_setsockopt(ctx, SOL_TCP, TCP_CONGESTION, &cubic, sizeof(cubic))) > + if (bpf_setsockopt(ctx, IPPROTO_TCP, TCP_CONGESTION, &cubic, sizeof(cubic))) > return 1; > if (verify_cc(ctx, cubic)) > return 1; > @@ -113,15 +112,15 @@ static __inline int set_keepalive(struct bpf_sock_addr *ctx) > if (bpf_setsockopt(ctx, SOL_SOCKET, SO_KEEPALIVE, &one, sizeof(one))) > return 1; > if (ctx->type == SOCK_STREAM) { > - if (bpf_setsockopt(ctx, SOL_TCP, TCP_KEEPIDLE, &one, sizeof(one))) > + if (bpf_setsockopt(ctx, IPPROTO_TCP, TCP_KEEPIDLE, &one, sizeof(one))) > return 1; > - if (bpf_setsockopt(ctx, SOL_TCP, TCP_KEEPINTVL, &one, sizeof(one))) > + if (bpf_setsockopt(ctx, IPPROTO_TCP, TCP_KEEPINTVL, &one, sizeof(one))) > return 1; > - if (bpf_setsockopt(ctx, SOL_TCP, TCP_KEEPCNT, &one, sizeof(one))) > + if (bpf_setsockopt(ctx, IPPROTO_TCP, TCP_KEEPCNT, &one, sizeof(one))) > return 1; > - if (bpf_setsockopt(ctx, SOL_TCP, TCP_SYNCNT, &one, sizeof(one))) > + if (bpf_setsockopt(ctx, IPPROTO_TCP, TCP_SYNCNT, &one, sizeof(one))) > return 1; > - if (bpf_setsockopt(ctx, SOL_TCP, TCP_USER_TIMEOUT, &one, sizeof(one))) > + if (bpf_setsockopt(ctx, IPPROTO_TCP, TCP_USER_TIMEOUT, &one, sizeof(one))) > return 1; > } > if (bpf_setsockopt(ctx, SOL_SOCKET, SO_KEEPALIVE, &zero, sizeof(zero))) > @@ -135,7 +134,7 @@ static __inline int set_notsent_lowat(struct bpf_sock_addr *ctx) > int lowat = 65535; > > if (ctx->type == SOCK_STREAM) { > - if (bpf_setsockopt(ctx, SOL_TCP, TCP_NOTSENT_LOWAT, &lowat, sizeof(lowat))) > + if (bpf_setsockopt(ctx, IPPROTO_TCP, TCP_NOTSENT_LOWAT, &lowat, sizeof(lowat))) > return 1; > } > >