Print this page
3065 some functions in the tcp module can be static

*** 52,67 **** static int tcp_bind(sock_lower_handle_t, struct sockaddr *, socklen_t, cred_t *); static int tcp_listen(sock_lower_handle_t, int, cred_t *); static int tcp_connect(sock_lower_handle_t, const struct sockaddr *, socklen_t, sock_connid_t *, cred_t *); static int tcp_getsockopt(sock_lower_handle_t, int, int, void *, socklen_t *, cred_t *); static int tcp_setsockopt(sock_lower_handle_t, int, int, const void *, socklen_t, cred_t *); static int tcp_sendmsg(sock_lower_handle_t, mblk_t *, struct nmsghdr *, ! cred_t *cr); static int tcp_shutdown(sock_lower_handle_t, int, cred_t *); static void tcp_clr_flowctrl(sock_lower_handle_t); static int tcp_ioctl(sock_lower_handle_t, int, intptr_t, int, int32_t *, cred_t *); static int tcp_close(sock_lower_handle_t, int, cred_t *); --- 52,71 ---- static int tcp_bind(sock_lower_handle_t, struct sockaddr *, socklen_t, cred_t *); static int tcp_listen(sock_lower_handle_t, int, cred_t *); static int tcp_connect(sock_lower_handle_t, const struct sockaddr *, socklen_t, sock_connid_t *, cred_t *); + static int tcp_getpeername(sock_lower_handle_t, struct sockaddr *, + socklen_t *, cred_t *); + static int tcp_getsockname(sock_lower_handle_t, struct sockaddr *, + socklen_t *, cred_t *); static int tcp_getsockopt(sock_lower_handle_t, int, int, void *, socklen_t *, cred_t *); static int tcp_setsockopt(sock_lower_handle_t, int, int, const void *, socklen_t, cred_t *); static int tcp_sendmsg(sock_lower_handle_t, mblk_t *, struct nmsghdr *, ! cred_t *); static int tcp_shutdown(sock_lower_handle_t, int, cred_t *); static void tcp_clr_flowctrl(sock_lower_handle_t); static int tcp_ioctl(sock_lower_handle_t, int, intptr_t, int, int32_t *, cred_t *); static int tcp_close(sock_lower_handle_t, int, cred_t *);
*** 129,138 **** --- 133,145 ---- cred_t *cr) { conn_t *lconnp, *econnp; tcp_t *listener, *eager; + /* All Solaris components should pass a cred for this operation. */ + ASSERT(cr != NULL); + /* * KSSL can move a socket from one listener to another, in which * case `lproto_handle' points to the new listener. To ensure that * the original listener is used the information is obtained from * the eager.
*** 332,342 **** return ((error == 0) ? EINPROGRESS : error); } /* ARGSUSED3 */ ! int tcp_getpeername(sock_lower_handle_t proto_handle, struct sockaddr *addr, socklen_t *addrlenp, cred_t *cr) { conn_t *connp = (conn_t *)proto_handle; tcp_t *tcp = connp->conn_tcp; --- 339,349 ---- return ((error == 0) ? EINPROGRESS : error); } /* ARGSUSED3 */ ! static int tcp_getpeername(sock_lower_handle_t proto_handle, struct sockaddr *addr, socklen_t *addrlenp, cred_t *cr) { conn_t *connp = (conn_t *)proto_handle; tcp_t *tcp = connp->conn_tcp;
*** 350,360 **** return (conn_getpeername(connp, addr, addrlenp)); } /* ARGSUSED3 */ ! int tcp_getsockname(sock_lower_handle_t proto_handle, struct sockaddr *addr, socklen_t *addrlenp, cred_t *cr) { conn_t *connp = (conn_t *)proto_handle; --- 357,367 ---- return (conn_getpeername(connp, addr, addrlenp)); } /* ARGSUSED3 */ ! static int tcp_getsockname(sock_lower_handle_t proto_handle, struct sockaddr *addr, socklen_t *addrlenp, cred_t *cr) { conn_t *connp = (conn_t *)proto_handle;
*** 375,384 **** --- 382,394 ---- void *optvalp_buf; int len; ASSERT(connp->conn_upper_handle != NULL); + /* All Solaris components should pass a cred for this operation. */ + ASSERT(cr != NULL); + error = proto_opt_check(level, option_name, *optlen, &max_optbuf_len, tcp_opt_obj.odb_opt_des_arr, tcp_opt_obj.odb_opt_arr_cnt, B_FALSE, B_TRUE, cr); if (error != 0) {
*** 422,431 **** --- 432,445 ---- { conn_t *connp = (conn_t *)proto_handle; int error; ASSERT(connp->conn_upper_handle != NULL); + + /* All Solaris components should pass a cred for this operation. */ + ASSERT(cr != NULL); + /* * Entering the squeue synchronously can result in a context switch, * which can cause a rather sever performance degradation. So we try to * handle whatever options we can without entering the squeue. */
*** 750,759 **** --- 764,774 ---- tcp_create(int family, int type, int proto, sock_downcalls_t **sock_downcalls, uint_t *smodep, int *errorp, int flags, cred_t *credp) { conn_t *connp; boolean_t isv6 = family == AF_INET6; + if (type != SOCK_STREAM || (family != AF_INET && family != AF_INET6) || (proto != 0 && proto != IPPROTO_TCP)) { *errorp = EPROTONOSUPPORT; return (NULL); }
*** 763,773 **** return (NULL); } /* * Put the ref for TCP. Ref for IP was already put ! * by ipcl_conn_create. Also Make the conn_t globally * visible to walkers */ mutex_enter(&connp->conn_lock); CONN_INC_REF_LOCKED(connp); ASSERT(connp->conn_ref == 2); --- 778,788 ---- return (NULL); } /* * Put the ref for TCP. Ref for IP was already put ! * by ipcl_conn_create. Also make the conn_t globally * visible to walkers */ mutex_enter(&connp->conn_lock); CONN_INC_REF_LOCKED(connp); ASSERT(connp->conn_ref == 2);