summaryrefslogtreecommitdiff
path: root/sys/netinet/tcp_usrreq.c
diff options
context:
space:
mode:
authorJonathan Lemon <jlemon@FreeBSD.org>2001-03-12 02:57:42 +0000
committerJonathan Lemon <jlemon@FreeBSD.org>2001-03-12 02:57:42 +0000
commit1db24ffb98a74acab6daaddc9445870f4a069dc9 (patch)
tree539d208b8debade8b08e28523638bd92a72c8351 /sys/netinet/tcp_usrreq.c
parentda3badcd237dbb9cb4395c1cf7cabadc5c591daa (diff)
Notes
Diffstat (limited to 'sys/netinet/tcp_usrreq.c')
-rw-r--r--sys/netinet/tcp_usrreq.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c
index 2b76f982eaba..ecd84a92479e 100644
--- a/sys/netinet/tcp_usrreq.c
+++ b/sys/netinet/tcp_usrreq.c
@@ -101,7 +101,7 @@ static struct tcpcb *
tcp_usrclosed __P((struct tcpcb *));
#ifdef TCPDEBUG
-#define TCPDEBUG0 int ostate
+#define TCPDEBUG0 int ostate = 0
#define TCPDEBUG1() ostate = tp ? tp->t_state : 0
#define TCPDEBUG2(req) if (tp && (so->so_options & SO_DEBUG)) \
tcp_trace(TA_USER, ostate, tp, 0, 0, req)
@@ -417,13 +417,19 @@ tcp_usr_accept(struct socket *so, struct sockaddr **nam)
int s = splnet();
int error = 0;
struct inpcb *inp = sotoinpcb(so);
- struct tcpcb *tp;
+ struct tcpcb *tp = NULL;
+ TCPDEBUG0;
if (so->so_state & SS_ISDISCONNECTED) {
error = ECONNABORTED;
goto out;
}
- COMMON_START();
+ if (inp == 0) {
+ splx(s);
+ return (EINVAL);
+ }
+ tp = intotcpcb(inp);
+ TCPDEBUG1();
in_setpeeraddr(so, nam);
COMMON_END(PRU_ACCEPT);
}
@@ -435,13 +441,19 @@ tcp6_usr_accept(struct socket *so, struct sockaddr **nam)
int s = splnet();
int error = 0;
struct inpcb *inp = sotoinpcb(so);
- struct tcpcb *tp;
+ struct tcpcb *tp = NULL;
+ TCPDEBUG0;
if (so->so_state & SS_ISDISCONNECTED) {
error = ECONNABORTED;
goto out;
}
- COMMON_START();
+ if (inp == 0) {
+ splx(s);
+ return (EINVAL);
+ }
+ tp = intotcpcb(inp);
+ TCPDEBUG1();
in6_mapped_peeraddr(so, nam);
COMMON_END(PRU_ACCEPT);
}