Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2844881pxb; Fri, 5 Nov 2021 05:45:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy2hEuXyczR44N/sP8ah/Jk0ZptoxLqZ9IpV2IVvRlRcnRWaKVB5TnmLk1lSDA6Qam4mTdR X-Received: by 2002:a17:906:dc92:: with SMTP id cs18mr72043333ejc.240.1636116352604; Fri, 05 Nov 2021 05:45:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1636116352; cv=none; d=google.com; s=arc-20160816; b=M3pzaGM71zCbLiDx9phxF6YoQZLRSPm7++21qpBlLkaoSNP0WpOWaRcKITbubKsbQA ASV7kgTJgHC1bg2iOZxc3wd8kmau1c1bueMLlW8mt4RVN1ntBHAc/kF0QVaSesUVlG7M sBr/CIed4PqlSSgTVmP2t9wtqcWV8xMGpzDPc0QU7bKZkO1QK3Ayj65NU/y57mGeQ8lV 6uAZK9mu1jKOKEQNJp9RS2Fa1S2UGqUehknm03mc9ATC+xVs4q4YJXzABa3axy0NCp9C G2lTPNIGoY+r4SLyxV/LRfvkGda4Q7vlBZRP4ZCNiYyuvrvxxRFUmGtn7zd/pENyLcv/ 2HPA== 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:dkim-signature; bh=VWnwoguiS8Ek3wXdinAoUlLWrPmI0p9qcxlIOqqvuf4=; b=g/z45QNy6mJicSOA37BfNiad4mk7cUDw3PHE0eOqedSTYTkgAyslJqD8DxcKjOvrW4 gMpKC+ANrJEYBgHUXJX6lBsQJ9scQYK6zjqyoIRNt8WD08nFhyGpXQ9EZMmWJ/pPa5pv gp/tvl0jbLQVS//dlIXIdm6xla4EN7a3OWLdTFE12nG4ZZUrqNr+dINpZsxPZ1TlRvcw Ku0CgarG/le5yGuhjuKTewgIxMNZFrhxQaPn6i6x8M+3sT2W7/mV8fhug7jQqs5Unmuh oNanrQ/PV0KbtUSbwABzm/vfP0La5KkioL2NAKfa+B6YwW1gmuZAHA8ebcgEJnHMjHHf 8NBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=WQTtiepP; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d13si15383962edm.164.2021.11.05.05.45.28; Fri, 05 Nov 2021 05:45:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=WQTtiepP; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-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 S229923AbhKEM3m (ORCPT + 99 others); Fri, 5 Nov 2021 08:29:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229529AbhKEM3l (ORCPT ); Fri, 5 Nov 2021 08:29:41 -0400 Received: from mail-ed1-x533.google.com (mail-ed1-x533.google.com [IPv6:2a00:1450:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1527CC061714; Fri, 5 Nov 2021 05:27:02 -0700 (PDT) Received: by mail-ed1-x533.google.com with SMTP id w1so32727693edd.10; Fri, 05 Nov 2021 05:27:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=VWnwoguiS8Ek3wXdinAoUlLWrPmI0p9qcxlIOqqvuf4=; b=WQTtiepPdxr+1qL1KOH7sLyVAHlZ4keVF2ROBKBaalj+LYa8+kUcsWY8b+ZnFEaseG ROTVJpXjPrRSfBHrfQcX+6W9DZFhS4teSACoXplshotQffNKW3wxCaE3eOS4eKHrDfoH LvjsMuvNbJSbaYKvsQehN/eRQnBheZjA8ncbrmpO+f2kSDuPmKcI3AnfXAzWWkUuKVAN mnj/RAbhMPbLwZxPJCiNnyCPBsqM6u/cq6Jtd5OT+efqhTJCggfYSwD97E9iyabfdMeI XbuAdP0tII+p9J/1g5aJ/Wm7RastZAQjeP+g7JGMkaGbeHClk+k3jXZSglBN/Q8a8zKi t5ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=VWnwoguiS8Ek3wXdinAoUlLWrPmI0p9qcxlIOqqvuf4=; b=ofsJbqap6nPjPHdhkU1+LI37jk2ZMIDJc6bnk28tjLwImWqnF0ITJ942mrsqJKV7X4 KiN6CGOtRdqQs2RRcdLMqDpZHu/mmywbcCRL1CqpPf7Us3Ovj/FnIoSrQuSTn3uBOepM cuOcdfETP23HEUUMIpBiUNqIpwiHYmLF/XFphBuvxmP3Nn4PennpXOq14wJ4gC0ZataE /wnh1mbdQ1oAjCsYGIz/1mb1e3G1dQ57xriepbvE6a4coWzdmCgh0KQ8Twibh4AhnsBy s+A/vq9mlqwBb8gYSUTFSs1oPIYIJuO3j+8jhOb/rVavvO/0h5Vmzm+gyxCcS393MsMw 4Rew== X-Gm-Message-State: AOAM531VLBTQQ622Qs4TUGYL7/ijQoCxiS0sCuFPxYPQlk7MztzITLUH Q4tB+1ZXPxOCyNIP/suFRvaKkRC29GZn0w== X-Received: by 2002:a17:906:d541:: with SMTP id cr1mr74734988ejc.81.1636115220681; Fri, 05 Nov 2021 05:27:00 -0700 (PDT) Received: from ?IPv6:2a04:241e:501:3870:9439:4202:183c:5296? ([2a04:241e:501:3870:9439:4202:183c:5296]) by smtp.gmail.com with ESMTPSA id oz13sm4081898ejc.65.2021.11.05.05.26.59 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 05 Nov 2021 05:27:00 -0700 (PDT) Subject: Re: [PATCH v2 21/25] tcp: authopt: Add initial l3index support To: David Ahern Cc: Eric Dumazet , Shuah Khan , Dmitry Safonov <0x7f454c46@gmail.com>, "David S. Miller" , Herbert Xu , Kuniyuki Iwashima , Hideaki YOSHIFUJI , Jakub Kicinski , Yuchung Cheng , Francesco Ruggeri , Mat Martineau , Christoph Paasch , Ivan Delalande , Priyaranjan Jha , netdev@vger.kernel.org, linux-crypto@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org References: <4e049d1ade4be3010b4ea63daf2ef3bed4e1892b.1635784253.git.cdleonard@gmail.com> From: Leonard Crestez Message-ID: <320b8801-1f35-a283-be11-a4f4275847d2@gmail.com> Date: Fri, 5 Nov 2021 14:26:58 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On 11/3/21 5:06 AM, David Ahern wrote: > On 11/1/21 10:34 AM, Leonard Crestez wrote: >> @@ -584,10 +614,24 @@ int tcp_set_authopt_key(struct sock *sk, sockptr_t optval, unsigned int optlen) >> return -EINVAL; >> err = tcp_authopt_alg_require(alg); >> if (err) >> return err; >> >> + /* check ifindex is valid (zero is always valid) */ >> + if (opt.flags & TCP_AUTHOPT_KEY_IFINDEX && opt.ifindex) { >> + struct net_device *dev; >> + >> + rcu_read_lock(); >> + dev = dev_get_by_index_rcu(sock_net(sk), opt.ifindex); >> + if (dev && netif_is_l3_master(dev)) >> + l3index = dev->ifindex; >> + rcu_read_unlock(); > > rcu_read_lock()... rcu_read_unlock() can be replaced with > netif_index_is_l3_master(...) Yes, this makes the code shorter.