Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7477fd2e authored by Pavel Emelyanov's avatar Pavel Emelyanov Committed by David S. Miller
Browse files

[SOCK]: Add some notes about per-bind-bucket sock lookup.



I was asked about "why don't we perform a sk_net filtering in
bind_conflict calls, like we do in other sock lookup places"
for a couple of times.

Can we please add a comment about why we do not need one?

Signed-off-by: default avatarPavel Emelyanov <xemul@openvz.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 13f51d82
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -55,6 +55,13 @@ int inet_csk_bind_conflict(const struct sock *sk,
	struct hlist_node *node;
	int reuse = sk->sk_reuse;

	/*
	 * Unlike other sk lookup places we do not check
	 * for sk_net here, since _all_ the socks listed
	 * in tb->owners list belong to the same net - the
	 * one this bucket belongs to.
	 */

	sk_for_each_bound(sk2, node, &tb->owners) {
		if (sk != sk2 &&
		    !inet_v6_ipv6only(sk2) &&
+4 −0
Original line number Diff line number Diff line
@@ -33,6 +33,10 @@ int inet6_csk_bind_conflict(const struct sock *sk,
	const struct hlist_node *node;

	/* We must walk the whole port owner list in this case. -DaveM */
	/*
	 * See comment in inet_csk_bind_conflict about sock lookup
	 * vs net namespaces issues.
	 */
	sk_for_each_bound(sk2, node, &tb->owners) {
		if (sk != sk2 &&
		    (!sk->sk_bound_dev_if ||