From: Philip Homburg Date: Fri, 17 Feb 2006 13:47:31 +0000 (+0000) Subject: improved tcp_acceptto. X-Git-Tag: v3.1.2a~337 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/ddns-confgen.html?a=commitdiff_plain;h=c367670fa88d5e14a9f7fcbae2c19026d882519e;p=minix.git improved tcp_acceptto. --- diff --git a/servers/inet/generic/tcp.c b/servers/inet/generic/tcp.c index f7cee644f..04b888ece 100644 --- a/servers/inet/generic/tcp.c +++ b/servers/inet/generic/tcp.c @@ -2247,6 +2247,7 @@ tcp_fd_t *tcp_fd; tcp_conn_t *tcp_conn; tcp_cookie_t *cookiep; acc_t *data; + tcp_cookie_t cookie; if (!(tcp_fd->tf_flags & TFF_LISTENQ)) { @@ -2272,11 +2273,13 @@ tcp_fd_t *tcp_fd; data= bf_packIffLess(data, sizeof(*cookiep)); cookiep= (tcp_cookie_t *)ptr2acc_data(data); + cookie= *cookiep; - dst_nr= cookiep->tc_ref; + bf_afree(data); data= NULL; + + dst_nr= cookie.tc_ref; if (dst_nr < 0 || dst_nr >= TCP_FD_NR) { - bf_afree(data); data= NULL; printf("tcp_acceptto: bad fd %d\n", dst_nr); tcp_reply_ioctl(tcp_fd, EINVAL); return NW_OK; @@ -2287,21 +2290,17 @@ tcp_fd_t *tcp_fd; dst_fd->tf_conn != NULL || !(dst_fd->tf_flags & TFF_COOKIE)) { - bf_afree(data); data= NULL; printf("tcp_acceptto: bad flags 0x%x or conn %p for fd %d\n", dst_fd->tf_flags, dst_fd->tf_conn, dst_nr); tcp_reply_ioctl(tcp_fd, EINVAL); return NW_OK; } - if (memcmp(cookiep, &dst_fd->tf_cookie, sizeof(*cookiep)) != 0) + if (memcmp(&cookie, &dst_fd->tf_cookie, sizeof(cookie)) != 0) { - bf_afree(data); data= NULL; printf("tcp_acceptto: bad cookie\n"); return NW_OK; } - bf_afree(data); data= NULL; - /* Move connection */ tcp_fd->tf_listenq[i]= NULL; tcp_conn->tc_fd= dst_fd;