Commit 565655f4 authored by Gleb Smirnoff's avatar Gleb Smirnoff
Browse files

inpcb: reduce some aliased functions after removal of PCBGROUP.

Reviewed by:		rrs
Differential revision:	https://reviews.freebsd.org/D33021
parent 93c67567
......@@ -1072,8 +1072,8 @@ in_pcbbind_setup(struct inpcb *inp, struct sockaddr *nam, in_addr_t *laddrp,
* then pick one.
*/
int
in_pcbconnect_mbuf(struct inpcb *inp, struct sockaddr *nam,
struct ucred *cred, struct mbuf *m, bool rehash)
in_pcbconnect(struct inpcb *inp, struct sockaddr *nam, struct ucred *cred,
bool rehash)
{
u_short lport, fport;
in_addr_t laddr, faddr;
......@@ -1109,9 +1109,9 @@ in_pcbconnect_mbuf(struct inpcb *inp, struct sockaddr *nam,
inp->inp_faddr.s_addr = faddr;
inp->inp_fport = fport;
if (rehash) {
in_pcbrehash_mbuf(inp, m);
in_pcbrehash(inp);
} else {
in_pcbinshash_mbuf(inp, m);
in_pcbinshash(inp);
}
if (anonport)
......@@ -1119,13 +1119,6 @@ in_pcbconnect_mbuf(struct inpcb *inp, struct sockaddr *nam,
return (0);
}
int
in_pcbconnect(struct inpcb *inp, struct sockaddr *nam, struct ucred *cred)
{
return (in_pcbconnect_mbuf(inp, nam, cred, NULL, true));
}
/*
* Do proper source address selection on an unbound socket in case
* of connect. Take jails into account as well.
......@@ -2285,8 +2278,8 @@ in_pcblookup_mbuf(struct inpcbinfo *pcbinfo, struct in_addr faddr,
/*
* Insert PCB onto various hash lists.
*/
static int
in_pcbinshash_internal(struct inpcb *inp, struct mbuf *m)
int
in_pcbinshash(struct inpcb *inp)
{
struct inpcbhead *pcbhash;
struct inpcbporthead *pcbporthash;
......@@ -2355,20 +2348,6 @@ in_pcbinshash_internal(struct inpcb *inp, struct mbuf *m)
return (0);
}
int
in_pcbinshash(struct inpcb *inp)
{
return (in_pcbinshash_internal(inp, NULL));
}
int
in_pcbinshash_mbuf(struct inpcb *inp, struct mbuf *m)
{
return (in_pcbinshash_internal(inp, m));
}
/*
* Move PCB to the proper hash bucket when { faddr, fport } have been
* changed. NOTE: This does not handle the case of the lport changing (the
......@@ -2376,7 +2355,7 @@ in_pcbinshash_mbuf(struct inpcb *inp, struct mbuf *m)
* not change after in_pcbinshash() has been called.
*/
void
in_pcbrehash_mbuf(struct inpcb *inp, struct mbuf *m)
in_pcbrehash(struct inpcb *inp)
{
struct inpcbinfo *pcbinfo = inp->inp_pcbinfo;
struct inpcbhead *head;
......@@ -2402,13 +2381,6 @@ in_pcbrehash_mbuf(struct inpcb *inp, struct mbuf *m)
CK_LIST_INSERT_HEAD(head, inp, inp_hash);
}
void
in_pcbrehash(struct inpcb *inp)
{
in_pcbrehash_mbuf(inp, NULL);
}
/*
* Remove PCB from various lists.
*/
......
......@@ -766,9 +766,7 @@ int in_pcballoc(struct socket *, struct inpcbinfo *);
int in_pcbbind(struct inpcb *, struct sockaddr *, struct ucred *);
int in_pcbbind_setup(struct inpcb *, struct sockaddr *, in_addr_t *,
u_short *, struct ucred *);
int in_pcbconnect(struct inpcb *, struct sockaddr *, struct ucred *);
int in_pcbconnect_mbuf(struct inpcb *, struct sockaddr *, struct ucred *,
struct mbuf *, bool);
int in_pcbconnect(struct inpcb *, struct sockaddr *, struct ucred *, bool);
int in_pcbconnect_setup(struct inpcb *, struct sockaddr *, in_addr_t *,
u_short *, in_addr_t *, u_short *, struct inpcb **,
struct ucred *);
......@@ -777,7 +775,6 @@ void in_pcbdisconnect(struct inpcb *);
void in_pcbdrop(struct inpcb *);
void in_pcbfree(struct inpcb *);
int in_pcbinshash(struct inpcb *);
int in_pcbinshash_mbuf(struct inpcb *, struct mbuf *);
int in_pcbladdr(struct inpcb *, struct in_addr *, struct in_addr *,
struct ucred *);
int in_pcblbgroup_numa(struct inpcb *, int arg);
......@@ -791,7 +788,6 @@ void in_pcbnotifyall(struct inpcbinfo *pcbinfo, struct in_addr,
int, struct inpcb *(*)(struct inpcb *, int));
void in_pcbref(struct inpcb *);
void in_pcbrehash(struct inpcb *);
void in_pcbrehash_mbuf(struct inpcb *, struct mbuf *);
int in_pcbrele_rlocked(struct inpcb *);
int in_pcbrele_wlocked(struct inpcb *);
void in_losing(struct inpcb *);
......
......@@ -943,8 +943,8 @@ syncache_socket(struct syncache *sc, struct socket *lso, struct mbuf *m)
laddr = inp->inp_laddr;
if (inp->inp_laddr.s_addr == INADDR_ANY)
inp->inp_laddr = sc->sc_inc.inc_laddr;
if ((error = in_pcbconnect_mbuf(inp, (struct sockaddr *)&sin,
thread0.td_ucred, m, false)) != 0) {
if ((error = in_pcbconnect(inp, (struct sockaddr *)&sin,
thread0.td_ucred, false)) != 0) {
inp->inp_laddr = laddr;
if ((s = tcp_log_addrs(&sc->sc_inc, NULL, NULL, NULL))) {
log(LOG_DEBUG, "%s; %s: in_pcbconnect failed "
......
......@@ -1697,7 +1697,7 @@ udp_connect(struct socket *so, struct sockaddr *nam, struct thread *td)
}
NET_EPOCH_ENTER(et);
INP_HASH_WLOCK(pcbinfo);
error = in_pcbconnect(inp, nam, td->td_ucred);
error = in_pcbconnect(inp, nam, td->td_ucred, true);
INP_HASH_WUNLOCK(pcbinfo);
NET_EPOCH_EXIT(et);
if (error == 0)
......
......@@ -516,9 +516,9 @@ in6_pcbconnect_mbuf(struct inpcb *inp, struct sockaddr *nam,
(htonl(ip6_randomflowlabel()) & IPV6_FLOWLABEL_MASK);
if (rehash) {
in_pcbrehash_mbuf(inp, m);
in_pcbrehash(inp);
} else {
in_pcbinshash_mbuf(inp, m);
in_pcbinshash(inp);
}
return (0);
......
......@@ -1215,7 +1215,7 @@ udp6_connect(struct socket *so, struct sockaddr *nam, struct thread *td)
NET_EPOCH_ENTER(et);
INP_HASH_WLOCK(pcbinfo);
error = in_pcbconnect(inp, (struct sockaddr *)&sin,
td->td_ucred);
td->td_ucred, true);
INP_HASH_WUNLOCK(pcbinfo);
NET_EPOCH_EXIT(et);
/*
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment