aboutsummaryrefslogtreecommitdiff
path: root/sys/netinet/in_pcb.c
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2023-02-27 14:52:28 +0000
committerMark Johnston <markj@FreeBSD.org>2023-02-27 15:03:11 +0000
commit3aff4ccdd714105db340d68f1a2aea2f46e99122 (patch)
treee533e475b94b6a503069463c19ca5f3e92f55157 /sys/netinet/in_pcb.c
parentb9199d152f3d61f93c21d63e3c85a5863f9d71e9 (diff)
downloadsrc-3aff4ccdd714105db340d68f1a2aea2f46e99122.tar.gz
src-3aff4ccdd714105db340d68f1a2aea2f46e99122.zip
netinet: Remove IP(V6)_BINDMULTI
This option was added in commit 0a100a6f1ee5 but was never completed. In particular, there is no logic to map flowids to different listening sockets, so it accomplishes basically the same thing as SO_REUSEPORT. Meanwhile, we've since added SO_REUSEPORT_LB, which at least tries to balance among listening sockets using a hash of the 4-tuple and some optional NUMA policy. The option was never documented or completed, and an exp-run revealed nothing using it in the ports tree. Moreover, it complicates the already very complicated in_pcbbind_setup(), and the checking in in_pcbbind_check_bindmulti() is insufficient. So, let's remove it. PR: 261398 (exp-run) Reviewed by: glebius Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D38574
Diffstat (limited to 'sys/netinet/in_pcb.c')
-rw-r--r--sys/netinet/in_pcb.c47
1 files changed, 2 insertions, 45 deletions
diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c
index a23c89fe8033..ce95ece8f5f2 100644
--- a/sys/netinet/in_pcb.c
+++ b/sys/netinet/in_pcb.c
@@ -860,36 +860,6 @@ inp_so_options(const struct inpcb *inp)
}
#endif /* INET || INET6 */
-/*
- * Check if a new BINDMULTI socket is allowed to be created.
- *
- * ni points to the new inp.
- * oi points to the existing inp.
- *
- * This checks whether the existing inp also has BINDMULTI and
- * whether the credentials match.
- */
-int
-in_pcbbind_check_bindmulti(const struct inpcb *ni, const struct inpcb *oi)
-{
- /* Check permissions match */
- if ((ni->inp_flags2 & INP_BINDMULTI) &&
- (ni->inp_cred->cr_uid !=
- oi->inp_cred->cr_uid))
- return (0);
-
- /* Check the existing inp has BINDMULTI set */
- if ((ni->inp_flags2 & INP_BINDMULTI) &&
- ((oi->inp_flags2 & INP_BINDMULTI) == 0))
- return (0);
-
- /*
- * We're okay - either INP_BINDMULTI isn't set on ni, or
- * it is and it matches the checks.
- */
- return (1);
-}
-
#ifdef INET
/*
* Set up a bind operation on a PCB, performing port allocation
@@ -993,8 +963,7 @@ in_pcbbind_setup(struct inpcb *inp, struct sockaddr_in *sin, in_addr_t *laddrp,
* XXX
* This entire block sorely needs a rewrite.
*/
- if (t &&
- ((inp->inp_flags2 & INP_BINDMULTI) == 0) &&
+ if (t != NULL &&
(so->so_type != SOCK_STREAM ||
ntohl(t->inp_faddr.s_addr) == INADDR_ANY) &&
(ntohl(sin->sin_addr.s_addr) != INADDR_ANY ||
@@ -1004,20 +973,10 @@ in_pcbbind_setup(struct inpcb *inp, struct sockaddr_in *sin, in_addr_t *laddrp,
(inp->inp_cred->cr_uid !=
t->inp_cred->cr_uid))
return (EADDRINUSE);
-
- /*
- * If the socket is a BINDMULTI socket, then
- * the credentials need to match and the
- * original socket also has to have been bound
- * with BINDMULTI.
- */
- if (t && (! in_pcbbind_check_bindmulti(inp, t)))
- return (EADDRINUSE);
}
t = in_pcblookup_local(pcbinfo, sin->sin_addr,
lport, lookupflags, cred);
- if (t && ((inp->inp_flags2 & INP_BINDMULTI) == 0) &&
- (reuseport & inp_so_options(t)) == 0 &&
+ if (t != NULL && (reuseport & inp_so_options(t)) == 0 &&
(reuseport_lb & inp_so_options(t)) == 0) {
#ifdef INET6
if (ntohl(sin->sin_addr.s_addr) !=
@@ -1028,8 +987,6 @@ in_pcbbind_setup(struct inpcb *inp, struct sockaddr_in *sin, in_addr_t *laddrp,
(t->inp_vflag & INP_IPV6PROTO) == 0)
#endif
return (EADDRINUSE);
- if (t && (! in_pcbbind_check_bindmulti(inp, t)))
- return (EADDRINUSE);
}
}
}