inpcb: reduce some aliased functions after removal of PCBGROUP.
Reviewed by: rrs Differential revision: https://reviews.freebsd.org/D33021
This commit is contained in:
parent
93c67567e0
commit
565655f4e3
@ -1072,8 +1072,8 @@ in_pcbbind_setup(struct inpcb *inp, struct sockaddr *nam, in_addr_t *laddrp,
|
|||||||
* then pick one.
|
* then pick one.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
in_pcbconnect_mbuf(struct inpcb *inp, struct sockaddr *nam,
|
in_pcbconnect(struct inpcb *inp, struct sockaddr *nam, struct ucred *cred,
|
||||||
struct ucred *cred, struct mbuf *m, bool rehash)
|
bool rehash)
|
||||||
{
|
{
|
||||||
u_short lport, fport;
|
u_short lport, fport;
|
||||||
in_addr_t laddr, faddr;
|
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_faddr.s_addr = faddr;
|
||||||
inp->inp_fport = fport;
|
inp->inp_fport = fport;
|
||||||
if (rehash) {
|
if (rehash) {
|
||||||
in_pcbrehash_mbuf(inp, m);
|
in_pcbrehash(inp);
|
||||||
} else {
|
} else {
|
||||||
in_pcbinshash_mbuf(inp, m);
|
in_pcbinshash(inp);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (anonport)
|
if (anonport)
|
||||||
@ -1119,13 +1119,6 @@ in_pcbconnect_mbuf(struct inpcb *inp, struct sockaddr *nam,
|
|||||||
return (0);
|
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
|
* Do proper source address selection on an unbound socket in case
|
||||||
* of connect. Take jails into account as well.
|
* 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.
|
* Insert PCB onto various hash lists.
|
||||||
*/
|
*/
|
||||||
static int
|
int
|
||||||
in_pcbinshash_internal(struct inpcb *inp, struct mbuf *m)
|
in_pcbinshash(struct inpcb *inp)
|
||||||
{
|
{
|
||||||
struct inpcbhead *pcbhash;
|
struct inpcbhead *pcbhash;
|
||||||
struct inpcbporthead *pcbporthash;
|
struct inpcbporthead *pcbporthash;
|
||||||
@ -2355,20 +2348,6 @@ in_pcbinshash_internal(struct inpcb *inp, struct mbuf *m)
|
|||||||
return (0);
|
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
|
* 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
|
* 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.
|
* not change after in_pcbinshash() has been called.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
in_pcbrehash_mbuf(struct inpcb *inp, struct mbuf *m)
|
in_pcbrehash(struct inpcb *inp)
|
||||||
{
|
{
|
||||||
struct inpcbinfo *pcbinfo = inp->inp_pcbinfo;
|
struct inpcbinfo *pcbinfo = inp->inp_pcbinfo;
|
||||||
struct inpcbhead *head;
|
struct inpcbhead *head;
|
||||||
@ -2402,13 +2381,6 @@ in_pcbrehash_mbuf(struct inpcb *inp, struct mbuf *m)
|
|||||||
CK_LIST_INSERT_HEAD(head, inp, inp_hash);
|
CK_LIST_INSERT_HEAD(head, inp, inp_hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
in_pcbrehash(struct inpcb *inp)
|
|
||||||
{
|
|
||||||
|
|
||||||
in_pcbrehash_mbuf(inp, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Remove PCB from various lists.
|
* 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(struct inpcb *, struct sockaddr *, struct ucred *);
|
||||||
int in_pcbbind_setup(struct inpcb *, struct sockaddr *, in_addr_t *,
|
int in_pcbbind_setup(struct inpcb *, struct sockaddr *, in_addr_t *,
|
||||||
u_short *, struct ucred *);
|
u_short *, struct ucred *);
|
||||||
int in_pcbconnect(struct inpcb *, struct sockaddr *, struct ucred *);
|
int in_pcbconnect(struct inpcb *, struct sockaddr *, struct ucred *, bool);
|
||||||
int in_pcbconnect_mbuf(struct inpcb *, struct sockaddr *, struct ucred *,
|
|
||||||
struct mbuf *, bool);
|
|
||||||
int in_pcbconnect_setup(struct inpcb *, struct sockaddr *, in_addr_t *,
|
int in_pcbconnect_setup(struct inpcb *, struct sockaddr *, in_addr_t *,
|
||||||
u_short *, in_addr_t *, u_short *, struct inpcb **,
|
u_short *, in_addr_t *, u_short *, struct inpcb **,
|
||||||
struct ucred *);
|
struct ucred *);
|
||||||
@ -777,7 +775,6 @@ void in_pcbdisconnect(struct inpcb *);
|
|||||||
void in_pcbdrop(struct inpcb *);
|
void in_pcbdrop(struct inpcb *);
|
||||||
void in_pcbfree(struct inpcb *);
|
void in_pcbfree(struct inpcb *);
|
||||||
int in_pcbinshash(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 *,
|
int in_pcbladdr(struct inpcb *, struct in_addr *, struct in_addr *,
|
||||||
struct ucred *);
|
struct ucred *);
|
||||||
int in_pcblbgroup_numa(struct inpcb *, int arg);
|
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));
|
int, struct inpcb *(*)(struct inpcb *, int));
|
||||||
void in_pcbref(struct inpcb *);
|
void in_pcbref(struct inpcb *);
|
||||||
void in_pcbrehash(struct inpcb *);
|
void in_pcbrehash(struct inpcb *);
|
||||||
void in_pcbrehash_mbuf(struct inpcb *, struct mbuf *);
|
|
||||||
int in_pcbrele_rlocked(struct inpcb *);
|
int in_pcbrele_rlocked(struct inpcb *);
|
||||||
int in_pcbrele_wlocked(struct inpcb *);
|
int in_pcbrele_wlocked(struct inpcb *);
|
||||||
void in_losing(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;
|
laddr = inp->inp_laddr;
|
||||||
if (inp->inp_laddr.s_addr == INADDR_ANY)
|
if (inp->inp_laddr.s_addr == INADDR_ANY)
|
||||||
inp->inp_laddr = sc->sc_inc.inc_laddr;
|
inp->inp_laddr = sc->sc_inc.inc_laddr;
|
||||||
if ((error = in_pcbconnect_mbuf(inp, (struct sockaddr *)&sin,
|
if ((error = in_pcbconnect(inp, (struct sockaddr *)&sin,
|
||||||
thread0.td_ucred, m, false)) != 0) {
|
thread0.td_ucred, false)) != 0) {
|
||||||
inp->inp_laddr = laddr;
|
inp->inp_laddr = laddr;
|
||||||
if ((s = tcp_log_addrs(&sc->sc_inc, NULL, NULL, NULL))) {
|
if ((s = tcp_log_addrs(&sc->sc_inc, NULL, NULL, NULL))) {
|
||||||
log(LOG_DEBUG, "%s; %s: in_pcbconnect failed "
|
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);
|
NET_EPOCH_ENTER(et);
|
||||||
INP_HASH_WLOCK(pcbinfo);
|
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);
|
INP_HASH_WUNLOCK(pcbinfo);
|
||||||
NET_EPOCH_EXIT(et);
|
NET_EPOCH_EXIT(et);
|
||||||
if (error == 0)
|
if (error == 0)
|
||||||
|
@ -516,9 +516,9 @@ in6_pcbconnect_mbuf(struct inpcb *inp, struct sockaddr *nam,
|
|||||||
(htonl(ip6_randomflowlabel()) & IPV6_FLOWLABEL_MASK);
|
(htonl(ip6_randomflowlabel()) & IPV6_FLOWLABEL_MASK);
|
||||||
|
|
||||||
if (rehash) {
|
if (rehash) {
|
||||||
in_pcbrehash_mbuf(inp, m);
|
in_pcbrehash(inp);
|
||||||
} else {
|
} else {
|
||||||
in_pcbinshash_mbuf(inp, m);
|
in_pcbinshash(inp);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
|
@ -1215,7 +1215,7 @@ udp6_connect(struct socket *so, struct sockaddr *nam, struct thread *td)
|
|||||||
NET_EPOCH_ENTER(et);
|
NET_EPOCH_ENTER(et);
|
||||||
INP_HASH_WLOCK(pcbinfo);
|
INP_HASH_WLOCK(pcbinfo);
|
||||||
error = in_pcbconnect(inp, (struct sockaddr *)&sin,
|
error = in_pcbconnect(inp, (struct sockaddr *)&sin,
|
||||||
td->td_ucred);
|
td->td_ucred, true);
|
||||||
INP_HASH_WUNLOCK(pcbinfo);
|
INP_HASH_WUNLOCK(pcbinfo);
|
||||||
NET_EPOCH_EXIT(et);
|
NET_EPOCH_EXIT(et);
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user