Changeset 218849 in webkit
- Timestamp:
- Jun 27, 2017, 3:54:19 PM (8 years ago)
- Location:
- trunk/Source/ThirdParty/libwebrtc
- Files:
-
- 5 added
- 48 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/ThirdParty/libwebrtc/ChangeLog
r218699 r218849 1 2017-06-27 Youenn Fablet <youenn@apple.com> 2 3 Refresh usrsctp to Source/ThirdParty/libwebrtc/WebKit/patch-usrsctp and libsrtp to ccf84786f8ef803cb9c75e919e5a3976b9f5a67 4 https://bugs.webkit.org/show_bug.cgi?id=173673 5 6 Reviewed by Sam Weinig. 7 8 * Source/third_party/libsrtp/README.chromium: 9 * Source/third_party/libsrtp/srtp/srtp.c: 10 (srtp_stream_init_keys): 11 (srtp_calc_aead_iv_srtcp): 12 (srtp_protect_rtcp_aead): 13 (srtp_unprotect_rtcp_aead): 14 * Source/third_party/libsrtp/test/srtp_driver.c: 15 (srtp_validate_encrypted_extensions_headers_gcm): 16 * Source/third_party/usrsctp/usrsctplib/.gitignore: Added. 17 * Source/third_party/usrsctp/usrsctplib/CMakeLists.txt: 18 * Source/third_party/usrsctp/usrsctplib/Makefile.am: 19 * Source/third_party/usrsctp/usrsctplib/README.md: 20 * Source/third_party/usrsctp/usrsctplib/configure.ac: 21 * Source/third_party/usrsctp/usrsctplib/programs/CMakeLists.txt: 22 * Source/third_party/usrsctp/usrsctplib/programs/Makefile.am: 23 * Source/third_party/usrsctp/usrsctplib/programs/client.c: 24 (main): 25 * Source/third_party/usrsctp/usrsctplib/programs/datachan_serv.c: 26 (main): 27 * Source/third_party/usrsctp/usrsctplib/programs/ekr_loop_offload.c: Added. 28 (handle_packets): 29 * Source/third_party/usrsctp/usrsctplib/programs/test_timer.c: Added. 30 (main): 31 * Source/third_party/usrsctp/usrsctplib/usrsctp.pc.in: Added. 32 * Source/third_party/usrsctp/usrsctplib/usrsctplib/CMakeLists.txt: 33 * Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_asconf.c: 34 * Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_asconf.h: 35 * Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_auth.c: 36 * Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_auth.h: 37 * Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_bsd_addr.c: 38 * Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_bsd_addr.h: 39 * Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_cc_functions.c: 40 (sctp_cwnd_update_after_fr): 41 (sctp_hs_cwnd_update_after_fr): 42 (sctp_htcp_cwnd_update_after_fr): 43 * Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_constants.h: 44 * Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_crc32.c: 45 * Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_crc32.h: 46 * Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_header.h: 47 * Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_indata.c: 48 (sctp_build_readq_entry): 49 (sctp_place_control_in_stream): 50 (sctp_abort_in_reasm): 51 (sctp_queue_data_to_stream): 52 (sctp_build_readq_entry_from_ctl): 53 (sctp_handle_old_unordered_data): 54 (sctp_inject_old_unordered_data): 55 (sctp_deliver_reasm_check): 56 (sctp_add_chk_to_control): 57 (sctp_queue_data_for_reasm): 58 (sctp_find_reasm_entry): 59 (sctp_process_a_data_chunk): 60 (sctp_sack_check): 61 (sctp_process_segment_range): 62 (sctp_check_for_revoked): 63 * Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_indata.h: 64 * Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_input.c: 65 (sctp_process_init): 66 (sctp_process_cookie_existing): 67 * Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_input.h: 68 * Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_output.c: 69 * Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_output.h: 70 * Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_pcb.c: 71 * Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_pcb.h: 72 * Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_peeloff.h: 73 * Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_ss_functions.c: 74 (sctp_ss_rr_add): 75 (sctp_ss_fcfs_select): 76 * Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_structs.h: 77 * Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_sysctl.c: 78 * Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_timer.c: 79 (sctp_recover_sent_list): 80 * Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_uio.h: 81 * Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_usrreq.c: 82 (sctp_init): 83 (sctp_pathmtu_adjustment): 84 * Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_var.h: 85 * Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctputil.c: 86 (sctp_log_strm_del): 87 (sctp_init_asoc): 88 (sctp_notify_send_failed): 89 (sctp_notify_send_failed2): 90 * Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctputil.h: 91 * Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet6/sctp6_usrreq.c: 92 * Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet6/sctp6_var.h: 93 * Source/third_party/usrsctp/usrsctplib/usrsctplib/user_mbuf.c: 94 (m_get): 95 (mbuf_initialize): 96 * Source/third_party/usrsctp/usrsctplib/usrsctplib/user_mbuf.h: 97 * Source/third_party/usrsctp/usrsctplib/usrsctplib/user_socket.c: 98 * Source/third_party/usrsctp/usrsctplib/usrsctplib/usrsctp.h: 99 * WebKit/patch-usrsctp: Added. 100 1 101 2017-06-22 Youenn Fablet <youenn@apple.com> 2 102 -
trunk/Source/ThirdParty/libwebrtc/Source/third_party/libsrtp/README.chromium
r210942 r218849 3 3 Version: 2cbd85085037dc7bf2eda48d4cf62e2829056e2d 4 4 License: 3-clause BSD 5 License File: srtp/LICENSE5 License File: LICENSE 6 6 Security Critical: Yes 7 7 … … 15 15 16 16 Patched in https://github.com/cisco/libsrtp/pull/209. 17 18 Patched in https://github.com/cisco/libsrtp/pull/259. 19 20 Patched in https://github.com/cisco/libsrtp/pull/262. 21 22 Patched in https://github.com/cisco/libsrtp/pull/287. -
trunk/Source/ThirdParty/libwebrtc/Source/third_party/libsrtp/srtp/srtp.c
r210942 r218849 766 766 rtp_xtn_hdr_base_key_len = base_key_length(srtp->rtp_xtn_hdr_cipher->type, rtp_xtn_hdr_keylen); 767 767 rtp_xtn_hdr_salt_len = rtp_xtn_hdr_keylen - rtp_xtn_hdr_base_key_len; 768 if (rtp_xtn_hdr_salt_len > rtp_salt_len) { 769 switch (srtp->rtp_cipher->type->id) { 770 case SRTP_AES_128_GCM: 771 case SRTP_AES_256_GCM: 772 /* The shorter GCM salt is padded to the required ICM salt length. */ 773 rtp_xtn_hdr_salt_len = rtp_salt_len; 774 break; 775 default: 776 /* zeroize temp buffer */ 777 octet_string_set_to_zero(tmp_key, MAX_SRTP_KEY_LEN); 778 return srtp_err_status_bad_param; 779 } 780 } 768 781 memset(tmp_xtn_hdr_key, 0x0, MAX_SRTP_KEY_LEN); 769 782 memcpy(tmp_xtn_hdr_key, key, (rtp_xtn_hdr_base_key_len + rtp_xtn_hdr_salt_len)); … … 2862 2875 * *hdr - The RTP header, used to get the SSRC value 2863 2876 * 2877 * Returns: srtp_err_status_ok if no error or srtp_err_status_bad_param 2878 * if seq_num is invalid 2879 * 2864 2880 */ 2865 static void srtp_calc_aead_iv_srtcp(srtp_stream_ctx_t *stream, v128_t *iv, 2866 uint32_t seq_num, srtcp_hdr_t *hdr) 2881 static srtp_err_status_t 2882 srtp_calc_aead_iv_srtcp(srtp_stream_ctx_t *stream, v128_t *iv, 2883 uint32_t seq_num, srtcp_hdr_t *hdr) 2867 2884 { 2868 2885 v128_t in; … … 2875 2892 memcpy(&in.v16[1], &hdr->ssrc, 4); /* still in network order! */ 2876 2893 in.v16[3] = 0; 2877 in.v32[2] = 0x7FFFFFFF & htonl(seq_num); /* bit 32 is suppose to be zero */ 2894 2895 /* 2896 * The SRTCP index (seq_num) spans bits 0 through 30 inclusive. 2897 * The most significant bit should be zero. 2898 */ 2899 if (seq_num & 0x80000000UL) { 2900 return srtp_err_status_bad_param; 2901 } 2902 in.v32[2] = htonl(seq_num); 2878 2903 2879 2904 debug_print(mod_srtp, "Pre-salted RTCP IV = %s\n", v128_hex_string(&in)); … … 2889 2914 */ 2890 2915 v128_xor(iv, &in, &salt); 2916 2917 return srtp_err_status_ok; 2891 2918 } 2892 2919 … … 2956 2983 2957 2984 /* 2958 * Calculating the IV and pass it down to the cipher 2959 */ 2960 srtp_calc_aead_iv_srtcp(stream, &iv, seq_num, hdr); 2985 * Calculate and set the IV 2986 */ 2987 status = srtp_calc_aead_iv_srtcp(stream, &iv, seq_num, hdr); 2988 if (status) { 2989 return srtp_err_status_cipher_fail; 2990 } 2961 2991 status = srtp_cipher_set_iv(stream->rtcp_cipher, (uint8_t*)&iv, srtp_direction_encrypt); 2962 2992 if (status) { … … 3103 3133 * Calculate and set the IV 3104 3134 */ 3105 srtp_calc_aead_iv_srtcp(stream, &iv, seq_num, hdr); 3135 status = srtp_calc_aead_iv_srtcp(stream, &iv, seq_num, hdr); 3136 if (status) { 3137 return srtp_err_status_cipher_fail; 3138 } 3106 3139 status = srtp_cipher_set_iv(stream->rtcp_cipher, (uint8_t*)&iv, srtp_direction_decrypt); 3107 3140 if (status) { -
trunk/Source/ThirdParty/libwebrtc/Source/third_party/libsrtp/test/srtp_driver.c
r210942 r218849 1944 1944 0x90, 0x0f, 0x12, 0x34, 0xde, 0xca, 0xfb, 0xad, 1945 1945 0xca, 0xfe, 0xba, 0xbe, 0xBE, 0xDE, 0x00, 0x06, 1946 0x17, 0x 58, 0x8A, 0x92, 0x70, 0xF4, 0xE1, 0x5E,1947 0x1C, 0x22, 0x00, 0x00, 0xC8, 0x30, 0x 95, 0x46,1948 0x A9, 0x94, 0xF0, 0xBC, 0x54, 0x78, 0x97, 0x00,1946 0x17, 0x12, 0xe0, 0x20, 0x5b, 0xfa, 0x94, 0x9b, 1947 0x1C, 0x22, 0x00, 0x00, 0xC8, 0x30, 0xbb, 0x46, 1948 0x73, 0x27, 0x78, 0xd9, 0x92, 0x9a, 0xab, 0x00, 1949 1949 0x0e, 0xca, 0x0c, 0xf9, 0x5e, 0xe9, 0x55, 0xb2, 1950 1950 0x6c, 0xd3, 0xd2, 0x88, 0xb4, 0x9f, 0x6c, 0xa9, 1951 0x bb, 0x4e, 0x15, 0xc2, 0xe9, 0xf2, 0x66, 0x781951 0xf4, 0xb1, 0xb7, 0x59, 0x71, 0x9e, 0xb5, 0xbc 1952 1952 }; 1953 1953 srtp_t srtp_snd, srtp_recv; -
trunk/Source/ThirdParty/libwebrtc/Source/third_party/usrsctp/usrsctplib/CMakeLists.txt
r210942 r218849 1 1 # 2 2 # Copyright (C) 2015-2015 Oleg Alexeenkov 3 # Copyright (C) 2015-201 5Felix Weinrank3 # Copyright (C) 2015-2017 Felix Weinrank 4 4 # 5 5 # All rights reserved. … … 38 38 endif() 39 39 40 # Enable verbose output in DEBUG mode41 if (${CMAKE_BUILD_TYPE} MATCHES "DEBUG")42 message(STATUS "enabling verbose outout")43 set(CMAKE_VERBOSE_MAKEFILE on)44 endif()45 46 40 add_subdirectory(usrsctplib) 47 41 add_subdirectory(programs) -
trunk/Source/ThirdParty/libwebrtc/Source/third_party/usrsctp/usrsctplib/Makefile.am
r210942 r218849 32 32 EXTRA_DIST = bootstrap Makefile.nmake 33 33 ACLOCAL_AMFLAGS = -I m4 34 # pkgconfig_DATA = usrsctp.pc -
trunk/Source/ThirdParty/libwebrtc/Source/third_party/usrsctp/usrsctplib/README.md
r210942 r218849 5 5 See [manual](Manual.md) for more information. 6 6 7 The status of contin ous integration testing is available from [grid](http://212.201.121.110:18010/grid) and [waterfall](http://212.201.121.110:18010/waterfall).7 The status of continuous integration testing is available from [grid](http://212.201.121.110:18010/grid) and [waterfall](http://212.201.121.110:18010/waterfall). 8 8 If you are only interested in a single branch, just append `?branch=BRANCHNAME` to the URL, for example [waterfall](http://212.201.121.110:18010/waterfall?branch=master). -
trunk/Source/ThirdParty/libwebrtc/Source/third_party/usrsctp/usrsctplib/configure.ac
r210942 r218849 37 37 AC_CONFIG_MACRO_DIR([m4]) 38 38 39 dnl Disable pkg_config support for now 40 dnl PKG_PROG_PKG_CONFIG 41 dnl PKG_INSTALLDIR 42 39 43 LIBCFLAGS="-DSCTP_PROCESS_LEVEL_LOCKS -DSCTP_SIMPLE_ALLOCATOR -D__Userspace__" 44 APPCFLAGS="" 45 40 46 case $host_os in 41 47 darwin*) 42 CFLAGS="$CFLAGS -std=c99 - D__APPLE_USE_RFC_2292"48 CFLAGS="$CFLAGS -std=c99 -Wno-deprecated-declarations -D__APPLE_USE_RFC_2292" 43 49 LIBCFLAGS="$LIBCFLAGS -U__APPLE__ -D__Userspace_os_Darwin" 44 50 ;; … … 91 97 fi 92 98 93 LIBCFLAGS="$CFLAGS $LIBCFLAGS"94 95 99 AC_ARG_ENABLE(invariants, 96 100 AC_HELP_STRING( [--enable-invariants], … … 115 119 enable_inet=$enableval,enable_inet=yes) 116 120 if test x$enable_inet = xyes; then 121 APPCFLAGS="$APPCFLAGS -DINET" 117 122 AC_DEFINE(INET, 1, [Support IPv4]) 118 123 fi … … 123 128 enable_inet6=$enableval,enable_inet6=yes) 124 129 if test x$enable_inet6 = xyes; then 130 APPCFLAGS="$APPCFLAGS -DINET6" 125 131 AC_DEFINE(INET6, 1, [Support IPv6]) 126 132 fi … … 132 138 AC_CHECK_FUNCS(inet_addr, , AC_CHECK_LIB(nsl, inet_addr)) 133 139 140 AC_CHECK_HEADERS(stdatomic.h) 134 141 AC_CHECK_HEADERS(sys/queue.h) 135 142 AC_CHECK_HEADERS(linux/if_addr.h, [], [], [#include <sys/socket.h>]) … … 175 182 176 183 AC_SUBST([LIBCFLAGS]) 184 AC_SUBST([APPCFLAGS]) 185 dnl AC_CONFIG_FILES([usrsctp.pc]) 177 186 AC_OUTPUT(Makefile usrsctplib/Makefile programs/Makefile) -
trunk/Source/ThirdParty/libwebrtc/Source/third_party/usrsctp/usrsctplib/programs/CMakeLists.txt
r210942 r218849 46 46 47 47 ################################################# 48 # CHECK FOR TYPES AND FUNCTIONS49 #################################################50 51 # xxx warum machen wir die checks?52 check_type_size("size_t" HAVE_SIZE_T)53 check_type_size("ssize_t" HAVE_SSIZE_T)54 55 check_function_exists("socket" HAVE_SOCKET)56 check_function_exists("inet_addr" HAVE_INET_ADDR)57 58 59 #################################################60 48 # CHECK INCLUDES 61 49 ################################################# 62 50 63 check_include_file(sys/socket.h HAVE_SYS_SOCKET_H)64 check_include_file(sys/types.h HAVE_SYS_TYPES_H)65 check_include_file(sys/queue.h HAVE_SYS_QUEUE_H)66 check_include_file(linux/if_addr.h HAVE_LINUX_IF_ADDR_H)67 check_include_file(linux/rtnetlink.h HAVE_LINUX_RTNETLINK_H)68 check_include_file(netinet/ip_icmp.h HAVE_NETINET_IP_ICMP_H)69 51 check_include_file(usrsctp.h HAVE_USRSCTP_H) 70 52 … … 75 57 76 58 check_struct_has_member("struct sockaddr" "sa_len" "sys/types.h;sys/socket.h" HAVE_SA_LEN) 77 if (HAVE_SA_LEN)78 79 endif ()59 if (HAVE_SA_LEN) 60 add_definitions(-DHAVE_SA_LEN) 61 endif () 80 62 81 63 check_struct_has_member("struct sockaddr_in" "sin_len" "sys/types.h;netinet/in.h" HAVE_SIN_LEN) 82 if (HAVE_SIN_LEN)83 84 endif ()64 if (HAVE_SIN_LEN) 65 add_definitions(-DHAVE_SIN_LEN) 66 endif () 85 67 86 68 check_struct_has_member("struct sockaddr_in6" "sin6_len" "sys/types.h;netinet/in.h" HAVE_SIN6_LEN) 87 if (HAVE_SIN6_LEN)88 89 endif ()69 if (HAVE_SIN6_LEN) 70 add_definitions(-DHAVE_SIN6_LEN) 71 endif () 90 72 91 73 check_struct_has_member("struct sockaddr_conn" "sconn_len" "usrsctp.h" HAVE_SCONN_LEN) 92 if (HAVE_SCONN_LEN)93 94 endif ()74 if (HAVE_SCONN_LEN) 75 add_definitions(-DHAVE_SCONN_LEN) 76 endif () 95 77 96 78 … … 101 83 option(SCTP_DEBUG "Provide debug information" 1) 102 84 if (SCTP_DEBUG) 103 104 endif ()85 add_definitions(-DSCTP_DEBUG) 86 endif () 105 87 106 88 option(INET "Support IPv4 " 1) 107 89 if (INET) 108 109 endif ()90 add_definitions(-DINET) 91 endif () 110 92 111 93 option(INET6 "Support IPv6 " 1) 112 94 if (INET6) 113 114 endif ()95 add_definitions(-DINET6) 96 endif () 115 97 116 98 option(LINK_STATIC "Link static" 0) … … 118 100 # xxx enable W32 support for shared lib ... 119 101 if (LINK_STATIC OR WIN32) 120 102 set(LINK_STATIC "usrsctp-static") 121 103 else() 122 123 endif ()104 set(LINK_STATIC "usrsctp") 105 endif () 124 106 125 107 option(WERROR "Warning as error" ON) … … 131 113 132 114 if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") 133 134 endif ()115 add_definitions(-D_GNU_SOURCE) 116 endif () 135 117 136 118 if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") 137 138 endif ()119 add_definitions(-D__APPLE_USE_RFC_2292) 120 endif () 139 121 140 122 … … 143 125 ################################################# 144 126 145 FIND_PACKAGE(Threads)127 find_package(Threads) 146 128 147 129 … … 150 132 ################################################# 151 133 152 SET (check_PROGRAMS 153 client.c 154 datachan_serv.c 155 daytime_server.c 156 discard_server.c 157 echo_server.c 158 ekr_client.c 159 ekr_loop.c 160 ekr_peer.c 161 ekr_server.c 162 http_client.c 163 rtcweb.c 164 test_libmgmt.c 165 tsctp.c 134 set(CHECK_PROGRAMS 135 client.c 136 datachan_serv.c 137 daytime_server.c 138 discard_server.c 139 echo_server.c 140 ekr_client.c 141 ekr_loop.c 142 ekr_loop_offload.c 143 ekr_peer.c 144 ekr_server.c 145 http_client.c 146 rtcweb.c 147 test_libmgmt.c 148 test_timer.c 149 tsctp.c 166 150 ) 167 151 168 152 # SETTINGS FOR UNIX COMPILER 169 IF("x${CMAKE_C_COMPILER_ID}" STREQUAL "xClang" OR "x${CMAKE_C_COMPILER_ID}" STREQUAL "xGNU")170 171 172 173 174 175 endif()176 ENDIF()153 if ("x${CMAKE_C_COMPILER_ID}" STREQUAL "xClang" OR "x${CMAKE_C_COMPILER_ID}" STREQUAL "xGNU") 154 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic -Wall -std=c99") 155 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wall -std=c99") 156 if (WERROR) 157 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror") 158 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror") 159 endif () 160 endif () 177 161 178 162 # SETTINGS FOR VISUAL STUDIO COMPILER 179 IF("x${CMAKE_C_COMPILER_ID}" STREQUAL "xMSVC")180 IF(CMAKE_C_FLAGS MATCHES "/W[0-4]")181 STRING(REGEX REPLACE "/W[0-4]" "/W3" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")182 ELSE()183 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W3")184 ENDIF()163 if ("x${CMAKE_C_COMPILER_ID}" STREQUAL "xMSVC") 164 if (CMAKE_C_FLAGS MATCHES "/W[0-4]") 165 string(REGEX REPLACE "/W[0-4]" "/W3" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") 166 else () 167 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W3") 168 endif () 185 169 186 IF(WERROR)187 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /WX")188 ENDIF()189 ENDIF()170 if (WERROR) 171 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /WX") 172 endif () 173 endif () 190 174 191 FOREACH (source_file ${check_PROGRAMS})192 GET_FILENAME_COMPONENT (source_file_we ${source_file} NAME_WE)193 ADD_EXECUTABLE(194 ${source_file_we}195 ${source_file}196 175 foreach (SOURCE_FILE ${CHECK_PROGRAMS}) 176 get_filename_component(SOURCE_FILE_WE ${SOURCE_FILE} NAME_WE) 177 add_executable( 178 ${SOURCE_FILE_WE} 179 ${SOURCE_FILE} 180 ) 197 181 198 TARGET_LINK_LIBRARIES (${source_file_we}199 200 201 182 target_link_libraries(${SOURCE_FILE_WE} 183 ${LINK_STATIC} 184 ${CMAKE_THREAD_LIBS_INIT} 185 ) 202 186 203 ADD_TEST (${source_file_we} ${source_file_we})204 ENDFOREACH()187 add_test(${SOURCE_FILE_WE} ${SOURCE_FILE_WE}) 188 endforeach () -
trunk/Source/ThirdParty/libwebrtc/Source/third_party/usrsctp/usrsctplib/programs/Makefile.am
r210942 r218849 30 30 31 31 AM_CPPFLAGS = -I$(srcdir)/../usrsctplib 32 EXTRA_DIST = Makefile.nmake tsctp.c daytime_server.c discard_server.c echo_server.c client.c rtcweb.c ekr_client.c ekr_server.c ekr_loop.c test_libmgmt.c http_client.c32 EXTRA_DIST = Makefile.nmake tsctp.c daytime_server.c discard_server.c echo_server.c client.c rtcweb.c ekr_client.c ekr_server.c ekr_loop.c ekr_loop_offload.c test_libmgmt.c http_client.c 33 33 34 noinst_PROGRAMS = tsctp daytime_server discard_server echo_server client rtcweb ekr_client ekr_server ekr_peer ekr_loop test_libmgmthttp_client34 noinst_PROGRAMS = tsctp daytime_server discard_server echo_server client rtcweb ekr_client ekr_server ekr_peer ekr_loop ekr_loop_offload test_libmgmt test_timer http_client 35 35 test_libmgmt_SOURCES = test_libmgmt.c 36 36 test_libmgmt_LDADD = ../usrsctplib/libusrsctp.la 37 test_timer_SOURCES = test_timer.c 38 test_timer_LDADD = ../usrsctplib/libusrsctp.la 37 39 tsctp_SOURCES = tsctp.c 38 40 tsctp_LDADD = ../usrsctplib/libusrsctp.la … … 55 57 ekr_loop_SOURCES = ekr_loop.c 56 58 ekr_loop_LDADD = ../usrsctplib/libusrsctp.la 59 ekr_loop_offload_SOURCES = ekr_loop_offload.c 60 ekr_loop_offload_LDADD = ../usrsctplib/libusrsctp.la 57 61 http_client_SOURCES = http_client.c 58 62 http_client_LDADD = ../usrsctplib/libusrsctp.la -
trunk/Source/ThirdParty/libwebrtc/Source/third_party/usrsctp/usrsctplib/programs/client.c
r210942 r218849 98 98 int i, n; 99 99 100 if (argc < 3) { 101 printf("%s", "Usage: client remote_addr remote_port local_port local_encaps_port remote_encaps_port\n"); 102 return (-1); 103 } 100 104 if (argc > 4) { 101 105 usrsctp_init(atoi(argv[4]), NULL, debug_printf); -
trunk/Source/ThirdParty/libwebrtc/Source/third_party/usrsctp/usrsctplib/programs/datachan_serv.c
r210942 r218849 471 471 prinfo.pr_policy = SCTP_PR_SCTP_TTL; 472 472 break; 473 default: 474 flags = 0; 475 prinfo.pr_policy = 0; 476 break; 473 477 } 474 478 sndinfo.snd_sid = stream; -
trunk/Source/ThirdParty/libwebrtc/Source/third_party/usrsctp/usrsctplib/usrsctplib/CMakeLists.txt
r210942 r218849 1 1 # 2 2 # Copyright (C) 2015-2015 Oleg Alexeenkov 3 # Copyright (C) 2015-201 5Felix Weinrank3 # Copyright (C) 2015-2017 Felix Weinrank 4 4 # 5 5 # All rights reserved. … … 41 41 include(CheckFunctionExists) 42 42 include(CheckStructHasMember) 43 include(CheckIncludeFile )43 include(CheckIncludeFiles) 44 44 include(CMakePushCheckState) 45 45 include(CheckTypeSize) 46 46 47 SET (VERSION "1.0.0") 48 49 SET (prefix ${CMAKE_INSTALL_PREFIX}) 50 SET (exec_prefix "\${prefix}") 51 SET (libdir "\${exec_prefix}/lib") 52 SET (includedir "\${prefix}/include/usrsctp") 53 SET (CMAKE_REQUIRED_INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}) 47 set(VERSION "1.0.0") 48 49 set(prefix ${CMAKE_INSTALL_PREFIX}) 50 set(exec_prefix "\${prefix}") 51 set(libdir "\${exec_prefix}/lib") 52 set(includedir "\${prefix}/include/usrsctp") 53 set(CMAKE_REQUIRED_INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}) 54 set(CMAKE_MACOSX_RPATH 1) 54 55 55 56 … … 58 59 ################################################# 59 60 60 check_type_size("size_t" HAVE_SIZE_T) 61 check_type_size("ssize_t" HAVE_SSIZE_T) 62 63 check_include_file(sys/socket.h HAVE_SYS_SOCKET_H) 64 check_include_file(sys/types.h HAVE_SYS_TYPES_H) 65 check_include_file(sys/queue.h HAVE_SYS_QUEUE_H) 66 check_include_file(linux/if_addr.h HAVE_LINUX_IF_ADDR_H) 67 check_include_file(linux/rtnetlink.h HAVE_LINUX_RTNETLINK_H) 68 check_include_file(netinet/ip_icmp.h HAVE_NETINET_IP_ICMP_H) 69 check_include_file(usrsctp.h HAVE_USRSCTP_H) 70 71 check_function_exists("socket" HAVE_SOCKET) 72 check_function_exists("inet_addr" HAVE_INET_ADDR) 61 check_include_files("sys/queue.h" HAVE_SYS_QUEUE_H) 62 if (HAVE_SYS_QUEUE_H) 63 add_definitions(-DHAVE_SYS_QUEUE_H) 64 endif () 65 66 check_include_files("sys/socket.h;linux/if_addr.h" HAVE_LINUX_IF_ADDR_H) 67 if (HAVE_LINUX_IF_ADDR_H) 68 add_definitions(-DHAVE_LINUX_IF_ADDR_H) 69 endif () 70 71 check_include_files("sys/socket.h;linux/rtnetlink.h" HAVE_LINUX_RTNETLINK_H) 72 if (HAVE_LINUX_RTNETLINK_H) 73 add_definitions(-DHAVE_LINUX_RTNETLINK_H) 74 endif () 75 76 check_include_files("sys/types.h;netinet/in.h;netinet/ip.h;netinet/ip_icmp.h" HAVE_NETINET_IP_ICMP_H) 77 if (HAVE_NETINET_IP_ICMP_H) 78 add_definitions(-DHAVE_NETINET_IP_ICMP_H) 79 endif () 80 81 check_include_files("stdatomic.h" HAVE_STDATOMIC_H) 82 if (HAVE_STDATOMIC_H) 83 add_definitions(-DHAVE_STDATOMIC_H) 84 endif () 73 85 74 86 add_definitions(-D__Userspace__) … … 82 94 83 95 check_struct_has_member("struct sockaddr" "sa_len" "sys/types.h;sys/socket.h" HAVE_SA_LEN) 84 if (HAVE_SA_LEN)85 86 87 endif ()96 if (HAVE_SA_LEN) 97 message(STATUS "HAVE_SA_LEN") 98 add_definitions(-DHAVE_SA_LEN) 99 endif () 88 100 89 101 check_struct_has_member("struct sockaddr_in" "sin_len" "sys/types.h;netinet/in.h" HAVE_SIN_LEN) 90 if (HAVE_SIN_LEN)91 92 93 endif ()102 if (HAVE_SIN_LEN) 103 message(STATUS "HAVE_SIN_LEN") 104 add_definitions(-DHAVE_SIN_LEN) 105 endif () 94 106 95 107 check_struct_has_member("struct sockaddr_in6" "sin6_len" "sys/types.h;netinet/in.h" HAVE_SIN6_LEN) 96 if (HAVE_SIN6_LEN)97 98 99 endif ()108 if (HAVE_SIN6_LEN) 109 message(STATUS "HAVE_SIN6_LEN") 110 add_definitions(-DHAVE_SIN6_LEN) 111 endif () 100 112 101 113 check_struct_has_member("struct sockaddr_conn" "sconn_len" "usrsctp.h" HAVE_SCONN_LEN) 102 if (HAVE_SCONN_LEN)103 104 105 endif ()114 if (HAVE_SCONN_LEN) 115 message(STATUS "HAVE_SCONN_LEN") 116 add_definitions(-DHAVE_SCONN_LEN) 117 endif () 106 118 107 119 … … 111 123 112 124 if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") 113 114 endif ()125 add_definitions(-D_GNU_SOURCE) 126 endif () 115 127 116 128 if (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") 117 118 endif ()129 add_definitions(-U__FreeBSD__) 130 endif () 119 131 120 132 if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") 121 add_definitions(-U__APPLE__) 122 add_definitions(-D__APPLE_USE_RFC_2292) 123 endif() 133 add_definitions(-U__APPLE__) 134 add_definitions(-D__APPLE_USE_RFC_2292) 135 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-deprecated-declarations") 136 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations") 137 endif () 124 138 125 139 if (${CMAKE_SYSTEM_NAME} MATCHES "DragonFly") 126 127 endif ()140 add_definitions(-U__DragonFly__) 141 endif () 128 142 129 143 if (${CMAKE_SYSTEM_NAME} MATCHES "NetBSD") 130 131 endif ()144 add_definitions(-U__NetBSD__) 145 endif () 132 146 133 147 if (${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD") 134 135 endif ()148 add_definitions(-U__OpenBSD__) 149 endif () 136 150 137 151 … … 142 156 option(INVARIANTS "Add runtime checks" 0) 143 157 if (INVARIANTS) 144 145 endif ()158 add_definitions(-DINVARIANTS) 159 endif () 146 160 147 161 option(SCTP_DEBUG "Provide debug information" 1) 148 162 if (SCTP_DEBUG) 149 150 endif ()163 add_definitions(-DSCTP_DEBUG) 164 endif () 151 165 152 166 option(INET "Support IPv4 " 1) 153 167 if (INET) 154 155 endif ()168 add_definitions(-DINET) 169 endif () 156 170 157 171 option(INET6 "Support IPv6 " 1) 158 172 if (INET6) 159 160 endif ()173 add_definitions(-DINET6) 174 endif () 161 175 162 176 option(SCTP_SIMPLE_ALLOCATOR " " 1) 163 177 if (SCTP_SIMPLE_ALLOCATOR) 164 165 endif ()178 add_definitions(-DSCTP_SIMPLE_ALLOCATOR) 179 endif () 166 180 167 181 option(SCTP_PROCESS_LEVEL_LOCKS " " 1) 168 182 if (SCTP_PROCESS_LEVEL_LOCKS) 169 170 endif ()183 add_definitions(-DSCTP_PROCESS_LEVEL_LOCKS) 184 endif () 171 185 172 186 option(SCTP_WITH_NO_CSUM "Disable SCTP checksum" 0) 173 187 if (SCTP_WITH_NO_CSUM) 174 175 endif ()188 add_definitions(-DSCTP_WITH_NO_CSUM) 189 endif () 176 190 177 191 option(SCTP_MBUF_LOGGING " " 0) 178 192 if (SCTP_MBUF_LOGGING) 179 180 endif ()193 add_definitions(-DSCTP_MBUF_LOGGING) 194 endif () 181 195 182 196 option(SCTP_PACKET_LOGGING " " 0) 183 197 if (SCTP_PACKET_LOGGING) 184 185 endif ()198 add_definitions(-DSCTP_PACKET_LOGGING) 199 endif () 186 200 187 201 option(SCTP_SO_LOCK_TESTING " " 0) 188 202 if (SCTP_SO_LOCK_TESTING) 189 190 endif ()203 add_definitions(-DSCTP_SO_LOCK_TESTING) 204 endif () 191 205 192 206 option(SCTP_EMBEDDED_V6_SCOPE " " 0) 193 207 if (SCTP_EMBEDDED_V6_SCOPE) 194 195 endif ()208 add_definitions(-DSCTP_EMBEDDED_V6_SCOPE) 209 endif () 196 210 197 211 option(SCTP_KAME " " 0) 198 212 if (SCTP_KAME) 199 200 endif ()213 add_definitions(-DSCTP_KAME) 214 endif () 201 215 202 216 option(WERROR "Warning as error" ON) … … 204 218 include_directories(${PROJECT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/netinet ${PROJECT_SOURCE_DIR}/netinet6) 205 219 206 LIST(APPEND usrsctp_root_HEADERS207 208 209 ) 210 211 LIST(APPEND usrsctp_netinet_HEADERS212 213 214 215 216 ) 217 218 LIST(APPEND usrsctp_netinet6_HEADERS220 list(APPEND usrsctp_root_HEADERS 221 user_atomic.h user_inpcb.h user_ip_icmp.h user_mbuf.h user_recv_thread.h user_socketvar.h usrsctp.h 222 user_environment.h user_ip6_var.h user_malloc.h user_queue.h user_route.h user_uma.h 223 ) 224 225 list(APPEND usrsctp_netinet_HEADERS 226 netinet/sctp_asconf.h netinet/sctp_constants.h netinet/sctp_indata.h netinet/sctp_os_userspace.h netinet/sctp_process_lock.h netinet/sctp_timer.h 227 netinet/sctp_auth.h netinet/sctp_crc32.h netinet/sctp_input.h netinet/sctp_output.h netinet/sctp_sha1.h netinet/sctp_uio.h 228 netinet/sctp_bsd_addr.h netinet/sctp.h netinet/sctp_lock_userspace.h netinet/sctp_pcb.h netinet/sctp_structs.h netinet/sctputil.h 229 netinet/sctp_callout.h netinet/sctp_header.h netinet/sctp_os.h netinet/sctp_peeloff.h netinet/sctp_sysctl.h netinet/sctp_var.h 230 ) 231 232 list(APPEND usrsctp_netinet6_HEADERS 219 233 netinet6/sctp6_var.h 220 234 ) 221 235 222 LIST(APPEND usrsctp_HEADERS223 224 225 226 ) 227 228 LIST(APPEND usrsctp_SOURCES229 230 231 232 236 list(APPEND usrsctp_HEADERS 237 ${usrsctp_root_HEADERS} 238 ${usrsctp_netinet_HEADERS} 239 ${usrsctp_netinet6_HEADERS} 240 ) 241 242 list(APPEND usrsctp_SOURCES 243 netinet6/sctp6_usrreq.c netinet/sctp_callout.c netinet/sctp_input.c netinet/sctp_sha1.c netinet/sctp_userspace.c user_mbuf.c 244 netinet/sctp_asconf.c netinet/sctp_cc_functions.c netinet/sctp_output.c netinet/sctp_ss_functions.c netinet/sctp_usrreq.c user_recv_thread.c 245 netinet/sctp_auth.c netinet/sctp_crc32.c netinet/sctp_pcb.c netinet/sctp_sysctl.c netinet/sctputil.c user_socket.c 246 netinet/sctp_bsd_addr.c netinet/sctp_indata.c netinet/sctp_peeloff.c netinet/sctp_timer.c user_environment.c 233 247 ) 234 248 … … 236 250 add_library(usrsctp-static STATIC ${usrsctp_SOURCES} ${usrsctp_HEADERS}) 237 251 238 if(WIN32) 239 message(STATUS "link library: ws2_32") 240 target_link_libraries(usrsctp ws2_32) 241 target_link_libraries(usrsctp-static ws2_32) 252 if (WIN32) 253 message(STATUS "link library: ws2_32") 254 target_link_libraries(usrsctp ws2_32) 255 target_link_libraries(usrsctp-static ws2_32) 256 endif () 257 258 set_target_properties(usrsctp-static PROPERTIES OUTPUT_NAME "usrsctp") 259 set_target_properties(usrsctp PROPERTIES IMPORT_SUFFIX "_import.lib") 260 set_target_properties(usrsctp PROPERTIES SOVERSION 1 VERSION 1.0.0) 261 262 # SETTINGS FOR UNIX COMPILER 263 if ("x${CMAKE_C_COMPILER_ID}" STREQUAL "xClang" OR "x${CMAKE_C_COMPILER_ID}" STREQUAL "xGNU") 264 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic -Wextra -Wall -std=c99 -Wno-unused-parameter") 265 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wextra -Wall -std=c99 -Wno-unused-parameter") 266 if (WERROR) 267 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror") 268 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror") 269 endif () 270 endif () 271 272 # SETTINGS FOR VISUAL STUDIO COMPILER 273 if ("x${CMAKE_C_COMPILER_ID}" STREQUAL "xMSVC") 274 if (CMAKE_C_FLAGS MATCHES "/W[0-4]") 275 STRING(REGEX REPLACE "/W[0-4]" "/W3" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") 276 ELSE () 277 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W3") 278 endif () 279 280 if (WERROR) 281 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /WX") 282 endif() 283 endif () 284 285 if ("x${CMAKE_C_COMPILER_ID}" STREQUAL "xMSVC90" OR "x${CMAKE_C_COMPILER_ID}" STREQUAL "xMSVC10") 286 SET_SOURCE_FILES_PROPERTIES(${usrsctp_SOURCES} PROPERTIES LANGUAGE C) 242 287 endif() 243 288 244 SET_TARGET_PROPERTIES (usrsctp-static PROPERTIES OUTPUT_NAME "usrsctp") 245 SET_TARGET_PROPERTIES (usrsctp PROPERTIES IMPORT_SUFFIX "_import.lib") 246 SET_TARGET_PROPERTIES (usrsctp PROPERTIES SOVERSION 1 VERSION 1.0.0) 247 248 # SETTINGS FOR UNIX COMPILER 249 IF ("x${CMAKE_C_COMPILER_ID}" STREQUAL "xClang" OR "x${CMAKE_C_COMPILER_ID}" STREQUAL "xGNU") 250 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic -Wall -std=c99") 251 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wall -std=c99") 252 if (WERROR) 253 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror") 254 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror") 255 endif() 256 ENDIF () 257 258 # SETTINGS FOR VISUAL STUDIO COMPILER 259 IF ("x${CMAKE_C_COMPILER_ID}" STREQUAL "xMSVC") 260 IF (CMAKE_C_FLAGS MATCHES "/W[0-4]") 261 STRING(REGEX REPLACE "/W[0-4]" "/W3" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") 262 ELSE () 263 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W3") 264 ENDIF () 265 266 IF (WERROR) 267 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /WX") 268 ENDIF() 269 ENDIF () 270 271 IF ("x${CMAKE_C_COMPILER_ID}" STREQUAL "xMSVC90" OR "x${CMAKE_C_COMPILER_ID}" STREQUAL "xMSVC10") 272 SET_SOURCE_FILES_PROPERTIES(${usrsctp_SOURCES} PROPERTIES LANGUAGE C) 273 ENDIF() 274 275 IF (NOT DEFINED CMAKE_INSTALL_LIBDIR) 289 if (NOT DEFINED CMAKE_INSTALL_LIBDIR) 276 290 SET(CMAKE_INSTALL_LIBDIR lib) 277 ENDIF()291 endif () 278 292 279 293 … … 282 296 ################################################# 283 297 284 INSTALL(TARGETS usrsctp usrsctp-static DESTINATION ${CMAKE_INSTALL_LIBDIR})285 INSTALL(FILES usrsctp.h DESTINATION include)298 install(TARGETS usrsctp usrsctp-static DESTINATION ${CMAKE_INSTALL_LIBDIR}) 299 install(FILES usrsctp.h DESTINATION include) -
trunk/Source/ThirdParty/libwebrtc/Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_asconf.c
r210942 r218849 33 33 #ifdef __FreeBSD__ 34 34 #include <sys/cdefs.h> 35 __FBSDID("$FreeBSD: head/sys/netinet/sctp_asconf.c 298847 2016-04-30 14:25:00Z tuexen $");35 __FBSDID("$FreeBSD: head/sys/netinet/sctp_asconf.c 310590 2016-12-26 11:06:41Z tuexen $"); 36 36 #endif 37 37 -
trunk/Source/ThirdParty/libwebrtc/Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_asconf.h
r210942 r218849 33 33 #ifdef __FreeBSD__ 34 34 #include <sys/cdefs.h> 35 __FBSDID("$FreeBSD: head/sys/netinet/sctp_asconf.h 237715 2012-06-28 16:01:08Z tuexen $");35 __FBSDID("$FreeBSD: head/sys/netinet/sctp_asconf.h 309607 2016-12-06 10:21:25Z tuexen $"); 36 36 #endif 37 37 -
trunk/Source/ThirdParty/libwebrtc/Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_auth.c
r210942 r218849 33 33 #ifdef __FreeBSD__ 34 34 #include <sys/cdefs.h> 35 __FBSDID("$FreeBSD: head/sys/netinet/sctp_auth.c 3 02928 2016-07-16 07:48:01Z tuexen $");35 __FBSDID("$FreeBSD: head/sys/netinet/sctp_auth.c 310590 2016-12-26 11:06:41Z tuexen $"); 36 36 #endif 37 37 -
trunk/Source/ThirdParty/libwebrtc/Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_auth.h
r210942 r218849 33 33 #ifdef __FreeBSD__ 34 34 #include <sys/cdefs.h> 35 __FBSDID("$FreeBSD: head/sys/netinet/sctp_auth.h 271673 2014-09-16 14:20:33Z tuexen $");35 __FBSDID("$FreeBSD: head/sys/netinet/sctp_auth.h 310590 2016-12-26 11:06:41Z tuexen $"); 36 36 #endif 37 37 -
trunk/Source/ThirdParty/libwebrtc/Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_bsd_addr.c
r210942 r218849 33 33 #ifdef __FreeBSD__ 34 34 #include <sys/cdefs.h> 35 __FBSDID("$FreeBSD: head/sys/netinet/sctp_bsd_addr.c 298942 2016-05-02 20:56:11Z pfg$");35 __FBSDID("$FreeBSD: head/sys/netinet/sctp_bsd_addr.c 310590 2016-12-26 11:06:41Z tuexen $"); 36 36 #endif 37 37 … … 307 307 308 308 #if defined(__Userspace_os_Windows) 309 #ifdef MALLOC 310 #undef MALLOC 311 #define MALLOC(x) HeapAlloc(GetProcessHeap(), 0, (x)) 312 #endif 313 #ifdef FREE 314 #undef FREE 315 #define FREE(x) HeapFree(GetProcessHeap(), 0, (x)) 316 #endif 309 317 static void 310 318 sctp_init_ifns_for_vrf(int vrfid) … … 336 344 if ((Err = GetAdaptersAddresses(AF_INET, 0, NULL, pAdapterAddrs, &AdapterAddrsSize)) != ERROR_SUCCESS) { 337 345 SCTP_PRINTF("GetAdaptersV4Addresses() failed with error code %d\n", Err); 338 GlobalFree(pAdapterAddrs);346 FREE(pAdapterAddrs); 339 347 return; 340 348 } … … 361 369 } 362 370 } 363 GlobalFree(pAdapterAddrs);371 FREE(pAdapterAddrs); 364 372 #endif 365 373 #ifdef INET6 … … 381 389 if ((Err = GetAdaptersAddresses(AF_INET6, 0, NULL, pAdapterAddrs, &AdapterAddrsSize)) != ERROR_SUCCESS) { 382 390 SCTP_PRINTF("GetAdaptersV6Addresses() failed with error code %d\n", Err); 383 GlobalFree(pAdapterAddrs);391 FREE(pAdapterAddrs); 384 392 return; 385 393 } … … 403 411 } 404 412 } 405 GlobalFree(pAdapterAddrs);413 FREE(pAdapterAddrs); 406 414 #endif 407 415 } … … 569 577 570 578 IFNET_RLOCK(); 571 TAILQ_FOREACH(ifn, &MODULE_GLOBAL(ifnet), if_li st) {579 TAILQ_FOREACH(ifn, &MODULE_GLOBAL(ifnet), if_link) { 572 580 if (sctp_is_desired_interface_type(ifn) == 0) { 573 581 /* non desired type */ … … 579 587 IF_ADDR_LOCK(ifn); 580 588 #endif 581 TAILQ_FOREACH(ifa, &ifn->if_addr list, ifa_list) {589 TAILQ_FOREACH(ifa, &ifn->if_addrhead, ifa_link) { 582 590 if (ifa->ifa_addr == NULL) { 583 591 continue; … … 746 754 747 755 IFNET_RLOCK(); 748 TAILQ_FOREACH(ifn, &MODULE_GLOBAL(ifnet), if_li st) {756 TAILQ_FOREACH(ifn, &MODULE_GLOBAL(ifnet), if_link) { 749 757 if (!(*pred)(ifn)) { 750 758 continue; 751 759 } 752 TAILQ_FOREACH(ifa, &ifn->if_addr list, ifa_list) {760 TAILQ_FOREACH(ifa, &ifn->if_addrhead, ifa_link) { 753 761 sctp_addr_change(ifa, add ? RTM_ADD : RTM_DELETE); 754 762 } -
trunk/Source/ThirdParty/libwebrtc/Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_bsd_addr.h
r210942 r218849 33 33 #ifdef __FreeBSD__ 34 34 #include <sys/cdefs.h> 35 __FBSDID("$FreeBSD: head/sys/netinet/sctp_bsd_addr.h 237540 2012-06-24 21:25:54Z tuexen $");35 __FBSDID("$FreeBSD: head/sys/netinet/sctp_bsd_addr.h 310590 2016-12-26 11:06:41Z tuexen $"); 36 36 #endif 37 37 -
trunk/Source/ThirdParty/libwebrtc/Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_cc_functions.c
r210942 r218849 33 33 #ifdef __FreeBSD__ 34 34 #include <sys/cdefs.h> 35 __FBSDID("$FreeBSD: head/sys/netinet/sctp_cc_functions.c 298942 2016-05-02 20:56:11Z pfg$");35 __FBSDID("$FreeBSD: head/sys/netinet/sctp_cc_functions.c 310590 2016-12-26 11:06:41Z tuexen $"); 36 36 #endif 37 37 … … 213 213 asoc->fast_recovery_tsn = asoc->sending_seq - 1; 214 214 } else { 215 asoc->fast_recovery_tsn = lchk->rec.data. TSN_seq- 1;215 asoc->fast_recovery_tsn = lchk->rec.data.tsn - 1; 216 216 } 217 217 … … 226 226 net->fast_recovery_tsn = asoc->sending_seq - 1; 227 227 } else { 228 net->fast_recovery_tsn = lchk->rec.data. TSN_seq- 1;228 net->fast_recovery_tsn = lchk->rec.data.tsn - 1; 229 229 } 230 230 … … 1807 1807 asoc->fast_recovery_tsn = asoc->sending_seq - 1; 1808 1808 } else { 1809 asoc->fast_recovery_tsn = lchk->rec.data. TSN_seq- 1;1809 asoc->fast_recovery_tsn = lchk->rec.data.tsn - 1; 1810 1810 } 1811 1811 … … 1820 1820 net->fast_recovery_tsn = asoc->sending_seq - 1; 1821 1821 } else { 1822 net->fast_recovery_tsn = lchk->rec.data. TSN_seq- 1;1822 net->fast_recovery_tsn = lchk->rec.data.tsn - 1; 1823 1823 } 1824 1824 … … 2334 2334 asoc->fast_recovery_tsn = asoc->sending_seq - 1; 2335 2335 } else { 2336 asoc->fast_recovery_tsn = lchk->rec.data. TSN_seq- 1;2336 asoc->fast_recovery_tsn = lchk->rec.data.tsn - 1; 2337 2337 } 2338 2338 … … 2347 2347 net->fast_recovery_tsn = asoc->sending_seq - 1; 2348 2348 } else { 2349 net->fast_recovery_tsn = lchk->rec.data. TSN_seq- 1;2349 net->fast_recovery_tsn = lchk->rec.data.tsn - 1; 2350 2350 } 2351 2351 -
trunk/Source/ThirdParty/libwebrtc/Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_constants.h
r210942 r218849 33 33 #ifdef __FreeBSD__ 34 34 #include <sys/cdefs.h> 35 __FBSDID("$FreeBSD: head/sys/netinet/sctp_constants.h 30 2949 2016-07-17 13:14:51Z tuexen $");35 __FBSDID("$FreeBSD: head/sys/netinet/sctp_constants.h 309682 2016-12-07 19:30:59Z tuexen $"); 36 36 #endif 37 37 … … 924 924 #define SCTP_TSN_GT(a, b) SCTP_UINT32_GT(a, b) 925 925 #define SCTP_TSN_GE(a, b) SCTP_UINT32_GE(a, b) 926 #define SCTP_MSGID_GT(o, a, b) ((o == 1) ? SCTP_UINT16_GT((uint16_t)a, (uint16_t)b) : SCTP_UINT32_GT(a, b)) 927 #define SCTP_MSGID_GE(o, a, b) ((o == 1) ? SCTP_UINT16_GE((uint16_t)a, (uint16_t)b) : SCTP_UINT32_GE(a, b)) 926 #define SCTP_MID_GT(i, a, b) (((i) == 1) ? SCTP_UINT32_GT(a, b) : SCTP_UINT16_GT((uint16_t)a, (uint16_t)b)) 927 #define SCTP_MID_GE(i, a, b) (((i) == 1) ? SCTP_UINT32_GE(a, b) : SCTP_UINT16_GE((uint16_t)a, (uint16_t)b)) 928 #define SCTP_MID_EQ(i, a, b) (((i) == 1) ? a == b : (uint16_t)a == (uint16_t)b) 928 929 929 930 /* Mapping array manipulation routines */ -
trunk/Source/ThirdParty/libwebrtc/Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_crc32.c
r210942 r218849 33 33 #ifdef __FreeBSD__ 34 34 #include <sys/cdefs.h> 35 __FBSDID("$FreeBSD: head/sys/netinet/sctp_crc32.c 235828 2012-05-23 11:26:28Z tuexen $");35 __FBSDID("$FreeBSD: head/sys/netinet/sctp_crc32.c 310590 2016-12-26 11:06:41Z tuexen $"); 36 36 #endif 37 37 … … 697 697 } 698 698 699 699 #if defined(__Userspace__) 700 uint32_t 701 #else 700 702 static uint32_t 703 #endif 701 704 calculate_crc32c(uint32_t crc32c, 702 705 const unsigned char *buffer, … … 711 714 #endif /* FreeBSD < 80000 || other OS */ 712 715 716 #if defined(__Userspace__) 717 uint32_t 718 #else 713 719 static uint32_t 720 #endif 714 721 sctp_finalize_crc32c(uint32_t crc32c) 715 722 { -
trunk/Source/ThirdParty/libwebrtc/Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_crc32.h
r210942 r218849 33 33 #ifdef __FreeBSD__ 34 34 #include <sys/cdefs.h> 35 __FBSDID("$FreeBSD: head/sys/netinet/sctp_crc32.h 235828 2012-05-23 11:26:28Z tuexen $");35 __FBSDID("$FreeBSD: head/sys/netinet/sctp_crc32.h 309607 2016-12-06 10:21:25Z tuexen $"); 36 36 #endif 37 37 … … 49 49 #if defined(__Userspace__) 50 50 #if !defined(SCTP_WITH_NO_CSUM) 51 uint32_t calculate_crc32c(uint32_t, const unsigned char *, unsigned int); 52 uint32_t sctp_finalize_crc32c(uint32_t); 51 53 uint32_t sctp_calculate_cksum(struct mbuf *, uint32_t); 52 54 #endif -
trunk/Source/ThirdParty/libwebrtc/Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_header.h
r210942 r218849 33 33 #ifdef __FreeBSD__ 34 34 #include <sys/cdefs.h> 35 __FBSDID("$FreeBSD: head/sys/netinet/sctp_header.h 30 2949 2016-07-17 13:14:51Z tuexen $");35 __FBSDID("$FreeBSD: head/sys/netinet/sctp_header.h 309682 2016-12-07 19:30:59Z tuexen $"); 36 36 #endif 37 37 … … 154 154 struct sctp_data { 155 155 uint32_t tsn; 156 uint16_t s tream_id;157 uint16_t s tream_sequence;158 uint32_t p rotocol_id;156 uint16_t sid; 157 uint16_t ssn; 158 uint32_t ppid; 159 159 /* user data follows */ 160 160 } SCTP_PACKED; … … 167 167 struct sctp_idata { 168 168 uint32_t tsn; 169 uint16_t s tream_id;169 uint16_t sid; 170 170 uint16_t reserved; /* Where does the SSN go? */ 171 uint32_t m sg_id;171 uint32_t mid; 172 172 union { 173 uint32_t p rotocol_id;173 uint32_t ppid; 174 174 uint32_t fsn; /* Fragment Sequence Number */ 175 175 } ppid_fsn; … … 410 410 411 411 struct sctp_strseq { 412 uint16_t s tream;413 uint16_t s equence;412 uint16_t sid; 413 uint16_t ssn; 414 414 } SCTP_PACKED; 415 415 416 416 struct sctp_strseq_mid { 417 uint16_t s tream;417 uint16_t sid; 418 418 uint16_t flags; 419 uint32_t m sg_id;419 uint32_t mid; 420 420 }; 421 421 -
trunk/Source/ThirdParty/libwebrtc/Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_indata.c
r210942 r218849 33 33 #ifdef __FreeBSD__ 34 34 #include <sys/cdefs.h> 35 __FBSDID("$FreeBSD: head/sys/netinet/sctp_indata.c 3 03927 2016-08-10 17:19:33Z tuexen $");35 __FBSDID("$FreeBSD: head/sys/netinet/sctp_indata.c 310590 2016-12-26 11:06:41Z tuexen $"); 36 36 #endif 37 37 … … 138 138 struct sctp_nets *net, 139 139 uint32_t tsn, uint32_t ppid, 140 uint32_t context, uint16_t s tream_no,141 uint32_t stream_seq, uint8_t flags,140 uint32_t context, uint16_t sid, 141 uint32_t mid, uint8_t flags, 142 142 struct mbuf *dm) 143 143 { … … 149 149 } 150 150 memset(read_queue_e, 0, sizeof(struct sctp_queued_to_read)); 151 read_queue_e->sinfo_stream = stream_no; 152 read_queue_e->sinfo_ssn = stream_seq; 151 read_queue_e->sinfo_stream = sid; 153 152 read_queue_e->sinfo_flags = (flags << 8); 154 153 read_queue_e->sinfo_ppid = ppid; … … 157 156 read_queue_e->sinfo_cumtsn = tsn; 158 157 read_queue_e->sinfo_assoc_id = sctp_get_associd(stcb); 158 read_queue_e->mid = mid; 159 159 read_queue_e->top_fsn = read_queue_e->fsn_included = 0xffffffff; 160 160 TAILQ_INIT(&read_queue_e->reasm); … … 356 356 struct sctp_queued_to_read *at; 357 357 struct sctp_readhead *q; 358 uint8_t bits, unordered;359 360 bits = (control->sinfo_flags >> 8);361 unordered = bits & SCTP_DATA_UNORDERED;358 uint8_t flags, unordered; 359 360 flags = (control->sinfo_flags >> 8); 361 unordered = flags & SCTP_DATA_UNORDERED; 362 362 if (unordered) { 363 363 q = &strm->uno_inqueue; … … 374 374 q = &strm->inqueue; 375 375 } 376 if ((bits & SCTP_DATA_NOT_FRAG) == SCTP_DATA_NOT_FRAG) { 377 control->end_added = control->last_frag_seen = control->first_frag_seen = 1; 376 if ((flags & SCTP_DATA_NOT_FRAG) == SCTP_DATA_NOT_FRAG) { 377 control->end_added = 1; 378 control->first_frag_seen = 1; 379 control->last_frag_seen = 1; 378 380 } 379 381 if (TAILQ_EMPTY(q)) { … … 388 390 } else { 389 391 TAILQ_FOREACH(at, q, next_instrm) { 390 if (SCTP_ TSN_GT(at->msg_id, control->msg_id)) {392 if (SCTP_MID_GT(asoc->idata_supported, at->mid, control->mid)) { 391 393 /* 392 394 * one in queue is bigger than the … … 400 402 } 401 403 break; 402 } else if ( at->msg_id == control->msg_id) {404 } else if (SCTP_MID_EQ(asoc->idata_supported, at->mid, control->mid)) { 403 405 /* 404 406 * Gak, He sent me a duplicate msg … … 416 418 SCTP_STR_LOG_FROM_INSERT_TL); 417 419 } 418 TAILQ_INSERT_AFTER(q, 419 at, control, next_instrm); 420 TAILQ_INSERT_AFTER(q, at, control, next_instrm); 420 421 if (unordered) { 421 422 control->on_strm_q = SCTP_ON_UNORDERED ; … … 445 446 opspot, 446 447 control->fsn_included, 447 chk->rec.data. TSN_seq,448 chk->rec.data.s tream_number,449 chk->rec.data.fsn _num, chk->rec.data.stream_seq);448 chk->rec.data.tsn, 449 chk->rec.data.sid, 450 chk->rec.data.fsn, chk->rec.data.mid); 450 451 } else { 451 452 snprintf(msg, sizeof(msg), … … 453 454 opspot, 454 455 control->fsn_included, 455 chk->rec.data. TSN_seq,456 chk->rec.data.s tream_number,457 chk->rec.data.fsn _num,458 (uint16_t)chk->rec.data. stream_seq);456 chk->rec.data.tsn, 457 chk->rec.data.sid, 458 chk->rec.data.fsn, 459 (uint16_t)chk->rec.data.mid); 459 460 } 460 461 oper = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); … … 492 493 static void 493 494 sctp_queue_data_to_stream(struct sctp_tcb *stcb, 494 struct sctp_stream_in *strm,495 495 struct sctp_association *asoc, 496 496 struct sctp_queued_to_read *control, int *abort_flag, int *need_reasm) … … 518 518 uint32_t nxt_todel; 519 519 struct mbuf *op_err; 520 struct sctp_stream_in *strm; 520 521 char msg[SCTP_DIAG_INFO_LEN]; 521 522 523 strm = &asoc->strmin[control->sinfo_stream]; 522 524 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_STR_LOGGING_ENABLE) { 523 525 sctp_log_strm_del(control, NULL, SCTP_STR_LOG_FROM_INTO_STRD); 524 526 } 525 if (SCTP_M SGID_GT((!asoc->idata_supported), strm->last_sequence_delivered, control->sinfo_ssn)) {527 if (SCTP_MID_GT((asoc->idata_supported), strm->last_mid_delivered, control->mid)) { 526 528 /* The incoming sseq is behind where we last delivered? */ 527 529 SCTPDBG(SCTP_DEBUG_INDATA1, "Duplicate S-SEQ: %u delivered: %u from peer, Abort association\n", 528 control->sinfo_ssn, strm->last_sequence_delivered); 529 protocol_error: 530 strm->last_mid_delivered, control->mid); 530 531 /* 531 532 * throw it in the stream so it gets cleaned up in … … 533 534 */ 534 535 TAILQ_INSERT_HEAD(&strm->inqueue, control, next_instrm); 535 snprintf(msg, sizeof(msg), "Delivered SSN=%4.4x, got TSN=%8.8x, SID=%4.4x, SSN=%4.4x", 536 strm->last_sequence_delivered, control->sinfo_tsn, 537 control->sinfo_stream, control->sinfo_ssn); 536 if (asoc->idata_supported) { 537 snprintf(msg, sizeof(msg), "Delivered MID=%8.8x, got TSN=%8.8x, SID=%4.4x, MID=%8.8x", 538 strm->last_mid_delivered, control->sinfo_tsn, 539 control->sinfo_stream, control->mid); 540 } else { 541 snprintf(msg, sizeof(msg), "Delivered SSN=%4.4x, got TSN=%8.8x, SID=%4.4x, SSN=%4.4x", 542 (uint16_t)strm->last_mid_delivered, 543 control->sinfo_tsn, 544 control->sinfo_stream, 545 (uint16_t)control->mid); 546 } 538 547 op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); 539 548 stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_2; … … 543 552 544 553 } 545 if ((SCTP_TSN_GE(asoc->cumulative_tsn, control->sinfo_tsn)) && (asoc->idata_supported == 0)) {546 goto protocol_error;547 }548 554 queue_needed = 1; 549 555 asoc->size_on_all_streams += control->length; 550 556 sctp_ucount_incr(asoc->cnt_on_all_streams); 551 nxt_todel = strm->last_ sequence_delivered + 1;552 if ( nxt_todel == control->sinfo_ssn) {557 nxt_todel = strm->last_mid_delivered + 1; 558 if (SCTP_MID_EQ(asoc->idata_supported, nxt_todel, control->mid)) { 553 559 #if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) 554 560 struct socket *so; … … 569 575 sctp_log_strm_del(control, NULL, SCTP_STR_LOG_FROM_IMMED_DEL); 570 576 } 571 /* EY it wont be queued if it could be delivered directly */577 /* EY it wont be queued if it could be delivered directly */ 572 578 queue_needed = 0; 573 579 asoc->size_on_all_streams -= control->length; 574 580 sctp_ucount_decr(asoc->cnt_on_all_streams); 575 strm->last_ sequence_delivered++;581 strm->last_mid_delivered++; 576 582 sctp_mark_non_revokable(asoc, control->sinfo_tsn); 577 583 sctp_add_to_readq(stcb->sctp_ep, stcb, … … 581 587 TAILQ_FOREACH_SAFE(control, &strm->inqueue, next_instrm, at) { 582 588 /* all delivered */ 583 nxt_todel = strm->last_ sequence_delivered + 1;584 if ( (nxt_todel == control->sinfo_ssn) &&589 nxt_todel = strm->last_mid_delivered + 1; 590 if (SCTP_MID_EQ(asoc->idata_supported, nxt_todel, control->mid) && 585 591 (((control->sinfo_flags >> 8) & SCTP_DATA_NOT_FRAG) == SCTP_DATA_NOT_FRAG)) { 586 592 asoc->size_on_all_streams -= control->length; … … 595 601 } 596 602 control->on_strm_q = 0; 597 strm->last_ sequence_delivered++;603 strm->last_mid_delivered++; 598 604 /* 599 605 * We ignore the return of deliver_data here … … 613 619 SCTP_SO_LOCKED); 614 620 continue; 615 } else if ( nxt_todel == control->sinfo_ssn) {621 } else if (SCTP_MID_EQ(asoc->idata_supported, nxt_todel, control->mid)) { 616 622 *need_reasm = 1; 617 623 } … … 629 635 if (sctp_place_control_in_stream(strm, asoc, control)) { 630 636 snprintf(msg, sizeof(msg), 631 "Queue to str msg_id: %u duplicate",632 control->m sg_id);637 "Queue to str MID: %u duplicate", 638 control->mid); 633 639 sctp_clean_up_control(stcb, control); 634 640 op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); … … 741 747 memset(nc, 0, sizeof(struct sctp_queued_to_read)); 742 748 nc->sinfo_stream = control->sinfo_stream; 743 nc-> sinfo_ssn = control->sinfo_ssn;749 nc->mid = control->mid; 744 750 TAILQ_INIT(&nc->reasm); 745 751 nc->top_fsn = control->top_fsn; 746 nc->m sg_id = control->msg_id;752 nc->mid = control->mid; 747 753 nc->sinfo_flags = control->sinfo_flags; 748 754 nc->sinfo_ppid = control->sinfo_ppid; … … 782 788 { 783 789 /* Special handling for the old un-ordered data chunk. 784 * All the chunks/TSN's go to m sg_id 0. So790 * All the chunks/TSN's go to mid 0. So 785 791 * we have to do the old style watching to see 786 792 * if we have it all. If you return one, no other … … 805 811 /* Now what can we add? */ 806 812 TAILQ_FOREACH_SAFE(chk, &control->reasm, sctp_next, lchk) { 807 if (chk->rec.data.fsn _num== fsn) {813 if (chk->rec.data.fsn == fsn) { 808 814 /* Ok lets add it */ 809 815 sctp_alloc_a_readq(stcb, nc); … … 828 834 if (tchk->rec.data.rcv_flags & SCTP_DATA_FIRST_FRAG) { 829 835 TAILQ_REMOVE(&control->reasm, tchk, sctp_next); 836 asoc->size_on_reasm_queue -= tchk->send_size; 837 sctp_ucount_decr(asoc->cnt_on_reasm_queue); 830 838 nc->first_frag_seen = 1; 831 nc->fsn_included = tchk->rec.data.fsn _num;839 nc->fsn_included = tchk->rec.data.fsn; 832 840 nc->data = tchk->data; 833 nc->sinfo_ppid = tchk->rec.data.p ayloadtype;834 nc->sinfo_tsn = tchk->rec.data. TSN_seq;835 sctp_mark_non_revokable(asoc, tchk->rec.data. TSN_seq);841 nc->sinfo_ppid = tchk->rec.data.ppid; 842 nc->sinfo_tsn = tchk->rec.data.tsn; 843 sctp_mark_non_revokable(asoc, tchk->rec.data.tsn); 836 844 tchk->data = NULL; 837 845 sctp_free_a_chunk(stcb, tchk, SCTP_SO_NOT_LOCKED); … … 920 928 SCTPDBG(SCTP_DEBUG_XXX, 921 929 "chunk is a first fsn: %u becomes fsn_included\n", 922 chk->rec.data.fsn _num);930 chk->rec.data.fsn); 923 931 if (control->first_frag_seen) { 924 932 /* … … 931 939 uint32_t tmp; 932 940 933 if (SCTP_TSN_GT(chk->rec.data.fsn _num, control->fsn_included)) {941 if (SCTP_TSN_GT(chk->rec.data.fsn, control->fsn_included)) { 934 942 /* Easy way the start of a new guy beyond the lowest */ 935 943 goto place_chunk; 936 944 } 937 if ((chk->rec.data.fsn _num== control->fsn_included) ||945 if ((chk->rec.data.fsn == control->fsn_included) || 938 946 (control->pdapi_started)) { 939 947 /* … … 967 975 /* Fix the FSN included */ 968 976 tmp = control->fsn_included; 969 control->fsn_included = chk->rec.data.fsn _num;970 chk->rec.data.fsn _num= tmp;977 control->fsn_included = chk->rec.data.fsn; 978 chk->rec.data.fsn = tmp; 971 979 /* Fix the TSN included */ 972 980 tmp = control->sinfo_tsn; 973 control->sinfo_tsn = chk->rec.data. TSN_seq;974 chk->rec.data. TSN_seq= tmp;981 control->sinfo_tsn = chk->rec.data.tsn; 982 chk->rec.data.tsn = tmp; 975 983 /* Fix the PPID included */ 976 984 tmp = control->sinfo_ppid; 977 control->sinfo_ppid = chk->rec.data.p ayloadtype;978 chk->rec.data.p ayloadtype= tmp;985 control->sinfo_ppid = chk->rec.data.ppid; 986 chk->rec.data.ppid = tmp; 979 987 /* Fix tail pointer */ 980 988 goto place_chunk; 981 989 } 982 990 control->first_frag_seen = 1; 983 control->top_fsn = control->fsn_included = chk->rec.data.fsn_num; 984 control->sinfo_tsn = chk->rec.data.TSN_seq; 985 control->sinfo_ppid = chk->rec.data.payloadtype; 991 control->fsn_included = chk->rec.data.fsn; 992 control->top_fsn = chk->rec.data.fsn; 993 control->sinfo_tsn = chk->rec.data.tsn; 994 control->sinfo_ppid = chk->rec.data.ppid; 986 995 control->data = chk->data; 987 sctp_mark_non_revokable(asoc, chk->rec.data. TSN_seq);996 sctp_mark_non_revokable(asoc, chk->rec.data.tsn); 988 997 chk->data = NULL; 989 998 sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED); … … 994 1003 inserted = 0; 995 1004 TAILQ_FOREACH(at, &control->reasm, sctp_next) { 996 if (SCTP_TSN_GT(at->rec.data.fsn _num, chk->rec.data.fsn_num)) {1005 if (SCTP_TSN_GT(at->rec.data.fsn, chk->rec.data.fsn)) { 997 1006 /* 998 1007 * This one in queue is bigger than the new one, insert … … 1004 1013 TAILQ_INSERT_BEFORE(at, chk, sctp_next); 1005 1014 break; 1006 } else if (at->rec.data.fsn _num == chk->rec.data.fsn_num) {1015 } else if (at->rec.data.fsn == chk->rec.data.fsn) { 1007 1016 /* 1008 1017 * They sent a duplicate fsn number. This … … 1021 1030 asoc->size_on_reasm_queue += chk->send_size; 1022 1031 sctp_ucount_incr(asoc->cnt_on_reasm_queue); 1023 control->top_fsn = chk->rec.data.fsn _num;1032 control->top_fsn = chk->rec.data.fsn; 1024 1033 TAILQ_INSERT_TAIL(&control->reasm, chk, sctp_next); 1025 1034 } … … 1038 1047 * we need to remove them from the stream's queue. 1039 1048 */ 1040 struct sctp_queued_to_read *control, *nctl =NULL;1049 struct sctp_queued_to_read *control, *nctl = NULL; 1041 1050 uint32_t next_to_del; 1042 1051 uint32_t pd_point; … … 1051 1060 control = TAILQ_FIRST(&strm->uno_inqueue); 1052 1061 1053 if ((control ) &&1062 if ((control != NULL) && 1054 1063 (asoc->idata_supported == 0)) { 1055 1064 /* Special handling needed for "old" data format */ … … 1064 1073 while (control) { 1065 1074 SCTPDBG(SCTP_DEBUG_XXX, "Looking at control: %p e(%d) ssn: %u top_fsn: %u inc_fsn: %u -uo\n", 1066 control, control->end_added, control-> sinfo_ssn, control->top_fsn, control->fsn_included);1075 control, control->end_added, control->mid, control->top_fsn, control->fsn_included); 1067 1076 nctl = TAILQ_NEXT(control, next_instrm); 1068 1077 if (control->end_added) { … … 1109 1118 return (ret); 1110 1119 } 1111 if ( strm->last_sequence_delivered == control->sinfo_ssn) {1120 if (SCTP_MID_EQ(asoc->idata_supported, strm->last_mid_delivered, control->mid)) { 1112 1121 /* Ok the guy at the top was being partially delivered 1113 1122 * completed, so we remove it. Note … … 1118 1127 SCTPDBG(SCTP_DEBUG_XXX, 1119 1128 "Looking at control: %p e(%d) ssn: %u top_fsn: %u inc_fsn: %u (lastdel: %u)- o\n", 1120 control, control->end_added, control-> sinfo_ssn,1129 control, control->end_added, control->mid, 1121 1130 control->top_fsn, control->fsn_included, 1122 strm->last_ sequence_delivered);1131 strm->last_mid_delivered); 1123 1132 if (control->end_added) { 1124 1133 if (control->on_strm_q) { … … 1151 1160 } 1152 1161 deliver_more: 1153 next_to_del = strm->last_ sequence_delivered + 1;1162 next_to_del = strm->last_mid_delivered + 1; 1154 1163 if (control) { 1155 1164 SCTPDBG(SCTP_DEBUG_XXX, 1156 1165 "Looking at control: %p e(%d) ssn: %u top_fsn: %u inc_fsn: %u (nxtdel: %u)- o\n", 1157 control, control->end_added, control-> sinfo_ssn, control->top_fsn, control->fsn_included,1166 control, control->end_added, control->mid, control->top_fsn, control->fsn_included, 1158 1167 next_to_del); 1159 1168 nctl = TAILQ_NEXT(control, next_instrm); 1160 if ( (control->sinfo_ssn ==next_to_del) &&1169 if (SCTP_MID_EQ(asoc->idata_supported, control->mid, next_to_del) && 1161 1170 (control->first_frag_seen)) { 1162 1171 int done; … … 1195 1204 inp_read_lock_held, SCTP_SO_NOT_LOCKED); 1196 1205 } 1197 strm->last_ sequence_delivered = next_to_del;1206 strm->last_mid_delivered = next_to_del; 1198 1207 if (done) { 1199 1208 control = nctl; … … 1238 1247 sctp_add_to_tail_pointer(control, chk->data); 1239 1248 } 1240 control->fsn_included = chk->rec.data.fsn _num;1249 control->fsn_included = chk->rec.data.fsn; 1241 1250 asoc->size_on_reasm_queue -= chk->send_size; 1242 1251 sctp_ucount_decr(asoc->cnt_on_reasm_queue); 1243 sctp_mark_non_revokable(asoc, chk->rec.data. TSN_seq);1252 sctp_mark_non_revokable(asoc, chk->rec.data.tsn); 1244 1253 chk->data = NULL; 1245 1254 if (chk->rec.data.rcv_flags & SCTP_DATA_FIRST_FRAG) { 1246 1255 control->first_frag_seen = 1; 1256 control->sinfo_tsn = chk->rec.data.tsn; 1257 control->sinfo_ppid = chk->rec.data.ppid; 1247 1258 } 1248 1259 if (chk->rec.data.rcv_flags & SCTP_DATA_LAST_FRAG) { … … 1285 1296 static void 1286 1297 sctp_queue_data_for_reasm(struct sctp_tcb *stcb, struct sctp_association *asoc, 1287 struct sctp_stream_in *strm,1288 1298 struct sctp_queued_to_read *control, 1289 1299 struct sctp_tmit_chunk *chk, … … 1293 1303 uint32_t next_fsn; 1294 1304 struct sctp_tmit_chunk *at, *nat; 1305 struct sctp_stream_in *strm; 1295 1306 int do_wakeup, unordered; 1296 1307 1308 strm = &asoc->strmin[control->sinfo_stream]; 1297 1309 /* 1298 1310 * For old un-ordered data chunks. … … 1342 1354 SCTPDBG(SCTP_DEBUG_XXX, 1343 1355 "chunk is a first fsn: %u becomes fsn_included\n", 1344 chk->rec.data.fsn _num);1356 chk->rec.data.fsn); 1345 1357 if (control->first_frag_seen) { 1346 1358 /* … … 1356 1368 } 1357 1369 control->first_frag_seen = 1; 1358 control->fsn_included = chk->rec.data.fsn_num; 1370 control->sinfo_ppid = chk->rec.data.ppid; 1371 control->sinfo_tsn = chk->rec.data.tsn; 1372 control->fsn_included = chk->rec.data.fsn; 1359 1373 control->data = chk->data; 1360 sctp_mark_non_revokable(asoc, chk->rec.data. TSN_seq);1374 sctp_mark_non_revokable(asoc, chk->rec.data.tsn); 1361 1375 chk->data = NULL; 1362 1376 sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED); … … 1367 1381 if (control->last_frag_seen == 0) { 1368 1382 /* Still willing to raise highest FSN seen */ 1369 if (SCTP_TSN_GT(chk->rec.data.fsn _num, control->top_fsn)) {1383 if (SCTP_TSN_GT(chk->rec.data.fsn, control->top_fsn)) { 1370 1384 SCTPDBG(SCTP_DEBUG_XXX, 1371 1385 "We have a new top_fsn: %u\n", 1372 chk->rec.data.fsn _num);1373 control->top_fsn = chk->rec.data.fsn _num;1386 chk->rec.data.fsn); 1387 control->top_fsn = chk->rec.data.fsn; 1374 1388 } 1375 1389 if (chk->rec.data.rcv_flags & SCTP_DATA_LAST_FRAG) { 1376 1390 SCTPDBG(SCTP_DEBUG_XXX, 1377 1391 "The last fsn is now in place fsn: %u\n", 1378 chk->rec.data.fsn _num);1392 chk->rec.data.fsn); 1379 1393 control->last_frag_seen = 1; 1380 1394 } … … 1386 1400 * (which is the TSN). 1387 1401 */ 1388 if (SCTP_TSN_GE(control->fsn_included, chk->rec.data.fsn _num)) {1402 if (SCTP_TSN_GE(control->fsn_included, chk->rec.data.fsn)) { 1389 1403 /* We have already delivered up to this so its a dup */ 1390 1404 sctp_abort_in_reasm(stcb, control, chk, … … 1399 1413 SCTPDBG(SCTP_DEBUG_XXX, 1400 1414 "Duplicate last fsn: %u (top: %u) -- abort\n", 1401 chk->rec.data.fsn _num, control->top_fsn);1415 chk->rec.data.fsn, control->top_fsn); 1402 1416 sctp_abort_in_reasm(stcb, control, 1403 1417 chk, abort_flag, … … 1413 1427 */ 1414 1428 1415 if (SCTP_TSN_GE(control->fsn_included, chk->rec.data.fsn _num)) {1429 if (SCTP_TSN_GE(control->fsn_included, chk->rec.data.fsn)) { 1416 1430 /* We have already delivered up to this so its a dup */ 1417 1431 SCTPDBG(SCTP_DEBUG_XXX, 1418 1432 "New fsn: %u is already seen in included_fsn: %u -- abort\n", 1419 chk->rec.data.fsn _num, control->fsn_included);1433 chk->rec.data.fsn, control->fsn_included); 1420 1434 sctp_abort_in_reasm(stcb, control, chk, 1421 1435 abort_flag, … … 1425 1439 } 1426 1440 /* validate not beyond top FSN if we have seen last one */ 1427 if (SCTP_TSN_GT(chk->rec.data.fsn _num, control->top_fsn)) {1441 if (SCTP_TSN_GT(chk->rec.data.fsn, control->top_fsn)) { 1428 1442 SCTPDBG(SCTP_DEBUG_XXX, 1429 1443 "New fsn: %u is beyond or at top_fsn: %u -- abort\n", 1430 chk->rec.data.fsn _num,1444 chk->rec.data.fsn, 1431 1445 control->top_fsn); 1432 1446 sctp_abort_in_reasm(stcb, control, chk, … … 1443 1457 SCTPDBG(SCTP_DEBUG_XXX, 1444 1458 "chunk is a not first fsn: %u needs to be inserted\n", 1445 chk->rec.data.fsn _num);1459 chk->rec.data.fsn); 1446 1460 TAILQ_FOREACH(at, &control->reasm, sctp_next) { 1447 if (SCTP_TSN_GT(at->rec.data.fsn _num, chk->rec.data.fsn_num)) {1461 if (SCTP_TSN_GT(at->rec.data.fsn, chk->rec.data.fsn)) { 1448 1462 /* 1449 1463 * This one in queue is bigger than the new one, insert … … 1452 1466 SCTPDBG(SCTP_DEBUG_XXX, 1453 1467 "Insert it before fsn: %u\n", 1454 at->rec.data.fsn _num);1468 at->rec.data.fsn); 1455 1469 asoc->size_on_reasm_queue += chk->send_size; 1456 1470 sctp_ucount_incr(asoc->cnt_on_reasm_queue); … … 1458 1472 inserted = 1; 1459 1473 break; 1460 } else if (at->rec.data.fsn _num == chk->rec.data.fsn_num) {1474 } else if (at->rec.data.fsn == chk->rec.data.fsn) { 1461 1475 /* Gak, He sent me a duplicate str seq number */ 1462 1476 /* … … 1469 1483 SCTPDBG(SCTP_DEBUG_XXX, 1470 1484 "Duplicate to fsn: %u -- abort\n", 1471 at->rec.data.fsn _num);1485 at->rec.data.fsn); 1472 1486 sctp_abort_in_reasm(stcb, control, 1473 1487 chk, abort_flag, … … 1479 1493 /* Goes on the end */ 1480 1494 SCTPDBG(SCTP_DEBUG_XXX, "Inserting at tail of list fsn: %u\n", 1481 chk->rec.data.fsn _num);1495 chk->rec.data.fsn); 1482 1496 asoc->size_on_reasm_queue += chk->send_size; 1483 1497 sctp_ucount_incr(asoc->cnt_on_reasm_queue); … … 1497 1511 next_fsn = control->fsn_included + 1; 1498 1512 TAILQ_FOREACH_SAFE(at, &control->reasm, sctp_next, nat) { 1499 if (at->rec.data.fsn _num== next_fsn) {1513 if (at->rec.data.fsn == next_fsn) { 1500 1514 /* We can add this one now to the control */ 1501 1515 SCTPDBG(SCTP_DEBUG_XXX, 1502 1516 "Adding more to control: %p at: %p fsn: %u next_fsn: %u included: %u\n", 1503 1517 control, at, 1504 at->rec.data.fsn _num,1518 at->rec.data.fsn, 1505 1519 next_fsn, control->fsn_included); 1506 1520 TAILQ_REMOVE(&control->reasm, at, sctp_next); … … 1539 1553 1540 1554 static struct sctp_queued_to_read * 1541 sctp_find_reasm_entry(struct sctp_stream_in *strm, uint32_t m sg_id, int ordered, int old)1555 sctp_find_reasm_entry(struct sctp_stream_in *strm, uint32_t mid, int ordered, int idata_supported) 1542 1556 { 1543 1557 struct sctp_queued_to_read *control; … … 1545 1559 if (ordered) { 1546 1560 TAILQ_FOREACH(control, &strm->inqueue, next_instrm) { 1547 if ( control->msg_id == msg_id) {1561 if (SCTP_MID_EQ(idata_supported, control->mid, mid)) { 1548 1562 break; 1549 1563 } 1550 1564 } 1551 1565 } else { 1552 if (old) { 1566 if (idata_supported) { 1567 TAILQ_FOREACH(control, &strm->uno_inqueue, next_instrm) { 1568 if (SCTP_MID_EQ(idata_supported, control->mid, mid)) { 1569 break; 1570 } 1571 } 1572 } else { 1553 1573 control = TAILQ_FIRST(&strm->uno_inqueue); 1554 return (control);1555 }1556 TAILQ_FOREACH(control, &strm->uno_inqueue, next_instrm) {1557 if (control->msg_id == msg_id) {1558 break;1559 }1560 1574 } 1561 1575 } … … 1567 1581 struct mbuf **m, int offset, int chk_length, 1568 1582 struct sctp_nets *net, uint32_t *high_tsn, int *abort_flag, 1569 int *break_flag, int last_chunk, uint8_t ch type)1583 int *break_flag, int last_chunk, uint8_t chk_type) 1570 1584 { 1571 1585 /* Process a data chunk */ 1572 1586 /* struct sctp_tmit_chunk *chk; */ 1573 struct sctp_data_chunk *ch;1574 struct sctp_idata_chunk *nch, chunk_buf;1575 1587 struct sctp_tmit_chunk *chk; 1576 uint32_t tsn, fsn, gap, m sg_id;1588 uint32_t tsn, fsn, gap, mid; 1577 1589 struct mbuf *dmbuf; 1578 1590 int the_len; 1579 1591 int need_reasm_check = 0; 1580 uint16_t s trmno;1592 uint16_t sid; 1581 1593 struct mbuf *op_err; 1582 1594 char msg[SCTP_DIAG_INFO_LEN]; 1583 struct sctp_queued_to_read *control =NULL;1584 uint32_t p rotocol_id;1585 uint8_t ch unk_flags;1595 struct sctp_queued_to_read *control = NULL; 1596 uint32_t ppid; 1597 uint8_t chk_flags; 1586 1598 struct sctp_stream_reset_list *liste; 1587 struct sctp_stream_in *strm;1588 1599 int ordered; 1589 1600 size_t clen; 1590 1601 int created_control = 0; 1591 uint8_t old_data; 1592 1593 chk = NULL;1594 if (chtype == SCTP_IDATA) { 1595 nch= (struct sctp_idata_chunk *)sctp_m_getptr(*m, offset,1596 sizeof(struct sctp_idata_chunk), (uint8_t *)&chunk_buf);1597 ch = (struct sctp_data_chunk *)nch;1602 1603 if (chk_type == SCTP_IDATA) { 1604 struct sctp_idata_chunk *chunk, chunk_buf; 1605 1606 chunk = (struct sctp_idata_chunk *)sctp_m_getptr(*m, offset, 1607 sizeof(struct sctp_idata_chunk), (uint8_t *)&chunk_buf); 1608 chk_flags = chunk->ch.chunk_flags; 1598 1609 clen = sizeof(struct sctp_idata_chunk); 1599 tsn = ntohl(ch ->dp.tsn);1600 msg_id = ntohl(nch->dp.msg_id);1601 protocol_id = nch->dp.ppid_fsn.protocol_id;1602 if (ch ->ch.chunk_flags & SCTP_DATA_FIRST_FRAG)1610 tsn = ntohl(chunk->dp.tsn); 1611 sid = ntohs(chunk->dp.sid); 1612 mid = ntohl(chunk->dp.mid); 1613 if (chk_flags & SCTP_DATA_FIRST_FRAG) { 1603 1614 fsn = 0; 1604 else 1605 fsn = ntohl(nch->dp.ppid_fsn.fsn); 1606 old_data = 0; 1615 ppid = chunk->dp.ppid_fsn.ppid; 1616 } else { 1617 fsn = ntohl(chunk->dp.ppid_fsn.fsn); 1618 ppid = 0xffffffff; /* Use as an invalid value. */ 1619 } 1607 1620 } else { 1608 ch = (struct sctp_data_chunk *)sctp_m_getptr(*m, offset, 1609 sizeof(struct sctp_data_chunk), (uint8_t *)&chunk_buf); 1610 tsn = ntohl(ch->dp.tsn); 1611 protocol_id = ch->dp.protocol_id; 1621 struct sctp_data_chunk *chunk, chunk_buf; 1622 1623 chunk = (struct sctp_data_chunk *)sctp_m_getptr(*m, offset, 1624 sizeof(struct sctp_data_chunk), (uint8_t *)&chunk_buf); 1625 chk_flags = chunk->ch.chunk_flags; 1612 1626 clen = sizeof(struct sctp_data_chunk); 1627 tsn = ntohl(chunk->dp.tsn); 1628 sid = ntohs(chunk->dp.sid); 1629 mid = (uint32_t)(ntohs(chunk->dp.ssn)); 1613 1630 fsn = tsn; 1614 msg_id = (uint32_t)(ntohs(ch->dp.stream_sequence)); 1615 nch = NULL; 1616 old_data = 1; 1617 } 1618 chunk_flags = ch->ch.chunk_flags; 1631 ppid = chunk->dp.ppid; 1632 } 1619 1633 if ((size_t)chk_length == clen) { 1620 1634 /* … … 1622 1636 * empty data chunk. 1623 1637 */ 1624 op_err = sctp_generate_no_user_data_cause( ch->dp.tsn);1638 op_err = sctp_generate_no_user_data_cause(tsn); 1625 1639 stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_14; 1626 1640 sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED); … … 1628 1642 return (0); 1629 1643 } 1630 if ((ch unk_flags & SCTP_DATA_SACK_IMMEDIATELY) == SCTP_DATA_SACK_IMMEDIATELY) {1644 if ((chk_flags & SCTP_DATA_SACK_IMMEDIATELY) == SCTP_DATA_SACK_IMMEDIATELY) { 1631 1645 asoc->send_sack = 1; 1632 1646 } 1633 ordered = ((ch unk_flags & SCTP_DATA_UNORDERED) == 0);1647 ordered = ((chk_flags & SCTP_DATA_UNORDERED) == 0); 1634 1648 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MAP_LOGGING_ENABLE) { 1635 1649 sctp_log_map(tsn, asoc->cumulative_tsn, asoc->highest_tsn_inside_map, SCTP_MAP_TSN_ENTERS); … … 1638 1652 return (0); 1639 1653 } 1640 SCTP_LTRACE_CHK(stcb->sctp_ep, stcb, ch ->ch.chunk_type, tsn);1654 SCTP_LTRACE_CHK(stcb->sctp_ep, stcb, chk_type, tsn); 1641 1655 if (SCTP_TSN_GE(asoc->cumulative_tsn, tsn)) { 1642 1656 /* It is a duplicate */ … … 1701 1715 1702 1716 /* Is the stream valid? */ 1703 strmno = ntohs(ch->dp.stream_id); 1704 1705 if (strmno >= asoc->streamincnt) { 1717 if (sid >= asoc->streamincnt) { 1706 1718 struct sctp_error_invalid_stream *cause; 1707 1719 … … 1720 1732 cause->cause.code = htons(SCTP_CAUSE_INVALID_STREAM); 1721 1733 cause->cause.length = htons(sizeof(struct sctp_error_invalid_stream)); 1722 cause->stream_id = ch->dp.stream_id;1734 cause->stream_id = htons(sid); 1723 1735 cause->reserved = htons(0); 1724 1736 sctp_queue_op_err(stcb, op_err); … … 1736 1748 return (0); 1737 1749 } 1738 strm = &asoc->strmin[strmno];1739 1750 /* 1740 1751 * If its a fragmented message, lets see if we can 1741 1752 * find the control on the reassembly queues. 1742 1753 */ 1743 if ((ch type == SCTP_IDATA) &&1744 ((ch unk_flags & SCTP_DATA_FIRST_FRAG) == 0) &&1754 if ((chk_type == SCTP_IDATA) && 1755 ((chk_flags & SCTP_DATA_FIRST_FRAG) == 0) && 1745 1756 (fsn == 0)) { 1746 1757 /* … … 1751 1762 */ 1752 1763 snprintf(msg, sizeof(msg), "FSN zero for MID=%8.8x, but flags=%2.2x", 1753 m sg_id, chunk_flags);1764 mid, chk_flags); 1754 1765 goto err_out; 1755 1766 } 1756 control = sctp_find_reasm_entry( strm, msg_id, ordered, old_data);1767 control = sctp_find_reasm_entry(&asoc->strmin[sid], mid, ordered, asoc->idata_supported); 1757 1768 SCTPDBG(SCTP_DEBUG_XXX, "chunk_flags:0x%x look for control on queues %p\n", 1758 ch unk_flags, control);1759 if ((ch unk_flags & SCTP_DATA_NOT_FRAG) != SCTP_DATA_NOT_FRAG) {1769 chk_flags, control); 1770 if ((chk_flags & SCTP_DATA_NOT_FRAG) != SCTP_DATA_NOT_FRAG) { 1760 1771 /* See if we can find the re-assembly entity */ 1761 1772 if (control != NULL) { 1762 1773 /* We found something, does it belong? */ 1763 if (ordered && (m sg_id != control->sinfo_ssn)) {1764 snprintf(msg, sizeof(msg), "Reassembly problem (MID=%8.8x)", m sg_id);1774 if (ordered && (mid != control->mid)) { 1775 snprintf(msg, sizeof(msg), "Reassembly problem (MID=%8.8x)", mid); 1765 1776 err_out: 1766 1777 op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); … … 1790 1801 */ 1791 1802 if (control != NULL) { 1792 if (ordered || (old_data == 0)) {1793 SCTPDBG(SCTP_DEBUG_XXX, "chunk_flags: 0x%x dup detected on msg_id: %u\n",1794 ch unk_flags, msg_id);1795 snprintf(msg, sizeof(msg), "Duplicate MID=%8.8x detected.", m sg_id);1803 if (ordered || asoc->idata_supported) { 1804 SCTPDBG(SCTP_DEBUG_XXX, "chunk_flags: 0x%x dup detected on MID: %u\n", 1805 chk_flags, mid); 1806 snprintf(msg, sizeof(msg), "Duplicate MID=%8.8x detected.", mid); 1796 1807 goto err_out; 1797 1808 } else { … … 1838 1849 } 1839 1850 /* now is it in the mapping array of what we have accepted? */ 1840 if ( nch == NULL) {1851 if (chk_type == SCTP_DATA) { 1841 1852 if (SCTP_TSN_GT(tsn, asoc->highest_tsn_inside_map) && 1842 1853 SCTP_TSN_GT(tsn, asoc->highest_tsn_inside_nr_map)) { … … 1870 1881 } 1871 1882 asoc->in_tsnlog[asoc->tsn_in_at].tsn = tsn; 1872 asoc->in_tsnlog[asoc->tsn_in_at].strm = s trmno;1873 asoc->in_tsnlog[asoc->tsn_in_at].seq = m sg_id;1883 asoc->in_tsnlog[asoc->tsn_in_at].strm = sid; 1884 asoc->in_tsnlog[asoc->tsn_in_at].seq = mid; 1874 1885 asoc->in_tsnlog[asoc->tsn_in_at].sz = chk_length; 1875 1886 asoc->in_tsnlog[asoc->tsn_in_at].flgs = chunk_flags; … … 1886 1897 * only validate the FIRST fragment so the bit must be set. 1887 1898 */ 1888 if ((ch unk_flags & SCTP_DATA_FIRST_FRAG) &&1899 if ((chk_flags & SCTP_DATA_FIRST_FRAG) && 1889 1900 (TAILQ_EMPTY(&asoc->resetHead)) && 1890 (ch unk_flags & SCTP_DATA_UNORDERED) == 0 &&1891 SCTP_M SGID_GE(old_data, asoc->strmin[strmno].last_sequence_delivered, msg_id)) {1901 (chk_flags & SCTP_DATA_UNORDERED) == 0 && 1902 SCTP_MID_GE(asoc->idata_supported, asoc->strmin[sid].last_mid_delivered, mid)) { 1892 1903 /* The incoming sseq is behind where we last delivered? */ 1893 1904 SCTPDBG(SCTP_DEBUG_INDATA1, "EVIL/Broken-Dup S-SEQ: %u delivered: %u from peer, Abort!\n", 1894 msg_id, asoc->strmin[strmno].last_sequence_delivered); 1895 1896 snprintf(msg, sizeof(msg), "Delivered SSN=%4.4x, got TSN=%8.8x, SID=%4.4x, SSN=%4.4x", 1897 asoc->strmin[strmno].last_sequence_delivered, 1898 tsn, strmno, msg_id); 1905 mid, asoc->strmin[sid].last_mid_delivered); 1906 1907 if (asoc->idata_supported) { 1908 snprintf(msg, sizeof(msg), "Delivered MID=%8.8x, got TSN=%8.8x, SID=%4.4x, MID=%8.8x", 1909 asoc->strmin[sid].last_mid_delivered, 1910 tsn, 1911 sid, 1912 mid); 1913 } else { 1914 snprintf(msg, sizeof(msg), "Delivered SSN=%4.4x, got TSN=%8.8x, SID=%4.4x, SSN=%4.4x", 1915 (uint16_t)asoc->strmin[sid].last_mid_delivered, 1916 tsn, 1917 sid, 1918 (uint16_t)mid); 1919 } 1899 1920 op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); 1900 1921 stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_16; … … 1903 1924 return (0); 1904 1925 } 1905 /************************************ 1906 * From here down we may find ch-> invalid 1907 * so its a good idea NOT to use it. 1908 *************************************/ 1909 if (nch) { 1926 if (chk_type == SCTP_IDATA) { 1910 1927 the_len = (chk_length - sizeof(struct sctp_idata_chunk)); 1911 1928 } else { … … 1913 1930 } 1914 1931 if (last_chunk == 0) { 1915 if ( nch) {1932 if (chk_type == SCTP_IDATA) { 1916 1933 dmbuf = SCTP_M_COPYM(*m, 1917 1934 (offset + sizeof(struct sctp_idata_chunk)), … … 1932 1949 dmbuf = *m; 1933 1950 /* lop off the top part */ 1934 if ( nch) {1951 if (chk_type == SCTP_IDATA) { 1935 1952 m_adj(dmbuf, (offset + sizeof(struct sctp_idata_chunk))); 1936 1953 } else { … … 1960 1977 } 1961 1978 /* 1962 * Now no matter what we need a control, get one1979 * Now no matter what, we need a control, get one 1963 1980 * if we don't have one (we may have gotten it 1964 1981 * above when we found the message was fragmented … … 1967 1984 sctp_alloc_a_readq(stcb, control); 1968 1985 sctp_build_readq_entry_mac(control, stcb, asoc->context, net, tsn, 1969 p rotocol_id,1970 s trmno, msg_id,1971 ch unk_flags,1972 NULL, fsn, m sg_id);1986 ppid, 1987 sid, 1988 chk_flags, 1989 NULL, fsn, mid); 1973 1990 if (control == NULL) { 1974 1991 SCTP_STAT_INCR(sctps_nomem); 1975 1992 return (0); 1976 1993 } 1977 if ((ch unk_flags & SCTP_DATA_NOT_FRAG) == SCTP_DATA_NOT_FRAG) {1994 if ((chk_flags & SCTP_DATA_NOT_FRAG) == SCTP_DATA_NOT_FRAG) { 1978 1995 control->data = dmbuf; 1979 1996 control->tail_mbuf = NULL; 1980 control->end_added = control->last_frag_seen = control->first_frag_seen = 1; 1981 control->top_fsn = control->fsn_included = fsn; 1997 control->end_added = 1; 1998 control->last_frag_seen = 1; 1999 control->first_frag_seen = 1; 2000 control->fsn_included = fsn; 2001 control->top_fsn = fsn; 1982 2002 } 1983 2003 created_control = 1; 1984 2004 } 1985 SCTPDBG(SCTP_DEBUG_XXX, "chunk_flags: 0x%x ordered: %d msgid: %u control: %p\n",1986 ch unk_flags, ordered, msg_id, control);1987 if ((ch unk_flags & SCTP_DATA_NOT_FRAG) == SCTP_DATA_NOT_FRAG &&2005 SCTPDBG(SCTP_DEBUG_XXX, "chunk_flags: 0x%x ordered: %d MID: %u control: %p\n", 2006 chk_flags, ordered, mid, control); 2007 if ((chk_flags & SCTP_DATA_NOT_FRAG) == SCTP_DATA_NOT_FRAG && 1988 2008 TAILQ_EMPTY(&asoc->resetHead) && 1989 2009 ((ordered == 0) || 1990 ( (uint16_t)(asoc->strmin[strmno].last_sequence_delivered + 1) == msg_id&&1991 TAILQ_EMPTY(&asoc->strmin[s trmno].inqueue)))) {2010 (SCTP_MID_EQ(asoc->idata_supported, asoc->strmin[sid].last_mid_delivered + 1, mid) && 2011 TAILQ_EMPTY(&asoc->strmin[sid].inqueue)))) { 1992 2012 /* Candidate for express delivery */ 1993 2013 /* … … 2002 2022 asoc->highest_tsn_inside_nr_map = tsn; 2003 2023 } 2004 SCTPDBG(SCTP_DEBUG_XXX, "Injecting control: %p to be read ( msg_id: %u)\n",2005 control, m sg_id);2024 SCTPDBG(SCTP_DEBUG_XXX, "Injecting control: %p to be read (MID: %u)\n", 2025 control, mid); 2006 2026 2007 2027 sctp_add_to_readq(stcb->sctp_ep, stcb, … … 2009 2029 1, SCTP_READ_LOCK_NOT_HELD, SCTP_SO_NOT_LOCKED); 2010 2030 2011 if ((ch unk_flags & SCTP_DATA_UNORDERED) == 0) {2031 if ((chk_flags & SCTP_DATA_UNORDERED) == 0) { 2012 2032 /* for ordered, bump what we delivered */ 2013 strm->last_sequence_delivered++;2033 asoc->strmin[sid].last_mid_delivered++; 2014 2034 } 2015 2035 SCTP_STAT_INCR(sctps_recvexpress); 2016 2036 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_STR_LOGGING_ENABLE) { 2017 sctp_log_strm_del_alt(stcb, tsn, m sg_id, strmno,2037 sctp_log_strm_del_alt(stcb, tsn, mid, sid, 2018 2038 SCTP_STR_LOG_FROM_EXPRS_DEL); 2019 2039 } … … 2023 2043 2024 2044 /* Now will we need a chunk too? */ 2025 if ((ch unk_flags & SCTP_DATA_NOT_FRAG) != SCTP_DATA_NOT_FRAG) {2045 if ((chk_flags & SCTP_DATA_NOT_FRAG) != SCTP_DATA_NOT_FRAG) { 2026 2046 sctp_alloc_a_chunk(stcb, chk); 2027 2047 if (chk == NULL) { … … 2034 2054 return (0); 2035 2055 } 2036 chk->rec.data. TSN_seq= tsn;2056 chk->rec.data.tsn = tsn; 2037 2057 chk->no_fr_allowed = 0; 2038 chk->rec.data.fsn _num= fsn;2039 chk->rec.data. stream_seq = msg_id;2040 chk->rec.data.s tream_number = strmno;2041 chk->rec.data.p ayloadtype = protocol_id;2058 chk->rec.data.fsn = fsn; 2059 chk->rec.data.mid = mid; 2060 chk->rec.data.sid = sid; 2061 chk->rec.data.ppid = ppid; 2042 2062 chk->rec.data.context = stcb->asoc.context; 2043 2063 chk->rec.data.doing_fast_retransmit = 0; 2044 chk->rec.data.rcv_flags = ch unk_flags;2064 chk->rec.data.rcv_flags = chk_flags; 2045 2065 chk->asoc = asoc; 2046 2066 chk->send_size = the_len; 2047 2067 chk->whoTo = net; 2048 SCTPDBG(SCTP_DEBUG_XXX, "Building ck: %p for control: %p to be read ( msg_id: %u)\n",2068 SCTPDBG(SCTP_DEBUG_XXX, "Building ck: %p for control: %p to be read (MID: %u)\n", 2049 2069 chk, 2050 control, m sg_id);2070 control, mid); 2051 2071 atomic_add_int(&net->ref_count, 1); 2052 2072 chk->data = dmbuf; … … 2065 2085 } 2066 2086 /* Now is it complete (i.e. not fragmented)? */ 2067 if ((ch unk_flags & SCTP_DATA_NOT_FRAG) == SCTP_DATA_NOT_FRAG) {2087 if ((chk_flags & SCTP_DATA_NOT_FRAG) == SCTP_DATA_NOT_FRAG) { 2068 2088 /* 2069 2089 * Special check for when streams are resetting. We … … 2108 2128 goto finish_express_del; 2109 2129 } 2110 if (ch unk_flags & SCTP_DATA_UNORDERED) {2130 if (chk_flags & SCTP_DATA_UNORDERED) { 2111 2131 /* queue directly into socket buffer */ 2112 SCTPDBG(SCTP_DEBUG_XXX, "Unordered data to be read control: %p msg_id: %u\n",2113 control, m sg_id);2132 SCTPDBG(SCTP_DEBUG_XXX, "Unordered data to be read control: %p MID: %u\n", 2133 control, mid); 2114 2134 sctp_mark_non_revokable(asoc, control->sinfo_tsn); 2115 2135 sctp_add_to_readq(stcb->sctp_ep, stcb, … … 2119 2139 2120 2140 } else { 2121 SCTPDBG(SCTP_DEBUG_XXX, "Queue control: %p for reordering msg_id: %u\n", control,2122 m sg_id);2123 sctp_queue_data_to_stream(stcb, strm,asoc, control, abort_flag, &need_reasm_check);2141 SCTPDBG(SCTP_DEBUG_XXX, "Queue control: %p for reordering MID: %u\n", control, 2142 mid); 2143 sctp_queue_data_to_stream(stcb, asoc, control, abort_flag, &need_reasm_check); 2124 2144 if (*abort_flag) { 2125 2145 if (last_chunk) { … … 2134 2154 need_reasm_check = 1; 2135 2155 SCTPDBG(SCTP_DEBUG_XXX, 2136 "Queue data to stream for reasm control: %p msg_id: %u\n",2137 control, m sg_id);2138 sctp_queue_data_for_reasm(stcb, asoc, strm,control, chk, created_control, abort_flag, tsn);2156 "Queue data to stream for reasm control: %p MID: %u\n", 2157 control, mid); 2158 sctp_queue_data_for_reasm(stcb, asoc, control, chk, created_control, abort_flag, tsn); 2139 2159 if (*abort_flag) { 2140 2160 /* … … 2164 2184 /* Set it present please */ 2165 2185 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_STR_LOGGING_ENABLE) { 2166 sctp_log_strm_del_alt(stcb, tsn, m sg_id, strmno, SCTP_STR_LOG_FROM_MARK_TSN);2186 sctp_log_strm_del_alt(stcb, tsn, mid, sid, SCTP_STR_LOG_FROM_MARK_TSN); 2167 2187 } 2168 2188 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MAP_LOGGING_ENABLE) { 2169 2189 sctp_log_map(asoc->mapping_array_base_tsn, asoc->cumulative_tsn, 2170 2190 asoc->highest_tsn_inside_map, SCTP_MAP_PREPARE_SLIDE); 2191 } 2192 if (need_reasm_check) { 2193 (void)sctp_deliver_reasm_check(stcb, asoc, &asoc->strmin[sid], SCTP_READ_LOCK_NOT_HELD); 2194 need_reasm_check = 0; 2171 2195 } 2172 2196 /* check the special flag for stream resets */ … … 2191 2215 TAILQ_FOREACH_SAFE(ctl, &asoc->pending_reply_queue, next, nctl) { 2192 2216 TAILQ_REMOVE(&asoc->pending_reply_queue, ctl, next); 2193 sctp_queue_data_to_stream(stcb, strm,asoc, ctl, abort_flag, &need_reasm_check);2217 sctp_queue_data_to_stream(stcb, asoc, ctl, abort_flag, &need_reasm_check); 2194 2218 if (*abort_flag) { 2195 2219 return (0); 2220 } 2221 if (need_reasm_check) { 2222 (void)sctp_deliver_reasm_check(stcb, asoc, &asoc->strmin[ctl->sinfo_stream], SCTP_READ_LOCK_NOT_HELD); 2223 need_reasm_check = 0; 2196 2224 } 2197 2225 } … … 2207 2235 */ 2208 2236 TAILQ_REMOVE(&asoc->pending_reply_queue, ctl, next); 2209 sctp_queue_data_to_stream(stcb, strm,asoc, ctl, abort_flag, &need_reasm_check);2237 sctp_queue_data_to_stream(stcb, asoc, ctl, abort_flag, &need_reasm_check); 2210 2238 if (*abort_flag) { 2211 2239 return (0); 2212 2240 } 2213 } 2214 } 2215 /* 2216 * Now service re-assembly to pick up anything that has been 2217 * held on reassembly queue? 2218 */ 2219 (void)sctp_deliver_reasm_check(stcb, asoc, strm, SCTP_READ_LOCK_NOT_HELD); 2220 need_reasm_check = 0; 2221 } 2222 2223 if (need_reasm_check) { 2224 /* Another one waits ? */ 2225 (void)sctp_deliver_reasm_check(stcb, asoc, strm, SCTP_READ_LOCK_NOT_HELD); 2241 if (need_reasm_check) { 2242 (void)sctp_deliver_reasm_check(stcb, asoc, &asoc->strmin[ctl->sinfo_stream], SCTP_READ_LOCK_NOT_HELD); 2243 need_reasm_check = 0; 2244 } 2245 } 2246 } 2226 2247 } 2227 2248 return (1); … … 2438 2459 struct sctp_association *asoc; 2439 2460 uint32_t highest_tsn; 2440 2461 int is_a_gap; 2462 2463 sctp_slide_mapping_arrays(stcb); 2441 2464 asoc = &stcb->asoc; 2442 2465 if (SCTP_TSN_GT(asoc->highest_tsn_inside_nr_map, asoc->highest_tsn_inside_map)) { … … 2445 2468 highest_tsn = asoc->highest_tsn_inside_map; 2446 2469 } 2470 /* Is there a gap now? */ 2471 is_a_gap = SCTP_TSN_GT(highest_tsn, stcb->asoc.cumulative_tsn); 2447 2472 2448 2473 /* … … 2462 2487 } 2463 2488 sctp_send_shutdown(stcb, 2464 ((stcb->asoc.alternate) ? stcb->asoc.alternate : stcb->asoc.primary_destination)); 2465 sctp_send_sack(stcb, SCTP_SO_NOT_LOCKED); 2489 ((stcb->asoc.alternate) ? stcb->asoc.alternate : stcb->asoc.primary_destination)); 2490 if (is_a_gap) { 2491 sctp_send_sack(stcb, SCTP_SO_NOT_LOCKED); 2492 } 2466 2493 } else { 2467 int is_a_gap;2468 2469 /* is there a gap now ? */2470 is_a_gap = SCTP_TSN_GT(highest_tsn, stcb->asoc.cumulative_tsn);2471 2472 2494 /* 2473 2495 * CMT DAC algorithm: increase number of packets … … 2831 2853 (tp1->whoTo->find_pseudo_cumack == 1) && 2832 2854 (tp1->snd_count == 1)) { 2833 tp1->whoTo->pseudo_cumack = tp1->rec.data. TSN_seq;2855 tp1->whoTo->pseudo_cumack = tp1->rec.data.tsn; 2834 2856 tp1->whoTo->find_pseudo_cumack = 0; 2835 2857 } … … 2837 2859 (tp1->whoTo->find_rtx_pseudo_cumack == 1) && 2838 2860 (tp1->snd_count > 1)) { 2839 tp1->whoTo->rtx_pseudo_cumack = tp1->rec.data. TSN_seq;2861 tp1->whoTo->rtx_pseudo_cumack = tp1->rec.data.tsn; 2840 2862 tp1->whoTo->find_rtx_pseudo_cumack = 0; 2841 2863 } 2842 if (tp1->rec.data. TSN_seq== theTSN) {2864 if (tp1->rec.data.tsn == theTSN) { 2843 2865 if (tp1->sent != SCTP_DATAGRAM_UNSENT) { 2844 2866 /*- … … 2854 2876 * i.e. ACKED or RESEND. 2855 2877 */ 2856 if (SCTP_TSN_GT(tp1->rec.data. TSN_seq,2878 if (SCTP_TSN_GT(tp1->rec.data.tsn, 2857 2879 *biggest_newly_acked_tsn)) { 2858 *biggest_newly_acked_tsn = tp1->rec.data. TSN_seq;2880 *biggest_newly_acked_tsn = tp1->rec.data.tsn; 2859 2881 } 2860 2882 /*- … … 2868 2890 tp1->whoTo->saw_newack = 1; 2869 2891 2870 if (SCTP_TSN_GT(tp1->rec.data. TSN_seq,2892 if (SCTP_TSN_GT(tp1->rec.data.tsn, 2871 2893 tp1->whoTo->this_sack_highest_newack)) { 2872 2894 tp1->whoTo->this_sack_highest_newack = 2873 tp1->rec.data. TSN_seq;2895 tp1->rec.data.tsn; 2874 2896 } 2875 2897 /*- … … 2881 2903 sctp_log_sack(*this_sack_lowest_newack, 2882 2904 last_tsn, 2883 tp1->rec.data. TSN_seq,2905 tp1->rec.data.tsn, 2884 2906 0, 2885 2907 0, 2886 2908 SCTP_LOG_TSN_ACKED); 2887 2909 } 2888 *this_sack_lowest_newack = tp1->rec.data. TSN_seq;2910 *this_sack_lowest_newack = tp1->rec.data.tsn; 2889 2911 } 2890 2912 /*- … … 2896 2918 * retransmissions. 2897 2919 */ 2898 if (tp1->rec.data. TSN_seq== tp1->whoTo->pseudo_cumack) {2920 if (tp1->rec.data.tsn == tp1->whoTo->pseudo_cumack) { 2899 2921 if (tp1->rec.data.chunk_was_revoked == 0) { 2900 2922 tp1->whoTo->new_pseudo_cumack = 1; … … 2903 2925 } 2904 2926 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_CWND_LOGGING_ENABLE) { 2905 sctp_log_cwnd(stcb, tp1->whoTo, tp1->rec.data. TSN_seq, SCTP_CWND_LOG_FROM_SACK);2927 sctp_log_cwnd(stcb, tp1->whoTo, tp1->rec.data.tsn, SCTP_CWND_LOG_FROM_SACK); 2906 2928 } 2907 if (tp1->rec.data. TSN_seq== tp1->whoTo->rtx_pseudo_cumack) {2929 if (tp1->rec.data.tsn == tp1->whoTo->rtx_pseudo_cumack) { 2908 2930 if (tp1->rec.data.chunk_was_revoked == 0) { 2909 2931 tp1->whoTo->new_pseudo_cumack = 1; … … 2914 2936 sctp_log_sack(*biggest_newly_acked_tsn, 2915 2937 last_tsn, 2916 tp1->rec.data. TSN_seq,2938 tp1->rec.data.tsn, 2917 2939 frag_strt, 2918 2940 frag_end, … … 2924 2946 tp1->book_size, 2925 2947 (uint32_t)(uintptr_t)tp1->whoTo, 2926 tp1->rec.data. TSN_seq);2948 tp1->rec.data.tsn); 2927 2949 } 2928 2950 sctp_flight_size_decrease(tp1); … … 2963 2985 } 2964 2986 if (tp1->sent <= SCTP_DATAGRAM_RESEND) { 2965 if (SCTP_TSN_GT(tp1->rec.data. TSN_seq,2987 if (SCTP_TSN_GT(tp1->rec.data.tsn, 2966 2988 stcb->asoc.this_sack_highest_gap)) { 2967 2989 stcb->asoc.this_sack_highest_gap = 2968 tp1->rec.data. TSN_seq;2990 tp1->rec.data.tsn; 2969 2991 } 2970 2992 if (tp1->sent == SCTP_DATAGRAM_RESEND) { … … 2992 3014 if (nr_sacking && 2993 3015 (tp1->sent != SCTP_DATAGRAM_NR_ACKED)) { 2994 if (stcb->asoc.strmout[tp1->rec.data.s tream_number].chunks_on_queues > 0) {2995 stcb->asoc.strmout[tp1->rec.data.s tream_number].chunks_on_queues--;3016 if (stcb->asoc.strmout[tp1->rec.data.sid].chunks_on_queues > 0) { 3017 stcb->asoc.strmout[tp1->rec.data.sid].chunks_on_queues--; 2996 3018 #ifdef INVARIANTS 2997 3019 } else { 2998 panic("No chunks on the queues for sid %u.", tp1->rec.data.s tream_number);3020 panic("No chunks on the queues for sid %u.", tp1->rec.data.sid); 2999 3021 #endif 3000 3022 } 3001 if ((stcb->asoc.strmout[tp1->rec.data.s tream_number].chunks_on_queues == 0) &&3002 (stcb->asoc.strmout[tp1->rec.data.s tream_number].state == SCTP_STREAM_RESET_PENDING) &&3003 TAILQ_EMPTY(&stcb->asoc.strmout[tp1->rec.data.s tream_number].outqueue)) {3023 if ((stcb->asoc.strmout[tp1->rec.data.sid].chunks_on_queues == 0) && 3024 (stcb->asoc.strmout[tp1->rec.data.sid].state == SCTP_STREAM_RESET_PENDING) && 3025 TAILQ_EMPTY(&stcb->asoc.strmout[tp1->rec.data.sid].outqueue)) { 3004 3026 stcb->asoc.trigger_reset = 1; 3005 3027 } … … 3015 3037 } 3016 3038 break; 3017 } /* if (tp1-> TSN_seq== theTSN) */3018 if (SCTP_TSN_GT(tp1->rec.data. TSN_seq, theTSN)) {3039 } /* if (tp1->tsn == theTSN) */ 3040 if (SCTP_TSN_GT(tp1->rec.data.tsn, theTSN)) { 3019 3041 break; 3020 3042 } … … 3108 3130 3109 3131 TAILQ_FOREACH(tp1, &asoc->sent_queue, sctp_next) { 3110 if (SCTP_TSN_GT(tp1->rec.data. TSN_seq, cumack)) {3132 if (SCTP_TSN_GT(tp1->rec.data.tsn, cumack)) { 3111 3133 /* 3112 3134 * ok this guy is either ACK or MARKED. If it is … … 3115 3137 * again. 3116 3138 */ 3117 if (SCTP_TSN_GT(tp1->rec.data. TSN_seq, biggest_tsn_acked)) {3139 if (SCTP_TSN_GT(tp1->rec.data.tsn, biggest_tsn_acked)) { 3118 3140 break; 3119 3141 } … … 3130 3152 tp1->book_size, 3131 3153 (uint32_t)(uintptr_t)tp1->whoTo, 3132 tp1->rec.data. TSN_seq);3154 tp1->rec.data.tsn); 3133 3155 } 3134 3156 sctp_flight_size_increase(tp1); … … 3141 3163 sctp_log_sack(asoc->last_acked_seq, 3142 3164 cumack, 3143 tp1->rec.data. TSN_seq,3165 tp1->rec.data.tsn, 3144 3166 0, 3145 3167 0, … … 3177 3199 sending_seq = asoc->sending_seq; 3178 3200 } else { 3179 sending_seq = tp1->rec.data. TSN_seq;3201 sending_seq = tp1->rec.data.tsn; 3180 3202 } 3181 3203 … … 3200 3222 if (tp1->sent < SCTP_DATAGRAM_RESEND) 3201 3223 sctp_log_fr(biggest_tsn_newly_acked, 3202 tp1->rec.data. TSN_seq,3224 tp1->rec.data.tsn, 3203 3225 tp1->sent, 3204 3226 SCTP_FR_LOG_CHECK_STRIKE); 3205 3227 } 3206 if (SCTP_TSN_GT(tp1->rec.data. TSN_seq, biggest_tsn_acked) ||3228 if (SCTP_TSN_GT(tp1->rec.data.tsn, biggest_tsn_acked) || 3207 3229 tp1->sent == SCTP_DATAGRAM_UNSENT) { 3208 3230 /* done */ … … 3227 3249 3228 3250 } 3229 if (SCTP_TSN_GT(tp1->rec.data. TSN_seq, asoc->this_sack_highest_gap)) {3251 if (SCTP_TSN_GT(tp1->rec.data.tsn, asoc->this_sack_highest_gap)) { 3230 3252 /* we are beyond the tsn in the sack */ 3231 3253 break; … … 3251 3273 */ 3252 3274 continue; 3253 } else if (tp1->whoTo && SCTP_TSN_GT(tp1->rec.data. TSN_seq,3275 } else if (tp1->whoTo && SCTP_TSN_GT(tp1->rec.data.tsn, 3254 3276 tp1->whoTo->this_sack_highest_newack)) { 3255 3277 /* … … 3280 3302 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_FR_LOGGING_ENABLE) { 3281 3303 sctp_log_fr(biggest_tsn_newly_acked, 3282 tp1->rec.data. TSN_seq,3304 tp1->rec.data.tsn, 3283 3305 tp1->sent, 3284 3306 SCTP_FR_LOG_STRIKE_CHUNK); … … 3301 3323 */ 3302 3324 if ((tp1->sent < SCTP_DATAGRAM_RESEND) && (num_dests_sacked == 1) && 3303 SCTP_TSN_GT(this_sack_lowest_newack, tp1->rec.data. TSN_seq)) {3325 SCTP_TSN_GT(this_sack_lowest_newack, tp1->rec.data.tsn)) { 3304 3326 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_FR_LOGGING_ENABLE) { 3305 3327 sctp_log_fr(16 + num_dests_sacked, 3306 tp1->rec.data. TSN_seq,3328 tp1->rec.data.tsn, 3307 3329 tp1->sent, 3308 3330 SCTP_FR_LOG_STRIKE_CHUNK); … … 3342 3364 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_FR_LOGGING_ENABLE) { 3343 3365 sctp_log_fr(biggest_tsn_newly_acked, 3344 tp1->rec.data. TSN_seq,3366 tp1->rec.data.tsn, 3345 3367 tp1->sent, 3346 3368 SCTP_FR_LOG_STRIKE_CHUNK); … … 3370 3392 (num_dests_sacked == 1) && 3371 3393 SCTP_TSN_GT(this_sack_lowest_newack, 3372 tp1->rec.data. TSN_seq)) {3394 tp1->rec.data.tsn)) { 3373 3395 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_FR_LOGGING_ENABLE) { 3374 3396 sctp_log_fr(32 + num_dests_sacked, 3375 tp1->rec.data. TSN_seq,3397 tp1->rec.data.tsn, 3376 3398 tp1->sent, 3377 3399 SCTP_FR_LOG_STRIKE_CHUNK); … … 3388 3410 * SFR algo covers HTNA. 3389 3411 */ 3390 } else if (SCTP_TSN_GT(tp1->rec.data. TSN_seq,3412 } else if (SCTP_TSN_GT(tp1->rec.data.tsn, 3391 3413 biggest_tsn_newly_acked)) { 3392 3414 /* … … 3400 3422 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_FR_LOGGING_ENABLE) { 3401 3423 sctp_log_fr(biggest_tsn_newly_acked, 3402 tp1->rec.data. TSN_seq,3424 tp1->rec.data.tsn, 3403 3425 tp1->sent, 3404 3426 SCTP_FR_LOG_STRIKE_CHUNK); … … 3421 3443 */ 3422 3444 if ((tp1->sent < SCTP_DATAGRAM_RESEND) && (num_dests_sacked == 1) && 3423 SCTP_TSN_GT(this_sack_lowest_newack, tp1->rec.data. TSN_seq)) {3445 SCTP_TSN_GT(this_sack_lowest_newack, tp1->rec.data.tsn)) { 3424 3446 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_FR_LOGGING_ENABLE) { 3425 3447 sctp_log_fr(48 + num_dests_sacked, 3426 tp1->rec.data. TSN_seq,3448 tp1->rec.data.tsn, 3427 3449 tp1->sent, 3428 3450 SCTP_FR_LOG_STRIKE_CHUNK); … … 3441 3463 tp1->book_size, 3442 3464 (uint32_t)(uintptr_t)tp1->whoTo, 3443 tp1->rec.data. TSN_seq);3465 tp1->rec.data.tsn); 3444 3466 } 3445 3467 if (tp1->whoTo) { … … 3478 3500 /* SCTP_PRINTF("OK, we are now ready to FR this guy\n"); */ 3479 3501 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_FR_LOGGING_ENABLE) { 3480 sctp_log_fr(tp1->rec.data. TSN_seq, tp1->snd_count,3502 sctp_log_fr(tp1->rec.data.tsn, tp1->snd_count, 3481 3503 0, SCTP_FR_MARKED); 3482 3504 } … … 3538 3560 /* 3539 3561 * SCTP_PRINTF("Marking TSN for FR new value %x\n", 3540 * (uint32_t)tpi->rec.data. TSN_seq);3562 * (uint32_t)tpi->rec.data.tsn); 3541 3563 */ 3542 3564 if (TAILQ_EMPTY(&asoc->send_queue)) { … … 3561 3583 ttt = TAILQ_FIRST(&asoc->send_queue); 3562 3584 tp1->rec.data.fast_retran_tsn = 3563 ttt->rec.data. TSN_seq;3585 ttt->rec.data.tsn; 3564 3586 } 3565 3587 … … 3609 3631 sctp_misc_ints(SCTP_FWD_TSN_CHECK, 3610 3632 asoc->advanced_peer_ack_point, 3611 tp1->rec.data. TSN_seq, 0, 0);3633 tp1->rec.data.tsn, 0, 0); 3612 3634 } 3613 3635 } … … 3661 3683 (tp1->sent == SCTP_DATAGRAM_NR_ACKED)) { 3662 3684 /* advance PeerAckPoint goes forward */ 3663 if (SCTP_TSN_GT(tp1->rec.data. TSN_seq, asoc->advanced_peer_ack_point)) {3664 asoc->advanced_peer_ack_point = tp1->rec.data. TSN_seq;3685 if (SCTP_TSN_GT(tp1->rec.data.tsn, asoc->advanced_peer_ack_point)) { 3686 asoc->advanced_peer_ack_point = tp1->rec.data.tsn; 3665 3687 a_adv = tp1; 3666 } else if (tp1->rec.data. TSN_seq== asoc->advanced_peer_ack_point) {3688 } else if (tp1->rec.data.tsn == asoc->advanced_peer_ack_point) { 3667 3689 /* No update but we do save the chk */ 3668 3690 a_adv = tp1; … … 3700 3722 if (chk->sent < SCTP_DATAGRAM_RESEND) { 3701 3723 SCTP_PRINTF("Chk TSN: %u size: %d inflight cnt: %d\n", 3702 chk->rec.data. TSN_seq,3724 chk->rec.data.tsn, 3703 3725 chk->send_size, 3704 3726 chk->snd_count); … … 3743 3765 tp1->book_size, 3744 3766 (uint32_t)(uintptr_t)tp1->whoTo, 3745 tp1->rec.data. TSN_seq);3767 tp1->rec.data.tsn); 3746 3768 return; 3747 3769 } … … 3762 3784 tp1->book_size, 3763 3785 (uint32_t)(uintptr_t)tp1->whoTo, 3764 tp1->rec.data. TSN_seq);3786 tp1->rec.data.tsn); 3765 3787 } 3766 3788 } … … 3834 3856 tp1 = TAILQ_LAST(&asoc->sent_queue, 3835 3857 sctpchunk_listhead); 3836 send_s = tp1->rec.data. TSN_seq+ 1;3858 send_s = tp1->rec.data.tsn + 1; 3837 3859 } else { 3838 3860 send_s = asoc->sending_seq; … … 3863 3885 /* process the new consecutive TSN first */ 3864 3886 TAILQ_FOREACH_SAFE(tp1, &asoc->sent_queue, sctp_next, tp2) { 3865 if (SCTP_TSN_GE(cumack, tp1->rec.data. TSN_seq)) {3887 if (SCTP_TSN_GE(cumack, tp1->rec.data.tsn)) { 3866 3888 if (tp1->sent == SCTP_DATAGRAM_UNSENT) { 3867 3889 SCTP_PRINTF("Warning, an unsent is now acked?\n"); … … 3879 3901 tp1->book_size, 3880 3902 (uint32_t)(uintptr_t)tp1->whoTo, 3881 tp1->rec.data. TSN_seq);3903 tp1->rec.data.tsn); 3882 3904 } 3883 3905 sctp_flight_size_decrease(tp1); … … 3937 3959 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_CWND_LOGGING_ENABLE) { 3938 3960 /* sa_ignore NO_NULL_CHK */ 3939 sctp_log_cwnd(stcb, tp1->whoTo, tp1->rec.data. TSN_seq, SCTP_CWND_LOG_FROM_SACK);3961 sctp_log_cwnd(stcb, tp1->whoTo, tp1->rec.data.tsn, SCTP_CWND_LOG_FROM_SACK); 3940 3962 } 3941 3963 } … … 3949 3971 } 3950 3972 if (tp1->sent != SCTP_DATAGRAM_NR_ACKED) { 3951 if (asoc->strmout[tp1->rec.data.s tream_number].chunks_on_queues > 0) {3952 asoc->strmout[tp1->rec.data.s tream_number].chunks_on_queues--;3973 if (asoc->strmout[tp1->rec.data.sid].chunks_on_queues > 0) { 3974 asoc->strmout[tp1->rec.data.sid].chunks_on_queues--; 3953 3975 #ifdef INVARIANTS 3954 3976 } else { 3955 panic("No chunks on the queues for sid %u.", tp1->rec.data.s tream_number);3977 panic("No chunks on the queues for sid %u.", tp1->rec.data.sid); 3956 3978 #endif 3957 3979 } 3958 3980 } 3959 if ((asoc->strmout[tp1->rec.data.s tream_number].chunks_on_queues == 0) &&3960 (asoc->strmout[tp1->rec.data.s tream_number].state == SCTP_STREAM_RESET_PENDING) &&3961 TAILQ_EMPTY(&asoc->strmout[tp1->rec.data.s tream_number].outqueue)) {3981 if ((asoc->strmout[tp1->rec.data.sid].chunks_on_queues == 0) && 3982 (asoc->strmout[tp1->rec.data.sid].state == SCTP_STREAM_RESET_PENDING) && 3983 TAILQ_EMPTY(&asoc->strmout[tp1->rec.data.sid].outqueue)) { 3962 3984 asoc->trigger_reset = 1; 3963 3985 } … … 3972 3994 sctp_log_sack(asoc->last_acked_seq, 3973 3995 cumack, 3974 tp1->rec.data. TSN_seq,3996 tp1->rec.data.tsn, 3975 3997 0, 3976 3998 0, … … 4395 4417 tp1 = TAILQ_LAST(&asoc->sent_queue, 4396 4418 sctpchunk_listhead); 4397 send_s = tp1->rec.data. TSN_seq+ 1;4419 send_s = tp1->rec.data.tsn + 1; 4398 4420 } else { 4399 4421 tp1 = NULL; … … 4412 4434 if (tp1) { 4413 4435 SCTP_PRINTF("Got send_s from tsn:%x + 1 of tp1: %p\n", 4414 tp1->rec.data. TSN_seq, (void *)tp1);4436 tp1->rec.data.tsn, (void *)tp1); 4415 4437 } 4416 4438 hopeless_peer: … … 4488 4510 /* process the new consecutive TSN first */ 4489 4511 TAILQ_FOREACH(tp1, &asoc->sent_queue, sctp_next) { 4490 if (SCTP_TSN_GE(last_tsn, tp1->rec.data. TSN_seq)) {4512 if (SCTP_TSN_GE(last_tsn, tp1->rec.data.tsn)) { 4491 4513 if (tp1->sent != SCTP_DATAGRAM_UNSENT) { 4492 4514 accum_moved = 1; … … 4517 4539 tp1->book_size, 4518 4540 (uint32_t)(uintptr_t)tp1->whoTo, 4519 tp1->rec.data. TSN_seq);4541 tp1->rec.data.tsn); 4520 4542 } 4521 4543 sctp_flight_size_decrease(tp1); … … 4529 4551 4530 4552 /* CMT SFR and DAC algos */ 4531 this_sack_lowest_newack = tp1->rec.data. TSN_seq;4553 this_sack_lowest_newack = tp1->rec.data.tsn; 4532 4554 tp1->whoTo->saw_newack = 1; 4533 4555 … … 4577 4599 sctp_log_sack(asoc->last_acked_seq, 4578 4600 cum_ack, 4579 tp1->rec.data. TSN_seq,4601 tp1->rec.data.tsn, 4580 4602 0, 4581 4603 0, … … 4583 4605 } 4584 4606 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_CWND_LOGGING_ENABLE) { 4585 sctp_log_cwnd(stcb, tp1->whoTo, tp1->rec.data. TSN_seq, SCTP_CWND_LOG_FROM_SACK);4607 sctp_log_cwnd(stcb, tp1->whoTo, tp1->rec.data.tsn, SCTP_CWND_LOG_FROM_SACK); 4586 4608 } 4587 4609 } … … 4672 4694 4673 4695 TAILQ_FOREACH_SAFE(tp1, &asoc->sent_queue, sctp_next, tp2) { 4674 if (SCTP_TSN_GT(tp1->rec.data. TSN_seq, cum_ack)) {4696 if (SCTP_TSN_GT(tp1->rec.data.tsn, cum_ack)) { 4675 4697 break; 4676 4698 } 4677 4699 if (tp1->sent != SCTP_DATAGRAM_NR_ACKED) { 4678 if (asoc->strmout[tp1->rec.data.s tream_number].chunks_on_queues > 0) {4679 asoc->strmout[tp1->rec.data.s tream_number].chunks_on_queues--;4700 if (asoc->strmout[tp1->rec.data.sid].chunks_on_queues > 0) { 4701 asoc->strmout[tp1->rec.data.sid].chunks_on_queues--; 4680 4702 #ifdef INVARIANTS 4681 4703 } else { 4682 panic("No chunks on the queues for sid %u.", tp1->rec.data.s tream_number);4704 panic("No chunks on the queues for sid %u.", tp1->rec.data.sid); 4683 4705 #endif 4684 4706 } 4685 4707 } 4686 if ((asoc->strmout[tp1->rec.data.s tream_number].chunks_on_queues == 0) &&4687 (asoc->strmout[tp1->rec.data.s tream_number].state == SCTP_STREAM_RESET_PENDING) &&4688 TAILQ_EMPTY(&asoc->strmout[tp1->rec.data.s tream_number].outqueue)) {4708 if ((asoc->strmout[tp1->rec.data.sid].chunks_on_queues == 0) && 4709 (asoc->strmout[tp1->rec.data.sid].state == SCTP_STREAM_RESET_PENDING) && 4710 TAILQ_EMPTY(&asoc->strmout[tp1->rec.data.sid].outqueue)) { 4689 4711 asoc->trigger_reset = 1; 4690 4712 } … … 4707 4729 sctp_log_sack(asoc->last_acked_seq, 4708 4730 cum_ack, 4709 tp1->rec.data. TSN_seq,4731 tp1->rec.data.tsn, 4710 4732 0, 4711 4733 0, … … 4813 4835 tp1->book_size, 4814 4836 (uint32_t)(uintptr_t)tp1->whoTo, 4815 tp1->rec.data. TSN_seq);4837 tp1->rec.data.tsn); 4816 4838 } 4817 4839 sctp_flight_size_increase(tp1); … … 5181 5203 struct sctp_queued_to_read *ctl, *nctl; 5182 5204 struct sctp_association *asoc; 5183 uint32_t tt;5184 int need_reasm_check = 0 , old;5205 uint32_t mid; 5206 int need_reasm_check = 0; 5185 5207 5186 5208 asoc = &stcb->asoc; 5187 tt = strmin->last_sequence_delivered; 5188 if (asoc->idata_supported) { 5189 old = 0; 5190 } else { 5191 old = 1; 5192 } 5209 mid = strmin->last_mid_delivered; 5193 5210 /* 5194 5211 * First deliver anything prior to and including the stream no that … … 5196 5213 */ 5197 5214 TAILQ_FOREACH_SAFE(ctl, &strmin->inqueue, next_instrm, nctl) { 5198 if (SCTP_M SGID_GE(old, tt, ctl->sinfo_ssn)) {5215 if (SCTP_MID_GE(asoc->idata_supported, mid, ctl->mid)) { 5199 5216 /* this is deliverable now */ 5200 5217 if (((ctl->sinfo_flags >> 8) & SCTP_DATA_NOT_FRAG) == SCTP_DATA_NOT_FRAG) { … … 5228 5245 if (ctl->first_frag_seen) { 5229 5246 /* Make it so this is next to deliver, we restore later */ 5230 strmin->last_ sequence_delivered = ctl->sinfo_ssn- 1;5247 strmin->last_mid_delivered = ctl->mid - 1; 5231 5248 need_reasm_check = 1; 5232 5249 break; … … 5241 5258 int ret; 5242 5259 ret = sctp_deliver_reasm_check(stcb, &stcb->asoc, strmin, SCTP_READ_LOCK_HELD); 5243 if (SCTP_M SGID_GT(old, tt, strmin->last_sequence_delivered)) {5260 if (SCTP_MID_GT(asoc->idata_supported, mid, strmin->last_mid_delivered)) { 5244 5261 /* Restore the next to deliver unless we are ahead */ 5245 strmin->last_ sequence_delivered = tt;5262 strmin->last_mid_delivered = mid; 5246 5263 } 5247 5264 if (ret == 0) { … … 5255 5272 * now ready. 5256 5273 */ 5257 tt = strmin->last_sequence_delivered + 1;5274 mid = strmin->last_mid_delivered + 1; 5258 5275 TAILQ_FOREACH_SAFE(ctl, &strmin->inqueue, next_instrm, nctl) { 5259 if ( tt == ctl->sinfo_ssn) {5276 if (SCTP_MID_EQ(asoc->idata_supported, mid, ctl->mid)) { 5260 5277 if (((ctl->sinfo_flags >> 8) & SCTP_DATA_NOT_FRAG) == SCTP_DATA_NOT_FRAG) { 5261 5278 /* this is deliverable now */ … … 5277 5294 sctp_ucount_decr(asoc->cnt_on_all_streams); 5278 5295 /* deliver it to at least the delivery-q */ 5279 strmin->last_ sequence_delivered = ctl->sinfo_ssn;5296 strmin->last_mid_delivered = ctl->mid; 5280 5297 if (stcb->sctp_socket) { 5281 5298 sctp_mark_non_revokable(asoc, ctl->sinfo_tsn); … … 5286 5303 5287 5304 } 5288 tt = strmin->last_sequence_delivered + 1;5305 mid = strmin->last_mid_delivered + 1; 5289 5306 } else { 5290 5307 /* Its a fragmented message */ 5291 5308 if (ctl->first_frag_seen) { 5292 5309 /* Make it so this is next to deliver */ 5293 strmin->last_ sequence_delivered = ctl->sinfo_ssn- 1;5310 strmin->last_mid_delivered = ctl->mid - 1; 5294 5311 need_reasm_check = 1; 5295 5312 break; … … 5310 5327 sctp_flush_reassm_for_str_seq(struct sctp_tcb *stcb, 5311 5328 struct sctp_association *asoc, 5312 uint16_t stream, uint32_t seq, int ordered, int old, uint32_t cumtsn)5329 uint16_t stream, uint32_t mid, int ordered, uint32_t cumtsn) 5313 5330 { 5314 5331 struct sctp_queued_to_read *control; … … 5316 5333 struct sctp_tmit_chunk *chk, *nchk; 5317 5334 int cnt_removed=0; 5335 5318 5336 /* 5319 5337 * For now large messages held on the stream reasm that are … … 5325 5343 */ 5326 5344 strm = &asoc->strmin[stream]; 5327 control = sctp_find_reasm_entry(strm, (uint32_t)seq, ordered, old);5345 control = sctp_find_reasm_entry(strm, mid, ordered, asoc->idata_supported); 5328 5346 if (control == NULL) { 5329 5347 /* Not found */ 5330 5348 return; 5331 5349 } 5350 if (!asoc->idata_supported && !ordered && SCTP_TSN_GT(control->fsn_included, cumtsn)) { 5351 return; 5352 } 5332 5353 TAILQ_FOREACH_SAFE(chk, &control->reasm, sctp_next, nchk) { 5333 5354 /* Purge hanging chunks */ 5334 if ( old && (ordered == 0)) {5335 if (SCTP_TSN_GT(chk->rec.data. TSN_seq, cumtsn)) {5355 if (!asoc->idata_supported && (ordered == 0)) { 5356 if (SCTP_TSN_GT(chk->rec.data.tsn, cumtsn)) { 5336 5357 break; 5337 5358 } … … 5485 5506 SCTP_INP_READ_LOCK(stcb->sctp_ep); 5486 5507 for (sid = 0 ; sid < asoc->streamincnt; sid++) { 5487 sctp_flush_reassm_for_str_seq(stcb, asoc, sid, 0, 0, 1,new_cum_tsn);5508 sctp_flush_reassm_for_str_seq(stcb, asoc, sid, 0, 0, new_cum_tsn); 5488 5509 } 5489 5510 SCTP_INP_READ_UNLOCK(stcb->sctp_ep); … … 5497 5518 /* New method. */ 5498 5519 unsigned int num_str; 5499 uint32_t sequence;5500 uint16_t s tream;5520 uint32_t mid, cur_mid; 5521 uint16_t sid; 5501 5522 uint16_t ordered, flags; 5502 int old;5503 5523 struct sctp_strseq *stseq, strseqbuf; 5504 5524 struct sctp_strseq_mid *stseq_m, strseqbuf_m; … … 5508 5528 if (asoc->idata_supported) { 5509 5529 num_str = fwd_sz / sizeof(struct sctp_strseq_mid); 5510 old = 0;5511 5530 } else { 5512 5531 num_str = fwd_sz / sizeof(struct sctp_strseq); 5513 old = 1;5514 5532 } 5515 5533 for (i = 0; i < num_str; i++) { … … 5522 5540 break; 5523 5541 } 5524 s tream = ntohs(stseq_m->stream);5525 sequence = ntohl(stseq_m->msg_id);5542 sid = ntohs(stseq_m->sid); 5543 mid = ntohl(stseq_m->mid); 5526 5544 flags = ntohs(stseq_m->flags); 5527 5545 if (flags & PR_SCTP_UNORDERED_FLAG) { … … 5538 5556 break; 5539 5557 } 5540 s tream = ntohs(stseq->stream);5541 sequence = (uint32_t)ntohs(stseq->sequence);5558 sid = ntohs(stseq->sid); 5559 mid = (uint32_t)ntohs(stseq->ssn); 5542 5560 ordered = 1; 5543 5561 } … … 5551 5569 * read entry into a PDI_ABORTED. 5552 5570 */ 5553 if (s tream>= asoc->streamincnt) {5571 if (sid >= asoc->streamincnt) { 5554 5572 /* screwed up streams, stop! */ 5555 5573 break; 5556 5574 } 5557 if ((asoc->str_of_pdapi == s tream) &&5558 (asoc->ssn_of_pdapi == sequence)) {5575 if ((asoc->str_of_pdapi == sid) && 5576 (asoc->ssn_of_pdapi == mid)) { 5559 5577 /* If this is the one we were partially delivering 5560 5578 * now then we no longer are. Note this will change … … 5563 5581 asoc->fragmented_delivery_inprogress = 0; 5564 5582 } 5565 strm = &asoc->strmin[stream]; 5566 if (asoc->idata_supported == 0) { 5567 uint16_t strm_at; 5568 5569 for(strm_at = strm->last_sequence_delivered; SCTP_MSGID_GE(1, sequence, strm_at); strm_at++) { 5570 sctp_flush_reassm_for_str_seq(stcb, asoc, stream, strm_at, ordered, old, new_cum_tsn); 5571 } 5572 } else { 5573 uint32_t strm_at; 5574 5575 for(strm_at = strm->last_sequence_delivered; SCTP_MSGID_GE(0, sequence, strm_at); strm_at++) { 5576 sctp_flush_reassm_for_str_seq(stcb, asoc, stream, strm_at, ordered, old, new_cum_tsn); 5577 } 5583 strm = &asoc->strmin[sid]; 5584 for (cur_mid = strm->last_mid_delivered; SCTP_MID_GE(asoc->idata_supported, mid, cur_mid); cur_mid++) { 5585 sctp_flush_reassm_for_str_seq(stcb, asoc, sid, cur_mid, ordered, new_cum_tsn); 5578 5586 } 5579 5587 TAILQ_FOREACH(ctl, &stcb->sctp_ep->read_queue, next) { 5580 if ((ctl->sinfo_stream == s tream) &&5581 ( ctl->sinfo_ssn == sequence)) {5582 str_seq = (s tream << 16) | (0x0000ffff & sequence);5588 if ((ctl->sinfo_stream == sid) && 5589 (SCTP_MID_EQ(asoc->idata_supported, ctl->mid, mid))) { 5590 str_seq = (sid << 16) | (0x0000ffff & mid); 5583 5591 ctl->pdapi_aborted = 1; 5584 5592 sv = stcb->asoc.control_pdapi; … … 5603 5611 stcb->asoc.control_pdapi = sv; 5604 5612 break; 5605 } else if ((ctl->sinfo_stream == s tream) &&5606 SCTP_M SGID_GT(old, ctl->sinfo_ssn, sequence)) {5613 } else if ((ctl->sinfo_stream == sid) && 5614 SCTP_MID_GT(asoc->idata_supported, ctl->mid, mid)) { 5607 5615 /* We are past our victim SSN */ 5608 5616 break; 5609 5617 } 5610 5618 } 5611 if (SCTP_M SGID_GT(old, sequence, strm->last_sequence_delivered)) {5619 if (SCTP_MID_GT(asoc->idata_supported, mid, strm->last_mid_delivered)) { 5612 5620 /* Update the sequence number */ 5613 strm->last_ sequence_delivered = sequence;5621 strm->last_mid_delivered = mid; 5614 5622 } 5615 5623 /* now kick the stream the new way */ -
trunk/Source/ThirdParty/libwebrtc/Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_indata.h
r210942 r218849 33 33 #ifdef __FreeBSD__ 34 34 #include <sys/cdefs.h> 35 __FBSDID("$FreeBSD: head/sys/netinet/sctp_indata.h 297663 2016-04-07 09:34:41Z rrs$");35 __FBSDID("$FreeBSD: head/sys/netinet/sctp_indata.h 310590 2016-12-26 11:06:41Z tuexen $"); 36 36 #endif 37 37 … … 45 45 struct sctp_nets *net, 46 46 uint32_t tsn, uint32_t ppid, 47 uint32_t context, uint16_t s tream_no,48 uint32_t stream_seq, uint8_t flags,47 uint32_t context, uint16_t sid, 48 uint32_t mid, uint8_t flags, 49 49 struct mbuf *dm); 50 50 51 51 52 #define sctp_build_readq_entry_mac(_ctl, in_it, context, net, tsn, ppid, s tream_no, stream_seq, flags, dm, tfsn, msgid) do { \52 #define sctp_build_readq_entry_mac(_ctl, in_it, context, net, tsn, ppid, sid, flags, dm, tfsn, mid) do { \ 53 53 if (_ctl) { \ 54 54 atomic_add_int(&((net)->ref_count), 1); \ 55 55 memset(_ctl, 0, sizeof(struct sctp_queued_to_read)); \ 56 (_ctl)->sinfo_stream = stream_no; \ 57 (_ctl)->sinfo_ssn = stream_seq; \ 56 (_ctl)->sinfo_stream = sid; \ 58 57 TAILQ_INIT(&_ctl->reasm); \ 59 58 (_ctl)->top_fsn = tfsn; \ 60 (_ctl)->m sg_id = msgid; \59 (_ctl)->mid = mid; \ 61 60 (_ctl)->sinfo_flags = (flags << 8); \ 62 61 (_ctl)->sinfo_ppid = ppid; \ -
trunk/Source/ThirdParty/libwebrtc/Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_input.c
r211848 r218849 33 33 #ifdef __FreeBSD__ 34 34 #include <sys/cdefs.h> 35 __FBSDID("$FreeBSD: head/sys/netinet/sctp_input.c 3 04837 2016-08-26 07:49:23Z tuexen$");35 __FBSDID("$FreeBSD: head/sys/netinet/sctp_input.c 313330 2017-02-06 08:49:57Z ae $"); 36 36 #endif 37 37 … … 344 344 newcnt = ntohs(init->num_inbound_streams); 345 345 TAILQ_FOREACH_SAFE(chk, &asoc->send_queue, sctp_next, nchk) { 346 if (chk->rec.data.s tream_number>= newcnt) {346 if (chk->rec.data.sid >= newcnt) { 347 347 TAILQ_REMOVE(&asoc->send_queue, chk, sctp_next); 348 348 asoc->send_queue_cnt--; 349 if (asoc->strmout[chk->rec.data.s tream_number].chunks_on_queues > 0) {350 asoc->strmout[chk->rec.data.s tream_number].chunks_on_queues--;349 if (asoc->strmout[chk->rec.data.sid].chunks_on_queues > 0) { 350 asoc->strmout[chk->rec.data.sid].chunks_on_queues--; 351 351 #ifdef INVARIANTS 352 352 } else { 353 panic("No chunks on the queues for sid %u.", chk->rec.data.s tream_number);353 panic("No chunks on the queues for sid %u.", chk->rec.data.sid); 354 354 #endif 355 355 } … … 436 436 } 437 437 for (i = 0; i < asoc->streamincnt; i++) { 438 asoc->strmin[i].s tream_no= i;439 asoc->strmin[i].last_ sequence_delivered = 0xffffffff;438 asoc->strmin[i].sid = i; 439 asoc->strmin[i].last_mid_delivered = 0xffffffff; 440 440 TAILQ_INIT(&asoc->strmin[i].inqueue); 441 441 TAILQ_INIT(&asoc->strmin[i].uno_inqueue); … … 1730 1730 * don't double things 1731 1731 */ 1732 struct timeval time_entered;1733 1732 net->hb_responded = 1; 1733 struct timeval time_entered; 1734 1734 net->RTO = sctp_calculate_rto(stcb, asoc, net, 1735 1735 &time_entered, 1736 1736 sctp_align_unsafe_makecopy, 1737 1737 SCTP_RTT_FROM_NON_DATA); 1738 cookie->time_entered = time_entered; 1738 cookie->time_entered = time_entered; 1739 1739 1740 if (stcb->asoc.sctp_autoclose_ticks && 1740 1741 (sctp_is_feature_on(inp, SCTP_PCB_FLAGS_AUTOCLOSE))) { … … 2050 2051 asoc->strmout[i].abandoned_unsent[0] = 0; 2051 2052 #endif 2052 stcb->asoc.strmout[i].s tream_no= i;2053 stcb->asoc.strmout[i].sid = i; 2053 2054 stcb->asoc.strmout[i].next_mid_ordered = 0; 2054 2055 stcb->asoc.strmout[i].next_mid_unordered = 0; … … 2483 2484 (void)SCTP_GETTIME_TIMEVAL(&stcb->asoc.time_entered); 2484 2485 if ((netp != NULL) && (*netp != NULL)) { 2485 struct timeval time_entered;2486 2486 /* calculate the RTT and set the encaps port */ 2487 struct timeval time_entered; 2487 2488 (*netp)->RTO = sctp_calculate_rto(stcb, asoc, *netp, 2488 2489 &time_entered, sctp_align_unsafe_makecopy, 2489 2490 SCTP_RTT_FROM_NON_DATA); 2490 2491 cookie->time_entered = time_entered; 2491 2492 } 2492 2493 /* respond with a COOKIE-ACK */ … … 3224 3225 window_data_tsn = stcb->asoc.sending_seq - 1; 3225 3226 } else { 3226 window_data_tsn = lchk->rec.data. TSN_seq;3227 window_data_tsn = lchk->rec.data.tsn; 3227 3228 } 3228 3229 … … 3230 3231 net = NULL; 3231 3232 TAILQ_FOREACH(lchk, &stcb->asoc.sent_queue, sctp_next) { 3232 if (lchk->rec.data. TSN_seq== tsn) {3233 if (lchk->rec.data.tsn == tsn) { 3233 3234 net = lchk->whoTo; 3234 3235 net->ecn_prev_cwnd = lchk->rec.data.cwnd_at_send; 3235 3236 break; 3236 3237 } 3237 if (SCTP_TSN_GT(lchk->rec.data. TSN_seq, tsn)) {3238 if (SCTP_TSN_GT(lchk->rec.data.tsn, tsn)) { 3238 3239 break; 3239 3240 } … … 3423 3424 tsn = ntohl(desc->tsn_ifany); 3424 3425 TAILQ_FOREACH(tp1, &stcb->asoc.sent_queue, sctp_next) { 3425 if (tp1->rec.data. TSN_seq== tsn) {3426 if (tp1->rec.data.tsn == tsn) { 3426 3427 /* found it */ 3427 3428 break; 3428 3429 } 3429 if (SCTP_TSN_GT(tp1->rec.data. TSN_seq, tsn)) {3430 if (SCTP_TSN_GT(tp1->rec.data.tsn, tsn)) { 3430 3431 /* not found */ 3431 3432 tp1 = NULL; … … 3440 3441 SCTP_STAT_INCR(sctps_pdrpdnfnd); 3441 3442 TAILQ_FOREACH(tp1, &stcb->asoc.sent_queue, sctp_next) { 3442 if (tp1->rec.data. TSN_seq== tsn) {3443 if (tp1->rec.data.tsn == tsn) { 3443 3444 /* found it */ 3444 3445 break; … … 3506 3507 tp1->rec.data.fast_retran_tsn = stcb->asoc.sending_seq; 3507 3508 } else { 3508 tp1->rec.data.fast_retran_tsn = (TAILQ_FIRST(&stcb->asoc.send_queue))->rec.data. TSN_seq;3509 tp1->rec.data.fast_retran_tsn = (TAILQ_FIRST(&stcb->asoc.send_queue))->rec.data.tsn; 3509 3510 } 3510 3511 … … 3522 3523 tp1->book_size, 3523 3524 (uint32_t)(uintptr_t)stcb, 3524 tp1->rec.data. TSN_seq);3525 tp1->rec.data.tsn); 3525 3526 } 3526 3527 if (tp1->sent < SCTP_DATAGRAM_RESEND) { … … 3665 3666 continue; 3666 3667 } 3667 stcb->asoc.strmin[temp].last_ sequence_delivered = 0xffffffff;3668 stcb->asoc.strmin[temp].last_mid_delivered = 0xffffffff; 3668 3669 } 3669 3670 } else { 3670 3671 list = NULL; 3671 3672 for (i = 0; i < stcb->asoc.streamincnt; i++) { 3672 stcb->asoc.strmin[i].last_ sequence_delivered = 0xffffffff;3673 stcb->asoc.strmin[i].last_mid_delivered = 0xffffffff; 3673 3674 } 3674 3675 } … … 4211 4212 TAILQ_INIT(&stcb->asoc.strmin[i].inqueue); 4212 4213 TAILQ_INIT(&stcb->asoc.strmin[i].uno_inqueue); 4213 stcb->asoc.strmin[i].s tream_no= i;4214 stcb->asoc.strmin[i].last_ sequence_delivered = oldstrm[i].last_sequence_delivered;4214 stcb->asoc.strmin[i].sid = i; 4215 stcb->asoc.strmin[i].last_mid_delivered = oldstrm[i].last_mid_delivered; 4215 4216 stcb->asoc.strmin[i].delivery_started = oldstrm[i].delivery_started; 4216 4217 stcb->asoc.strmin[i].pd_api_started = oldstrm[i].pd_api_started; … … 4229 4230 TAILQ_INIT(&stcb->asoc.strmin[i].inqueue); 4230 4231 TAILQ_INIT(&stcb->asoc.strmin[i].uno_inqueue); 4231 stcb->asoc.strmin[i].s tream_no= i;4232 stcb->asoc.strmin[i].last_ sequence_delivered = 0xffffffff;4232 stcb->asoc.strmin[i].sid = i; 4233 stcb->asoc.strmin[i].last_mid_delivered = 0xffffffff; 4233 4234 stcb->asoc.strmin[i].pd_api_started = 0; 4234 4235 stcb->asoc.strmin[i].delivery_started = 0; … … 5999 6000 inp_decr = inp; 6000 6001 } 6001 #ifdef IPSEC6002 /*-6003 * I very much doubt any of the IPSEC stuff will work but I have no6004 * idea, so I will leave it in place.6005 */6006 if (inp != NULL) {6007 switch (dst->sa_family) {6008 #ifdef INET6009 case AF_INET:6010 if (ipsec4_in_reject(m, &inp->ip_inp.inp)) {6011 SCTP_STAT_INCR(sctps_hdrops);6012 goto out;6013 }6014 break;6015 #endif6016 #ifdef INET66017 case AF_INET6:6018 if (ipsec6_in_reject(m, &inp->ip_inp.inp)) {6019 SCTP_STAT_INCR(sctps_hdrops);6020 goto out;6021 }6022 break;6023 #endif6024 default:6025 break;6026 }6027 }6028 #endif6029 6002 SCTPDBG(SCTP_DEBUG_INPUT1, "Ok, Common input processing called, m:%p iphlen:%d offset:%d length:%d stcb:%p\n", 6030 6003 (void *)m, iphlen, offset, length, (void *)stcb); -
trunk/Source/ThirdParty/libwebrtc/Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_input.h
r210942 r218849 33 33 #ifdef __FreeBSD__ 34 34 #include <sys/cdefs.h> 35 __FBSDID("$FreeBSD: head/sys/netinet/sctp_input.h 284515 2015-06-17 15:20:14Z tuexen $");35 __FBSDID("$FreeBSD: head/sys/netinet/sctp_input.h 310590 2016-12-26 11:06:41Z tuexen $"); 36 36 #endif 37 37 -
trunk/Source/ThirdParty/libwebrtc/Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_output.c
r211848 r218849 33 33 #ifdef __FreeBSD__ 34 34 #include <sys/cdefs.h> 35 __FBSDID("$FreeBSD: head/sys/netinet/sctp_output.c 3 04579 2016-08-22 01:45:29Z tuexen $");35 __FBSDID("$FreeBSD: head/sys/netinet/sctp_output.c 313032 2017-02-01 00:10:29Z tuexen $"); 36 36 #endif 37 37 … … 3748 3748 stcb->asoc.strmout[i].abandoned_unsent[0] = 0; 3749 3749 #endif 3750 stcb->asoc.strmout[i].s tream_no= i;3750 stcb->asoc.strmout[i].sid = i; 3751 3751 stcb->asoc.strmout[i].last_msg_incomplete = 0; 3752 3752 stcb->asoc.strmout[i].state = SCTP_STREAM_OPENING; … … 5003 5003 SCTP_STAT_INCR(sctps_sendnocrc); 5004 5004 #else 5005 sctphdr->checksum = sctp_calculate_cksum(m, 0); 5006 SCTP_STAT_INCR(sctps_sendswcrc); 5005 if (SCTP_BASE_VAR(crc32c_offloaded) == 0) { 5006 sctphdr->checksum = sctp_calculate_cksum(m, 0); 5007 SCTP_STAT_INCR(sctps_sendswcrc); 5008 } else { 5009 SCTP_STAT_INCR(sctps_sendhwcrc); 5010 } 5007 5011 #endif 5008 5012 if (tos_value == 0) { … … 5050 5054 struct sctp_paramhdr *ph; 5051 5055 int cnt_inits_to = 0; 5052 int ret;5056 int error; 5053 5057 uint16_t num_ext, chunk_len, padding_len, parameter_len; 5054 5058 … … 5313 5317 } 5314 5318 SCTPDBG(SCTP_DEBUG_OUTPUT4, "Sending INIT - calls lowlevel_output\n"); 5315 ret= sctp_lowlevel_chunk_output(inp, stcb, net,5316 (struct sockaddr *)&net->ro._l_addr,5317 m, 0, NULL, 0, 0, 0, 0,5318 inp->sctp_lport, stcb->rport, htonl(0),5319 net->port, NULL,5319 if ((error = sctp_lowlevel_chunk_output(inp, stcb, net, 5320 (struct sockaddr *)&net->ro._l_addr, 5321 m, 0, NULL, 0, 0, 0, 0, 5322 inp->sctp_lport, stcb->rport, htonl(0), 5323 net->port, NULL, 5320 5324 #if defined(__FreeBSD__) 5321 0, 0, 5322 #endif 5323 so_locked); 5324 SCTPDBG(SCTP_DEBUG_OUTPUT4, "lowlevel_output - %d\n", ret); 5325 0, 0, 5326 #endif 5327 so_locked))) { 5328 SCTPDBG(SCTP_DEBUG_OUTPUT4, "Gak send error %d\n", error); 5329 if (error == ENOBUFS) { 5330 stcb->asoc.ifp_had_enobuf = 1; 5331 SCTP_STAT_INCR(sctps_lowlevelerr); 5332 } 5333 } else { 5334 stcb->asoc.ifp_had_enobuf = 0; 5335 } 5325 5336 SCTP_STAT_INCR_COUNTER64(sctps_outcontrolchunks); 5326 5337 (void)SCTP_GETTIME_TIMEVAL(&net->last_sent_time); … … 5920 5931 int abort_flag; 5921 5932 int nat_friendly = 0; 5933 int error; 5922 5934 struct socket *so; 5923 5935 uint16_t num_ext, chunk_len, padding_len, parameter_len; … … 6005 6017 memset(&stc, 0, sizeof(struct sctp_state_cookie)); 6006 6018 6007 struct timeval time_entered;6008 6019 /* the time I built cookie */ 6020 struct timeval time_entered; 6009 6021 (void)SCTP_GETTIME_TIMEVAL(&time_entered); 6010 6022 stc.time_entered = time_entered; 6011 6023 /* populate any tie tags */ 6012 6024 if (asoc != NULL) { … … 6601 6613 } 6602 6614 6603 (void)sctp_lowlevel_chunk_output(inp, NULL, NULL, to, m, 0, NULL, 0, 0,6604 0, 0,6605 inp->sctp_lport, sh->src_port, init_chk->init.initiate_tag,6606 port, over_addr,6615 if ((error = sctp_lowlevel_chunk_output(inp, NULL, NULL, to, m, 0, NULL, 0, 0, 6616 0, 0, 6617 inp->sctp_lport, sh->src_port, init_chk->init.initiate_tag, 6618 port, over_addr, 6607 6619 #if defined(__FreeBSD__) 6608 mflowtype, mflowid, 6609 #endif 6610 SCTP_SO_NOT_LOCKED); 6620 mflowtype, mflowid, 6621 #endif 6622 SCTP_SO_NOT_LOCKED))) { 6623 SCTPDBG(SCTP_DEBUG_OUTPUT4, "Gak send error %d\n", error); 6624 if (error == ENOBUFS) { 6625 if (asoc != NULL) { 6626 asoc->ifp_had_enobuf = 1; 6627 } 6628 SCTP_STAT_INCR(sctps_lowlevelerr); 6629 } 6630 } else { 6631 if (asoc != NULL) { 6632 asoc->ifp_had_enobuf = 0; 6633 } 6634 } 6611 6635 SCTP_STAT_INCR_COUNTER64(sctps_outcontrolchunks); 6612 6636 } … … 6850 6874 } 6851 6875 (void)SCTP_GETTIME_TIMEVAL(&sp->ts); 6852 sp->s tream= srcv->sinfo_stream;6876 sp->sid = srcv->sinfo_stream; 6853 6877 sp->msg_is_complete = 1; 6854 6878 sp->sender_all_done = 1; … … 7446 7470 data_list[i]->sent_rcv_time = net->last_sent_time; 7447 7471 data_list[i]->rec.data.cwnd_at_send = net->cwnd; 7448 data_list[i]->rec.data.fast_retran_tsn = data_list[i]->rec.data. TSN_seq;7472 data_list[i]->rec.data.fast_retran_tsn = data_list[i]->rec.data.tsn; 7449 7473 if (data_list[i]->whoTo == NULL) { 7450 7474 data_list[i]->whoTo = net; … … 7453 7477 /* on to the sent queue */ 7454 7478 tp1 = TAILQ_LAST(&asoc->sent_queue, sctpchunk_listhead); 7455 if ((tp1) && SCTP_TSN_GT(tp1->rec.data. TSN_seq, data_list[i]->rec.data.TSN_seq)) {7479 if ((tp1) && SCTP_TSN_GT(tp1->rec.data.tsn, data_list[i]->rec.data.tsn)) { 7456 7480 struct sctp_tmit_chunk *tpp; 7457 7481 … … 7464 7488 } 7465 7489 tp1 = tpp; 7466 if (SCTP_TSN_GT(tp1->rec.data. TSN_seq, data_list[i]->rec.data.TSN_seq)) {7490 if (SCTP_TSN_GT(tp1->rec.data.tsn, data_list[i]->rec.data.tsn)) { 7467 7491 goto back_up_more; 7468 7492 } … … 7493 7517 data_list[i]->book_size, 7494 7518 (uint32_t)(uintptr_t)data_list[i]->whoTo, 7495 data_list[i]->rec.data. TSN_seq);7519 data_list[i]->rec.data.tsn); 7496 7520 } 7497 7521 sctp_flight_size_increase(data_list[i]); … … 7555 7579 } 7556 7580 7557 7558 static int 7559 sctp_can_we_split_this(struct sctp_tcb *stcb, 7560 uint32_t length, 7561 uint32_t goal_mtu, uint32_t frag_point, int eeor_on) 7581 static uint32_t 7582 sctp_can_we_split_this(struct sctp_tcb *stcb, uint32_t length, 7583 uint32_t space_left, uint32_t frag_point, int eeor_on) 7562 7584 { 7563 7585 /* Make a decision on if I should split a … … 7570 7592 * be all the guy is putting in the hopper. 7571 7593 */ 7572 if ( goal_mtu>= length) {7594 if (space_left >= length) { 7573 7595 /*- 7574 7596 * If we have data outstanding, … … 7586 7608 } else { 7587 7609 /* You can fill the rest */ 7588 return ( goal_mtu);7610 return (space_left); 7589 7611 } 7590 7612 } … … 7597 7619 return (length); 7598 7620 } 7599 7600 if ((length <= goal_mtu) || 7601 ((length - goal_mtu) < SCTP_BASE_SYSCTL(sctp_min_residual))) { 7621 if ((length <= space_left) || 7622 ((length - space_left) < SCTP_BASE_SYSCTL(sctp_min_residual))) { 7602 7623 /* Sub-optimial residual don't split in non-eeor mode. */ 7603 7624 return (0); 7604 7625 } 7605 7626 /* If we reach here length is larger 7606 * than the goal_mtu. Do we wish to split7627 * than the space_left. Do we wish to split 7607 7628 * it for the sake of packet putting together? 7608 7629 */ 7609 if ( goal_mtu>= min(SCTP_BASE_SYSCTL(sctp_min_split_point), frag_point)) {7630 if (space_left >= min(SCTP_BASE_SYSCTL(sctp_min_split_point), frag_point)) { 7610 7631 /* Its ok to split it */ 7611 return (min( goal_mtu, frag_point));7632 return (min(space_left, frag_point)); 7612 7633 } 7613 7634 /* Nope, can't split */ 7614 7635 return (0); 7615 7616 7636 } 7617 7637 … … 7619 7639 sctp_move_to_outqueue(struct sctp_tcb *stcb, 7620 7640 struct sctp_stream_out *strq, 7621 uint32_t goal_mtu,7641 uint32_t space_left, 7622 7642 uint32_t frag_point, 7623 7643 int *giveup, … … 7660 7680 (strq->last_msg_incomplete)) { 7661 7681 SCTP_PRINTF("Huh? Stream:%d lm_in_c=%d but queue is NULL\n", 7662 strq->s tream_no,7682 strq->sid, 7663 7683 strq->last_msg_incomplete); 7664 7684 strq->last_msg_incomplete = 0; … … 7778 7798 } 7779 7799 } else { 7780 to_move = sctp_can_we_split_this(stcb, length, goal_mtu, frag_point, eeor_mode);7800 to_move = sctp_can_we_split_this(stcb, length, space_left, frag_point, eeor_mode); 7781 7801 if (to_move) { 7782 7802 /*- … … 8001 8021 if (rcv_flags & SCTP_DATA_UNORDERED) { 8002 8022 /* Just use 0. The receiver ignores the values. */ 8003 chk->rec.data. stream_seq= 0;8023 chk->rec.data.mid = 0; 8004 8024 } else { 8005 chk->rec.data. stream_seq= strq->next_mid_ordered;8025 chk->rec.data.mid = strq->next_mid_ordered; 8006 8026 if (rcv_flags & SCTP_DATA_LAST_FRAG) { 8007 8027 strq->next_mid_ordered++; … … 8010 8030 } else { 8011 8031 if (rcv_flags & SCTP_DATA_UNORDERED) { 8012 chk->rec.data. stream_seq= strq->next_mid_unordered;8032 chk->rec.data.mid = strq->next_mid_unordered; 8013 8033 if (rcv_flags & SCTP_DATA_LAST_FRAG) { 8014 8034 strq->next_mid_unordered++; 8015 8035 } 8016 8036 } else { 8017 chk->rec.data. stream_seq= strq->next_mid_ordered;8037 chk->rec.data.mid = strq->next_mid_ordered; 8018 8038 if (rcv_flags & SCTP_DATA_LAST_FRAG) { 8019 8039 strq->next_mid_ordered++; … … 8021 8041 } 8022 8042 } 8023 chk->rec.data.s tream_number = sp->stream;8024 chk->rec.data.p ayloadtype= sp->ppid;8043 chk->rec.data.sid = sp->sid; 8044 chk->rec.data.ppid = sp->ppid; 8025 8045 chk->rec.data.context = sp->context; 8026 8046 chk->rec.data.doing_fast_retransmit = 0; … … 8041 8061 } 8042 8062 #if defined(__FreeBSD__) || defined(__Panda__) 8043 chk->rec.data. TSN_seq= atomic_fetchadd_int(&asoc->sending_seq, 1);8063 chk->rec.data.tsn = atomic_fetchadd_int(&asoc->sending_seq, 1); 8044 8064 #else 8045 chk->rec.data. TSN_seq= asoc->sending_seq++;8065 chk->rec.data.tsn = asoc->sending_seq++; 8046 8066 #endif 8047 8067 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LOG_AT_SEND_2_OUTQ) { 8048 8068 sctp_misc_ints(SCTP_STRMOUT_LOG_SEND, 8049 8069 (uint32_t)(uintptr_t)stcb, sp->length, 8050 (uint32_t)((chk->rec.data.s tream_number << 16) | chk->rec.data.stream_seq),8051 chk->rec.data. TSN_seq);8070 (uint32_t)((chk->rec.data.sid << 16) | (0x0000ffff & chk->rec.data.mid)), 8071 chk->rec.data.tsn); 8052 8072 } 8053 8073 if (stcb->asoc.idata_supported == 0) { … … 8067 8087 asoc->tsn_out_wrapped = 1; 8068 8088 } 8069 asoc->out_tsnlog[asoc->tsn_out_at].tsn = chk->rec.data. TSN_seq;8070 asoc->out_tsnlog[asoc->tsn_out_at].strm = chk->rec.data.s tream_number;8071 asoc->out_tsnlog[asoc->tsn_out_at].seq = chk->rec.data. stream_seq;8089 asoc->out_tsnlog[asoc->tsn_out_at].tsn = chk->rec.data.tsn; 8090 asoc->out_tsnlog[asoc->tsn_out_at].strm = chk->rec.data.sid; 8091 asoc->out_tsnlog[asoc->tsn_out_at].seq = chk->rec.data.mid; 8072 8092 asoc->out_tsnlog[asoc->tsn_out_at].sz = chk->send_size; 8073 8093 asoc->out_tsnlog[asoc->tsn_out_at].flgs = chk->rec.data.rcv_flags; … … 8080 8100 dchkh->ch.chunk_type = SCTP_DATA; 8081 8101 dchkh->ch.chunk_flags = chk->rec.data.rcv_flags; 8082 dchkh->dp.tsn = htonl(chk->rec.data. TSN_seq);8083 dchkh->dp.s tream_id = htons((strq->stream_no & 0x0000ffff));8084 dchkh->dp.s tream_sequence = htons((uint16_t)chk->rec.data.stream_seq);8085 dchkh->dp.p rotocol_id = chk->rec.data.payloadtype;8102 dchkh->dp.tsn = htonl(chk->rec.data.tsn); 8103 dchkh->dp.sid = htons(strq->sid); 8104 dchkh->dp.ssn = htons((uint16_t)chk->rec.data.mid); 8105 dchkh->dp.ppid = chk->rec.data.ppid; 8086 8106 dchkh->ch.chunk_length = htons(chk->send_size); 8087 8107 } else { 8088 8108 ndchkh->ch.chunk_type = SCTP_IDATA; 8089 8109 ndchkh->ch.chunk_flags = chk->rec.data.rcv_flags; 8090 ndchkh->dp.tsn = htonl(chk->rec.data. TSN_seq);8091 ndchkh->dp.s tream_id = htons(strq->stream_no);8110 ndchkh->dp.tsn = htonl(chk->rec.data.tsn); 8111 ndchkh->dp.sid = htons(strq->sid); 8092 8112 ndchkh->dp.reserved = htons(0); 8093 ndchkh->dp.m sg_id = htonl(chk->rec.data.stream_seq);8113 ndchkh->dp.mid = htonl(chk->rec.data.mid); 8094 8114 if (sp->fsn == 0) 8095 ndchkh->dp.ppid_fsn.p rotocol_id = chk->rec.data.payloadtype;8115 ndchkh->dp.ppid_fsn.ppid = chk->rec.data.ppid; 8096 8116 else 8097 8117 ndchkh->dp.ppid_fsn.fsn = htonl(sp->fsn); … … 8171 8191 struct sctp_association *asoc; 8172 8192 struct sctp_stream_out *strq; 8173 int goal_mtu, moved_how_much, total_moved = 0, bail = 0;8174 int giveup;8193 uint32_t space_left, moved, total_moved; 8194 int bail, giveup; 8175 8195 8176 8196 SCTP_TCB_LOCK_ASSERT(stcb); 8177 8197 asoc = &stcb->asoc; 8198 total_moved = 0; 8178 8199 switch (net->ro._l_addr.sa.sa_family) { 8179 8200 #ifdef INET 8180 8201 case AF_INET: 8181 goal_mtu= net->mtu - SCTP_MIN_V4_OVERHEAD;8202 space_left = net->mtu - SCTP_MIN_V4_OVERHEAD; 8182 8203 break; 8183 8204 #endif 8184 8205 #ifdef INET6 8185 8206 case AF_INET6: 8186 goal_mtu= net->mtu - SCTP_MIN_OVERHEAD;8207 space_left = net->mtu - SCTP_MIN_OVERHEAD; 8187 8208 break; 8188 8209 #endif 8189 8210 #if defined(__Userspace__) 8190 8211 case AF_CONN: 8191 goal_mtu= net->mtu - sizeof(struct sctphdr);8212 space_left = net->mtu - sizeof(struct sctphdr); 8192 8213 break; 8193 8214 #endif 8194 8215 default: 8195 8216 /* TSNH */ 8196 goal_mtu= net->mtu;8217 space_left = net->mtu; 8197 8218 break; 8198 8219 } 8199 8220 /* Need an allowance for the data chunk header too */ 8200 8221 if (stcb->asoc.idata_supported == 0) { 8201 goal_mtu-= sizeof(struct sctp_data_chunk);8222 space_left -= sizeof(struct sctp_data_chunk); 8202 8223 } else { 8203 goal_mtu-= sizeof(struct sctp_idata_chunk);8224 space_left -= sizeof(struct sctp_idata_chunk); 8204 8225 } 8205 8226 8206 8227 /* must make even word boundary */ 8207 goal_mtu&= 0xfffffffc;8228 space_left &= 0xfffffffc; 8208 8229 strq = stcb->asoc.ss_functions.sctp_ss_select_stream(stcb, net, asoc); 8209 while ((goal_mtu > 0) && strq) { 8210 giveup = 0; 8211 bail = 0; 8212 moved_how_much = sctp_move_to_outqueue(stcb, strq, goal_mtu, frag_point, 8213 &giveup, eeor_mode, &bail, so_locked); 8214 stcb->asoc.ss_functions.sctp_ss_scheduled(stcb, net, asoc, strq, moved_how_much); 8215 8216 if ((giveup) || bail) { 8230 giveup = 0; 8231 bail = 0; 8232 while ((space_left > 0) && (strq != NULL)) { 8233 moved = sctp_move_to_outqueue(stcb, strq, space_left, frag_point, 8234 &giveup, eeor_mode, &bail, so_locked); 8235 stcb->asoc.ss_functions.sctp_ss_scheduled(stcb, net, asoc, strq, moved); 8236 if ((giveup != 0) || (bail != 0)) { 8217 8237 break; 8218 8238 } 8219 8239 strq = stcb->asoc.ss_functions.sctp_ss_select_stream(stcb, net, asoc); 8220 if (strq == NULL) { 8221 break; 8222 } 8223 total_moved += moved_how_much; 8224 goal_mtu -= (moved_how_much + sizeof(struct sctp_data_chunk)); 8225 goal_mtu &= 0xfffffffc; 8226 } 8227 if (bail) 8240 total_moved += moved; 8241 space_left -= moved; 8242 if (stcb->asoc.idata_supported == 0) { 8243 if (space_left >= sizeof(struct sctp_data_chunk)) { 8244 space_left -= sizeof(struct sctp_data_chunk); 8245 } else { 8246 space_left = 0; 8247 } 8248 } else { 8249 if (space_left >= sizeof(struct sctp_idata_chunk)) { 8250 space_left -= sizeof(struct sctp_idata_chunk); 8251 } else { 8252 space_left = 0; 8253 } 8254 } 8255 space_left &= 0xfffffffc; 8256 } 8257 if (bail != 0) 8228 8258 *quit_now = 1; 8229 8259 … … 9324 9354 } 9325 9355 if (error == ENOBUFS) { 9356 asoc->ifp_had_enobuf = 1; 9326 9357 SCTP_STAT_INCR(sctps_lowlevelerr); 9327 asoc->ifp_had_enobuf = 1;9328 9358 } 9329 9359 if (error == EHOSTUNREACH) { … … 9354 9384 if (bundle_at) { 9355 9385 /* setup for a RTO measurement */ 9356 tsns_sent = data_list[0]->rec.data. TSN_seq;9386 tsns_sent = data_list[0]->rec.data.tsn; 9357 9387 /* fill time if not already filled */ 9358 9388 if (*now_filled == 0) { … … 9702 9732 struct sctp_tmit_chunk *chk; 9703 9733 9704 m_shutdown = sctp_get_mbuf_for_msg(sizeof(struct sctp_shutdown_chunk), 0, M_NOWAIT, 1, MT_HEADER); 9705 if (m_shutdown == NULL) { 9706 /* no mbuf's */ 9707 return; 9708 } 9709 SCTP_BUF_RESV_UF(m_shutdown, SCTP_MIN_OVERHEAD); 9710 sctp_alloc_a_chunk(stcb, chk); 9734 TAILQ_FOREACH(chk, &stcb->asoc.control_send_queue, sctp_next) { 9735 if (chk->rec.chunk_id.id == SCTP_SHUTDOWN) { 9736 /* We already have a SHUTDOWN queued. Reuse it. */ 9737 if (chk->whoTo) { 9738 sctp_free_remote_addr(chk->whoTo); 9739 chk->whoTo = NULL; 9740 } 9741 break; 9742 } 9743 } 9711 9744 if (chk == NULL) { 9712 /* no memory */ 9713 sctp_m_freem(m_shutdown); 9714 return; 9715 } 9716 chk->copy_by_ref = 0; 9717 chk->rec.chunk_id.id = SCTP_SHUTDOWN; 9718 chk->rec.chunk_id.can_take_data = 1; 9719 chk->flags = 0; 9720 chk->send_size = sizeof(struct sctp_shutdown_chunk); 9721 chk->sent = SCTP_DATAGRAM_UNSENT; 9722 chk->snd_count = 0; 9723 chk->flags = 0; 9724 chk->asoc = &stcb->asoc; 9725 chk->data = m_shutdown; 9726 chk->whoTo = net; 9727 if (chk->whoTo) { 9728 atomic_add_int(&chk->whoTo->ref_count, 1); 9729 } 9730 shutdown_cp = mtod(m_shutdown, struct sctp_shutdown_chunk *); 9731 shutdown_cp->ch.chunk_type = SCTP_SHUTDOWN; 9732 shutdown_cp->ch.chunk_flags = 0; 9733 shutdown_cp->ch.chunk_length = htons(chk->send_size); 9734 shutdown_cp->cumulative_tsn_ack = htonl(stcb->asoc.cumulative_tsn); 9735 SCTP_BUF_LEN(m_shutdown) = chk->send_size; 9736 TAILQ_INSERT_TAIL(&chk->asoc->control_send_queue, chk, sctp_next); 9737 chk->asoc->ctrl_queue_cnt++; 9745 m_shutdown = sctp_get_mbuf_for_msg(sizeof(struct sctp_shutdown_chunk), 0, M_NOWAIT, 1, MT_HEADER); 9746 if (m_shutdown == NULL) { 9747 /* no mbuf's */ 9748 return; 9749 } 9750 SCTP_BUF_RESV_UF(m_shutdown, SCTP_MIN_OVERHEAD); 9751 sctp_alloc_a_chunk(stcb, chk); 9752 if (chk == NULL) { 9753 /* no memory */ 9754 sctp_m_freem(m_shutdown); 9755 return; 9756 } 9757 chk->copy_by_ref = 0; 9758 chk->rec.chunk_id.id = SCTP_SHUTDOWN; 9759 chk->rec.chunk_id.can_take_data = 1; 9760 chk->flags = 0; 9761 chk->send_size = sizeof(struct sctp_shutdown_chunk); 9762 chk->sent = SCTP_DATAGRAM_UNSENT; 9763 chk->snd_count = 0; 9764 chk->flags = 0; 9765 chk->asoc = &stcb->asoc; 9766 chk->data = m_shutdown; 9767 chk->whoTo = net; 9768 if (chk->whoTo) { 9769 atomic_add_int(&chk->whoTo->ref_count, 1); 9770 } 9771 shutdown_cp = mtod(m_shutdown, struct sctp_shutdown_chunk *); 9772 shutdown_cp->ch.chunk_type = SCTP_SHUTDOWN; 9773 shutdown_cp->ch.chunk_flags = 0; 9774 shutdown_cp->ch.chunk_length = htons(chk->send_size); 9775 shutdown_cp->cumulative_tsn_ack = htonl(stcb->asoc.cumulative_tsn); 9776 SCTP_BUF_LEN(m_shutdown) = chk->send_size; 9777 TAILQ_INSERT_TAIL(&chk->asoc->control_send_queue, chk, sctp_next); 9778 chk->asoc->ctrl_queue_cnt++; 9779 } else { 9780 TAILQ_REMOVE(&stcb->asoc.control_send_queue, chk, sctp_next); 9781 chk->whoTo = net; 9782 if (chk->whoTo) { 9783 atomic_add_int(&chk->whoTo->ref_count, 1); 9784 } 9785 shutdown_cp = mtod(chk->data, struct sctp_shutdown_chunk *); 9786 shutdown_cp->cumulative_tsn_ack = htonl(stcb->asoc.cumulative_tsn); 9787 TAILQ_INSERT_TAIL(&stcb->asoc.control_send_queue, chk, sctp_next); 9788 } 9738 9789 return; 9739 9790 } … … 10004 10055 #endif 10005 10056 so_locked))) { 10006 SCTP_STAT_INCR(sctps_lowlevelerr); 10057 SCTPDBG(SCTP_DEBUG_OUTPUT3, "Gak send error %d\n", error); 10058 if (error == ENOBUFS) { 10059 asoc->ifp_had_enobuf = 1; 10060 SCTP_STAT_INCR(sctps_lowlevelerr); 10061 } 10007 10062 return (error); 10063 } else { 10064 asoc->ifp_had_enobuf = 0; 10008 10065 } 10009 10066 endofchain = NULL; … … 10049 10106 if (chk->data == NULL) { 10050 10107 SCTP_PRINTF("TSN:%x chk->snd_count:%d chk->sent:%d can't retran - no data\n", 10051 chk->rec.data. TSN_seq, chk->snd_count, chk->sent);10108 chk->rec.data.tsn, chk->snd_count, chk->sent); 10052 10109 continue; 10053 10110 } … … 10058 10115 10059 10116 snprintf(msg, sizeof(msg), "TSN %8.8x retransmitted %d times, giving up", 10060 chk->rec.data. TSN_seq, chk->snd_count);10117 chk->rec.data.tsn, chk->snd_count); 10061 10118 op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), 10062 10119 msg); … … 10097 10154 10098 10155 tsn = asoc->last_acked_seq + 1; 10099 if (tsn == chk->rec.data. TSN_seq) {10156 if (tsn == chk->rec.data.tsn) { 10100 10157 /* 10101 10158 * we make a special exception for this … … 10280 10337 so_locked))) { 10281 10338 /* error, we could not output */ 10282 SCTP_STAT_INCR(sctps_lowlevelerr); 10339 SCTPDBG(SCTP_DEBUG_OUTPUT3, "Gak send error %d\n", error); 10340 if (error == ENOBUFS) { 10341 asoc->ifp_had_enobuf = 1; 10342 SCTP_STAT_INCR(sctps_lowlevelerr); 10343 } 10283 10344 return (error); 10345 } else { 10346 asoc->ifp_had_enobuf = 0; 10284 10347 } 10285 10348 endofchain = NULL; … … 10308 10371 #endif 10309 10372 if (bundle_at) { 10310 tsns_sent = data_list[0]->rec.data. TSN_seq;10373 tsns_sent = data_list[0]->rec.data.tsn; 10311 10374 } 10312 10375 for (i = 0; i < bundle_at; i++) { … … 10356 10419 data_list[i]->book_size, 10357 10420 (uint32_t)(uintptr_t)data_list[i]->whoTo, 10358 data_list[i]->rec.data. TSN_seq);10421 data_list[i]->rec.data.tsn); 10359 10422 } 10360 10423 sctp_flight_size_increase(data_list[i]); … … 10435 10498 10436 10499 void 10437 sctp_chunk_output 10500 sctp_chunk_output(struct sctp_inpcb *inp, 10438 10501 struct sctp_tcb *stcb, 10439 10502 int from_where, … … 10777 10840 unsigned int space_needed; 10778 10841 unsigned int cnt_of_skipped = 0; 10779 int old; 10780 10781 if (asoc->idata_supported) { 10782 old = 0; 10783 } else { 10784 old = 1; 10785 } 10842 10786 10843 SCTP_TCB_LOCK_ASSERT(stcb); 10787 10844 TAILQ_FOREACH(chk, &asoc->control_send_queue, sctp_next) { … … 10839 10896 break; 10840 10897 } 10841 if ( old && (at->rec.data.rcv_flags & SCTP_DATA_UNORDERED)) {10898 if (!asoc->idata_supported && (at->rec.data.rcv_flags & SCTP_DATA_UNORDERED)) { 10842 10899 /* We don't report these */ 10843 10900 continue; … … 10845 10902 cnt_of_skipped++; 10846 10903 } 10847 if (old) { 10904 if (asoc->idata_supported) { 10905 space_needed = (sizeof(struct sctp_forward_tsn_chunk) + 10906 (cnt_of_skipped * sizeof(struct sctp_strseq_mid))); 10907 } else { 10848 10908 space_needed = (sizeof(struct sctp_forward_tsn_chunk) + 10849 10909 (cnt_of_skipped * sizeof(struct sctp_strseq))); 10850 } else {10851 space_needed = (sizeof(struct sctp_forward_tsn_chunk) +10852 (cnt_of_skipped * sizeof(struct sctp_strseq_mid)));10853 10910 } 10854 10911 cnt_of_space = (unsigned int)M_TRAILINGSPACE(chk->data); … … 10879 10936 space_needed); 10880 10937 } 10881 if (old) { 10882 cnt_of_skipped = cnt_of_space - sizeof(struct sctp_forward_tsn_chunk); 10938 cnt_of_skipped = cnt_of_space - sizeof(struct sctp_forward_tsn_chunk); 10939 if (asoc->idata_supported) { 10940 cnt_of_skipped /= sizeof(struct sctp_strseq_mid); 10941 } else { 10883 10942 cnt_of_skipped /= sizeof(struct sctp_strseq); 10884 } else {10885 cnt_of_skipped = cnt_of_space - sizeof(struct sctp_forward_tsn_chunk);10886 cnt_of_skipped /= sizeof(struct sctp_strseq_mid);10887 10943 } 10888 10944 /*- … … 10902 10958 if (at && SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LOG_TRY_ADVANCE) { 10903 10959 sctp_misc_ints(SCTP_FWD_TSN_CHECK, 10904 0xff, cnt_of_skipped, at->rec.data. TSN_seq,10960 0xff, cnt_of_skipped, at->rec.data.tsn, 10905 10961 asoc->advanced_peer_ack_point); 10906 10962 } … … 10911 10967 */ 10912 10968 if (last) { 10913 advance_peer_ack_point = last->rec.data.TSN_seq; 10914 } 10915 if (old) { 10969 advance_peer_ack_point = last->rec.data.tsn; 10970 } 10971 if (asoc->idata_supported) { 10972 space_needed = sizeof(struct sctp_forward_tsn_chunk) + 10973 cnt_of_skipped * sizeof(struct sctp_strseq_mid); 10974 } else { 10916 10975 space_needed = sizeof(struct sctp_forward_tsn_chunk) + 10917 10976 cnt_of_skipped * sizeof(struct sctp_strseq); 10918 } else {10919 space_needed = sizeof(struct sctp_forward_tsn_chunk) +10920 cnt_of_skipped * sizeof(struct sctp_strseq_mid);10921 10977 } 10922 10978 } … … 10926 10982 fwdtsn->ch.chunk_length = htons(chk->send_size); 10927 10983 fwdtsn->ch.chunk_flags = 0; 10928 if (old) { 10984 if (asoc->idata_supported) { 10985 fwdtsn->ch.chunk_type = SCTP_IFORWARD_CUM_TSN; 10986 } else { 10929 10987 fwdtsn->ch.chunk_type = SCTP_FORWARD_CUM_TSN; 10930 } else {10931 fwdtsn->ch.chunk_type = SCTP_IFORWARD_CUM_TSN;10932 10988 } 10933 10989 fwdtsn->new_cumulative_tsn = htonl(advance_peer_ack_point); … … 10938 10994 * strseq pointer. 10939 10995 */ 10940 if (old) { 10996 if (asoc->idata_supported) { 10997 strseq_m = (struct sctp_strseq_mid *)fwdtsn; 10998 strseq = NULL; 10999 } else { 10941 11000 strseq = (struct sctp_strseq *)fwdtsn; 10942 } else { 10943 strseq_m = (struct sctp_strseq_mid *)fwdtsn; 11001 strseq_m = NULL; 10944 11002 } 10945 11003 /*- … … 10960 11018 break; 10961 11019 } 10962 if ( old && (at->rec.data.rcv_flags & SCTP_DATA_UNORDERED)) {11020 if (!asoc->idata_supported && (at->rec.data.rcv_flags & SCTP_DATA_UNORDERED)) { 10963 11021 /* We don't report these */ 10964 11022 continue; 10965 11023 } 10966 if (at->rec.data. TSN_seq== advance_peer_ack_point) {11024 if (at->rec.data.tsn == advance_peer_ack_point) { 10967 11025 at->rec.data.fwd_tsn_cnt = 0; 10968 11026 } 10969 if (old) { 10970 strseq->stream = htons(at->rec.data.stream_number); 10971 strseq->sequence = htons((uint16_t)at->rec.data.stream_seq); 10972 strseq++; 10973 } else { 10974 strseq_m->stream = htons(at->rec.data.stream_number); 11027 if (asoc->idata_supported) { 11028 strseq_m->sid = htons(at->rec.data.sid); 10975 11029 if (at->rec.data.rcv_flags & SCTP_DATA_UNORDERED) { 10976 11030 strseq_m->flags = htons(PR_SCTP_UNORDERED_FLAG); … … 10978 11032 strseq_m->flags = 0; 10979 11033 } 10980 strseq_m->m sg_id = htonl(at->rec.data.stream_seq);11034 strseq_m->mid = htonl(at->rec.data.mid); 10981 11035 strseq_m++; 11036 } else { 11037 strseq->sid = htons(at->rec.data.sid); 11038 strseq->ssn = htons((uint16_t)at->rec.data.mid); 11039 strseq++; 10982 11040 } 10983 11041 i++; … … 11396 11454 uint32_t vtag; 11397 11455 uint32_t auth_offset = 0; 11456 int error; 11398 11457 uint16_t cause_len, chunk_len, padding_len; 11399 11458 … … 11474 11533 } 11475 11534 } 11476 (void)sctp_lowlevel_chunk_output(stcb->sctp_ep, stcb, net,11477 (struct sockaddr *)&net->ro._l_addr,11478 m_out, auth_offset, auth, stcb->asoc.authinfo.active_keyid, 1, 0, 0,11479 stcb->sctp_ep->sctp_lport, stcb->rport, htonl(vtag),11480 stcb->asoc.primary_destination->port, NULL,11535 if ((error = sctp_lowlevel_chunk_output(stcb->sctp_ep, stcb, net, 11536 (struct sockaddr *)&net->ro._l_addr, 11537 m_out, auth_offset, auth, stcb->asoc.authinfo.active_keyid, 1, 0, 0, 11538 stcb->sctp_ep->sctp_lport, stcb->rport, htonl(vtag), 11539 stcb->asoc.primary_destination->port, NULL, 11481 11540 #if defined(__FreeBSD__) 11482 0, 0, 11483 #endif 11484 so_locked); 11541 0, 0, 11542 #endif 11543 so_locked))) { 11544 SCTPDBG(SCTP_DEBUG_OUTPUT3, "Gak send error %d\n", error); 11545 if (error == ENOBUFS) { 11546 stcb->asoc.ifp_had_enobuf = 1; 11547 SCTP_STAT_INCR(sctps_lowlevelerr); 11548 } 11549 } else { 11550 stcb->asoc.ifp_had_enobuf = 0; 11551 } 11485 11552 SCTP_STAT_INCR_COUNTER64(sctps_outcontrolchunks); 11486 11553 } … … 11495 11562 struct sctp_shutdown_complete_chunk *shutdown_complete; 11496 11563 uint32_t vtag; 11564 int error; 11497 11565 uint8_t flags; 11498 11566 … … 11514 11582 shutdown_complete->ch.chunk_length = htons(sizeof(struct sctp_shutdown_complete_chunk)); 11515 11583 SCTP_BUF_LEN(m_shutdown_comp) = sizeof(struct sctp_shutdown_complete_chunk); 11516 (void)sctp_lowlevel_chunk_output(stcb->sctp_ep, stcb, net,11517 (struct sockaddr *)&net->ro._l_addr,11518 m_shutdown_comp, 0, NULL, 0, 1, 0, 0,11519 stcb->sctp_ep->sctp_lport, stcb->rport,11520 htonl(vtag),11521 net->port, NULL,11584 if ((error = sctp_lowlevel_chunk_output(stcb->sctp_ep, stcb, net, 11585 (struct sockaddr *)&net->ro._l_addr, 11586 m_shutdown_comp, 0, NULL, 0, 1, 0, 0, 11587 stcb->sctp_ep->sctp_lport, stcb->rport, 11588 htonl(vtag), 11589 net->port, NULL, 11522 11590 #if defined(__FreeBSD__) 11523 0, 0, 11524 #endif 11525 SCTP_SO_NOT_LOCKED); 11591 0, 0, 11592 #endif 11593 SCTP_SO_NOT_LOCKED))) { 11594 SCTPDBG(SCTP_DEBUG_OUTPUT3, "Gak send error %d\n", error); 11595 if (error == ENOBUFS) { 11596 stcb->asoc.ifp_had_enobuf = 1; 11597 SCTP_STAT_INCR(sctps_lowlevelerr); 11598 } 11599 } else { 11600 stcb->asoc.ifp_had_enobuf = 0; 11601 } 11526 11602 SCTP_STAT_INCR_COUNTER64(sctps_outcontrolchunks); 11527 11603 return; … … 11898 11974 SCTP_STAT_INCR(sctps_sendnocrc); 11899 11975 #else 11900 shout->checksum = sctp_calculate_cksum(mout, 0); 11901 SCTP_STAT_INCR(sctps_sendswcrc); 11976 if (SCTP_BASE_VAR(crc32c_offloaded) == 0) { 11977 shout->checksum = sctp_calculate_cksum(mout, 0); 11978 SCTP_STAT_INCR(sctps_sendswcrc); 11979 } else { 11980 SCTP_STAT_INCR(sctps_sendhwcrc); 11981 } 11902 11982 #endif 11903 11983 #ifdef SCTP_PACKET_LOGGING … … 12883 12963 stcb->asoc.strmout[i].next_mid_unordered = oldstream[i].next_mid_unordered; 12884 12964 stcb->asoc.strmout[i].last_msg_incomplete = oldstream[i].last_msg_incomplete; 12885 stcb->asoc.strmout[i].s tream_no= i;12965 stcb->asoc.strmout[i].sid = i; 12886 12966 stcb->asoc.strmout[i].state = oldstream[i].state; 12887 12967 /* FIX ME FIX ME */ … … 12911 12991 stcb->asoc.strmout[i].next_mid_ordered = 0; 12912 12992 stcb->asoc.strmout[i].next_mid_unordered = 0; 12913 stcb->asoc.strmout[i].s tream_no= i;12993 stcb->asoc.strmout[i].sid = i; 12914 12994 stcb->asoc.strmout[i].last_msg_incomplete = 0; 12915 12995 stcb->asoc.ss_functions.sctp_ss_init_stream(stcb, &stcb->asoc.strmout[i], NULL); … … 13223 13303 (void)SCTP_GETTIME_TIMEVAL(&sp->ts); 13224 13304 13225 sp->s tream= srcv->sinfo_stream;13305 sp->sid = srcv->sinfo_stream; 13226 13306 #if defined(__APPLE__) 13227 13307 #if defined(APPLE_LEOPARD) … … 14838 14918 14839 14919 /* get prefix entry of address */ 14920 #if defined(__FreeBSD__) 14921 ND6_RLOCK(); 14922 #endif 14840 14923 LIST_FOREACH(pfx, &MODULE_GLOBAL(nd_prefix), ndpr_entry) { 14841 14924 if (pfx->ndpr_stateflags & NDPRF_DETACHED) … … 14847 14930 /* no prefix entry in the prefix list */ 14848 14931 if (pfx == NULL) { 14932 #if defined(__FreeBSD__) 14933 ND6_RUNLOCK(); 14934 #endif 14849 14935 SCTPDBG(SCTP_DEBUG_OUTPUT2, "No prefix entry for "); 14850 14936 SCTPDBG_ADDR(SCTP_DEBUG_OUTPUT2, (struct sockaddr *)src6); … … 14868 14954 SCTPDBG(SCTP_DEBUG_OUTPUT2, "installed router is "); 14869 14955 SCTPDBG_ADDR(SCTP_DEBUG_OUTPUT2, ro->ro_rt->rt_gateway); 14870 if (sctp_cmpaddr((struct sockaddr *)&gw6, 14871 ro->ro_rt->rt_gateway)) { 14956 if (sctp_cmpaddr((struct sockaddr *)&gw6, ro->ro_rt->rt_gateway)) { 14957 #if defined(__FreeBSD__) 14958 ND6_RUNLOCK(); 14959 #endif 14872 14960 SCTPDBG(SCTP_DEBUG_OUTPUT2, "pfxrouter is installed\n"); 14873 14961 return (1); 14874 14962 } 14875 14963 } 14964 #if defined(__FreeBSD__) 14965 ND6_RUNLOCK(); 14966 #endif 14876 14967 SCTPDBG(SCTP_DEBUG_OUTPUT2, "pfxrouter is not installed\n"); 14877 14968 return (0); -
trunk/Source/ThirdParty/libwebrtc/Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_output.h
r210942 r218849 33 33 #ifdef __FreeBSD__ 34 34 #include <sys/cdefs.h> 35 __FBSDID("$FreeBSD: head/sys/netinet/sctp_output.h 295072 2016-01-30 12:58:38Z tuexen $");35 __FBSDID("$FreeBSD: head/sys/netinet/sctp_output.h 310590 2016-12-26 11:06:41Z tuexen $"); 36 36 #endif 37 37 -
trunk/Source/ThirdParty/libwebrtc/Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_pcb.c
r211817 r218849 33 33 #ifdef __FreeBSD__ 34 34 #include <sys/cdefs.h> 35 __FBSDID("$FreeBSD: head/sys/netinet/sctp_pcb.c 3 03813 2016-08-07 12:51:13Z tuexen$");35 __FBSDID("$FreeBSD: head/sys/netinet/sctp_pcb.c 313330 2017-02-06 08:49:57Z ae $"); 36 36 #endif 37 37 … … 2856 2856 return (ENOBUFS); 2857 2857 } 2858 #ifdef IPSEC2859 #if !(defined(__APPLE__))2860 error = ipsec_init_policy(so, &inp->ip_inp.inp.inp_sp);2861 #else2862 error = 0;2863 #endif2864 if (error != 0) {2865 #if defined(__FreeBSD__)2866 crfree(inp->ip_inp.inp.inp_cred);2867 #endif2868 SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_ep), inp);2869 SCTP_INP_INFO_WUNLOCK();2870 return error;2871 }2872 #endif /* IPSEC */2873 2858 SCTP_INCR_EP_COUNT(); 2874 2859 inp->ip_inp.inp.inp_ip_ttl = MODULE_GLOBAL(ip_defttl); … … 2913 2898 #if defined(__FreeBSD__) 2914 2899 crfree(inp->ip_inp.inp.inp_cred); 2915 #ifdef IPSEC2916 ipsec_delete_pcbpolicy(&inp->ip_inp.inp);2917 #endif2918 2900 #endif 2919 2901 SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_ep), inp); … … 2938 2920 #if defined(__FreeBSD__) 2939 2921 crfree(inp->ip_inp.inp.inp_cred); 2940 #ifdef IPSEC2941 ipsec_delete_pcbpolicy(&inp->ip_inp.inp);2942 #endif2943 2922 #endif 2944 2923 SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_ep), inp); … … 2955 2934 #if defined(__FreeBSD__) 2956 2935 crfree(inp->ip_inp.inp.inp_cred); 2957 #ifdef IPSEC2958 ipsec_delete_pcbpolicy(&inp->ip_inp.inp);2959 #endif2960 2936 #endif 2961 2937 SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_ep), inp); … … 2977 2953 SCTP_HASH_FREE(inp->sctp_tcbhash, inp->sctp_hashmark); 2978 2954 so->so_pcb = NULL; 2979 #if defined(__FreeBSD__)2980 crfree(inp->ip_inp.inp.inp_cred);2981 #ifdef IPSEC2982 ipsec_delete_pcbpolicy(&inp->ip_inp.inp);2983 #endif2984 #endif2985 2955 SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_ep), inp); 2986 2956 SCTP_UNLOCK_EXC(SCTP_BASE_INFO(sctbinfo).ipi_lock); … … 4272 4242 * sctp_free_assoc() call. 4273 4243 */ 4274 #ifdef IPSEC4275 ipsec_delete_pcbpolicy(ip_pcb);4276 #endif4277 4244 #ifndef __Panda__ 4278 4245 if (ip_pcb->inp_options) { … … 5590 5557 uint32_t strseq; 5591 5558 stcb->asoc.control_pdapi = sq; 5592 strseq = (sq->sinfo_stream << 16) | sq->sinfo_ssn;5559 strseq = (sq->sinfo_stream << 16) | (sq->mid & 0x0000ffff); 5593 5560 sctp_ulp_notify(SCTP_NOTIFY_PARTIAL_DELVIERY_INDICATION, 5594 5561 stcb, … … 5690 5657 socantrcvmore_locked(so); 5691 5658 #endif 5659 socantsendmore(so); 5692 5660 sctp_sowwakeup(inp, so); 5693 5661 sctp_sorwakeup(inp, so); … … 5818 5786 /* pending send queue SHOULD be empty */ 5819 5787 TAILQ_FOREACH_SAFE(chk, &asoc->send_queue, sctp_next, nchk) { 5820 if (asoc->strmout[chk->rec.data.s tream_number].chunks_on_queues > 0) {5821 asoc->strmout[chk->rec.data.s tream_number].chunks_on_queues--;5788 if (asoc->strmout[chk->rec.data.sid].chunks_on_queues > 0) { 5789 asoc->strmout[chk->rec.data.sid].chunks_on_queues--; 5822 5790 #ifdef INVARIANTS 5823 5791 } else { 5824 panic("No chunks on the queues for sid %u.", chk->rec.data.s tream_number);5792 panic("No chunks on the queues for sid %u.", chk->rec.data.sid); 5825 5793 #endif 5826 5794 } … … 5850 5818 TAILQ_FOREACH_SAFE(chk, &asoc->sent_queue, sctp_next, nchk) { 5851 5819 if (chk->sent != SCTP_DATAGRAM_NR_ACKED) { 5852 if (asoc->strmout[chk->rec.data.s tream_number].chunks_on_queues > 0) {5853 asoc->strmout[chk->rec.data.s tream_number].chunks_on_queues--;5820 if (asoc->strmout[chk->rec.data.sid].chunks_on_queues > 0) { 5821 asoc->strmout[chk->rec.data.sid].chunks_on_queues--; 5854 5822 #ifdef INVARIANTS 5855 5823 } else { 5856 panic("No chunks on the queues for sid %u.", chk->rec.data.s tream_number);5824 panic("No chunks on the queues for sid %u.", chk->rec.data.sid); 5857 5825 #endif 5858 5826 } … … 6845 6813 #endif 6846 6814 #if defined(__Userspace__) 6847 mbuf_init(NULL); 6848 // atomic_init(); 6815 mbuf_initialize(NULL); 6849 6816 #if defined(INET) || defined(INET6) 6850 6817 recv_thread_init(); … … 7927 7894 TAILQ_FOREACH_SAFE(chk, &ctl->reasm, sctp_next, nchk) { 7928 7895 cnt++; 7929 SCTP_CALC_TSN_TO_GAP(gap, chk->rec.data. TSN_seq, asoc->mapping_array_base_tsn);7896 SCTP_CALC_TSN_TO_GAP(gap, chk->rec.data.tsn, asoc->mapping_array_base_tsn); 7930 7897 asoc->size_on_reasm_queue = sctp_sbspace_sub(asoc->size_on_reasm_queue, chk->send_size); 7931 7898 sctp_ucount_decr(asoc->cnt_on_reasm_queue); … … 7969 7936 TAILQ_FOREACH_SAFE(chk, &ctl->reasm, sctp_next, nchk) { 7970 7937 cnt++; 7971 SCTP_CALC_TSN_TO_GAP(gap, chk->rec.data. TSN_seq, asoc->mapping_array_base_tsn);7938 SCTP_CALC_TSN_TO_GAP(gap, chk->rec.data.tsn, asoc->mapping_array_base_tsn); 7972 7939 asoc->size_on_reasm_queue = sctp_sbspace_sub(asoc->size_on_reasm_queue, chk->send_size); 7973 7940 sctp_ucount_decr(asoc->cnt_on_reasm_queue); -
trunk/Source/ThirdParty/libwebrtc/Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_pcb.h
r210942 r218849 33 33 #ifdef __FreeBSD__ 34 34 #include <sys/cdefs.h> 35 __FBSDID("$FreeBSD: head/sys/netinet/sctp_pcb.h 298942 2016-05-02 20:56:11Z pfg$");35 __FBSDID("$FreeBSD: head/sys/netinet/sctp_pcb.h 310590 2016-12-26 11:06:41Z tuexen $"); 36 36 #endif 37 37 … … 342 342 int (*conn_output)(void *addr, void *buffer, size_t length, uint8_t tos, uint8_t set_df); 343 343 void (*debug_printf)(const char *format, ...); 344 int crc32c_offloaded; 344 345 #endif 345 346 }; -
trunk/Source/ThirdParty/libwebrtc/Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_peeloff.h
r210942 r218849 33 33 #ifdef __FreeBSD__ 34 34 #include <sys/cdefs.h> 35 __FBSDID("$FreeBSD: head/sys/netinet/sctp_peeloff.h 243516 2012-11-25 14:25:08Z tuexen $");35 __FBSDID("$FreeBSD: head/sys/netinet/sctp_peeloff.h 309607 2016-12-06 10:21:25Z tuexen $"); 36 36 #endif 37 37 -
trunk/Source/ThirdParty/libwebrtc/Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_ss_functions.c
r210942 r218849 29 29 #ifdef __FreeBSD__ 30 30 #include <sys/cdefs.h> 31 __FBSDID("$FreeBSD: head/sys/netinet/sctp_ss_functions.c 3 03793 2016-08-06 12:51:07Z tuexen $");31 __FBSDID("$FreeBSD: head/sys/netinet/sctp_ss_functions.c 310590 2016-12-26 11:06:41Z tuexen $"); 32 32 #endif 33 33 … … 299 299 } else { 300 300 strqt = TAILQ_FIRST(&asoc->ss_data.out.wheel); 301 while (strqt != NULL && (strqt->s tream_no < strq->stream_no)) {301 while (strqt != NULL && (strqt->sid < strq->sid)) { 302 302 strqt = TAILQ_NEXT(strqt, ss_params.rr.next_spoke); 303 303 } … … 866 866 default_again: 867 867 if (sp != NULL) { 868 strq = &asoc->strmout[sp->s tream];868 strq = &asoc->strmout[sp->sid]; 869 869 } else { 870 870 strq = NULL; -
trunk/Source/ThirdParty/libwebrtc/Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_structs.h
r210942 r218849 33 33 #ifdef __FreeBSD__ 34 34 #include <sys/cdefs.h> 35 __FBSDID("$FreeBSD: head/sys/netinet/sctp_structs.h 3 03792 2016-08-06 12:33:15Z tuexen $");35 __FBSDID("$FreeBSD: head/sys/netinet/sctp_structs.h 310590 2016-12-26 11:06:41Z tuexen $"); 36 36 #endif 37 37 … … 447 447 448 448 struct sctp_data_chunkrec { 449 uint32_t TSN_seq;/* the TSN of this transmit */450 uint32_t stream_seq; /* the stream sequence number of this transmit */451 uint16_t s tream_number;/* the stream number of this guy */452 uint32_t p ayloadtype;449 uint32_t tsn; /* the TSN of this transmit */ 450 uint32_t mid; /* the message identifier of this transmit */ 451 uint16_t sid; /* the stream number of this guy */ 452 uint32_t ppid; 453 453 uint32_t context; /* from send */ 454 454 uint32_t cwnd_at_send; … … 459 459 uint32_t fast_retran_tsn; /* sending_seq at the time of FR */ 460 460 struct timeval timetodrop; /* time we drop it from queue */ 461 uint32_t fsn _num;/* Fragment Sequence Number */461 uint32_t fsn; /* Fragment Sequence Number */ 462 462 uint8_t doing_fast_retransmit; 463 463 uint8_t rcv_flags; /* flags pulled from data chunk on inbound for … … 514 514 struct sctp_queued_to_read { /* sinfo structure Pluse more */ 515 515 uint16_t sinfo_stream; /* off the wire */ 516 uint32_t sinfo_ssn; /* off the wire */517 516 uint16_t sinfo_flags; /* SCTP_UNORDERED from wire use SCTP_EOF for 518 517 * EOR */ … … 524 523 sctp_assoc_t sinfo_assoc_id; /* our assoc id */ 525 524 /* Non sinfo stuff */ 526 uint32_t m sg_id;/* Fragment Index */525 uint32_t mid; /* Fragment Index */ 527 526 uint32_t length; /* length of data */ 528 527 uint32_t held_length; /* length held in sb */ … … 585 584 uint32_t context; 586 585 uint16_t sinfo_flags; 587 uint16_t s tream;586 uint16_t sid; 588 587 uint16_t act_flags; 589 588 uint16_t auth_keyid; … … 604 603 struct sctp_readhead inqueue; 605 604 struct sctp_readhead uno_inqueue; 606 uint32_t last_ sequence_delivered; /* used for re-order */607 uint16_t s tream_no;605 uint32_t last_mid_delivered; /* used for re-order */ 606 uint16_t sid; 608 607 uint8_t delivery_started; 609 608 uint8_t pd_api_started; … … 687 686 uint32_t next_mid_ordered; 688 687 uint32_t next_mid_unordered; 689 uint16_t s tream_no;688 uint16_t sid; 690 689 uint8_t last_msg_incomplete; 691 690 uint8_t state; -
trunk/Source/ThirdParty/libwebrtc/Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_sysctl.c
r210942 r218849 33 33 #ifdef __FreeBSD__ 34 34 #include <sys/cdefs.h> 35 __FBSDID("$FreeBSD: head/sys/netinet/sctp_sysctl.c 3 03024 2016-07-19 09:48:08Z tuexen $");35 __FBSDID("$FreeBSD: head/sys/netinet/sctp_sysctl.c 310590 2016-12-26 11:06:41Z tuexen $"); 36 36 #endif 37 37 -
trunk/Source/ThirdParty/libwebrtc/Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_timer.c
r210942 r218849 33 33 #ifdef __FreeBSD__ 34 34 #include <sys/cdefs.h> 35 __FBSDID("$FreeBSD: head/sys/netinet/sctp_timer.c 299273 2016-05-09 16:35:05Z tuexen $");35 __FBSDID("$FreeBSD: head/sys/netinet/sctp_timer.c 313030 2017-01-31 23:34:02Z tuexen $"); 36 36 #endif 37 37 … … 430 430 asoc = &stcb->asoc; 431 431 TAILQ_FOREACH_SAFE(chk, &asoc->sent_queue, sctp_next, nchk) { 432 if (SCTP_TSN_GE(asoc->last_acked_seq, chk->rec.data. TSN_seq)) {432 if (SCTP_TSN_GE(asoc->last_acked_seq, chk->rec.data.tsn)) { 433 433 SCTP_PRINTF("Found chk:%p tsn:%x <= last_acked_seq:%x\n", 434 (void *)chk, chk->rec.data. TSN_seq, asoc->last_acked_seq);434 (void *)chk, chk->rec.data.tsn, asoc->last_acked_seq); 435 435 if (chk->sent != SCTP_DATAGRAM_NR_ACKED) { 436 if (asoc->strmout[chk->rec.data.s tream_number].chunks_on_queues > 0) {437 asoc->strmout[chk->rec.data.s tream_number].chunks_on_queues--;438 } 439 } 440 if ((asoc->strmout[chk->rec.data.s tream_number].chunks_on_queues == 0) &&441 (asoc->strmout[chk->rec.data.s tream_number].state == SCTP_STREAM_RESET_PENDING) &&442 TAILQ_EMPTY(&asoc->strmout[chk->rec.data.s tream_number].outqueue)) {436 if (asoc->strmout[chk->rec.data.sid].chunks_on_queues > 0) { 437 asoc->strmout[chk->rec.data.sid].chunks_on_queues--; 438 } 439 } 440 if ((asoc->strmout[chk->rec.data.sid].chunks_on_queues == 0) && 441 (asoc->strmout[chk->rec.data.sid].state == SCTP_STREAM_RESET_PENDING) && 442 TAILQ_EMPTY(&asoc->strmout[chk->rec.data.sid].outqueue)) { 443 443 asoc->trigger_reset = 1; 444 444 } … … 463 463 SCTP_PRINTF("after recover order is as follows\n"); 464 464 TAILQ_FOREACH(chk, &asoc->sent_queue, sctp_next) { 465 SCTP_PRINTF("chk:%p TSN:%x\n", (void *)chk, chk->rec.data. TSN_seq);465 SCTP_PRINTF("chk:%p TSN:%x\n", (void *)chk, chk->rec.data.tsn); 466 466 } 467 467 } … … 551 551 #endif 552 552 TAILQ_FOREACH_SAFE(chk, &stcb->asoc.sent_queue, sctp_next, nchk) { 553 if (SCTP_TSN_GE(stcb->asoc.last_acked_seq, chk->rec.data. TSN_seq)) {553 if (SCTP_TSN_GE(stcb->asoc.last_acked_seq, chk->rec.data.tsn)) { 554 554 /* Strange case our list got out of order? */ 555 555 SCTP_PRINTF("Our list is out of order? last_acked:%x chk:%x\n", 556 (unsigned int)stcb->asoc.last_acked_seq, (unsigned int)chk->rec.data. TSN_seq);556 (unsigned int)stcb->asoc.last_acked_seq, (unsigned int)chk->rec.data.tsn); 557 557 recovery_cnt++; 558 558 #ifdef INVARIANTS … … 579 579 /* validate its been outstanding long enough */ 580 580 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_FR_LOGGING_ENABLE) { 581 sctp_log_fr(chk->rec.data. TSN_seq,581 sctp_log_fr(chk->rec.data.tsn, 582 582 chk->sent_rcv_time.tv_sec, 583 583 chk->sent_rcv_time.tv_usec, … … 647 647 if (fir == 0) { 648 648 fir = 1; 649 tsnfirst = chk->rec.data. TSN_seq;650 } 651 tsnlast = chk->rec.data. TSN_seq;649 tsnfirst = chk->rec.data.tsn; 650 } 651 tsnlast = chk->rec.data.tsn; 652 652 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_FR_LOGGING_ENABLE) { 653 sctp_log_fr(chk->rec.data. TSN_seq, chk->snd_count,653 sctp_log_fr(chk->rec.data.tsn, chk->snd_count, 654 654 0, SCTP_FR_T3_MARKED); 655 655 } … … 667 667 chk->book_size, 668 668 (uint32_t)(uintptr_t)chk->whoTo, 669 chk->rec.data. TSN_seq);669 chk->rec.data.tsn); 670 670 } 671 671 sctp_flight_size_decrease(chk); … … 697 697 chk->rec.data.fast_retran_tsn = stcb->asoc.sending_seq; 698 698 } else { 699 chk->rec.data.fast_retran_tsn = (TAILQ_FIRST(&stcb->asoc.send_queue))->rec.data. TSN_seq;699 chk->rec.data.fast_retran_tsn = (TAILQ_FIRST(&stcb->asoc.send_queue))->rec.data.tsn; 700 700 } 701 701 } … … 727 727 SCTPDBG(SCTP_DEBUG_TIMER1, "LAST TSN marked was %x\n", 728 728 tsnlast); 729 SCTPDBG(SCTP_DEBUG_TIMER1, "Num marked for retransmission was %d peer-rwd:%ld\n", 730 num_mk, (u_long)stcb->asoc.peers_rwnd); 731 SCTPDBG(SCTP_DEBUG_TIMER1, "LAST TSN marked was %x\n", 732 tsnlast); 733 SCTPDBG(SCTP_DEBUG_TIMER1, "Num marked for retransmission was %d peer-rwd:%d\n", 729 SCTPDBG(SCTP_DEBUG_TIMER1, "Num marked for retransmission was %d peer-rwd:%u\n", 734 730 num_mk, 735 (int)stcb->asoc.peers_rwnd);731 stcb->asoc.peers_rwnd); 736 732 } 737 733 #endif … … 795 791 chk->book_size, 796 792 (uint32_t)(uintptr_t)chk->whoTo, 797 chk->rec.data. TSN_seq);793 chk->rec.data.tsn); 798 794 } 799 795 -
trunk/Source/ThirdParty/libwebrtc/Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_uio.h
r210942 r218849 33 33 #ifdef __FreeBSD__ 34 34 #include <sys/cdefs.h> 35 __FBSDID("$FreeBSD: head/sys/netinet/sctp_uio.h 30 2950 2016-07-17 13:33:35Z tuexen $");35 __FBSDID("$FreeBSD: head/sys/netinet/sctp_uio.h 309607 2016-12-06 10:21:25Z tuexen $"); 36 36 #endif 37 37 -
trunk/Source/ThirdParty/libwebrtc/Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_usrreq.c
r210942 r218849 33 33 #ifdef __FreeBSD__ 34 34 #include <sys/cdefs.h> 35 __FBSDID("$FreeBSD: head/sys/netinet/sctp_usrreq.c 3 04573 2016-08-22 00:40:45Z tuexen $");35 __FBSDID("$FreeBSD: head/sys/netinet/sctp_usrreq.c 313031 2017-01-31 23:36:31Z tuexen $"); 36 36 #endif 37 37 … … 148 148 SCTP_BASE_VAR(conn_output) = conn_output; 149 149 SCTP_BASE_VAR(debug_printf) = debug_printf; 150 SCTP_BASE_VAR(crc32c_offloaded) = 0; 150 151 #endif 151 152 sctp_pcb_init(); … … 255 256 stcb->asoc.smallest_mtu = nxtsz; 256 257 /* now off to subtract IP_DF flag if needed */ 257 overhead = IP_HDR_SIZE ;258 overhead = IP_HDR_SIZE + sizeof(struct sctphdr); 258 259 if (sctp_auth_is_required_chunk(SCTP_DATA, stcb->asoc.peer_auth_chunks)) { 259 260 overhead += sctp_get_auth_chunk_len(stcb->asoc.peer_hmac_id); … … 282 283 chk->book_size, 283 284 (uint32_t)(uintptr_t)chk->whoTo, 284 chk->rec.data. TSN_seq);285 chk->rec.data.tsn); 285 286 } 286 287 /* Clear any time so NO RTT is being done */ -
trunk/Source/ThirdParty/libwebrtc/Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_var.h
r210942 r218849 33 33 #ifdef __FreeBSD__ 34 34 #include <sys/cdefs.h> 35 __FBSDID("$FreeBSD: head/sys/netinet/sctp_var.h 30 1114 2016-06-01 10:14:04Z bz$");35 __FBSDID("$FreeBSD: head/sys/netinet/sctp_var.h 309682 2016-12-07 19:30:59Z tuexen $"); 36 36 #endif 37 37 … … 341 341 stcb->asoc.fs_index = 0;\ 342 342 stcb->asoc.fslog[stcb->asoc.fs_index].total_flight = stcb->asoc.total_flight; \ 343 stcb->asoc.fslog[stcb->asoc.fs_index].tsn = tp1->rec.data. TSN_seq; \343 stcb->asoc.fslog[stcb->asoc.fs_index].tsn = tp1->rec.data.tsn; \ 344 344 stcb->asoc.fslog[stcb->asoc.fs_index].book = tp1->book_size; \ 345 345 stcb->asoc.fslog[stcb->asoc.fs_index].sent = tp1->sent; \ … … 362 362 stcb->asoc.fs_index = 0;\ 363 363 stcb->asoc.fslog[stcb->asoc.fs_index].total_flight = stcb->asoc.total_flight; \ 364 stcb->asoc.fslog[stcb->asoc.fs_index].tsn = tp1->rec.data. TSN_seq; \364 stcb->asoc.fslog[stcb->asoc.fs_index].tsn = tp1->rec.data.tsn; \ 365 365 stcb->asoc.fslog[stcb->asoc.fs_index].book = tp1->book_size; \ 366 366 stcb->asoc.fslog[stcb->asoc.fs_index].sent = tp1->sent; \ -
trunk/Source/ThirdParty/libwebrtc/Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctputil.c
r210942 r218849 33 33 #ifdef __FreeBSD__ 34 34 #include <sys/cdefs.h> 35 __FBSDID("$FreeBSD: head/sys/netinet/sctputil.c 3 04736 2016-08-24 06:22:53Z tuexen $");35 __FBSDID("$FreeBSD: head/sys/netinet/sctputil.c 310590 2016-12-26 11:06:41Z tuexen $"); 36 36 #endif 37 37 … … 311 311 sctp_clog.x.strlog.stcb = control->stcb; 312 312 sctp_clog.x.strlog.n_tsn = control->sinfo_tsn; 313 sctp_clog.x.strlog.n_sseq = control->sinfo_ssn;313 sctp_clog.x.strlog.n_sseq = (uint16_t)control->mid; 314 314 sctp_clog.x.strlog.strm = control->sinfo_stream; 315 315 if (poschk != NULL) { 316 316 sctp_clog.x.strlog.e_tsn = poschk->sinfo_tsn; 317 sctp_clog.x.strlog.e_sseq = poschk->sinfo_ssn;317 sctp_clog.x.strlog.e_sseq = (uint16_t)poschk->mid; 318 318 } else { 319 319 sctp_clog.x.strlog.e_tsn = 0; … … 1213 1213 asoc->strmout[i].abandoned_unsent[0] = 0; 1214 1214 #endif 1215 asoc->strmout[i].s tream_no= i;1215 asoc->strmout[i].sid = i; 1216 1216 asoc->strmout[i].last_msg_incomplete = 0; 1217 1217 asoc->strmout[i].state = SCTP_STREAM_OPENING; … … 3118 3118 ssfe->ssfe_error = error; 3119 3119 /* not exactly what the user sent in, but should be close :) */ 3120 ssfe->ssfe_info.snd_sid = chk->rec.data.s tream_number;3120 ssfe->ssfe_info.snd_sid = chk->rec.data.sid; 3121 3121 ssfe->ssfe_info.snd_flags = chk->rec.data.rcv_flags; 3122 ssfe->ssfe_info.snd_ppid = chk->rec.data.p ayloadtype;3122 ssfe->ssfe_info.snd_ppid = chk->rec.data.ppid; 3123 3123 ssfe->ssfe_info.snd_context = chk->rec.data.context; 3124 3124 ssfe->ssfe_info.snd_assoc_id = sctp_get_associd(stcb); … … 3136 3136 ssf->ssf_error = error; 3137 3137 /* not exactly what the user sent in, but should be close :) */ 3138 ssf->ssf_info.sinfo_stream = chk->rec.data.s tream_number;3139 ssf->ssf_info.sinfo_ssn = (uint16_t)chk->rec.data. stream_seq;3138 ssf->ssf_info.sinfo_stream = chk->rec.data.sid; 3139 ssf->ssf_info.sinfo_ssn = (uint16_t)chk->rec.data.mid; 3140 3140 ssf->ssf_info.sinfo_flags = chk->rec.data.rcv_flags; 3141 ssf->ssf_info.sinfo_ppid = chk->rec.data.p ayloadtype;3141 ssf->ssf_info.sinfo_ppid = chk->rec.data.ppid; 3142 3142 ssf->ssf_info.sinfo_context = chk->rec.data.context; 3143 3143 ssf->ssf_info.sinfo_assoc_id = sctp_get_associd(stcb); … … 3222 3222 ssfe->ssfe_error = error; 3223 3223 /* not exactly what the user sent in, but should be close :) */ 3224 ssfe->ssfe_info.snd_sid = sp->s tream;3224 ssfe->ssfe_info.snd_sid = sp->sid; 3225 3225 if (sp->some_taken) { 3226 3226 ssfe->ssfe_info.snd_flags = SCTP_DATA_LAST_FRAG; … … 3240 3240 ssf->ssf_error = error; 3241 3241 /* not exactly what the user sent in, but should be close :) */ 3242 ssf->ssf_info.sinfo_stream = sp->s tream;3242 ssf->ssf_info.sinfo_stream = sp->sid; 3243 3243 ssf->ssf_info.sinfo_ssn = 0; 3244 3244 if (sp->some_taken) { … … 4028 4028 asoc->sent_queue_cnt--; 4029 4029 if (chk->sent != SCTP_DATAGRAM_NR_ACKED) { 4030 if (asoc->strmout[chk->rec.data.s tream_number].chunks_on_queues > 0) {4031 asoc->strmout[chk->rec.data.s tream_number].chunks_on_queues--;4030 if (asoc->strmout[chk->rec.data.sid].chunks_on_queues > 0) { 4031 asoc->strmout[chk->rec.data.sid].chunks_on_queues--; 4032 4032 #ifdef INVARIANTS 4033 4033 } else { 4034 panic("No chunks on the queues for sid %u.", chk->rec.data.s tream_number);4034 panic("No chunks on the queues for sid %u.", chk->rec.data.sid); 4035 4035 #endif 4036 4036 } … … 4052 4052 TAILQ_REMOVE(&asoc->send_queue, chk, sctp_next); 4053 4053 asoc->send_queue_cnt--; 4054 if (asoc->strmout[chk->rec.data.s tream_number].chunks_on_queues > 0) {4055 asoc->strmout[chk->rec.data.s tream_number].chunks_on_queues--;4054 if (asoc->strmout[chk->rec.data.sid].chunks_on_queues > 0) { 4055 asoc->strmout[chk->rec.data.sid].chunks_on_queues--; 4056 4056 #ifdef INVARIANTS 4057 4057 } else { 4058 panic("No chunks on the queues for sid %u.", chk->rec.data.s tream_number);4058 panic("No chunks on the queues for sid %u.", chk->rec.data.sid); 4059 4059 #endif 4060 4060 } … … 4841 4841 memset(&rcv, 0, sizeof(struct sctp_rcvinfo)); 4842 4842 rcv.rcv_sid = control->sinfo_stream; 4843 rcv.rcv_ssn = control->sinfo_ssn;4843 rcv.rcv_ssn = (uint16_t)control->mid; 4844 4844 rcv.rcv_flags = control->sinfo_flags; 4845 4845 rcv.rcv_ppid = control->sinfo_ppid; … … 5054 5054 no_user_data_cause->cause.code = htons(SCTP_CAUSE_NO_USER_DATA); 5055 5055 no_user_data_cause->cause.length = htons(len); 5056 no_user_data_cause->tsn = tsn; /* tsn is passed in as NBO */5056 no_user_data_cause->tsn = htonl(tsn); 5057 5057 } 5058 5058 return (m); … … 5105 5105 struct sctp_tmit_chunk *chk = NULL, *tp2; 5106 5106 struct sctp_stream_queue_pending *sp; 5107 uint16_t stream = 0, seq = 0; 5107 uint32_t mid; 5108 uint16_t sid; 5108 5109 uint8_t foundeom = 0; 5109 5110 int ret_sz = 0; … … 5118 5119 } 5119 5120 #endif 5120 s tream = tp1->rec.data.stream_number;5121 seq = tp1->rec.data.stream_seq;5121 sid = tp1->rec.data.sid; 5122 mid = tp1->rec.data.mid; 5122 5123 if (sent || !(tp1->rec.data.rcv_flags & SCTP_DATA_FIRST_FRAG)) { 5123 5124 stcb->asoc.abandoned_sent[0]++; 5124 5125 stcb->asoc.abandoned_sent[PR_SCTP_POLICY(tp1->flags)]++; 5125 stcb->asoc.strmout[s tream].abandoned_sent[0]++;5126 stcb->asoc.strmout[sid].abandoned_sent[0]++; 5126 5127 #if defined(SCTP_DETAILED_STR_STATS) 5127 5128 stcb->asoc.strmout[stream].abandoned_sent[PR_SCTP_POLICY(tp1->flags)]++; … … 5130 5131 stcb->asoc.abandoned_unsent[0]++; 5131 5132 stcb->asoc.abandoned_unsent[PR_SCTP_POLICY(tp1->flags)]++; 5132 stcb->asoc.strmout[s tream].abandoned_unsent[0]++;5133 stcb->asoc.strmout[sid].abandoned_unsent[0]++; 5133 5134 #if defined(SCTP_DETAILED_STR_STATS) 5134 5135 stcb->asoc.strmout[stream].abandoned_unsent[PR_SCTP_POLICY(tp1->flags)]++; … … 5184 5185 */ 5185 5186 TAILQ_FOREACH_SAFE(tp1, &stcb->asoc.send_queue, sctp_next, tp2) { 5186 if ((tp1->rec.data.s tream_number != stream) ||5187 ( tp1->rec.data.stream_seq != seq)) {5187 if ((tp1->rec.data.sid != sid) || 5188 (!SCTP_MID_EQ(stcb->asoc.idata_supported, tp1->rec.data.mid, mid))) { 5188 5189 break; 5189 5190 } … … 5225 5226 */ 5226 5227 SCTP_TCB_SEND_LOCK(stcb); 5227 strq = &stcb->asoc.strmout[s tream];5228 strq = &stcb->asoc.strmout[sid]; 5228 5229 sp = TAILQ_FIRST(&strq->outqueue); 5229 5230 if (sp != NULL) { … … 5252 5253 if (stcb->asoc.idata_supported == 0) { 5253 5254 if (sp->sinfo_flags & SCTP_UNORDERED) { 5254 chk->rec.data. stream_seq= 0;5255 chk->rec.data.mid = 0; 5255 5256 } else { 5256 chk->rec.data. stream_seq= strq->next_mid_ordered;5257 chk->rec.data.mid = strq->next_mid_ordered; 5257 5258 } 5258 5259 } else { 5259 5260 if (sp->sinfo_flags & SCTP_UNORDERED) { 5260 chk->rec.data. stream_seq= strq->next_mid_unordered;5261 chk->rec.data.mid = strq->next_mid_unordered; 5261 5262 } else { 5262 chk->rec.data. stream_seq= strq->next_mid_ordered;5263 chk->rec.data.mid = strq->next_mid_ordered; 5263 5264 } 5264 5265 } 5265 chk->rec.data.s tream_number = sp->stream;5266 chk->rec.data.p ayloadtype= sp->ppid;5266 chk->rec.data.sid = sp->sid; 5267 chk->rec.data.ppid = sp->ppid; 5267 5268 chk->rec.data.context = sp->context; 5268 5269 chk->flags = sp->act_flags; 5269 5270 chk->whoTo = NULL; 5270 5271 #if defined(__FreeBSD__) || defined(__Panda__) 5271 chk->rec.data. TSN_seq= atomic_fetchadd_int(&stcb->asoc.sending_seq, 1);5272 chk->rec.data.tsn = atomic_fetchadd_int(&stcb->asoc.sending_seq, 1); 5272 5273 #else 5273 chk->rec.data. TSN_seq= stcb->asoc.sending_seq++;5274 chk->rec.data.tsn = stcb->asoc.sending_seq++; 5274 5275 #endif 5275 5276 strq->chunks_on_queues++; … … 6056 6057 if ((sinfo != NULL) && (filling_sinfo != 0)) { 6057 6058 sinfo->sinfo_stream = control->sinfo_stream; 6058 sinfo->sinfo_ssn = (uint16_t)control-> sinfo_ssn;6059 sinfo->sinfo_ssn = (uint16_t)control->mid; 6059 6060 sinfo->sinfo_flags = control->sinfo_flags; 6060 6061 sinfo->sinfo_ppid = control->sinfo_ppid; … … 6128 6129 entry->vtag = control->sinfo_assoc_id; 6129 6130 entry->strm = control->sinfo_stream; 6130 entry->seq = control->sinfo_ssn;6131 entry->seq = (uint16_t)control->mid; 6131 6132 entry->sz = control->length; 6132 6133 entry->flgs = control->sinfo_flags; -
trunk/Source/ThirdParty/libwebrtc/Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctputil.h
r210942 r218849 33 33 #ifdef __FreeBSD__ 34 34 #include <sys/cdefs.h> 35 __FBSDID("$FreeBSD: head/sys/netinet/sctputil.h 298508 2016-04-23 09:15:58Z tuexen $");35 __FBSDID("$FreeBSD: head/sys/netinet/sctputil.h 310590 2016-12-26 11:06:41Z tuexen $"); 36 36 #endif 37 37 -
trunk/Source/ThirdParty/libwebrtc/Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet6/sctp6_usrreq.c
r210942 r218849 33 33 #ifdef __FreeBSD__ 34 34 #include <sys/cdefs.h> 35 __FBSDID("$FreeBSD: head/sys/netinet6/sctp6_usrreq.c 3 02138 2016-06-23 09:13:15Z tuexen$");35 __FBSDID("$FreeBSD: head/sys/netinet6/sctp6_usrreq.c 313330 2017-02-06 08:49:57Z ae $"); 36 36 #endif 37 37 … … 65 65 #define APPLE_FILE_NO 9 66 66 #endif 67 #ifdef IPSEC68 #include <netipsec/ipsec.h>69 #include <netipsec/ipsec6.h>70 #endif /* IPSEC */71 72 67 #if !defined(__Userspace__) 73 68 extern struct protosw inetsw[]; … … 799 794 inp6->inp_ip_ttl = MODULE_GLOBAL(ip_defttl); 800 795 #endif 801 /*802 * Hmm what about the IPSEC stuff that is missing here but in803 * sctp_attach()?804 */805 796 SCTP_INP_WUNLOCK(inp); 806 797 return (0); -
trunk/Source/ThirdParty/libwebrtc/Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet6/sctp6_var.h
r210942 r218849 33 33 #ifdef __FreeBSD__ 34 34 #include <sys/cdefs.h> 35 __FBSDID("$FreeBSD: head/sys/netinet6/sctp6_var.h 298132 2016-04-16 21:34:49Z tuexen $");35 __FBSDID("$FreeBSD: head/sys/netinet6/sctp6_var.h 309607 2016-12-06 10:21:25Z tuexen $"); 36 36 #endif 37 37 -
trunk/Source/ThirdParty/libwebrtc/Source/third_party/usrsctp/usrsctplib/usrsctplib/user_mbuf.c
r210942 r218849 122 122 #endif 123 123 /* Mbuf master zone, zone_mbuf, has already been 124 * created in mbuf_init () */124 * created in mbuf_initialize() */ 125 125 mret = SCTP_ZONE_GET(zone_mbuf, struct mbuf); 126 126 #if defined(SCTP_SIMPLE_ALLOCATOR) … … 328 328 /************ End functions to substitute umem_cache_alloc and umem_cache_free **************/ 329 329 330 /* __Userspace__331 * TODO: mbuf_init must be called in the initialization routines332 * of userspace stack.333 */334 330 void 335 mbuf_init (void *dummy)331 mbuf_initialize(void *dummy) 336 332 { 337 333 -
trunk/Source/ThirdParty/libwebrtc/Source/third_party/usrsctp/usrsctplib/usrsctplib/user_mbuf.h
r210942 r218849 59 59 60 60 /* mbuf initialization function */ 61 void mbuf_init (void *);61 void mbuf_initialize(void *); 62 62 63 63 #define M_MOVE_PKTHDR(to, from) m_move_pkthdr((to), (from)) -
trunk/Source/ThirdParty/libwebrtc/Source/third_party/usrsctp/usrsctplib/usrsctplib/user_socket.c
r210942 r218849 40 40 #include <netinet/sctp_input.h> 41 41 #include <netinet/sctp_peeloff.h> 42 #include <netinet/sctp_crc32.h> 42 43 #ifdef INET6 43 44 #include <netinet6/sctp6_var.h> … … 3308 3309 3309 3310 void 3311 usrsctp_enable_crc32c_offload(void) 3312 { 3313 SCTP_BASE_VAR(crc32c_offloaded) = 1; 3314 } 3315 3316 void 3317 usrsctp_disable_crc32c_offload(void) 3318 { 3319 SCTP_BASE_VAR(crc32c_offloaded) = 0; 3320 } 3321 3322 /* Compute the CRC32C in network byte order */ 3323 uint32_t 3324 usrsctp_crc32c(void *buffer, size_t length) 3325 { 3326 uint32_t base = 0xffffffff; 3327 3328 base = calculate_crc32c(0xffffffff, (unsigned char *)buffer, (unsigned int) length); 3329 base = sctp_finalize_crc32c(base); 3330 return (base); 3331 } 3332 3333 void 3310 3334 usrsctp_conninput(void *addr, const void *buffer, size_t length, uint8_t ecn_bits) 3311 3335 { … … 3348 3372 sh, ch, 3349 3373 #if !defined(SCTP_WITH_NO_CSUM) 3350 1,3374 SCTP_BASE_VAR(crc32c_offloaded) == 1 ? 0 : 1, 3351 3375 #endif 3352 3376 ecn_bits, … … 3402 3426 USRSCTP_SYSCTL_SET_DEF(sctp_path_rtx_max_default) 3403 3427 USRSCTP_SYSCTL_SET_DEF(sctp_add_more_threshold) 3428 USRSCTP_SYSCTL_SET_DEF(sctp_nr_incoming_streams_default) 3404 3429 USRSCTP_SYSCTL_SET_DEF(sctp_nr_outgoing_streams_default) 3405 3430 USRSCTP_SYSCTL_SET_DEF(sctp_cmt_on_off) … … 3482 3507 USRSCTP_SYSCTL_GET_DEF(sctp_path_rtx_max_default) 3483 3508 USRSCTP_SYSCTL_GET_DEF(sctp_add_more_threshold) 3509 USRSCTP_SYSCTL_GET_DEF(sctp_nr_incoming_streams_default) 3484 3510 USRSCTP_SYSCTL_GET_DEF(sctp_nr_outgoing_streams_default) 3485 3511 USRSCTP_SYSCTL_GET_DEF(sctp_cmt_on_off) -
trunk/Source/ThirdParty/libwebrtc/Source/third_party/usrsctp/usrsctplib/usrsctplib/usrsctp.h
r210942 r218849 87 87 88 88 typedef uint32_t sctp_assoc_t; 89 90 #if defined(_WIN32) && defined(_MSC_VER) 91 #pragma pack (push, 1) 92 #define SCTP_PACKED 93 #else 94 #define SCTP_PACKED __attribute__((packed)) 95 #endif 96 97 struct sctp_common_header { 98 uint16_t source_port; 99 uint16_t destination_port; 100 uint32_t verification_tag; 101 uint32_t crc32c; 102 } SCTP_PACKED; 103 104 #if defined(_WIN32) && defined(_MSC_VER) 105 #pragma pack() 106 #endif 107 #undef SCTP_PACKED 89 108 90 109 #define AF_CONN 123 … … 991 1010 void 992 1011 usrsctp_freedumpbuffer(char *); 1012 1013 void 1014 usrsctp_enable_crc32c_offload(void); 1015 1016 void 1017 usrsctp_disable_crc32c_offload(void); 1018 1019 uint32_t 1020 usrsctp_crc32c(void *, size_t); 993 1021 994 1022 #define USRSCTP_SYSCTL_DECL(__field) \
Note:
See TracChangeset
for help on using the changeset viewer.