summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorae <ae@FreeBSD.org>2014-09-10 13:17:35 +0000
committerae <ae@FreeBSD.org>2014-09-10 13:17:35 +0000
commit9186ea6a594a8833c5023330ae1b2fe8a83196a5 (patch)
tree514afc4a826494f8288a8d5ad364ad895d768b40
parent924d84a44cab6e8006fe21ab8b497cb85bf1e4cc (diff)
downloadFreeBSD-src-9186ea6a594a8833c5023330ae1b2fe8a83196a5.zip
FreeBSD-src-9186ea6a594a8833c5023330ae1b2fe8a83196a5.tar.gz
Make in6_pcblookup_hash_locked and in6_pcbladdr static.
Obtained from: Yandex LLC Sponsored by: Yandex LLC
-rw-r--r--sys/netinet/tcp_usrreq.c41
-rw-r--r--sys/netinet6/in6_pcb.c7
-rw-r--r--sys/netinet6/in6_pcb.h5
3 files changed, 9 insertions, 44 deletions
diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c
index 42c1e1d..22a160c 100644
--- a/sys/netinet/tcp_usrreq.c
+++ b/sys/netinet/tcp_usrreq.c
@@ -1160,10 +1160,7 @@ out:
static int
tcp6_connect(struct tcpcb *tp, struct sockaddr *nam, struct thread *td)
{
- struct inpcb *inp = tp->t_inpcb, *oinp;
- struct socket *so = inp->inp_socket;
- struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)nam;
- struct in6_addr addr6;
+ struct inpcb *inp = tp->t_inpcb;
int error;
INP_WLOCK_ASSERT(inp);
@@ -1174,39 +1171,9 @@ tcp6_connect(struct tcpcb *tp, struct sockaddr *nam, struct thread *td)
if (error)
goto out;
}
-
- /*
- * Cannot simply call in_pcbconnect, because there might be an
- * earlier incarnation of this same connection still in
- * TIME_WAIT state, creating an ADDRINUSE error.
- * in6_pcbladdr() also handles scope zone IDs.
- *
- * XXXRW: We wouldn't need to expose in6_pcblookup_hash_locked()
- * outside of in6_pcb.c if there were an in6_pcbconnect_setup().
- */
- error = in6_pcbladdr(inp, nam, &addr6);
- if (error)
- goto out;
- oinp = in6_pcblookup_hash_locked(inp->inp_pcbinfo,
- &sin6->sin6_addr, sin6->sin6_port,
- IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_laddr)
- ? &addr6
- : &inp->in6p_laddr,
- inp->inp_lport, 0, NULL);
- if (oinp) {
- error = EADDRINUSE;
+ error = in6_pcbconnect(inp, nam, td->td_ucred);
+ if (error != 0)
goto out;
- }
- if (IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_laddr))
- inp->in6p_laddr = addr6;
- inp->in6p_faddr = sin6->sin6_addr;
- inp->inp_fport = sin6->sin6_port;
- /* update flowinfo - draft-itojun-ipv6-flowlabel-api-00 */
- inp->inp_flow &= ~IPV6_FLOWLABEL_MASK;
- if (inp->inp_flags & IN6P_AUTOFLOWLABEL)
- inp->inp_flow |=
- (htonl(ip6_randomflowlabel()) & IPV6_FLOWLABEL_MASK);
- in_pcbrehash(inp);
INP_HASH_WUNLOCK(&V_tcbinfo);
/* Compute window scaling to request. */
@@ -1214,7 +1181,7 @@ tcp6_connect(struct tcpcb *tp, struct sockaddr *nam, struct thread *td)
(TCP_MAXWIN << tp->request_r_scale) < sb_max)
tp->request_r_scale++;
- soisconnecting(so);
+ soisconnecting(inp->inp_socket);
TCPSTAT_INC(tcps_connattempt);
tcp_state_change(tp, TCPS_SYN_SENT);
tp->iss = tcp_new_isn(tp);
diff --git a/sys/netinet6/in6_pcb.c b/sys/netinet6/in6_pcb.c
index 9b4246e..2be2e83 100644
--- a/sys/netinet6/in6_pcb.c
+++ b/sys/netinet6/in6_pcb.c
@@ -108,6 +108,9 @@ __FBSDID("$FreeBSD$");
#include <netinet6/in6_pcb.h>
#include <netinet6/scope6_var.h>
+static struct inpcb *in6_pcblookup_hash_locked(struct inpcbinfo *,
+ struct in6_addr *, u_int, struct in6_addr *, u_int, int, struct ifnet *);
+
int
in6_pcbbind(register struct inpcb *inp, struct sockaddr *nam,
struct ucred *cred)
@@ -319,7 +322,7 @@ in6_pcbbind(register struct inpcb *inp, struct sockaddr *nam,
* a bit of a kludge, but cleaning up the internal interfaces would
* have forced minor changes in every protocol).
*/
-int
+static int
in6_pcbladdr(register struct inpcb *inp, struct sockaddr *nam,
struct in6_addr *plocal_addr6)
{
@@ -1058,7 +1061,7 @@ found:
/*
* Lookup PCB in hash list.
*/
-struct inpcb *
+static struct inpcb *
in6_pcblookup_hash_locked(struct inpcbinfo *pcbinfo, struct in6_addr *faddr,
u_int fport_arg, struct in6_addr *laddr, u_int lport_arg,
int lookupflags, struct ifnet *ifp)
diff --git a/sys/netinet6/in6_pcb.h b/sys/netinet6/in6_pcb.h
index 19d151b..e758dac 100644
--- a/sys/netinet6/in6_pcb.h
+++ b/sys/netinet6/in6_pcb.h
@@ -86,7 +86,6 @@ int in6_pcbconnect(struct inpcb *, struct sockaddr *, struct ucred *);
int in6_pcbconnect_mbuf(struct inpcb *, struct sockaddr *,
struct ucred *, struct mbuf *);
void in6_pcbdisconnect(struct inpcb *);
-int in6_pcbladdr(struct inpcb *, struct sockaddr *, struct in6_addr *);
struct inpcb *
in6_pcblookup_local(struct inpcbinfo *,
struct in6_addr *, u_short, int,
@@ -96,10 +95,6 @@ struct inpcb *
u_int, struct in6_addr *, u_int, int,
struct ifnet *);
struct inpcb *
- in6_pcblookup_hash_locked(struct inpcbinfo *, struct in6_addr *,
- u_int, struct in6_addr *, u_int, int,
- struct ifnet *);
-struct inpcb *
in6_pcblookup_mbuf(struct inpcbinfo *, struct in6_addr *,
u_int, struct in6_addr *, u_int, int,
struct ifnet *ifp, struct mbuf *);
OpenPOWER on IntegriCloud