Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp3311153rwe; Mon, 29 Aug 2022 09:15:06 -0700 (PDT) X-Google-Smtp-Source: AA6agR7y2WWzsq3B5qNOi8RXAk+zJc8aU2w/+zoMX0zlxjjkcVPAtSTsPQo5nN/AWs55vna/ODqi X-Received: by 2002:a17:906:9b15:b0:730:d10f:a932 with SMTP id eo21-20020a1709069b1500b00730d10fa932mr13934008ejc.304.1661789706017; Mon, 29 Aug 2022 09:15:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661789706; cv=none; d=google.com; s=arc-20160816; b=SbBTS2/Sj9cXKJ7YWrig4uRxg1K20Xi+41+WTkDyJZMpVGPXAAG0JWzppv70EX4Cy5 X+xRAsNYeGtwRMHiNOigSfr0mfNjbnvsqlFIxHkL78jo5G1/c9tmtik+dWxibPJordKz AUoCjmjl70+051S+iaNKaKITJUlis2FcXV2T0jila2SCebAaBbSP49v+WLp6vBPJc5oG FS8ehS1j7m4IQDWKduKz8c6ATeXD3jM2B9i/aySNtGk4ekDRfz45FjKnJkpzxBqxhuny dFez7/6jI8de1hsysqoqB+LoxhHsonqxaSUlcIaQw4rk5bsAyrCeOSsyG7v3BhX/0ZYY 3Qhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=taWUzi4UHNfxICa8CAve34OKJtJJKSkD21g1k9CF/lA=; b=Mt4BLFtvv1ooIOmsOklHOQ5rPj1HLTpWlnIxUE37y1+0F8mKjVwboq9RG8QENk57Xi hNBJdJJjtGGhSx6giL5IU6QpGK9Whm0OAFIKmSvlyseHIlB2P1SFGSDvNslBhLgxkJpi tDhvYULQxu3nOgDZF6hv5geqUjbE3r7WlPU6EyMCjJb5DL0OyGinxLS832yFSXO9QxLi acnzicaGbg86HmurdT5l852mbJICfjnfFkIi5F7h08ILrSGFVGryLiPlYFrA6Bq5eC6W kiWY6bepWKMtDxMbJn8tWCHmK0hB6PqQOyqA9z8cPTceB5rX95jrWX6N/Ns1R73VM+hj c8EA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=bnPj20mJ; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hu9-20020a170907a08900b00732f76a97bdsi6373182ejc.907.2022.08.29.09.14.39; Mon, 29 Aug 2022 09:15:05 -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; dkim=pass header.i=@gmail.com header.s=20210112 header.b=bnPj20mJ; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229998AbiH2PuO (ORCPT + 99 others); Mon, 29 Aug 2022 11:50:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54724 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229566AbiH2PuK (ORCPT ); Mon, 29 Aug 2022 11:50:10 -0400 Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A77CD47B8C; Mon, 29 Aug 2022 08:50:08 -0700 (PDT) Received: by mail-pj1-x1030.google.com with SMTP id h13-20020a17090a648d00b001fdb9003787so3657598pjj.4; Mon, 29 Aug 2022 08:50:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc; bh=taWUzi4UHNfxICa8CAve34OKJtJJKSkD21g1k9CF/lA=; b=bnPj20mJnripHXQ/GXvCmT3YEOJYNbHJkMkHYD8cOZCdgZEOncfbxWW7i8XLvWPDT9 zo7UAer/yx8HxZEp6Ek/u3o1cgFe35r8AtlRmiq+gnwHIYY3ElFXHTfkh42rzH90I0gm m/EMCBdk4lYUnl+11n2bG2S26YwT9UUc7clJqCaOcBVqBNXDfjqjBXSTIWzj+HCUqNRT qNi5LZLElki9RY4b5b3yiHAvuR27ALlvvOYFsLNrMBm/IaeBjZTU0cbFAdz6Op1dbc5g vR5QTAQp4RnYAWwNN5+5Z+fLbZcrIJeil/1JSrt4lN/ooVCdEX4XSMfU5YjzWrZSny/h xGvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=taWUzi4UHNfxICa8CAve34OKJtJJKSkD21g1k9CF/lA=; b=XRGc0TwrOeazTzCvZoEERvnWxfW2/8pIxXS89pXdwulgIz6hcnl5WCL2thudximj4T 47Wbem/M6Rxh6sIijXz4RqLhmJo002pW5rIJPf6AVaMx8vgZkrpsf8aB4TzUm/E4iZI7 cMXJpQqx6HP7pMi7wsv5SHqSZkEtKap1hxALbiGRPdgHuwPX/67Ab8JOFJCHZO3fpGhj UabpjeagJNcq8toFLKO68TlBhJFC+pZMnoGswnGdJc6tS4JJ25CRudEUAibhnNJMVEk5 c4wmI2B/aLo2Cj9VC24KRV7kx1tP0vjOPA3PmhAvMgM18ZeIHhb/Sci6bZoVHjnw3Qm+ fTVw== X-Gm-Message-State: ACgBeo3pQH9t4WZCT6ruaHKDIo3CNmHGGTgyFFp/Ccts/2o7utY80YmG eJ+nEI5cwG0XbtgCyRkMm6ulmR0br4C0IBSGPFA= X-Received: by 2002:a17:90a:d714:b0:1fd:ea53:b924 with SMTP id y20-20020a17090ad71400b001fdea53b924mr2976795pju.70.1661788208072; Mon, 29 Aug 2022 08:50:08 -0700 (PDT) MIME-Version: 1.0 References: <20220826055025.1018491-1-james.hilliard1@gmail.com> In-Reply-To: From: James Hilliard Date: Mon, 29 Aug 2022 09:49:55 -0600 Message-ID: Subject: Re: [PATCH] selftests/bpf: Fix connect4_prog tcp/socket header type conflict To: Daniel Borkmann Cc: bpf@vger.kernel.org, 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 Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,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 Mon, Aug 29, 2022 at 9:11 AM Daniel Borkmann wrote: > > 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" Yeah, that seems to work, changed in v2: https://lore.kernel.org/bpf/20220829154710.3870139-1-james.hilliard1@gmail.com/ > > 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; > > } > > > > >