Thread (55 messages) 55 messages, 5 authors, 2021-11-05

Re: [PATCH v2 21/25] tcp: authopt: Add initial l3index support

From: David Ahern <hidden>
Date: 2021-11-03 03:07:04
Also in: linux-crypto, linux-kselftest, lkml

On 11/1/21 10:34 AM, Leonard Crestez wrote:
quoted hunk ↗ jump to hunk
@@ -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(...)
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help