Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F131816146
D38356.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
8 KB
Referenced Files
None
Subscribers
None
D38356.id.diff
View Options
diff --git a/sys/netinet/in_pcb.h b/sys/netinet/in_pcb.h
--- a/sys/netinet/in_pcb.h
+++ b/sys/netinet/in_pcb.h
@@ -742,8 +742,9 @@
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 *, bool);
-int in_pcbconnect_setup(struct inpcb *, struct sockaddr *, in_addr_t *,
+int in_pcbconnect(struct inpcb *, struct sockaddr_in *, struct ucred *,
+ bool);
+int in_pcbconnect_setup(struct inpcb *, struct sockaddr_in *, in_addr_t *,
u_short *, in_addr_t *, u_short *, struct inpcb **,
struct ucred *);
void in_pcbdetach(struct inpcb *);
diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c
--- a/sys/netinet/in_pcb.c
+++ b/sys/netinet/in_pcb.c
@@ -1055,7 +1055,7 @@
* then pick one.
*/
int
-in_pcbconnect(struct inpcb *inp, struct sockaddr *nam, struct ucred *cred,
+in_pcbconnect(struct inpcb *inp, struct sockaddr_in *sin, struct ucred *cred,
bool rehash)
{
u_short lport, fport;
@@ -1068,7 +1068,7 @@
lport = inp->inp_lport;
laddr = inp->inp_laddr.s_addr;
anonport = (lport == 0);
- error = in_pcbconnect_setup(inp, nam, &laddr, &lport, &faddr, &fport,
+ error = in_pcbconnect_setup(inp, sin, &laddr, &lport, &faddr, &fport,
NULL, cred);
if (error)
return (error);
@@ -1327,11 +1327,10 @@
* is set to NULL.
*/
int
-in_pcbconnect_setup(struct inpcb *inp, struct sockaddr *nam,
+in_pcbconnect_setup(struct inpcb *inp, struct sockaddr_in *sin,
in_addr_t *laddrp, u_short *lportp, in_addr_t *faddrp, u_short *fportp,
struct inpcb **oinpp, struct ucred *cred)
{
- struct sockaddr_in *sin = (struct sockaddr_in *)nam;
struct in_ifaddr *ia;
struct inpcb *oinp;
struct in_addr laddr, faddr;
diff --git a/sys/netinet/tcp_syncache.c b/sys/netinet/tcp_syncache.c
--- a/sys/netinet/tcp_syncache.c
+++ b/sys/netinet/tcp_syncache.c
@@ -882,8 +882,7 @@
if (IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_laddr))
inp->in6p_laddr = sc->sc_inc.inc6_laddr;
INP_HASH_WLOCK(&V_tcbinfo);
- error = in6_pcbconnect(inp, (struct sockaddr *)&sin6,
- thread0.td_ucred, false);
+ error = in6_pcbconnect(inp, &sin6, thread0.td_ucred, false);
INP_HASH_WUNLOCK(&V_tcbinfo);
if (error != 0) {
inp->in6p_laddr = laddr6;
@@ -918,8 +917,7 @@
if (inp->inp_laddr.s_addr == INADDR_ANY)
inp->inp_laddr = sc->sc_inc.inc_laddr;
INP_HASH_WLOCK(&V_tcbinfo);
- error = in_pcbconnect(inp, (struct sockaddr *)&sin,
- thread0.td_ucred, false);
+ error = in_pcbconnect(inp, &sin, thread0.td_ucred, false);
INP_HASH_WUNLOCK(&V_tcbinfo);
if (error != 0) {
inp->inp_laddr = laddr;
diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c
--- a/sys/netinet/tcp_usrreq.c
+++ b/sys/netinet/tcp_usrreq.c
@@ -118,11 +118,11 @@
* TCP protocol interface to socket abstraction.
*/
#ifdef INET
-static int tcp_connect(struct tcpcb *, struct sockaddr *,
+static int tcp_connect(struct tcpcb *, struct sockaddr_in *,
struct thread *td);
#endif /* INET */
#ifdef INET6
-static int tcp6_connect(struct tcpcb *, struct sockaddr *,
+static int tcp6_connect(struct tcpcb *, struct sockaddr_in6 *,
struct thread *td);
#endif /* INET6 */
static void tcp_disconnect(struct tcpcb *);
@@ -482,7 +482,7 @@
}
tp = intotcpcb(inp);
NET_EPOCH_ENTER(et);
- if ((error = tcp_connect(tp, nam, td)) != 0)
+ if ((error = tcp_connect(tp, sinp, td)) != 0)
goto out_in_epoch;
#ifdef TCP_OFFLOAD
if (registered_toedevs > 0 &&
@@ -574,7 +574,7 @@
inp->inp_vflag |= INP_IPV4;
inp->inp_vflag &= ~INP_IPV6;
NET_EPOCH_ENTER(et);
- if ((error = tcp_connect(tp, (struct sockaddr *)&sin, td)) != 0)
+ if ((error = tcp_connect(tp, &sin, td)) != 0)
goto out_in_epoch;
#ifdef TCP_OFFLOAD
if (registered_toedevs > 0 &&
@@ -597,7 +597,7 @@
inp->inp_vflag |= INP_IPV6;
inp->inp_inc.inc_flags |= INC_ISIPV6;
NET_EPOCH_ENTER(et);
- if ((error = tcp6_connect(tp, nam, td)) != 0)
+ if ((error = tcp6_connect(tp, sin6, td)) != 0)
goto out_in_epoch;
#ifdef TCP_OFFLOAD
if (registered_toedevs > 0 &&
@@ -864,6 +864,7 @@
struct sockaddr_in *sinp;
#endif
#ifdef INET6
+ struct sockaddr_in6 *sin6;
int isipv6;
#endif
u_int8_t incflagsav;
@@ -934,9 +935,6 @@
#endif /* INET */
#ifdef INET6
case AF_INET6:
- {
- struct sockaddr_in6 *sin6;
-
sin6 = (struct sockaddr_in6 *)nam;
if (sin6->sin6_len != sizeof(*sin6)) {
error = EINVAL;
@@ -991,7 +989,6 @@
isipv6 = 1;
}
break;
- }
#endif /* INET6 */
default:
error = EAFNOSUPPORT;
@@ -1014,14 +1011,13 @@
*/
#ifdef INET6
if (isipv6)
- error = tcp6_connect(tp, nam, td);
+ error = tcp6_connect(tp, sin6, td);
#endif /* INET6 */
#if defined(INET6) && defined(INET)
else
#endif
#ifdef INET
- error = tcp_connect(tp,
- (struct sockaddr *)sinp, td);
+ error = tcp_connect(tp, sinp, td);
#endif
/*
* The bind operation in tcp_connect succeeded. We
@@ -1106,14 +1102,13 @@
tp->t_flags &= ~TF_FASTOPEN;
#ifdef INET6
if (isipv6)
- error = tcp6_connect(tp, nam, td);
+ error = tcp6_connect(tp, sin6, td);
#endif /* INET6 */
#if defined(INET6) && defined(INET)
else
#endif
#ifdef INET
- error = tcp_connect(tp,
- (struct sockaddr *)sinp, td);
+ error = tcp_connect(tp, sinp, td);
#endif
/*
* The bind operation in tcp_connect succeeded. We
@@ -1401,7 +1396,7 @@
* Initialize connection parameters and enter SYN-SENT state.
*/
static int
-tcp_connect(struct tcpcb *tp, struct sockaddr *nam, struct thread *td)
+tcp_connect(struct tcpcb *tp, struct sockaddr_in *sin, struct thread *td)
{
struct inpcb *inp = tptoinpcb(tp), *oinp;
struct socket *so = tptosocket(tp);
@@ -1420,7 +1415,7 @@
*/
laddr = inp->inp_laddr;
lport = inp->inp_lport;
- error = in_pcbconnect_setup(inp, nam, &laddr.s_addr, &lport,
+ error = in_pcbconnect_setup(inp, sin, &laddr.s_addr, &lport,
&inp->inp_faddr.s_addr, &inp->inp_fport, &oinp, td->td_ucred);
if (error && oinp == NULL)
goto out;
@@ -1468,7 +1463,7 @@
#ifdef INET6
static int
-tcp6_connect(struct tcpcb *tp, struct sockaddr *nam, struct thread *td)
+tcp6_connect(struct tcpcb *tp, struct sockaddr_in6 *sin6, struct thread *td)
{
struct inpcb *inp = tptoinpcb(tp);
struct epoch_tracker et;
@@ -1478,7 +1473,7 @@
NET_EPOCH_ENTER(et);
INP_HASH_WLOCK(&V_tcbinfo);
- error = in6_pcbconnect(inp, nam, td->td_ucred, true);
+ error = in6_pcbconnect(inp, sin6, td->td_ucred, true);
INP_HASH_WUNLOCK(&V_tcbinfo);
NET_EPOCH_EXIT(et);
if (error != 0)
diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c
--- a/sys/netinet/udp_usrreq.c
+++ b/sys/netinet/udp_usrreq.c
@@ -1252,7 +1252,7 @@
sin->sin_addr.s_addr == INADDR_ANY ||
sin->sin_addr.s_addr == INADDR_BROADCAST) {
INP_HASH_WLOCK(pcbinfo);
- error = in_pcbconnect_setup(inp, addr, &laddr.s_addr,
+ error = in_pcbconnect_setup(inp, sin, &laddr.s_addr,
&lport, &faddr.s_addr, &fport, NULL,
td->td_ucred);
if (error) {
@@ -1603,7 +1603,7 @@
}
NET_EPOCH_ENTER(et);
INP_HASH_WLOCK(pcbinfo);
- error = in_pcbconnect(inp, nam, td->td_ucred, true);
+ error = in_pcbconnect(inp, sin, td->td_ucred, true);
INP_HASH_WUNLOCK(pcbinfo);
NET_EPOCH_EXIT(et);
if (error == 0)
diff --git a/sys/netinet6/in6_pcb.h b/sys/netinet6/in6_pcb.h
--- a/sys/netinet6/in6_pcb.h
+++ b/sys/netinet6/in6_pcb.h
@@ -74,7 +74,8 @@
void in6_pcbpurgeif0(struct inpcbinfo *, struct ifnet *);
void in6_losing(struct inpcb *);
int in6_pcbbind(struct inpcb *, struct sockaddr *, struct ucred *);
-int in6_pcbconnect(struct inpcb *, struct sockaddr *, struct ucred *, bool);
+int in6_pcbconnect(struct inpcb *, struct sockaddr_in6 *, struct ucred *,
+ bool);
void in6_pcbdisconnect(struct inpcb *);
struct inpcb *
in6_pcblookup_local(struct inpcbinfo *,
diff --git a/sys/netinet6/in6_pcb.c b/sys/netinet6/in6_pcb.c
--- a/sys/netinet6/in6_pcb.c
+++ b/sys/netinet6/in6_pcb.c
@@ -412,11 +412,10 @@
* then pick one.
*/
int
-in6_pcbconnect(struct inpcb *inp, struct sockaddr *nam, struct ucred *cred,
+in6_pcbconnect(struct inpcb *inp, struct sockaddr_in6 *sin6, struct ucred *cred,
bool rehash)
{
struct inpcbinfo *pcbinfo = inp->inp_pcbinfo;
- struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)nam;
struct sockaddr_in6 laddr6;
int error;
diff --git a/sys/netinet6/udp6_usrreq.c b/sys/netinet6/udp6_usrreq.c
--- a/sys/netinet6/udp6_usrreq.c
+++ b/sys/netinet6/udp6_usrreq.c
@@ -1147,8 +1147,7 @@
inp->inp_vflag &= ~INP_IPV6;
NET_EPOCH_ENTER(et);
INP_HASH_WLOCK(pcbinfo);
- error = in_pcbconnect(inp, (struct sockaddr *)&sin,
- td->td_ucred, true);
+ error = in_pcbconnect(inp, &sin, td->td_ucred, true);
INP_HASH_WUNLOCK(pcbinfo);
NET_EPOCH_EXIT(et);
/*
@@ -1181,7 +1180,7 @@
inp->inp_vflag |= INP_IPV6;
NET_EPOCH_ENTER(et);
INP_HASH_WLOCK(pcbinfo);
- error = in6_pcbconnect(inp, nam, td->td_ucred, true);
+ error = in6_pcbconnect(inp, sin6, td->td_ucred, true);
INP_HASH_WUNLOCK(pcbinfo);
NET_EPOCH_EXIT(et);
/*
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Oct 12, 10:03 AM (13 h, 58 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
23603665
Default Alt Text
D38356.id.diff (8 KB)
Attached To
Mode
D38356: inpcb: use family specific sockaddr argument for connect functions
Attached
Detach File
Event Timeline
Log In to Comment