[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <320b8801-1f35-a283-be11-a4f4275847d2@gmail.com>
Date: Fri, 5 Nov 2021 14:26:58 +0200
From: Leonard Crestez <cdleonard@...il.com>
To: David Ahern <dsahern@...il.com>
Cc: Eric Dumazet <edumazet@...gle.com>, Shuah Khan <shuah@...nel.org>,
Dmitry Safonov <0x7f454c46@...il.com>,
"David S. Miller" <davem@...emloft.net>,
Herbert Xu <herbert@...dor.apana.org.au>,
Kuniyuki Iwashima <kuniyu@...zon.co.jp>,
Hideaki YOSHIFUJI <yoshfuji@...ux-ipv6.org>,
Jakub Kicinski <kuba@...nel.org>,
Yuchung Cheng <ycheng@...gle.com>,
Francesco Ruggeri <fruggeri@...sta.com>,
Mat Martineau <mathew.j.martineau@...ux.intel.com>,
Christoph Paasch <cpaasch@...le.com>,
Ivan Delalande <colona@...sta.com>,
Priyaranjan Jha <priyarjha@...gle.com>, netdev@...r.kernel.org,
linux-crypto@...r.kernel.org, linux-kselftest@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 21/25] tcp: authopt: Add initial l3index support
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.
Powered by blists - more mailing lists