Lines Matching refs:connp

143 static void	udp_icmp_error_ipv6(conn_t *connp, mblk_t *mp,
156 int udp_opt_set(conn_t *connp, uint_t optset_context,
160 int udp_opt_get(conn_t *connp, int level, int name,
162 static int udp_output_connected(conn_t *connp, mblk_t *mp, cred_t *cr,
164 static int udp_output_lastdst(conn_t *connp, mblk_t *mp, cred_t *cr,
166 static int udp_output_newdst(conn_t *connp, mblk_t *data_mp, sin_t *sin,
394 conn_t *connp = udp->udp_connp; in udp_bind_hash_remove() local
403 ASSERT(connp->conn_lport != 0); in udp_bind_hash_remove()
405 lockp = &us->us_bind_fanout[UDP_BIND_HASH(connp->conn_lport, in udp_bind_hash_remove()
427 conn_t *connp = udp->udp_connp; in udp_bind_hash_insert() local
447 if (V6_OR_V4_INADDR_ANY(connp->conn_bound_addr_v6) && in udp_bind_hash_insert()
485 conn_t *connp; in udp_tpi_bind() local
505 connp = Q_TO_CONN(q); in udp_tpi_bind()
506 udp = connp->conn_udp; in udp_tpi_bind()
539 if (connp->conn_family == AF_INET) { in udp_tpi_bind()
547 ASSERT(connp->conn_family == AF_INET6); in udp_tpi_bind()
564 if (connp->conn_family != AF_INET || in udp_tpi_bind()
578 if (connp->conn_family != AF_INET6 || in udp_tpi_bind()
592 error = udp_do_bind(connp, sa, tbr->ADDR_length, cr, in udp_tpi_bind()
619 conn_t *connp = Q_TO_CONN(q); in udp_tpi_connect() local
676 error = proto_verify_ip_addr(connp->conn_family, sa, len); in udp_tpi_connect()
682 error = udp_do_connect(connp, sa, len, cr, pid); in udp_tpi_connect()
694 if (connp->conn_family == AF_INET) { in udp_tpi_connect()
716 putnext(connp->conn_rq, mp); in udp_tpi_connect()
717 putnext(connp->conn_rq, mp1); in udp_tpi_connect()
724 conn_t *connp; in udp_tpi_close() local
736 connp = Q_TO_CONN(q); in udp_tpi_close()
737 udp_do_close(connp); in udp_tpi_close()
744 udp_close_free(conn_t *connp) in udp_close_free() argument
746 udp_t *udp = connp->conn_udp; in udp_close_free()
758 ASSERT(udp->udp_connp == connp); in udp_close_free()
760 udp->udp_connp = connp; in udp_close_free()
764 udp_do_disconnect(conn_t *connp) in udp_do_disconnect() argument
771 udp = connp->conn_udp; in udp_do_disconnect()
773 mutex_enter(&connp->conn_lock); in udp_do_disconnect()
775 mutex_exit(&connp->conn_lock); in udp_do_disconnect()
778 udpf = &us->us_bind_fanout[UDP_BIND_HASH(connp->conn_lport, in udp_do_disconnect()
781 if (connp->conn_mcbc_bind) in udp_do_disconnect()
782 connp->conn_saddr_v6 = ipv6_all_zeros; in udp_do_disconnect()
784 connp->conn_saddr_v6 = connp->conn_bound_addr_v6; in udp_do_disconnect()
785 connp->conn_laddr_v6 = connp->conn_bound_addr_v6; in udp_do_disconnect()
786 connp->conn_faddr_v6 = ipv6_all_zeros; in udp_do_disconnect()
787 connp->conn_fport = 0; in udp_do_disconnect()
792 if (connp->conn_family == AF_INET6) in udp_do_disconnect()
793 connp->conn_ipversion = IPV6_VERSION; in udp_do_disconnect()
795 connp->conn_v6lastdst = ipv6_all_zeros; in udp_do_disconnect()
796 error = udp_build_hdr_template(connp, &connp->conn_saddr_v6, in udp_do_disconnect()
797 &connp->conn_faddr_v6, connp->conn_fport, connp->conn_flowinfo); in udp_do_disconnect()
798 mutex_exit(&connp->conn_lock); in udp_do_disconnect()
806 return (ip_laddr_fanout_insert(connp)); in udp_do_disconnect()
812 conn_t *connp = Q_TO_CONN(q); in udp_tpi_disconnect() local
826 error = udp_do_disconnect(connp); in udp_tpi_disconnect()
842 udp_disconnect(conn_t *connp) in udp_disconnect() argument
846 connp->conn_dgram_errind = B_FALSE; in udp_disconnect()
847 error = udp_do_disconnect(connp); in udp_disconnect()
891 conn_t *connp = (conn_t *)arg1; in udp_icmp_input() local
900 udp_t *udp = connp->conn_udp; in udp_icmp_input()
908 udp_icmp_error_ipv6(connp, mp, ira); in udp_icmp_input()
933 if (connp->conn_ipversion != IPV4_VERSION) in udp_icmp_input()
936 ixa = conn_get_ixa(connp, B_FALSE); in udp_icmp_input()
948 mutex_enter(&connp->conn_lock); in udp_icmp_input()
949 ipha = (ipha_t *)connp->conn_ht_iphc; in udp_icmp_input()
957 mutex_exit(&connp->conn_lock); in udp_icmp_input()
983 if (!connp->conn_dgram_errind) { in udp_icmp_input()
988 switch (connp->conn_family) { in udp_icmp_input()
994 if (IPCL_IS_NONSTR(connp)) { in udp_icmp_input()
995 mutex_enter(&connp->conn_lock); in udp_icmp_input()
997 if (sin.sin_port == connp->conn_fport && in udp_icmp_input()
999 connp->conn_faddr_v4) { in udp_icmp_input()
1000 mutex_exit(&connp->conn_lock); in udp_icmp_input()
1001 (*connp->conn_upcalls->su_set_error) in udp_icmp_input()
1002 (connp->conn_upper_handle, error); in udp_icmp_input()
1009 mutex_exit(&connp->conn_lock); in udp_icmp_input()
1014 putnext(connp->conn_rq, mp1); in udp_icmp_input()
1022 if (IPCL_IS_NONSTR(connp)) { in udp_icmp_input()
1023 mutex_enter(&connp->conn_lock); in udp_icmp_input()
1025 if (sin6.sin6_port == connp->conn_fport && in udp_icmp_input()
1027 &connp->conn_faddr_v6)) { in udp_icmp_input()
1028 mutex_exit(&connp->conn_lock); in udp_icmp_input()
1029 (*connp->conn_upcalls->su_set_error) in udp_icmp_input()
1030 (connp->conn_upper_handle, error); in udp_icmp_input()
1037 mutex_exit(&connp->conn_lock); in udp_icmp_input()
1042 putnext(connp->conn_rq, mp1); in udp_icmp_input()
1057 udp_icmp_error_ipv6(conn_t *connp, mblk_t *mp, ip_recv_attr_t *ira) in udp_icmp_error_ipv6() argument
1067 udp_t *udp = connp->conn_udp; in udp_icmp_error_ipv6()
1121 if (!connp->conn_ipv6_recvpathmtu) in udp_icmp_error_ipv6()
1147 sin6->sin6_addr = connp->conn_faddr_v6; in udp_icmp_error_ipv6()
1165 udp_ulp_recv(connp, newmp, msgdsize(newmp), ira); in udp_icmp_error_ipv6()
1190 if (!connp->conn_dgram_errind) { in udp_icmp_error_ipv6()
1201 if (IPCL_IS_NONSTR(connp)) { in udp_icmp_error_ipv6()
1202 mutex_enter(&connp->conn_lock); in udp_icmp_error_ipv6()
1204 if (sin6.sin6_port == connp->conn_fport && in udp_icmp_error_ipv6()
1206 &connp->conn_faddr_v6)) { in udp_icmp_error_ipv6()
1207 mutex_exit(&connp->conn_lock); in udp_icmp_error_ipv6()
1208 (*connp->conn_upcalls->su_set_error) in udp_icmp_error_ipv6()
1209 (connp->conn_upper_handle, error); in udp_icmp_error_ipv6()
1216 mutex_exit(&connp->conn_lock); in udp_icmp_error_ipv6()
1221 putnext(connp->conn_rq, mp1); in udp_icmp_error_ipv6()
1241 conn_t *connp = udp->udp_connp; in udp_addr_req() local
1259 if (connp->conn_family == AF_INET) in udp_addr_req()
1264 mutex_enter(&connp->conn_lock); in udp_addr_req()
1276 (void) conn_getsockname(connp, sa, &addrlen); in udp_addr_req()
1287 (void) conn_getpeername(connp, sa, &addrlen); in udp_addr_req()
1290 mutex_exit(&connp->conn_lock); in udp_addr_req()
1298 conn_t *connp = udp->udp_connp; in udp_copy_info() local
1300 if (connp->conn_family == AF_INET) { in udp_copy_info()
1389 conn_t *connp; in udp_open() local
1427 connp = udp_do_open(credp, isv6, KM_SLEEP, &err); in udp_open()
1428 if (connp == NULL) { in udp_open()
1432 udp = connp->conn_udp; in udp_open()
1435 connp->conn_dev = conn_dev; in udp_open()
1436 connp->conn_minor_arena = minor_arena; in udp_open()
1441 q->q_ptr = connp; in udp_open()
1442 WR(q)->q_ptr = connp; in udp_open()
1443 connp->conn_rq = q; in udp_open()
1444 connp->conn_wq = WR(q); in udp_open()
1450 ASSERT(connp->conn_proto == IPPROTO_UDP); in udp_open()
1451 ASSERT(connp->conn_udp == udp); in udp_open()
1452 ASSERT(udp->udp_connp == connp); in udp_open()
1458 WR(q)->q_hiwat = connp->conn_sndbuf; in udp_open()
1459 WR(q)->q_lowat = connp->conn_sndlowat; in udp_open()
1464 (void) proto_set_tx_wroff(q, connp, connp->conn_wroff); in udp_open()
1465 (void) proto_set_rx_hiwat(q, connp, in udp_open()
1466 udp_set_rcv_hiwat(udp, connp->conn_rcvbuf)); in udp_open()
1468 mutex_enter(&connp->conn_lock); in udp_open()
1469 connp->conn_state_flags &= ~CONN_INCIPIENT; in udp_open()
1470 mutex_exit(&connp->conn_lock); in udp_open()
1528 udp_opt_get(conn_t *connp, t_scalar_t level, t_scalar_t name, in udp_opt_get() argument
1532 udp_t *udp = connp->conn_udp; in udp_opt_get()
1537 coas.coa_connp = connp; in udp_opt_get()
1538 coas.coa_ixa = connp->conn_ixa; in udp_opt_get()
1539 coas.coa_ipp = &connp->conn_xmit_ipp; in udp_opt_get()
1554 if (connp->conn_family != AF_INET) in udp_opt_get()
1560 mutex_enter(&connp->conn_lock); in udp_opt_get()
1563 mutex_exit(&connp->conn_lock); in udp_opt_get()
1570 mutex_exit(&connp->conn_lock); in udp_opt_get()
1577 mutex_enter(&connp->conn_lock); in udp_opt_get()
1579 mutex_exit(&connp->conn_lock); in udp_opt_get()
1582 mutex_enter(&connp->conn_lock); in udp_opt_get()
1584 mutex_exit(&connp->conn_lock); in udp_opt_get()
1588 mutex_enter(&connp->conn_lock); in udp_opt_get()
1590 mutex_exit(&connp->conn_lock); in udp_opt_get()
1601 conn_t *connp = Q_TO_CONN(q); in udp_tpi_opt_get() local
1604 err = udp_opt_get(connp, level, name, ptr); in udp_tpi_opt_get()
1615 conn_t *connp = coa->coa_connp; in udp_do_opt_set() local
1617 udp_t *udp = connp->conn_udp; in udp_do_opt_set()
1653 if (connp->conn_mlp_type == mlptSingle) in udp_do_opt_set()
1703 if (connp->conn_family != AF_INET) { in udp_do_opt_set()
1708 mutex_enter(&connp->conn_lock); in udp_do_opt_set()
1710 mutex_exit(&connp->conn_lock); in udp_do_opt_set()
1717 mutex_enter(&connp->conn_lock); in udp_do_opt_set()
1719 mutex_exit(&connp->conn_lock); in udp_do_opt_set()
1733 udp_opt_set(conn_t *connp, uint_t optset_context, int level, in udp_opt_set() argument
1737 udp_t *udp = connp->conn_udp; in udp_opt_set()
1791 ASSERT(coa->coa_connp == connp); in udp_opt_set()
1797 coas.coa_connp = connp; in udp_opt_set()
1799 coas.coa_ixa = conn_get_ixa(connp, B_TRUE); in udp_opt_set()
1804 coas.coa_ipp = &connp->conn_xmit_ipp; in udp_opt_set()
1848 mutex_enter(&connp->conn_lock); in udp_opt_set()
1850 if (connp->conn_dhcpinit_ill != NULL) { in udp_opt_set()
1856 ill_t *oill = connp->conn_dhcpinit_ill; in udp_opt_set()
1860 ill_set_inputfn(connp->conn_dhcpinit_ill); in udp_opt_set()
1861 connp->conn_dhcpinit_ill = NULL; in udp_opt_set()
1865 connp->conn_dhcpinit_ill = ill; in udp_opt_set()
1868 mutex_exit(&connp->conn_lock); in udp_opt_set()
1872 mutex_exit(&connp->conn_lock); in udp_opt_set()
1907 mutex_enter(&connp->conn_lock); in udp_opt_set()
1908 connp->conn_v6lastdst = ipv6_all_zeros; in udp_opt_set()
1911 &connp->conn_faddr_v6, &nexthop); in udp_opt_set()
1912 saddr = connp->conn_saddr_v6; in udp_opt_set()
1913 faddr = connp->conn_faddr_v6; in udp_opt_set()
1914 fport = connp->conn_fport; in udp_opt_set()
1915 mutex_exit(&connp->conn_lock); in udp_opt_set()
1919 (void) ip_attr_connect(connp, coa->coa_ixa, in udp_opt_set()
1933 mutex_enter(&connp->conn_lock); in udp_opt_set()
1934 if (!IN6_IS_ADDR_UNSPECIFIED(&connp->conn_faddr_v6) && in udp_opt_set()
1935 !IN6_IS_ADDR_V4MAPPED_ANY(&connp->conn_faddr_v6)) { in udp_opt_set()
1936 err = udp_build_hdr_template(connp, in udp_opt_set()
1937 &connp->conn_saddr_v6, &connp->conn_faddr_v6, in udp_opt_set()
1938 connp->conn_fport, connp->conn_flowinfo); in udp_opt_set()
1940 mutex_exit(&connp->conn_lock); in udp_opt_set()
1944 connp->conn_v6lastdst = ipv6_all_zeros; in udp_opt_set()
1946 mutex_exit(&connp->conn_lock); in udp_opt_set()
1949 (void) proto_set_rx_hiwat(connp->conn_rq, connp, in udp_opt_set()
1950 connp->conn_rcvbuf); in udp_opt_set()
1952 if ((coa->coa_changed & COA_SNDBUF_CHANGED) && !IPCL_IS_NONSTR(connp)) { in udp_opt_set()
1953 connp->conn_wq->q_hiwat = connp->conn_sndbuf; in udp_opt_set()
1959 mutex_enter(&connp->conn_lock); in udp_opt_set()
1960 wroff = connp->conn_ht_iphc_allocated + us->us_wroff_extra; in udp_opt_set()
1963 if (wroff > connp->conn_wroff) { in udp_opt_set()
1964 connp->conn_wroff = wroff; in udp_opt_set()
1965 mutex_exit(&connp->conn_lock); in udp_opt_set()
1966 (void) proto_set_tx_wroff(connp->conn_rq, connp, wroff); in udp_opt_set()
1968 mutex_exit(&connp->conn_lock); in udp_opt_set()
1980 conn_t *connp = Q_TO_CONN(q); in udp_tpi_opt_set() local
1983 error = udp_opt_set(connp, optset_context, level, name, inlen, invalp, in udp_tpi_opt_set()
1993 udp_prepend_hdr(conn_t *connp, ip_xmit_attr_t *ixa, const ip_pkt_t *ipp, in udp_prepend_hdr() argument
1999 udp_stack_t *us = connp->conn_netstack->netstack_udp; in udp_prepend_hdr()
2002 udp_t *udp = connp->conn_udp; in udp_prepend_hdr()
2022 udpha->uha_src_port = connp->conn_lport; in udp_prepend_hdr()
2075 udp_build_hdr_template(conn_t *connp, const in6_addr_t *v6src, in udp_build_hdr_template() argument
2081 ASSERT(MUTEX_HELD(&connp->conn_lock)); in udp_build_hdr_template()
2086 connp->conn_v6lastdst = ipv6_all_zeros; in udp_build_hdr_template()
2088 error = conn_build_hdr_template(connp, UDPH_SIZE, 0, v6src, v6dst, in udp_build_hdr_template()
2097 udpha = (udpha_t *)connp->conn_ht_ulp; in udp_build_hdr_template()
2098 udpha->uha_src_port = connp->conn_lport; in udp_build_hdr_template()
2136 udp_ulp_recv(conn_t *connp, mblk_t *mp, uint_t len, ip_recv_attr_t *ira) in udp_ulp_recv() argument
2138 if (IPCL_IS_NONSTR(connp)) { in udp_ulp_recv()
2139 udp_t *udp = connp->conn_udp; in udp_ulp_recv()
2143 if ((*connp->conn_upcalls->su_recv) in udp_ulp_recv()
2144 (connp->conn_upper_handle, mp, len, 0, &error, NULL) < 0) { in udp_ulp_recv()
2150 if ((*connp->conn_upcalls->su_recv) in udp_ulp_recv()
2151 (connp->conn_upper_handle, NULL, 0, 0, in udp_ulp_recv()
2155 connp->conn_flow_cntrld = in udp_ulp_recv()
2165 putnext(connp->conn_rq, mp); in udp_ulp_recv()
2179 putnext(connp->conn_rq, mp); in udp_ulp_recv()
2192 conn_t *connp = (conn_t *)arg1; in udp_input() local
2207 ASSERT(connp->conn_flags & IPCL_UDPCONN); in udp_input()
2209 udp = connp->conn_udp; in udp_input()
2223 mutex_enter(&connp->conn_lock); in udp_input()
2225 recv_ancillary = connp->conn_recv_ancillary; in udp_input()
2226 mutex_exit(&connp->conn_lock); in udp_input()
2249 connp->conn_family == AF_INET) { in udp_input()
2257 mutex_enter(&connp->conn_lock); in udp_input()
2262 mutex_exit(&connp->conn_lock); in udp_input()
2267 mutex_exit(&connp->conn_lock); in udp_input()
2290 ASSERT(connp->conn_family == AF_INET6); in udp_input()
2308 if (connp->conn_family == AF_INET) { in udp_input()
2319 udi_size += conn_recvancillary_size(connp, in udp_input()
2344 sin->sin_family = connp->conn_family; in udp_input()
2353 conn_recvancillary_add(connp, recv_ancillary, ira, in udp_input()
2369 udi_size += conn_recvancillary_size(connp, in udp_input()
2401 IPCL_ZONEID(connp), us->us_netstack); in udp_input()
2414 &ip6h->ip6_dst, IPCL_ZONEID(connp), in udp_input()
2418 sin6->sin6_family = connp->conn_family; in udp_input()
2421 conn_recvancillary_add(connp, recv_ancillary, ira, in udp_input()
2430 DTRACE_UDP5(receive, mblk_t *, NULL, ip_xmit_attr_t *, connp->conn_ixa, in udp_input()
2440 udp_ulp_recv(connp, mp1, pkt_len, ira); in udp_input()
2499 conn_t *connp = Q_TO_CONN(q); in udp_tpi_unbind() local
2502 error = udp_do_unbind(connp); in udp_tpi_unbind()
2601 udp_output_ancillary(conn_t *connp, sin_t *sin, sin6_t *sin6, mblk_t *mp, in udp_output_ancillary() argument
2604 udp_t *udp = connp->conn_udp; in udp_output_ancillary()
2627 ixa = conn_get_ixa_exclusive(connp); in udp_output_ancillary()
2649 ixa->ixa_cred = connp->conn_cred; /* Restore */ in udp_output_ancillary()
2650 ixa->ixa_cpid = connp->conn_cpid; in udp_output_ancillary()
2656 mutex_enter(&connp->conn_lock); in udp_output_ancillary()
2657 error = ip_pkt_copy(&connp->conn_xmit_ipp, ipp, KM_NOSLEEP); in udp_output_ancillary()
2658 mutex_exit(&connp->conn_lock); in udp_output_ancillary()
2672 coa->coa_connp = connp; in udp_output_ancillary()
2679 error = process_auxiliary_options(connp, msg->msg_control, in udp_output_ancillary()
2686 error = tpi_optcom_buf(connp->conn_wq, tudr_mp, in udp_output_ancillary()
2701 mutex_enter(&connp->conn_lock); in udp_output_ancillary()
2711 v6src = connp->conn_saddr_v6; in udp_output_ancillary()
2737 if (!ip_srcid_find_id(srcid, &v6src, IPCL_ZONEID(connp), in udp_output_ancillary()
2738 v4mapped, connp->conn_netstack)) { in udp_output_ancillary()
2740 mutex_exit(&connp->conn_lock); in udp_output_ancillary()
2747 v6dst = connp->conn_faddr_v6; in udp_output_ancillary()
2748 dstport = connp->conn_fport; in udp_output_ancillary()
2749 flowinfo = connp->conn_flowinfo; in udp_output_ancillary()
2751 mutex_exit(&connp->conn_lock); in udp_output_ancillary()
2765 error = ip_attr_connect(connp, ixa, &v6src, &v6dst, &v6nexthop, dstport, in udp_output_ancillary()
2814 if (connp->conn_mlp_type != mlptSingle && in udp_output_ancillary()
2833 error = conn_update_label(connp, ixa, &v6dst, ipp); in udp_output_ancillary()
2840 mp = udp_prepend_hdr(connp, ixa, ipp, &v6src, &v6dst, dstport, in udp_output_ancillary()
2866 (void) ixa_check_drain_insert(connp, ixa); in udp_output_ancillary()
2877 mutex_enter(&connp->conn_lock); in udp_output_ancillary()
2882 if (connp->conn_mcbc_bind) in udp_output_ancillary()
2883 connp->conn_saddr_v6 = ipv6_all_zeros; in udp_output_ancillary()
2885 connp->conn_saddr_v6 = connp->conn_bound_addr_v6; in udp_output_ancillary()
2886 connp->conn_v6lastdst = ipv6_all_zeros; in udp_output_ancillary()
2887 mutex_exit(&connp->conn_lock); in udp_output_ancillary()
2892 ixa->ixa_cred = connp->conn_cred; /* Restore */ in udp_output_ancillary()
2893 ixa->ixa_cpid = connp->conn_cpid; in udp_output_ancillary()
2905 udp_output_connected(conn_t *connp, mblk_t *mp, cred_t *cr, pid_t pid) in udp_output_connected() argument
2907 udp_t *udp = connp->conn_udp; in udp_output_connected()
2916 ixa = conn_get_ixa(connp, B_FALSE); in udp_output_connected()
2928 mutex_enter(&connp->conn_lock); in udp_output_connected()
2929 mp = udp_prepend_header_template(connp, ixa, mp, &connp->conn_saddr_v6, in udp_output_connected()
2930 connp->conn_fport, connp->conn_flowinfo, &error); in udp_output_connected()
2934 mutex_exit(&connp->conn_lock); in udp_output_connected()
2936 ixa->ixa_cred = connp->conn_cred; /* Restore */ in udp_output_connected()
2937 ixa->ixa_cpid = connp->conn_cpid; in udp_output_connected()
2953 saddr = connp->conn_saddr_v6; in udp_output_connected()
2954 faddr = connp->conn_faddr_v6; in udp_output_connected()
2955 fport = connp->conn_fport; in udp_output_connected()
2956 ip_attr_nexthop(&connp->conn_xmit_ipp, ixa, &faddr, &nexthop); in udp_output_connected()
2957 mutex_exit(&connp->conn_lock); in udp_output_connected()
2959 error = ip_attr_connect(connp, ixa, &saddr, &faddr, &nexthop, in udp_output_connected()
2994 ixa->ixa_cred = connp->conn_cred; /* Restore */ in udp_output_connected()
2995 ixa->ixa_cpid = connp->conn_cpid; in udp_output_connected()
3003 mutex_exit(&connp->conn_lock); in udp_output_connected()
3020 (void) ixa_check_drain_insert(connp, ixa); in udp_output_connected()
3032 ixa->ixa_cred = connp->conn_cred; /* Restore */ in udp_output_connected()
3033 ixa->ixa_cpid = connp->conn_cpid; in udp_output_connected()
3045 udp_output_lastdst(conn_t *connp, mblk_t *mp, cred_t *cr, pid_t pid, in udp_output_lastdst() argument
3048 udp_t *udp = connp->conn_udp; in udp_output_lastdst()
3052 ASSERT(MUTEX_HELD(&connp->conn_lock)); in udp_output_lastdst()
3060 mp = udp_prepend_header_template(connp, ixa, mp, &connp->conn_v6lastsrc, in udp_output_lastdst()
3061 connp->conn_lastdstport, connp->conn_lastflowinfo, &error); in udp_output_lastdst()
3065 mutex_exit(&connp->conn_lock); in udp_output_lastdst()
3067 ixa->ixa_cred = connp->conn_cred; /* Restore */ in udp_output_lastdst()
3068 ixa->ixa_cpid = connp->conn_cpid; in udp_output_lastdst()
3084 lastsrc = connp->conn_v6lastsrc; in udp_output_lastdst()
3085 lastdst = connp->conn_v6lastdst; in udp_output_lastdst()
3086 lastport = connp->conn_lastdstport; in udp_output_lastdst()
3087 ip_attr_nexthop(&connp->conn_xmit_ipp, ixa, &lastdst, &nexthop); in udp_output_lastdst()
3088 mutex_exit(&connp->conn_lock); in udp_output_lastdst()
3090 error = ip_attr_connect(connp, ixa, &lastsrc, &lastdst, in udp_output_lastdst()
3125 ixa->ixa_cred = connp->conn_cred; /* Restore */ in udp_output_lastdst()
3126 ixa->ixa_cpid = connp->conn_cpid; in udp_output_lastdst()
3134 mutex_exit(&connp->conn_lock); in udp_output_lastdst()
3150 (void) ixa_check_drain_insert(connp, ixa); in udp_output_lastdst()
3161 mutex_enter(&connp->conn_lock); in udp_output_lastdst()
3166 if (connp->conn_mcbc_bind) in udp_output_lastdst()
3167 connp->conn_saddr_v6 = ipv6_all_zeros; in udp_output_lastdst()
3169 connp->conn_saddr_v6 = connp->conn_bound_addr_v6; in udp_output_lastdst()
3170 connp->conn_v6lastdst = ipv6_all_zeros; in udp_output_lastdst()
3171 mutex_exit(&connp->conn_lock); in udp_output_lastdst()
3175 ixa->ixa_cred = connp->conn_cred; /* Restore */ in udp_output_lastdst()
3176 ixa->ixa_cpid = connp->conn_cpid; in udp_output_lastdst()
3191 udp_prepend_header_template(conn_t *connp, ip_xmit_attr_t *ixa, mblk_t *mp, in udp_prepend_header_template() argument
3194 udp_t *udp = connp->conn_udp; in udp_prepend_header_template()
3206 ASSERT(MUTEX_HELD(&connp->conn_lock)); in udp_prepend_header_template()
3211 copylen = connp->conn_ht_iphc_len; in udp_prepend_header_template()
3238 bcopy(connp->conn_ht_iphc, iph, copylen); in udp_prepend_header_template()
3239 ip_hdr_length = (uint_t)(connp->conn_ht_ulp - connp->conn_ht_iphc); in udp_prepend_header_template()
3255 cksum += connp->conn_sum; in udp_prepend_header_template()
3259 ipp = &connp->conn_xmit_ipp; in udp_prepend_header_template()
3313 udp_ud_err_connected(conn_t *connp, t_scalar_t error) in udp_ud_err_connected() argument
3322 mutex_enter(&connp->conn_lock); in udp_ud_err_connected()
3324 if (connp->conn_family == AF_INET) { in udp_ud_err_connected()
3328 sin->sin_port = connp->conn_fport; in udp_ud_err_connected()
3329 sin->sin_addr.s_addr = connp->conn_faddr_v4; in udp_ud_err_connected()
3336 sin6->sin6_port = connp->conn_fport; in udp_ud_err_connected()
3337 sin6->sin6_flowinfo = connp->conn_flowinfo; in udp_ud_err_connected()
3338 sin6->sin6_addr = connp->conn_faddr_v6; in udp_ud_err_connected()
3339 if (IN6_IS_ADDR_LINKSCOPE(&connp->conn_faddr_v6) && in udp_ud_err_connected()
3340 (connp->conn_ixa->ixa_flags & IXAF_SCOPEID_SET)) { in udp_ud_err_connected()
3341 sin6->sin6_scope_id = connp->conn_ixa->ixa_scopeid; in udp_ud_err_connected()
3349 mutex_exit(&connp->conn_lock); in udp_ud_err_connected()
3353 putnext(connp->conn_rq, mp1); in udp_ud_err_connected()
3373 conn_t *connp = Q_TO_CONN(q); in udp_wput() local
3374 udp_t *udp = connp->conn_udp; in udp_wput()
3415 error = udp_output_connected(connp, mp, cr, pid); in udp_wput()
3418 if (connp->conn_rq != NULL) in udp_wput()
3419 udp_ud_err_connected(connp, (t_scalar_t)error); in udp_wput()
3465 cr = connp->conn_cred; in udp_wput()
3466 pid = connp->conn_cpid; in udp_wput()
3482 switch (connp->conn_family) { in udp_wput()
3505 if (IN6_IS_ADDR_V4MAPPED(&connp->conn_saddr_v6)) { in udp_wput()
3516 if (connp->conn_ipv6_v6only) { in udp_wput()
3528 if (!IN6_IS_ADDR_V4MAPPED(&connp->conn_saddr_v6) && in udp_wput()
3529 !IN6_IS_ADDR_UNSPECIFIED(&connp->conn_saddr_v6)) { in udp_wput()
3548 !conn_same_as_last_v6(connp, sin6)) { in udp_wput()
3553 error = udp_output_ancillary(connp, NULL, sin6, in udp_wput()
3564 ixa = conn_get_ixa(connp, B_FALSE); in udp_wput()
3569 mutex_enter(&connp->conn_lock); in udp_wput()
3571 if (conn_same_as_last_v6(connp, sin6) && in udp_wput()
3572 connp->conn_lastsrcid == srcid && in udp_wput()
3576 error = udp_output_lastdst(connp, data_mp, cr, in udp_wput()
3581 error = udp_output_newdst(connp, data_mp, NULL, in udp_wput()
3584 ASSERT(MUTEX_NOT_HELD(&connp->conn_lock)); in udp_wput()
3611 !conn_same_as_last_v4(connp, sin)) { in udp_wput()
3616 error = udp_output_ancillary(connp, sin, NULL, in udp_wput()
3627 ixa = conn_get_ixa(connp, B_FALSE); in udp_wput()
3632 mutex_enter(&connp->conn_lock); in udp_wput()
3634 if (conn_same_as_last_v4(connp, sin) && in udp_wput()
3638 error = udp_output_lastdst(connp, data_mp, cr, in udp_wput()
3643 error = udp_output_newdst(connp, data_mp, sin, in udp_wput()
3646 ASSERT(MUTEX_NOT_HELD(&connp->conn_lock)); in udp_wput()
3676 udp_output_newdst(conn_t *connp, mblk_t *data_mp, sin_t *sin, sin6_t *sin6, in udp_output_newdst() argument
3681 udp_t *udp = connp->conn_udp; in udp_output_newdst()
3690 ASSERT(MUTEX_HELD(&connp->conn_lock)); in udp_output_newdst()
3713 mutex_exit(&connp->conn_lock); in udp_output_newdst()
3730 v6src = connp->conn_saddr_v6; in udp_output_newdst()
3758 if (!ip_srcid_find_id(srcid, &v6src, IPCL_ZONEID(connp), in udp_output_newdst()
3759 v4mapped, connp->conn_netstack)) { in udp_output_newdst()
3761 mutex_exit(&connp->conn_lock); in udp_output_newdst()
3768 if (connp->conn_xmit_ipp.ipp_fields & IPPF_ADDR) { in udp_output_newdst()
3769 ip_pkt_t *ipp = &connp->conn_xmit_ipp; in udp_output_newdst()
3780 ip_attr_nexthop(&connp->conn_xmit_ipp, ixa, &v6dst, &v6nexthop); in udp_output_newdst()
3781 mutex_exit(&connp->conn_lock); in udp_output_newdst()
3783 error = ip_attr_connect(connp, ixa, &v6src, &v6dst, &v6nexthop, dstport, in udp_output_newdst()
3825 CL_INET_UDP_CONNECT(connp, B_TRUE, &v6dst, dstport, error); in udp_output_newdst()
3832 mutex_enter(&connp->conn_lock); in udp_output_newdst()
3840 mutex_exit(&connp->conn_lock); in udp_output_newdst()
3860 if (connp->conn_mlp_type != mlptSingle) { in udp_output_newdst()
3861 mutex_exit(&connp->conn_lock); in udp_output_newdst()
3877 error = conn_update_label(connp, ixa, &v6dst, in udp_output_newdst()
3878 &connp->conn_xmit_ipp); in udp_output_newdst()
3880 mutex_exit(&connp->conn_lock); in udp_output_newdst()
3884 error = udp_build_hdr_template(connp, &v6src, &v6dst, dstport, in udp_output_newdst()
3887 mutex_exit(&connp->conn_lock); in udp_output_newdst()
3890 } else if ((connp->conn_xmit_ipp.ipp_fields & in udp_output_newdst()
3892 ipversion != connp->conn_lastipversion || in udp_output_newdst()
3893 IN6_IS_ADDR_UNSPECIFIED(&connp->conn_v6lastdst)) { in udp_output_newdst()
3895 error = udp_build_hdr_template(connp, &v6src, &v6dst, dstport, in udp_output_newdst()
3898 mutex_exit(&connp->conn_lock); in udp_output_newdst()
3904 ipha_t *ipha = (ipha_t *)connp->conn_ht_iphc; in udp_output_newdst()
3915 ip6_t *ip6h = (ip6_t *)connp->conn_ht_iphc; in udp_output_newdst()
3924 oldixa = conn_replace_ixa(connp, ixa); in udp_output_newdst()
3925 connp->conn_v6lastdst = v6dst; in udp_output_newdst()
3926 connp->conn_lastipversion = ipversion; in udp_output_newdst()
3927 connp->conn_lastdstport = dstport; in udp_output_newdst()
3928 connp->conn_lastflowinfo = flowinfo; in udp_output_newdst()
3929 connp->conn_lastscopeid = ixa->ixa_scopeid; in udp_output_newdst()
3930 connp->conn_lastsrcid = srcid; in udp_output_newdst()
3932 connp->conn_v6lastsrc = v6src; in udp_output_newdst()
3934 data_mp = udp_prepend_header_template(connp, ixa, data_mp, &v6src, in udp_output_newdst()
3938 mutex_exit(&connp->conn_lock); in udp_output_newdst()
3959 (void) ixa_check_drain_insert(connp, ixa); in udp_output_newdst()
3970 mutex_enter(&connp->conn_lock); in udp_output_newdst()
3975 if (connp->conn_mcbc_bind) in udp_output_newdst()
3976 connp->conn_saddr_v6 = ipv6_all_zeros; in udp_output_newdst()
3978 connp->conn_saddr_v6 = connp->conn_bound_addr_v6; in udp_output_newdst()
3979 connp->conn_v6lastdst = ipv6_all_zeros; in udp_output_newdst()
3980 mutex_exit(&connp->conn_lock); in udp_output_newdst()
3984 ixa->ixa_cred = connp->conn_cred; /* Restore */ in udp_output_newdst()
3985 ixa->ixa_cpid = connp->conn_cpid; in udp_output_newdst()
3991 ixa->ixa_cred = connp->conn_cred; /* Restore */ in udp_output_newdst()
3992 ixa->ixa_cpid = connp->conn_cpid; in udp_output_newdst()
4020 conn_t *connp = Q_TO_CONN(q); in udp_wput_cmdblk() local
4021 udp_t *udp = connp->conn_udp; in udp_wput_cmdblk()
4031 mutex_enter(&connp->conn_lock); in udp_wput_cmdblk()
4037 cmdp->cb_error = conn_getpeername(connp, data, in udp_wput_cmdblk()
4041 cmdp->cb_error = conn_getsockname(connp, data, &cmdp->cb_len); in udp_wput_cmdblk()
4047 mutex_exit(&connp->conn_lock); in udp_wput_cmdblk()
4055 conn_t *connp = udp->udp_connp; in udp_use_pure_tpi() local
4057 mutex_enter(&connp->conn_lock); in udp_use_pure_tpi()
4059 mutex_exit(&connp->conn_lock); in udp_use_pure_tpi()
4068 conn_t *connp = Q_TO_CONN(q); in udp_wput_other() local
4069 udp_t *udp = connp->conn_udp; in udp_wput_other()
4248 conn_t *connp = Q_TO_CONN(q); in udp_wput_iocdata() local
4249 udp_t *udp = connp->conn_udp; in udp_wput_iocdata()
4297 if (connp->conn_family == AF_INET) in udp_wput_iocdata()
4324 (void) conn_getsockname(connp, (struct sockaddr *)mp1->b_wptr, in udp_wput_iocdata()
4328 (void) conn_getpeername(connp, (struct sockaddr *)mp1->b_wptr, in udp_wput_iocdata()
4538 conn_t *connp; in udp_do_open() local
4565 connp = ipcl_conn_create(IPCL_UDPCONN, flags, ns); in udp_do_open()
4566 if (connp == NULL) { in udp_do_open()
4571 udp = connp->conn_udp; in udp_do_open()
4583 ASSERT(connp->conn_proto == IPPROTO_UDP); in udp_do_open()
4584 ASSERT(connp->conn_udp == udp); in udp_do_open()
4585 ASSERT(udp->udp_connp == connp); in udp_do_open()
4589 connp->conn_ixa->ixa_flags |= IXAF_VERIFY_SOURCE; in udp_do_open()
4591 connp->conn_family = AF_INET6; in udp_do_open()
4592 connp->conn_ipversion = IPV6_VERSION; in udp_do_open()
4593 connp->conn_ixa->ixa_flags &= ~IXAF_IS_IPV4; in udp_do_open()
4594 connp->conn_default_ttl = us->us_ipv6_hoplimit; in udp_do_open()
4597 connp->conn_family = AF_INET; in udp_do_open()
4598 connp->conn_ipversion = IPV4_VERSION; in udp_do_open()
4599 connp->conn_ixa->ixa_flags |= IXAF_IS_IPV4; in udp_do_open()
4600 connp->conn_default_ttl = us->us_ipv4_ttl; in udp_do_open()
4604 ASSERT(connp->conn_ixa->ixa_protocol == connp->conn_proto); in udp_do_open()
4605 connp->conn_xmit_ipp.ipp_unicast_hops = connp->conn_default_ttl; in udp_do_open()
4607 connp->conn_ixa->ixa_multicast_ttl = IP_DEFAULT_MULTICAST_TTL; in udp_do_open()
4608 connp->conn_ixa->ixa_flags |= IXAF_MULTICAST_LOOP | IXAF_SET_ULP_CKSUM; in udp_do_open()
4610 connp->conn_ixa->ixa_zoneid = zoneid; in udp_do_open()
4612 connp->conn_zoneid = zoneid; in udp_do_open()
4619 connp->conn_mac_mode = CONN_MAC_AWARE; in udp_do_open()
4621 connp->conn_zone_is_global = (crgetzoneid(credp) == GLOBAL_ZONEID); in udp_do_open()
4625 connp->conn_rcvbuf = us->us_recv_hiwat; in udp_do_open()
4626 connp->conn_sndbuf = us->us_xmit_hiwat; in udp_do_open()
4627 connp->conn_sndlowat = us->us_xmit_lowat; in udp_do_open()
4628 connp->conn_rcvlowat = udp_mod_info.mi_lowat; in udp_do_open()
4630 connp->conn_wroff = len + us->us_wroff_extra; in udp_do_open()
4631 connp->conn_so_type = SOCK_DGRAM; in udp_do_open()
4633 connp->conn_recv = udp_input; in udp_do_open()
4634 connp->conn_recvicmp = udp_icmp_input; in udp_do_open()
4636 connp->conn_cred = credp; in udp_do_open()
4637 connp->conn_cpid = curproc->p_pid; in udp_do_open()
4638 connp->conn_open_time = ddi_get_lbolt64(); in udp_do_open()
4640 ASSERT(!(connp->conn_ixa->ixa_free_flags & IXA_FREE_CRED)); in udp_do_open()
4641 connp->conn_ixa->ixa_cred = connp->conn_cred; in udp_do_open()
4642 connp->conn_ixa->ixa_cpid = connp->conn_cpid; in udp_do_open()
4644 connp->conn_ixa->ixa_tsl = crgetlabel(connp->conn_cred); in udp_do_open()
4649 connp->conn_ixa->ixa_flags |= IXAF_PMTU_DISCOVERY; in udp_do_open()
4651 return (connp); in udp_do_open()
4660 conn_t *connp; in udp_create() local
4674 connp = udp_do_open(credp, isv6, flags, errorp); in udp_create()
4675 if (connp == NULL) in udp_create()
4678 udp = connp->conn_udp; in udp_create()
4684 connp->conn_flags |= IPCL_NONSTR; in udp_create()
4691 (void) udp_set_rcv_hiwat(udp, connp->conn_rcvbuf); in udp_create()
4692 udp->udp_rcv_disply_hiwat = connp->conn_rcvbuf; in udp_create()
4694 connp->conn_flow_cntrld = B_FALSE; in udp_create()
4696 mutex_enter(&connp->conn_lock); in udp_create()
4697 connp->conn_state_flags &= ~CONN_INCIPIENT; in udp_create()
4698 mutex_exit(&connp->conn_lock); in udp_create()
4703 return ((sock_lower_handle_t)connp); in udp_create()
4711 conn_t *connp = (conn_t *)proto_handle; in udp_activate() local
4717 connp->conn_upcalls = sock_upcalls; in udp_activate()
4718 connp->conn_upper_handle = sock_handle; in udp_activate()
4722 sopp.sopp_wroff = connp->conn_wroff; in udp_activate()
4724 sopp.sopp_rxhiwat = connp->conn_rcvbuf; in udp_activate()
4725 sopp.sopp_rxlowat = connp->conn_rcvlowat; in udp_activate()
4728 (connp->conn_family == AF_INET) ? UDP_MAXPACKET_IPV4 : in udp_activate()
4733 (*connp->conn_upcalls->su_set_proto_props)(connp->conn_upper_handle, in udp_activate()
4738 udp_do_close(conn_t *connp) in udp_do_close() argument
4742 ASSERT(connp != NULL && IPCL_IS_UDP(connp)); in udp_do_close()
4743 udp = connp->conn_udp; in udp_do_close()
4749 if (connp->conn_ipversion == IPV4_VERSION) { in udp_do_close()
4751 connp->conn_netstack->netstack_stackid, in udp_do_close()
4753 (uint8_t *)(&V4_PART_OF_V6(connp->conn_laddr_v6)), in udp_do_close()
4754 (in_port_t)connp->conn_lport, NULL); in udp_do_close()
4757 connp->conn_netstack->netstack_stackid, in udp_do_close()
4759 (uint8_t *)&(connp->conn_laddr_v6), in udp_do_close()
4760 (in_port_t)connp->conn_lport, NULL); in udp_do_close()
4766 ip_quiesce_conn(connp); in udp_do_close()
4768 if (!IPCL_IS_NONSTR(connp)) { in udp_do_close()
4769 ASSERT(connp->conn_wq != NULL); in udp_do_close()
4770 ASSERT(connp->conn_rq != NULL); in udp_do_close()
4771 qprocsoff(connp->conn_rq); in udp_do_close()
4774 udp_close_free(connp); in udp_do_close()
4786 ASSERT(connp->conn_ref == 1); in udp_do_close()
4788 if (!IPCL_IS_NONSTR(connp)) { in udp_do_close()
4789 inet_minor_free(connp->conn_minor_arena, connp->conn_dev); in udp_do_close()
4791 ip_free_helper_stream(connp); in udp_do_close()
4794 connp->conn_ref--; in udp_do_close()
4795 ipcl_conn_destroy(connp); in udp_do_close()
4802 conn_t *connp = (conn_t *)proto_handle; in udp_close() local
4807 udp_do_close(connp); in udp_close()
4812 udp_do_bind(conn_t *connp, struct sockaddr *sa, socklen_t len, cred_t *cr, in udp_do_bind() argument
4817 udp_t *udp = connp->conn_udp; in udp_do_bind()
4829 zoneid_t zoneid = IPCL_ZONEID(connp); in udp_do_bind()
4830 ip_stack_t *ipst = connp->conn_netstack->netstack_ip; in udp_do_bind()
4842 if (connp->conn_family != AF_INET || in udp_do_bind()
4861 if (connp->conn_family != AF_INET6 || in udp_do_bind()
4867 if (connp->conn_ipv6_v6only) in udp_do_bind()
4909 if (connp->conn_anon_priv_bind) { in udp_do_bind()
4948 mutex_enter(&connp->conn_lock); in udp_do_bind()
4950 mutex_exit(&connp->conn_lock); in udp_do_bind()
4962 if (connp->conn_family == AF_INET) { in udp_do_bind()
4964 ASSERT(connp->conn_ixa->ixa_flags & IXAF_IS_IPV4); in udp_do_bind()
4971 connp->conn_ipversion = IPV4_VERSION; in udp_do_bind()
4972 connp->conn_ixa->ixa_flags |= IXAF_IS_IPV4; in udp_do_bind()
4974 connp->conn_ipversion = IPV6_VERSION; in udp_do_bind()
4975 connp->conn_ixa->ixa_flags &= ~IXAF_IS_IPV4; in udp_do_bind()
5002 if (connp->conn_anon_priv_bind) { in udp_do_bind()
5041 if (!IPCL_BIND_ZONE_MATCH(connp1, connp)) in udp_do_bind()
5063 if (connp1->conn_exclbind || connp->conn_exclbind || in udp_do_bind()
5064 IPCL_CONNS_MAC(udp1->udp_connp, connp)) { in udp_do_bind()
5081 if (connp->conn_ipversion != connp1->conn_ipversion) { in udp_do_bind()
5118 (connp->conn_reuseaddr && requested_port != 0)) { in udp_do_bind()
5141 mutex_exit(&connp->conn_lock); in udp_do_bind()
5145 if (connp->conn_anon_priv_bind) { in udp_do_bind()
5170 mutex_exit(&connp->conn_lock); in udp_do_bind()
5183 connp->conn_bound_addr_v6 = v6src; in udp_do_bind()
5184 connp->conn_laddr_v6 = v6src; in udp_do_bind()
5186 connp->conn_ixa->ixa_flags |= IXAF_SCOPEID_SET; in udp_do_bind()
5187 connp->conn_ixa->ixa_scopeid = scopeid; in udp_do_bind()
5188 connp->conn_incoming_ifindex = scopeid; in udp_do_bind()
5190 connp->conn_ixa->ixa_flags &= ~IXAF_SCOPEID_SET; in udp_do_bind()
5191 connp->conn_incoming_ifindex = connp->conn_bound_if; in udp_do_bind()
5197 connp->conn_saddr_v6 = v6src; in udp_do_bind()
5198 connp->conn_mcbc_bind = B_FALSE; in udp_do_bind()
5203 connp->conn_saddr_v6 = ipv6_all_zeros; in udp_do_bind()
5204 connp->conn_mcbc_bind = B_TRUE; in udp_do_bind()
5209 connp->conn_lport = lport; in udp_do_bind()
5215 if ((requested_port == 0) && (!connp->conn_anon_priv_bind)) { in udp_do_bind()
5220 if (connp->conn_family == AF_INET) { in udp_do_bind()
5221 sin->sin_port = connp->conn_lport; in udp_do_bind()
5223 sin6->sin6_port = connp->conn_lport; in udp_do_bind()
5228 mutex_exit(&connp->conn_lock); in udp_do_bind()
5234 if (connp->conn_ipversion == IPV4_VERSION) { in udp_do_bind()
5235 (*cl_inet_bind)(connp->conn_netstack->netstack_stackid, in udp_do_bind()
5237 (in_port_t)connp->conn_lport, NULL); in udp_do_bind()
5239 (*cl_inet_bind)(connp->conn_netstack->netstack_stackid, in udp_do_bind()
5241 (in_port_t)connp->conn_lport, NULL); in udp_do_bind()
5245 mutex_enter(&connp->conn_lock); in udp_do_bind()
5246 connp->conn_anon_port = (is_system_labeled() && requested_port == 0); in udp_do_bind()
5247 if (is_system_labeled() && (!connp->conn_anon_port || in udp_do_bind()
5248 connp->conn_anon_mlp)) { in udp_do_bind()
5253 connp->conn_mlp_type = in udp_do_bind()
5254 connp->conn_recv_ancillary.crb_recvucred ? mlptBoth : in udp_do_bind()
5257 connp->conn_allzones ? ALL_ZONES : zone->zone_id, in udp_do_bind()
5261 mutex_exit(&connp->conn_lock); in udp_do_bind()
5264 mlpport = connp->conn_anon_port ? PMAPPORT : port; in udp_do_bind()
5273 connp->conn_mlp_type == mlptSingle) { in udp_do_bind()
5275 mutex_exit(&connp->conn_lock); in udp_do_bind()
5285 if (connp->conn_debug) { in udp_do_bind()
5292 mutex_exit(&connp->conn_lock); in udp_do_bind()
5310 if (connp->conn_zoneid != mlpzone) { in udp_do_bind()
5311 if (connp->conn_debug) { in udp_do_bind()
5317 mlpport, connp->conn_zoneid, in udp_do_bind()
5321 mutex_exit(&connp->conn_lock); in udp_do_bind()
5325 if (connp->conn_anon_port) { in udp_do_bind()
5326 error = tsol_mlp_anon(zone, mlptype, connp->conn_proto, in udp_do_bind()
5329 if (connp->conn_debug) { in udp_do_bind()
5336 mutex_exit(&connp->conn_lock); in udp_do_bind()
5340 connp->conn_mlp_type = mlptype; in udp_do_bind()
5350 error = udp_build_hdr_template(connp, &connp->conn_saddr_v6, in udp_do_bind()
5351 &connp->conn_faddr_v6, connp->conn_fport, connp->conn_flowinfo); in udp_do_bind()
5353 mutex_exit(&connp->conn_lock); in udp_do_bind()
5357 connp->conn_faddr_v6 = ipv6_all_zeros; in udp_do_bind()
5358 connp->conn_fport = 0; in udp_do_bind()
5359 connp->conn_v6lastdst = ipv6_all_zeros; in udp_do_bind()
5360 mutex_exit(&connp->conn_lock); in udp_do_bind()
5362 error = ip_laddr_fanout_insert(connp); in udp_do_bind()
5371 mutex_enter(&connp->conn_lock); in udp_do_bind()
5373 UDP_BIND_HASH(connp->conn_lport, in udp_do_bind()
5376 connp->conn_saddr_v6 = ipv6_all_zeros; in udp_do_bind()
5377 connp->conn_bound_addr_v6 = ipv6_all_zeros; in udp_do_bind()
5378 connp->conn_laddr_v6 = ipv6_all_zeros; in udp_do_bind()
5380 connp->conn_ixa->ixa_flags &= ~IXAF_SCOPEID_SET; in udp_do_bind()
5381 connp->conn_incoming_ifindex = connp->conn_bound_if; in udp_do_bind()
5385 connp->conn_lport = 0; in udp_do_bind()
5387 connp->conn_anon_port = B_FALSE; in udp_do_bind()
5388 connp->conn_mlp_type = mlptSingle; in udp_do_bind()
5390 connp->conn_v6lastdst = ipv6_all_zeros; in udp_do_bind()
5393 (void) udp_build_hdr_template(connp, &connp->conn_saddr_v6, in udp_do_bind()
5394 &connp->conn_faddr_v6, connp->conn_fport, connp->conn_flowinfo); in udp_do_bind()
5395 mutex_exit(&connp->conn_lock); in udp_do_bind()
5404 conn_t *connp; in udp_bind() local
5409 connp = (conn_t *)proto_handle; in udp_bind()
5412 error = udp_do_unbind(connp); in udp_bind()
5414 error = udp_do_bind(connp, sa, len, cr, B_TRUE); in udp_bind()
5427 udp_implicit_bind(conn_t *connp, cred_t *cr) in udp_implicit_bind() argument
5438 if (connp->conn_family == AF_INET) { in udp_implicit_bind()
5445 ASSERT(connp->conn_family == AF_INET6); in udp_implicit_bind()
5453 error = udp_do_bind(connp, (struct sockaddr *)&sin6addr, len, in udp_implicit_bind()
5463 udp_do_unbind(conn_t *connp) in udp_do_unbind() argument
5465 udp_t *udp = connp->conn_udp; in udp_do_unbind()
5473 if (connp->conn_ipversion == IPV4_VERSION) { in udp_do_unbind()
5475 connp->conn_netstack->netstack_stackid, in udp_do_unbind()
5477 (uint8_t *)(&V4_PART_OF_V6(connp->conn_laddr_v6)), in udp_do_unbind()
5478 (in_port_t)connp->conn_lport, NULL); in udp_do_unbind()
5481 connp->conn_netstack->netstack_stackid, in udp_do_unbind()
5483 (uint8_t *)&(connp->conn_laddr_v6), in udp_do_unbind()
5484 (in_port_t)connp->conn_lport, NULL); in udp_do_unbind()
5488 mutex_enter(&connp->conn_lock); in udp_do_unbind()
5491 mutex_exit(&connp->conn_lock); in udp_do_unbind()
5494 udpf = &us->us_bind_fanout[UDP_BIND_HASH(connp->conn_lport, in udp_do_unbind()
5498 connp->conn_saddr_v6 = ipv6_all_zeros; in udp_do_unbind()
5499 connp->conn_bound_addr_v6 = ipv6_all_zeros; in udp_do_unbind()
5500 connp->conn_laddr_v6 = ipv6_all_zeros; in udp_do_unbind()
5501 connp->conn_mcbc_bind = B_FALSE; in udp_do_unbind()
5502 connp->conn_lport = 0; in udp_do_unbind()
5504 connp->conn_faddr_v6 = ipv6_all_zeros; in udp_do_unbind()
5505 connp->conn_fport = 0; in udp_do_unbind()
5508 connp->conn_v6lastdst = ipv6_all_zeros; in udp_do_unbind()
5511 (void) udp_build_hdr_template(connp, &connp->conn_saddr_v6, in udp_do_unbind()
5512 &connp->conn_faddr_v6, connp->conn_fport, connp->conn_flowinfo); in udp_do_unbind()
5513 mutex_exit(&connp->conn_lock); in udp_do_unbind()
5515 ip_unbind(connp); in udp_do_unbind()
5524 udp_do_connect(conn_t *connp, const struct sockaddr *sa, socklen_t len, in udp_do_connect() argument
5543 in6_addr_t v6src = connp->conn_saddr_v6; in udp_do_connect()
5546 udp = connp->conn_udp; in udp_do_connect()
5564 ASSERT(connp->conn_ipversion == IPV4_VERSION); in udp_do_connect()
5575 if (!ip_srcid_find_id(srcid, &v6src, IPCL_ZONEID(connp), in udp_do_connect()
5576 v4mapped, connp->conn_netstack)) { in udp_do_connect()
5582 if (connp->conn_ipv6_v6only) in udp_do_connect()
5591 &connp->conn_bound_addr_v6) && in udp_do_connect()
5592 !IN6_IS_ADDR_V4MAPPED(&connp->conn_bound_addr_v6)) { in udp_do_connect()
5619 ixa = conn_get_ixa(connp, B_FALSE); in udp_do_connect()
5623 mutex_enter(&connp->conn_lock); in udp_do_connect()
5630 mutex_exit(&connp->conn_lock); in udp_do_connect()
5636 ASSERT(connp->conn_lport != 0 && udp->udp_ptpbhn != NULL); in udp_do_connect()
5638 udpf = &us->us_bind_fanout[UDP_BIND_HASH(connp->conn_lport, in udp_do_connect()
5644 if (connp->conn_mcbc_bind) in udp_do_connect()
5645 connp->conn_saddr_v6 = ipv6_all_zeros; in udp_do_connect()
5647 connp->conn_saddr_v6 = connp->conn_bound_addr_v6; in udp_do_connect()
5648 connp->conn_laddr_v6 = connp->conn_bound_addr_v6; in udp_do_connect()
5649 connp->conn_faddr_v6 = ipv6_all_zeros; in udp_do_connect()
5650 connp->conn_fport = 0; in udp_do_connect()
5654 connp->conn_fport = dstport; in udp_do_connect()
5655 connp->conn_ipversion = ipversion; in udp_do_connect()
5665 if (connp->conn_family == AF_INET) { in udp_do_connect()
5671 connp->conn_faddr_v6 = v6dst; in udp_do_connect()
5672 connp->conn_flowinfo = 0; in udp_do_connect()
5674 ASSERT(connp->conn_ipversion == IPV6_VERSION); in udp_do_connect()
5684 connp->conn_faddr_v6 = v6dst; in udp_do_connect()
5685 connp->conn_flowinfo = flowinfo; in udp_do_connect()
5692 if (connp->conn_cred != cr) { in udp_do_connect()
5694 crfree(connp->conn_cred); in udp_do_connect()
5695 connp->conn_cred = cr; in udp_do_connect()
5697 connp->conn_cpid = pid; in udp_do_connect()
5709 connp->conn_incoming_ifindex = scopeid; in udp_do_connect()
5712 connp->conn_incoming_ifindex = connp->conn_bound_if; in udp_do_connect()
5720 connp->conn_v6lastdst = ipv6_all_zeros; in udp_do_connect()
5723 error = conn_connect(connp, NULL, IPDF_ALLOW_MCBC); in udp_do_connect()
5724 mutex_exit(&connp->conn_lock); in udp_do_connect()
5732 error = ipcl_conn_insert(connp); in udp_do_connect()
5736 mutex_enter(&connp->conn_lock); in udp_do_connect()
5737 error = udp_build_hdr_template(connp, &connp->conn_saddr_v6, in udp_do_connect()
5738 &connp->conn_faddr_v6, connp->conn_fport, connp->conn_flowinfo); in udp_do_connect()
5740 mutex_exit(&connp->conn_lock); in udp_do_connect()
5746 connp->conn_v6lastdst = connp->conn_faddr_v6; in udp_do_connect()
5747 connp->conn_lastipversion = connp->conn_ipversion; in udp_do_connect()
5748 connp->conn_lastdstport = connp->conn_fport; in udp_do_connect()
5749 connp->conn_lastflowinfo = connp->conn_flowinfo; in udp_do_connect()
5750 connp->conn_lastscopeid = scopeid; in udp_do_connect()
5751 connp->conn_lastsrcid = srcid; in udp_do_connect()
5753 connp->conn_v6lastsrc = v6src; in udp_do_connect()
5755 oldixa = conn_replace_ixa(connp, ixa); in udp_do_connect()
5756 mutex_exit(&connp->conn_lock); in udp_do_connect()
5773 if (connp->conn_lport != connp1->conn_lport || in udp_do_connect()
5774 connp->conn_ipversion != connp1->conn_ipversion || in udp_do_connect()
5776 !IN6_ARE_ADDR_EQUAL(&connp->conn_laddr_v6, in udp_do_connect()
5779 !(IPCL_ZONE_MATCH(connp, connp1->conn_zoneid) || in udp_do_connect()
5780 IPCL_ZONE_MATCH(connp1, connp->conn_zoneid))) in udp_do_connect()
5787 CL_INET_UDP_CONNECT(connp, B_TRUE, &v6dst, dstport, error); in udp_do_connect()
5802 mutex_enter(&connp->conn_lock); in udp_do_connect()
5805 connp->conn_faddr_v6 = ipv6_all_zeros; in udp_do_connect()
5806 connp->conn_fport = 0; in udp_do_connect()
5808 if (connp->conn_mcbc_bind) in udp_do_connect()
5809 connp->conn_saddr_v6 = ipv6_all_zeros; in udp_do_connect()
5811 connp->conn_saddr_v6 = connp->conn_bound_addr_v6; in udp_do_connect()
5812 connp->conn_laddr_v6 = connp->conn_bound_addr_v6; in udp_do_connect()
5815 connp->conn_v6lastdst = ipv6_all_zeros; in udp_do_connect()
5816 connp->conn_flowinfo = 0; in udp_do_connect()
5818 (void) udp_build_hdr_template(connp, &connp->conn_saddr_v6, in udp_do_connect()
5819 &connp->conn_faddr_v6, connp->conn_fport, connp->conn_flowinfo); in udp_do_connect()
5820 mutex_exit(&connp->conn_lock); in udp_do_connect()
5828 conn_t *connp = (conn_t *)proto_handle; in udp_connect() local
5829 udp_t *udp = connp->conn_udp; in udp_connect()
5845 error = udp_disconnect(connp); in udp_connect()
5849 error = proto_verify_ip_addr(connp->conn_family, sa, len); in udp_connect()
5855 error = udp_implicit_bind(connp, cr); in udp_connect()
5868 connp->conn_dgram_errind = B_TRUE; in udp_connect()
5870 error = udp_do_connect(connp, sa, len, cr, pid); in udp_connect()
5875 unbind_err = udp_do_unbind(connp); in udp_connect()
5881 (*connp->conn_upcalls->su_connected) in udp_connect()
5882 (connp->conn_upper_handle, 0, NULL, -1); in udp_connect()
5906 conn_t *connp = (conn_t *)proto_handle; in udp_send() local
5907 udp_t *udp = connp->conn_udp; in udp_send()
5921 error = udp_implicit_bind(connp, cr); in udp_send()
5940 error = udp_output_ancillary(connp, NULL, NULL, mp, in udp_send()
5943 error = udp_output_connected(connp, mp, cr, pid); in udp_send()
5954 error = proto_verify_ip_addr(connp->conn_family, in udp_send()
5960 switch (connp->conn_family) { in udp_send()
5979 if (IN6_IS_ADDR_V4MAPPED(&connp->conn_saddr_v6)) { in udp_send()
5987 if (connp->conn_ipv6_v6only) { in udp_send()
5999 if (!IN6_IS_ADDR_V4MAPPED(&connp->conn_saddr_v6) && in udp_send()
6000 !IN6_IS_ADDR_UNSPECIFIED(&connp->conn_saddr_v6)) { in udp_send()
6019 ixa = conn_get_ixa(connp, B_FALSE); in udp_send()
6027 mutex_enter(&connp->conn_lock); in udp_send()
6040 mutex_exit(&connp->conn_lock); in udp_send()
6049 mutex_exit(&connp->conn_lock); in udp_send()
6051 error = udp_output_ancillary(connp, NULL, sin6, mp, in udp_send()
6053 } else if (conn_same_as_last_v6(connp, sin6) && in udp_send()
6054 connp->conn_lastsrcid == srcid && in udp_send()
6057 error = udp_output_lastdst(connp, mp, cr, pid, ixa); in udp_send()
6060 error = udp_output_newdst(connp, mp, NULL, sin6, in udp_send()
6063 ASSERT(MUTEX_NOT_HELD(&connp->conn_lock)); in udp_send()
6082 ixa = conn_get_ixa(connp, B_FALSE); in udp_send()
6090 mutex_enter(&connp->conn_lock); in udp_send()
6101 mutex_exit(&connp->conn_lock); in udp_send()
6109 mutex_exit(&connp->conn_lock); in udp_send()
6111 error = udp_output_ancillary(connp, sin, NULL, mp, in udp_send()
6113 } else if (conn_same_as_last_v4(connp, sin) && in udp_send()
6116 error = udp_output_lastdst(connp, mp, cr, pid, ixa); in udp_send()
6119 error = udp_output_newdst(connp, mp, sin, NULL, in udp_send()
6122 ASSERT(MUTEX_NOT_HELD(&connp->conn_lock)); in udp_send()
6137 conn_t *connp = (conn_t *)proto_handle; in udp_fallback() local
6147 udp = connp->conn_udp; in udp_fallback()
6154 connp->conn_dev = (dev_t)RD(q)->q_ptr; in udp_fallback()
6155 connp->conn_minor_arena = WR(q)->q_ptr; in udp_fallback()
6157 RD(q)->q_ptr = WR(q)->q_ptr = connp; in udp_fallback()
6161 connp->conn_rq = RD(q); in udp_fallback()
6162 connp->conn_wq = WR(q); in udp_fallback()
6169 stropt->so_wroff = connp->conn_wroff; in udp_fallback()
6176 ip_free_helper_stream(connp); in udp_fallback()
6187 (void) udp_getsockname((sock_lower_handle_t)connp, in udp_fallback()
6189 error = udp_getpeername((sock_lower_handle_t)connp, in udp_fallback()
6195 if (connp->conn_dgram_errind) in udp_fallback()
6197 if (connp->conn_ixa->ixa_flags & IXAF_DONTROUTE) in udp_fallback()
6200 mp = (*quiesced_cb)(connp->conn_upper_handle, arg, &tca, in udp_fallback()
6226 mutex_enter(&connp->conn_lock); in udp_fallback()
6227 connp->conn_flags &= ~IPCL_NONSTR; in udp_fallback()
6228 mutex_exit(&connp->conn_lock); in udp_fallback()
6232 ASSERT(connp->conn_ref >= 1); in udp_fallback()
6242 conn_t *connp = (conn_t *)proto_handle; in udp_getpeername() local
6243 udp_t *udp = connp->conn_udp; in udp_getpeername()
6249 mutex_enter(&connp->conn_lock); in udp_getpeername()
6253 error = conn_getpeername(connp, sa, salenp); in udp_getpeername()
6254 mutex_exit(&connp->conn_lock); in udp_getpeername()
6263 conn_t *connp = (conn_t *)proto_handle; in udp_getsockname() local
6269 mutex_enter(&connp->conn_lock); in udp_getsockname()
6270 error = conn_getsockname(connp, sa, salenp); in udp_getsockname()
6271 mutex_exit(&connp->conn_lock); in udp_getsockname()
6279 conn_t *connp = (conn_t *)proto_handle; in udp_getsockopt() local
6299 len = udp_opt_get(connp, level, option_name, optvalp_buf); in udp_getsockopt()
6321 conn_t *connp = (conn_t *)proto_handle; in udp_setsockopt() local
6338 error = udp_opt_set(connp, SETFN_OPTCOM_NEGOTIATE, level, option_name, in udp_setsockopt()
6350 conn_t *connp = (conn_t *)proto_handle; in udp_clr_flowctrl() local
6351 udp_t *udp = connp->conn_udp; in udp_clr_flowctrl()
6354 connp->conn_flow_cntrld = B_FALSE; in udp_clr_flowctrl()
6362 conn_t *connp = (conn_t *)proto_handle; in udp_shutdown() local
6369 (*connp->conn_upcalls->su_opctl)(connp->conn_upper_handle, in udp_shutdown()
6373 (*connp->conn_upcalls->su_opctl)(connp->conn_upper_handle, in udp_shutdown()
6382 conn_t *connp = (conn_t *)proto_handle; in udp_ioctl() local
6393 if (connp->conn_helper_info == NULL) { in udp_ioctl()
6394 udp_stack_t *us = connp->conn_udp->udp_us; in udp_ioctl()
6401 error = ip_create_helper_stream(connp, us->us_ldi_ident); in udp_ioctl()
6421 error = ldi_ioctl(connp->conn_helper_info->iphs_handle, in udp_ioctl()