sctp_output.c (7d4b968b0fa6afc6bca132c27e2041c979ee6101) sctp_output.c (482444b4a58e000cd61107152cd4d5cc58b8a4e5)
1/*-
2 * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 *
7 * a) Redistributions of source code must retain the above copyright notice,
8 * this list of conditions and the following disclaimer.

--- 1845 unchanged lines hidden (view full) ---

1854 {{0, 7},
1855 {0, 0},
1856 {0, 0},
1857 {0, 0}
1858 }
1859 }
1860};
1861
1/*-
2 * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 *
7 * a) Redistributions of source code must retain the above copyright notice,
8 * this list of conditions and the following disclaimer.

--- 1845 unchanged lines hidden (view full) ---

1854 {{0, 7},
1855 {0, 0},
1856 {0, 0},
1857 {0, 0}
1858 }
1859 }
1860};
1861
1862/* EY below are nr_sacks version of the preceeding two data structures, identical except their names */
1863#define SCTP_MAX_NR_GAPS_INARRAY 4
1864struct nr_sack_track {
1865 uint8_t right_edge; /* mergable on the right edge */
1866 uint8_t left_edge; /* mergable on the left edge */
1867 uint8_t num_entries;
1868 uint8_t spare;
1869 struct sctp_nr_gap_ack_block nr_gaps[SCTP_MAX_NR_GAPS_INARRAY];
1870};
1871
1862
1872struct nr_sack_track nr_sack_array[256] = {
1873 {0, 0, 0, 0, /* 0x00 */
1874 {{0, 0},
1875 {0, 0},
1876 {0, 0},
1877 {0, 0}
1878 }
1879 },
1880 {1, 0, 1, 0, /* 0x01 */
1881 {{0, 0},
1882 {0, 0},
1883 {0, 0},
1884 {0, 0}
1885 }
1886 },
1887 {0, 0, 1, 0, /* 0x02 */
1888 {{1, 1},
1889 {0, 0},
1890 {0, 0},
1891 {0, 0}
1892 }
1893 },
1894 {1, 0, 1, 0, /* 0x03 */
1895 {{0, 1},
1896 {0, 0},
1897 {0, 0},
1898 {0, 0}
1899 }
1900 },
1901 {0, 0, 1, 0, /* 0x04 */
1902 {{2, 2},
1903 {0, 0},
1904 {0, 0},
1905 {0, 0}
1906 }
1907 },
1908 {1, 0, 2, 0, /* 0x05 */
1909 {{0, 0},
1910 {2, 2},
1911 {0, 0},
1912 {0, 0}
1913 }
1914 },
1915 {0, 0, 1, 0, /* 0x06 */
1916 {{1, 2},
1917 {0, 0},
1918 {0, 0},
1919 {0, 0}
1920 }
1921 },
1922 {1, 0, 1, 0, /* 0x07 */
1923 {{0, 2},
1924 {0, 0},
1925 {0, 0},
1926 {0, 0}
1927 }
1928 },
1929 {0, 0, 1, 0, /* 0x08 */
1930 {{3, 3},
1931 {0, 0},
1932 {0, 0},
1933 {0, 0}
1934 }
1935 },
1936 {1, 0, 2, 0, /* 0x09 */
1937 {{0, 0},
1938 {3, 3},
1939 {0, 0},
1940 {0, 0}
1941 }
1942 },
1943 {0, 0, 2, 0, /* 0x0a */
1944 {{1, 1},
1945 {3, 3},
1946 {0, 0},
1947 {0, 0}
1948 }
1949 },
1950 {1, 0, 2, 0, /* 0x0b */
1951 {{0, 1},
1952 {3, 3},
1953 {0, 0},
1954 {0, 0}
1955 }
1956 },
1957 {0, 0, 1, 0, /* 0x0c */
1958 {{2, 3},
1959 {0, 0},
1960 {0, 0},
1961 {0, 0}
1962 }
1963 },
1964 {1, 0, 2, 0, /* 0x0d */
1965 {{0, 0},
1966 {2, 3},
1967 {0, 0},
1968 {0, 0}
1969 }
1970 },
1971 {0, 0, 1, 0, /* 0x0e */
1972 {{1, 3},
1973 {0, 0},
1974 {0, 0},
1975 {0, 0}
1976 }
1977 },
1978 {1, 0, 1, 0, /* 0x0f */
1979 {{0, 3},
1980 {0, 0},
1981 {0, 0},
1982 {0, 0}
1983 }
1984 },
1985 {0, 0, 1, 0, /* 0x10 */
1986 {{4, 4},
1987 {0, 0},
1988 {0, 0},
1989 {0, 0}
1990 }
1991 },
1992 {1, 0, 2, 0, /* 0x11 */
1993 {{0, 0},
1994 {4, 4},
1995 {0, 0},
1996 {0, 0}
1997 }
1998 },
1999 {0, 0, 2, 0, /* 0x12 */
2000 {{1, 1},
2001 {4, 4},
2002 {0, 0},
2003 {0, 0}
2004 }
2005 },
2006 {1, 0, 2, 0, /* 0x13 */
2007 {{0, 1},
2008 {4, 4},
2009 {0, 0},
2010 {0, 0}
2011 }
2012 },
2013 {0, 0, 2, 0, /* 0x14 */
2014 {{2, 2},
2015 {4, 4},
2016 {0, 0},
2017 {0, 0}
2018 }
2019 },
2020 {1, 0, 3, 0, /* 0x15 */
2021 {{0, 0},
2022 {2, 2},
2023 {4, 4},
2024 {0, 0}
2025 }
2026 },
2027 {0, 0, 2, 0, /* 0x16 */
2028 {{1, 2},
2029 {4, 4},
2030 {0, 0},
2031 {0, 0}
2032 }
2033 },
2034 {1, 0, 2, 0, /* 0x17 */
2035 {{0, 2},
2036 {4, 4},
2037 {0, 0},
2038 {0, 0}
2039 }
2040 },
2041 {0, 0, 1, 0, /* 0x18 */
2042 {{3, 4},
2043 {0, 0},
2044 {0, 0},
2045 {0, 0}
2046 }
2047 },
2048 {1, 0, 2, 0, /* 0x19 */
2049 {{0, 0},
2050 {3, 4},
2051 {0, 0},
2052 {0, 0}
2053 }
2054 },
2055 {0, 0, 2, 0, /* 0x1a */
2056 {{1, 1},
2057 {3, 4},
2058 {0, 0},
2059 {0, 0}
2060 }
2061 },
2062 {1, 0, 2, 0, /* 0x1b */
2063 {{0, 1},
2064 {3, 4},
2065 {0, 0},
2066 {0, 0}
2067 }
2068 },
2069 {0, 0, 1, 0, /* 0x1c */
2070 {{2, 4},
2071 {0, 0},
2072 {0, 0},
2073 {0, 0}
2074 }
2075 },
2076 {1, 0, 2, 0, /* 0x1d */
2077 {{0, 0},
2078 {2, 4},
2079 {0, 0},
2080 {0, 0}
2081 }
2082 },
2083 {0, 0, 1, 0, /* 0x1e */
2084 {{1, 4},
2085 {0, 0},
2086 {0, 0},
2087 {0, 0}
2088 }
2089 },
2090 {1, 0, 1, 0, /* 0x1f */
2091 {{0, 4},
2092 {0, 0},
2093 {0, 0},
2094 {0, 0}
2095 }
2096 },
2097 {0, 0, 1, 0, /* 0x20 */
2098 {{5, 5},
2099 {0, 0},
2100 {0, 0},
2101 {0, 0}
2102 }
2103 },
2104 {1, 0, 2, 0, /* 0x21 */
2105 {{0, 0},
2106 {5, 5},
2107 {0, 0},
2108 {0, 0}
2109 }
2110 },
2111 {0, 0, 2, 0, /* 0x22 */
2112 {{1, 1},
2113 {5, 5},
2114 {0, 0},
2115 {0, 0}
2116 }
2117 },
2118 {1, 0, 2, 0, /* 0x23 */
2119 {{0, 1},
2120 {5, 5},
2121 {0, 0},
2122 {0, 0}
2123 }
2124 },
2125 {0, 0, 2, 0, /* 0x24 */
2126 {{2, 2},
2127 {5, 5},
2128 {0, 0},
2129 {0, 0}
2130 }
2131 },
2132 {1, 0, 3, 0, /* 0x25 */
2133 {{0, 0},
2134 {2, 2},
2135 {5, 5},
2136 {0, 0}
2137 }
2138 },
2139 {0, 0, 2, 0, /* 0x26 */
2140 {{1, 2},
2141 {5, 5},
2142 {0, 0},
2143 {0, 0}
2144 }
2145 },
2146 {1, 0, 2, 0, /* 0x27 */
2147 {{0, 2},
2148 {5, 5},
2149 {0, 0},
2150 {0, 0}
2151 }
2152 },
2153 {0, 0, 2, 0, /* 0x28 */
2154 {{3, 3},
2155 {5, 5},
2156 {0, 0},
2157 {0, 0}
2158 }
2159 },
2160 {1, 0, 3, 0, /* 0x29 */
2161 {{0, 0},
2162 {3, 3},
2163 {5, 5},
2164 {0, 0}
2165 }
2166 },
2167 {0, 0, 3, 0, /* 0x2a */
2168 {{1, 1},
2169 {3, 3},
2170 {5, 5},
2171 {0, 0}
2172 }
2173 },
2174 {1, 0, 3, 0, /* 0x2b */
2175 {{0, 1},
2176 {3, 3},
2177 {5, 5},
2178 {0, 0}
2179 }
2180 },
2181 {0, 0, 2, 0, /* 0x2c */
2182 {{2, 3},
2183 {5, 5},
2184 {0, 0},
2185 {0, 0}
2186 }
2187 },
2188 {1, 0, 3, 0, /* 0x2d */
2189 {{0, 0},
2190 {2, 3},
2191 {5, 5},
2192 {0, 0}
2193 }
2194 },
2195 {0, 0, 2, 0, /* 0x2e */
2196 {{1, 3},
2197 {5, 5},
2198 {0, 0},
2199 {0, 0}
2200 }
2201 },
2202 {1, 0, 2, 0, /* 0x2f */
2203 {{0, 3},
2204 {5, 5},
2205 {0, 0},
2206 {0, 0}
2207 }
2208 },
2209 {0, 0, 1, 0, /* 0x30 */
2210 {{4, 5},
2211 {0, 0},
2212 {0, 0},
2213 {0, 0}
2214 }
2215 },
2216 {1, 0, 2, 0, /* 0x31 */
2217 {{0, 0},
2218 {4, 5},
2219 {0, 0},
2220 {0, 0}
2221 }
2222 },
2223 {0, 0, 2, 0, /* 0x32 */
2224 {{1, 1},
2225 {4, 5},
2226 {0, 0},
2227 {0, 0}
2228 }
2229 },
2230 {1, 0, 2, 0, /* 0x33 */
2231 {{0, 1},
2232 {4, 5},
2233 {0, 0},
2234 {0, 0}
2235 }
2236 },
2237 {0, 0, 2, 0, /* 0x34 */
2238 {{2, 2},
2239 {4, 5},
2240 {0, 0},
2241 {0, 0}
2242 }
2243 },
2244 {1, 0, 3, 0, /* 0x35 */
2245 {{0, 0},
2246 {2, 2},
2247 {4, 5},
2248 {0, 0}
2249 }
2250 },
2251 {0, 0, 2, 0, /* 0x36 */
2252 {{1, 2},
2253 {4, 5},
2254 {0, 0},
2255 {0, 0}
2256 }
2257 },
2258 {1, 0, 2, 0, /* 0x37 */
2259 {{0, 2},
2260 {4, 5},
2261 {0, 0},
2262 {0, 0}
2263 }
2264 },
2265 {0, 0, 1, 0, /* 0x38 */
2266 {{3, 5},
2267 {0, 0},
2268 {0, 0},
2269 {0, 0}
2270 }
2271 },
2272 {1, 0, 2, 0, /* 0x39 */
2273 {{0, 0},
2274 {3, 5},
2275 {0, 0},
2276 {0, 0}
2277 }
2278 },
2279 {0, 0, 2, 0, /* 0x3a */
2280 {{1, 1},
2281 {3, 5},
2282 {0, 0},
2283 {0, 0}
2284 }
2285 },
2286 {1, 0, 2, 0, /* 0x3b */
2287 {{0, 1},
2288 {3, 5},
2289 {0, 0},
2290 {0, 0}
2291 }
2292 },
2293 {0, 0, 1, 0, /* 0x3c */
2294 {{2, 5},
2295 {0, 0},
2296 {0, 0},
2297 {0, 0}
2298 }
2299 },
2300 {1, 0, 2, 0, /* 0x3d */
2301 {{0, 0},
2302 {2, 5},
2303 {0, 0},
2304 {0, 0}
2305 }
2306 },
2307 {0, 0, 1, 0, /* 0x3e */
2308 {{1, 5},
2309 {0, 0},
2310 {0, 0},
2311 {0, 0}
2312 }
2313 },
2314 {1, 0, 1, 0, /* 0x3f */
2315 {{0, 5},
2316 {0, 0},
2317 {0, 0},
2318 {0, 0}
2319 }
2320 },
2321 {0, 0, 1, 0, /* 0x40 */
2322 {{6, 6},
2323 {0, 0},
2324 {0, 0},
2325 {0, 0}
2326 }
2327 },
2328 {1, 0, 2, 0, /* 0x41 */
2329 {{0, 0},
2330 {6, 6},
2331 {0, 0},
2332 {0, 0}
2333 }
2334 },
2335 {0, 0, 2, 0, /* 0x42 */
2336 {{1, 1},
2337 {6, 6},
2338 {0, 0},
2339 {0, 0}
2340 }
2341 },
2342 {1, 0, 2, 0, /* 0x43 */
2343 {{0, 1},
2344 {6, 6},
2345 {0, 0},
2346 {0, 0}
2347 }
2348 },
2349 {0, 0, 2, 0, /* 0x44 */
2350 {{2, 2},
2351 {6, 6},
2352 {0, 0},
2353 {0, 0}
2354 }
2355 },
2356 {1, 0, 3, 0, /* 0x45 */
2357 {{0, 0},
2358 {2, 2},
2359 {6, 6},
2360 {0, 0}
2361 }
2362 },
2363 {0, 0, 2, 0, /* 0x46 */
2364 {{1, 2},
2365 {6, 6},
2366 {0, 0},
2367 {0, 0}
2368 }
2369 },
2370 {1, 0, 2, 0, /* 0x47 */
2371 {{0, 2},
2372 {6, 6},
2373 {0, 0},
2374 {0, 0}
2375 }
2376 },
2377 {0, 0, 2, 0, /* 0x48 */
2378 {{3, 3},
2379 {6, 6},
2380 {0, 0},
2381 {0, 0}
2382 }
2383 },
2384 {1, 0, 3, 0, /* 0x49 */
2385 {{0, 0},
2386 {3, 3},
2387 {6, 6},
2388 {0, 0}
2389 }
2390 },
2391 {0, 0, 3, 0, /* 0x4a */
2392 {{1, 1},
2393 {3, 3},
2394 {6, 6},
2395 {0, 0}
2396 }
2397 },
2398 {1, 0, 3, 0, /* 0x4b */
2399 {{0, 1},
2400 {3, 3},
2401 {6, 6},
2402 {0, 0}
2403 }
2404 },
2405 {0, 0, 2, 0, /* 0x4c */
2406 {{2, 3},
2407 {6, 6},
2408 {0, 0},
2409 {0, 0}
2410 }
2411 },
2412 {1, 0, 3, 0, /* 0x4d */
2413 {{0, 0},
2414 {2, 3},
2415 {6, 6},
2416 {0, 0}
2417 }
2418 },
2419 {0, 0, 2, 0, /* 0x4e */
2420 {{1, 3},
2421 {6, 6},
2422 {0, 0},
2423 {0, 0}
2424 }
2425 },
2426 {1, 0, 2, 0, /* 0x4f */
2427 {{0, 3},
2428 {6, 6},
2429 {0, 0},
2430 {0, 0}
2431 }
2432 },
2433 {0, 0, 2, 0, /* 0x50 */
2434 {{4, 4},
2435 {6, 6},
2436 {0, 0},
2437 {0, 0}
2438 }
2439 },
2440 {1, 0, 3, 0, /* 0x51 */
2441 {{0, 0},
2442 {4, 4},
2443 {6, 6},
2444 {0, 0}
2445 }
2446 },
2447 {0, 0, 3, 0, /* 0x52 */
2448 {{1, 1},
2449 {4, 4},
2450 {6, 6},
2451 {0, 0}
2452 }
2453 },
2454 {1, 0, 3, 0, /* 0x53 */
2455 {{0, 1},
2456 {4, 4},
2457 {6, 6},
2458 {0, 0}
2459 }
2460 },
2461 {0, 0, 3, 0, /* 0x54 */
2462 {{2, 2},
2463 {4, 4},
2464 {6, 6},
2465 {0, 0}
2466 }
2467 },
2468 {1, 0, 4, 0, /* 0x55 */
2469 {{0, 0},
2470 {2, 2},
2471 {4, 4},
2472 {6, 6}
2473 }
2474 },
2475 {0, 0, 3, 0, /* 0x56 */
2476 {{1, 2},
2477 {4, 4},
2478 {6, 6},
2479 {0, 0}
2480 }
2481 },
2482 {1, 0, 3, 0, /* 0x57 */
2483 {{0, 2},
2484 {4, 4},
2485 {6, 6},
2486 {0, 0}
2487 }
2488 },
2489 {0, 0, 2, 0, /* 0x58 */
2490 {{3, 4},
2491 {6, 6},
2492 {0, 0},
2493 {0, 0}
2494 }
2495 },
2496 {1, 0, 3, 0, /* 0x59 */
2497 {{0, 0},
2498 {3, 4},
2499 {6, 6},
2500 {0, 0}
2501 }
2502 },
2503 {0, 0, 3, 0, /* 0x5a */
2504 {{1, 1},
2505 {3, 4},
2506 {6, 6},
2507 {0, 0}
2508 }
2509 },
2510 {1, 0, 3, 0, /* 0x5b */
2511 {{0, 1},
2512 {3, 4},
2513 {6, 6},
2514 {0, 0}
2515 }
2516 },
2517 {0, 0, 2, 0, /* 0x5c */
2518 {{2, 4},
2519 {6, 6},
2520 {0, 0},
2521 {0, 0}
2522 }
2523 },
2524 {1, 0, 3, 0, /* 0x5d */
2525 {{0, 0},
2526 {2, 4},
2527 {6, 6},
2528 {0, 0}
2529 }
2530 },
2531 {0, 0, 2, 0, /* 0x5e */
2532 {{1, 4},
2533 {6, 6},
2534 {0, 0},
2535 {0, 0}
2536 }
2537 },
2538 {1, 0, 2, 0, /* 0x5f */
2539 {{0, 4},
2540 {6, 6},
2541 {0, 0},
2542 {0, 0}
2543 }
2544 },
2545 {0, 0, 1, 0, /* 0x60 */
2546 {{5, 6},
2547 {0, 0},
2548 {0, 0},
2549 {0, 0}
2550 }
2551 },
2552 {1, 0, 2, 0, /* 0x61 */
2553 {{0, 0},
2554 {5, 6},
2555 {0, 0},
2556 {0, 0}
2557 }
2558 },
2559 {0, 0, 2, 0, /* 0x62 */
2560 {{1, 1},
2561 {5, 6},
2562 {0, 0},
2563 {0, 0}
2564 }
2565 },
2566 {1, 0, 2, 0, /* 0x63 */
2567 {{0, 1},
2568 {5, 6},
2569 {0, 0},
2570 {0, 0}
2571 }
2572 },
2573 {0, 0, 2, 0, /* 0x64 */
2574 {{2, 2},
2575 {5, 6},
2576 {0, 0},
2577 {0, 0}
2578 }
2579 },
2580 {1, 0, 3, 0, /* 0x65 */
2581 {{0, 0},
2582 {2, 2},
2583 {5, 6},
2584 {0, 0}
2585 }
2586 },
2587 {0, 0, 2, 0, /* 0x66 */
2588 {{1, 2},
2589 {5, 6},
2590 {0, 0},
2591 {0, 0}
2592 }
2593 },
2594 {1, 0, 2, 0, /* 0x67 */
2595 {{0, 2},
2596 {5, 6},
2597 {0, 0},
2598 {0, 0}
2599 }
2600 },
2601 {0, 0, 2, 0, /* 0x68 */
2602 {{3, 3},
2603 {5, 6},
2604 {0, 0},
2605 {0, 0}
2606 }
2607 },
2608 {1, 0, 3, 0, /* 0x69 */
2609 {{0, 0},
2610 {3, 3},
2611 {5, 6},
2612 {0, 0}
2613 }
2614 },
2615 {0, 0, 3, 0, /* 0x6a */
2616 {{1, 1},
2617 {3, 3},
2618 {5, 6},
2619 {0, 0}
2620 }
2621 },
2622 {1, 0, 3, 0, /* 0x6b */
2623 {{0, 1},
2624 {3, 3},
2625 {5, 6},
2626 {0, 0}
2627 }
2628 },
2629 {0, 0, 2, 0, /* 0x6c */
2630 {{2, 3},
2631 {5, 6},
2632 {0, 0},
2633 {0, 0}
2634 }
2635 },
2636 {1, 0, 3, 0, /* 0x6d */
2637 {{0, 0},
2638 {2, 3},
2639 {5, 6},
2640 {0, 0}
2641 }
2642 },
2643 {0, 0, 2, 0, /* 0x6e */
2644 {{1, 3},
2645 {5, 6},
2646 {0, 0},
2647 {0, 0}
2648 }
2649 },
2650 {1, 0, 2, 0, /* 0x6f */
2651 {{0, 3},
2652 {5, 6},
2653 {0, 0},
2654 {0, 0}
2655 }
2656 },
2657 {0, 0, 1, 0, /* 0x70 */
2658 {{4, 6},
2659 {0, 0},
2660 {0, 0},
2661 {0, 0}
2662 }
2663 },
2664 {1, 0, 2, 0, /* 0x71 */
2665 {{0, 0},
2666 {4, 6},
2667 {0, 0},
2668 {0, 0}
2669 }
2670 },
2671 {0, 0, 2, 0, /* 0x72 */
2672 {{1, 1},
2673 {4, 6},
2674 {0, 0},
2675 {0, 0}
2676 }
2677 },
2678 {1, 0, 2, 0, /* 0x73 */
2679 {{0, 1},
2680 {4, 6},
2681 {0, 0},
2682 {0, 0}
2683 }
2684 },
2685 {0, 0, 2, 0, /* 0x74 */
2686 {{2, 2},
2687 {4, 6},
2688 {0, 0},
2689 {0, 0}
2690 }
2691 },
2692 {1, 0, 3, 0, /* 0x75 */
2693 {{0, 0},
2694 {2, 2},
2695 {4, 6},
2696 {0, 0}
2697 }
2698 },
2699 {0, 0, 2, 0, /* 0x76 */
2700 {{1, 2},
2701 {4, 6},
2702 {0, 0},
2703 {0, 0}
2704 }
2705 },
2706 {1, 0, 2, 0, /* 0x77 */
2707 {{0, 2},
2708 {4, 6},
2709 {0, 0},
2710 {0, 0}
2711 }
2712 },
2713 {0, 0, 1, 0, /* 0x78 */
2714 {{3, 6},
2715 {0, 0},
2716 {0, 0},
2717 {0, 0}
2718 }
2719 },
2720 {1, 0, 2, 0, /* 0x79 */
2721 {{0, 0},
2722 {3, 6},
2723 {0, 0},
2724 {0, 0}
2725 }
2726 },
2727 {0, 0, 2, 0, /* 0x7a */
2728 {{1, 1},
2729 {3, 6},
2730 {0, 0},
2731 {0, 0}
2732 }
2733 },
2734 {1, 0, 2, 0, /* 0x7b */
2735 {{0, 1},
2736 {3, 6},
2737 {0, 0},
2738 {0, 0}
2739 }
2740 },
2741 {0, 0, 1, 0, /* 0x7c */
2742 {{2, 6},
2743 {0, 0},
2744 {0, 0},
2745 {0, 0}
2746 }
2747 },
2748 {1, 0, 2, 0, /* 0x7d */
2749 {{0, 0},
2750 {2, 6},
2751 {0, 0},
2752 {0, 0}
2753 }
2754 },
2755 {0, 0, 1, 0, /* 0x7e */
2756 {{1, 6},
2757 {0, 0},
2758 {0, 0},
2759 {0, 0}
2760 }
2761 },
2762 {1, 0, 1, 0, /* 0x7f */
2763 {{0, 6},
2764 {0, 0},
2765 {0, 0},
2766 {0, 0}
2767 }
2768 },
2769 {0, 1, 1, 0, /* 0x80 */
2770 {{7, 7},
2771 {0, 0},
2772 {0, 0},
2773 {0, 0}
2774 }
2775 },
2776 {1, 1, 2, 0, /* 0x81 */
2777 {{0, 0},
2778 {7, 7},
2779 {0, 0},
2780 {0, 0}
2781 }
2782 },
2783 {0, 1, 2, 0, /* 0x82 */
2784 {{1, 1},
2785 {7, 7},
2786 {0, 0},
2787 {0, 0}
2788 }
2789 },
2790 {1, 1, 2, 0, /* 0x83 */
2791 {{0, 1},
2792 {7, 7},
2793 {0, 0},
2794 {0, 0}
2795 }
2796 },
2797 {0, 1, 2, 0, /* 0x84 */
2798 {{2, 2},
2799 {7, 7},
2800 {0, 0},
2801 {0, 0}
2802 }
2803 },
2804 {1, 1, 3, 0, /* 0x85 */
2805 {{0, 0},
2806 {2, 2},
2807 {7, 7},
2808 {0, 0}
2809 }
2810 },
2811 {0, 1, 2, 0, /* 0x86 */
2812 {{1, 2},
2813 {7, 7},
2814 {0, 0},
2815 {0, 0}
2816 }
2817 },
2818 {1, 1, 2, 0, /* 0x87 */
2819 {{0, 2},
2820 {7, 7},
2821 {0, 0},
2822 {0, 0}
2823 }
2824 },
2825 {0, 1, 2, 0, /* 0x88 */
2826 {{3, 3},
2827 {7, 7},
2828 {0, 0},
2829 {0, 0}
2830 }
2831 },
2832 {1, 1, 3, 0, /* 0x89 */
2833 {{0, 0},
2834 {3, 3},
2835 {7, 7},
2836 {0, 0}
2837 }
2838 },
2839 {0, 1, 3, 0, /* 0x8a */
2840 {{1, 1},
2841 {3, 3},
2842 {7, 7},
2843 {0, 0}
2844 }
2845 },
2846 {1, 1, 3, 0, /* 0x8b */
2847 {{0, 1},
2848 {3, 3},
2849 {7, 7},
2850 {0, 0}
2851 }
2852 },
2853 {0, 1, 2, 0, /* 0x8c */
2854 {{2, 3},
2855 {7, 7},
2856 {0, 0},
2857 {0, 0}
2858 }
2859 },
2860 {1, 1, 3, 0, /* 0x8d */
2861 {{0, 0},
2862 {2, 3},
2863 {7, 7},
2864 {0, 0}
2865 }
2866 },
2867 {0, 1, 2, 0, /* 0x8e */
2868 {{1, 3},
2869 {7, 7},
2870 {0, 0},
2871 {0, 0}
2872 }
2873 },
2874 {1, 1, 2, 0, /* 0x8f */
2875 {{0, 3},
2876 {7, 7},
2877 {0, 0},
2878 {0, 0}
2879 }
2880 },
2881 {0, 1, 2, 0, /* 0x90 */
2882 {{4, 4},
2883 {7, 7},
2884 {0, 0},
2885 {0, 0}
2886 }
2887 },
2888 {1, 1, 3, 0, /* 0x91 */
2889 {{0, 0},
2890 {4, 4},
2891 {7, 7},
2892 {0, 0}
2893 }
2894 },
2895 {0, 1, 3, 0, /* 0x92 */
2896 {{1, 1},
2897 {4, 4},
2898 {7, 7},
2899 {0, 0}
2900 }
2901 },
2902 {1, 1, 3, 0, /* 0x93 */
2903 {{0, 1},
2904 {4, 4},
2905 {7, 7},
2906 {0, 0}
2907 }
2908 },
2909 {0, 1, 3, 0, /* 0x94 */
2910 {{2, 2},
2911 {4, 4},
2912 {7, 7},
2913 {0, 0}
2914 }
2915 },
2916 {1, 1, 4, 0, /* 0x95 */
2917 {{0, 0},
2918 {2, 2},
2919 {4, 4},
2920 {7, 7}
2921 }
2922 },
2923 {0, 1, 3, 0, /* 0x96 */
2924 {{1, 2},
2925 {4, 4},
2926 {7, 7},
2927 {0, 0}
2928 }
2929 },
2930 {1, 1, 3, 0, /* 0x97 */
2931 {{0, 2},
2932 {4, 4},
2933 {7, 7},
2934 {0, 0}
2935 }
2936 },
2937 {0, 1, 2, 0, /* 0x98 */
2938 {{3, 4},
2939 {7, 7},
2940 {0, 0},
2941 {0, 0}
2942 }
2943 },
2944 {1, 1, 3, 0, /* 0x99 */
2945 {{0, 0},
2946 {3, 4},
2947 {7, 7},
2948 {0, 0}
2949 }
2950 },
2951 {0, 1, 3, 0, /* 0x9a */
2952 {{1, 1},
2953 {3, 4},
2954 {7, 7},
2955 {0, 0}
2956 }
2957 },
2958 {1, 1, 3, 0, /* 0x9b */
2959 {{0, 1},
2960 {3, 4},
2961 {7, 7},
2962 {0, 0}
2963 }
2964 },
2965 {0, 1, 2, 0, /* 0x9c */
2966 {{2, 4},
2967 {7, 7},
2968 {0, 0},
2969 {0, 0}
2970 }
2971 },
2972 {1, 1, 3, 0, /* 0x9d */
2973 {{0, 0},
2974 {2, 4},
2975 {7, 7},
2976 {0, 0}
2977 }
2978 },
2979 {0, 1, 2, 0, /* 0x9e */
2980 {{1, 4},
2981 {7, 7},
2982 {0, 0},
2983 {0, 0}
2984 }
2985 },
2986 {1, 1, 2, 0, /* 0x9f */
2987 {{0, 4},
2988 {7, 7},
2989 {0, 0},
2990 {0, 0}
2991 }
2992 },
2993 {0, 1, 2, 0, /* 0xa0 */
2994 {{5, 5},
2995 {7, 7},
2996 {0, 0},
2997 {0, 0}
2998 }
2999 },
3000 {1, 1, 3, 0, /* 0xa1 */
3001 {{0, 0},
3002 {5, 5},
3003 {7, 7},
3004 {0, 0}
3005 }
3006 },
3007 {0, 1, 3, 0, /* 0xa2 */
3008 {{1, 1},
3009 {5, 5},
3010 {7, 7},
3011 {0, 0}
3012 }
3013 },
3014 {1, 1, 3, 0, /* 0xa3 */
3015 {{0, 1},
3016 {5, 5},
3017 {7, 7},
3018 {0, 0}
3019 }
3020 },
3021 {0, 1, 3, 0, /* 0xa4 */
3022 {{2, 2},
3023 {5, 5},
3024 {7, 7},
3025 {0, 0}
3026 }
3027 },
3028 {1, 1, 4, 0, /* 0xa5 */
3029 {{0, 0},
3030 {2, 2},
3031 {5, 5},
3032 {7, 7}
3033 }
3034 },
3035 {0, 1, 3, 0, /* 0xa6 */
3036 {{1, 2},
3037 {5, 5},
3038 {7, 7},
3039 {0, 0}
3040 }
3041 },
3042 {1, 1, 3, 0, /* 0xa7 */
3043 {{0, 2},
3044 {5, 5},
3045 {7, 7},
3046 {0, 0}
3047 }
3048 },
3049 {0, 1, 3, 0, /* 0xa8 */
3050 {{3, 3},
3051 {5, 5},
3052 {7, 7},
3053 {0, 0}
3054 }
3055 },
3056 {1, 1, 4, 0, /* 0xa9 */
3057 {{0, 0},
3058 {3, 3},
3059 {5, 5},
3060 {7, 7}
3061 }
3062 },
3063 {0, 1, 4, 0, /* 0xaa */
3064 {{1, 1},
3065 {3, 3},
3066 {5, 5},
3067 {7, 7}
3068 }
3069 },
3070 {1, 1, 4, 0, /* 0xab */
3071 {{0, 1},
3072 {3, 3},
3073 {5, 5},
3074 {7, 7}
3075 }
3076 },
3077 {0, 1, 3, 0, /* 0xac */
3078 {{2, 3},
3079 {5, 5},
3080 {7, 7},
3081 {0, 0}
3082 }
3083 },
3084 {1, 1, 4, 0, /* 0xad */
3085 {{0, 0},
3086 {2, 3},
3087 {5, 5},
3088 {7, 7}
3089 }
3090 },
3091 {0, 1, 3, 0, /* 0xae */
3092 {{1, 3},
3093 {5, 5},
3094 {7, 7},
3095 {0, 0}
3096 }
3097 },
3098 {1, 1, 3, 0, /* 0xaf */
3099 {{0, 3},
3100 {5, 5},
3101 {7, 7},
3102 {0, 0}
3103 }
3104 },
3105 {0, 1, 2, 0, /* 0xb0 */
3106 {{4, 5},
3107 {7, 7},
3108 {0, 0},
3109 {0, 0}
3110 }
3111 },
3112 {1, 1, 3, 0, /* 0xb1 */
3113 {{0, 0},
3114 {4, 5},
3115 {7, 7},
3116 {0, 0}
3117 }
3118 },
3119 {0, 1, 3, 0, /* 0xb2 */
3120 {{1, 1},
3121 {4, 5},
3122 {7, 7},
3123 {0, 0}
3124 }
3125 },
3126 {1, 1, 3, 0, /* 0xb3 */
3127 {{0, 1},
3128 {4, 5},
3129 {7, 7},
3130 {0, 0}
3131 }
3132 },
3133 {0, 1, 3, 0, /* 0xb4 */
3134 {{2, 2},
3135 {4, 5},
3136 {7, 7},
3137 {0, 0}
3138 }
3139 },
3140 {1, 1, 4, 0, /* 0xb5 */
3141 {{0, 0},
3142 {2, 2},
3143 {4, 5},
3144 {7, 7}
3145 }
3146 },
3147 {0, 1, 3, 0, /* 0xb6 */
3148 {{1, 2},
3149 {4, 5},
3150 {7, 7},
3151 {0, 0}
3152 }
3153 },
3154 {1, 1, 3, 0, /* 0xb7 */
3155 {{0, 2},
3156 {4, 5},
3157 {7, 7},
3158 {0, 0}
3159 }
3160 },
3161 {0, 1, 2, 0, /* 0xb8 */
3162 {{3, 5},
3163 {7, 7},
3164 {0, 0},
3165 {0, 0}
3166 }
3167 },
3168 {1, 1, 3, 0, /* 0xb9 */
3169 {{0, 0},
3170 {3, 5},
3171 {7, 7},
3172 {0, 0}
3173 }
3174 },
3175 {0, 1, 3, 0, /* 0xba */
3176 {{1, 1},
3177 {3, 5},
3178 {7, 7},
3179 {0, 0}
3180 }
3181 },
3182 {1, 1, 3, 0, /* 0xbb */
3183 {{0, 1},
3184 {3, 5},
3185 {7, 7},
3186 {0, 0}
3187 }
3188 },
3189 {0, 1, 2, 0, /* 0xbc */
3190 {{2, 5},
3191 {7, 7},
3192 {0, 0},
3193 {0, 0}
3194 }
3195 },
3196 {1, 1, 3, 0, /* 0xbd */
3197 {{0, 0},
3198 {2, 5},
3199 {7, 7},
3200 {0, 0}
3201 }
3202 },
3203 {0, 1, 2, 0, /* 0xbe */
3204 {{1, 5},
3205 {7, 7},
3206 {0, 0},
3207 {0, 0}
3208 }
3209 },
3210 {1, 1, 2, 0, /* 0xbf */
3211 {{0, 5},
3212 {7, 7},
3213 {0, 0},
3214 {0, 0}
3215 }
3216 },
3217 {0, 1, 1, 0, /* 0xc0 */
3218 {{6, 7},
3219 {0, 0},
3220 {0, 0},
3221 {0, 0}
3222 }
3223 },
3224 {1, 1, 2, 0, /* 0xc1 */
3225 {{0, 0},
3226 {6, 7},
3227 {0, 0},
3228 {0, 0}
3229 }
3230 },
3231 {0, 1, 2, 0, /* 0xc2 */
3232 {{1, 1},
3233 {6, 7},
3234 {0, 0},
3235 {0, 0}
3236 }
3237 },
3238 {1, 1, 2, 0, /* 0xc3 */
3239 {{0, 1},
3240 {6, 7},
3241 {0, 0},
3242 {0, 0}
3243 }
3244 },
3245 {0, 1, 2, 0, /* 0xc4 */
3246 {{2, 2},
3247 {6, 7},
3248 {0, 0},
3249 {0, 0}
3250 }
3251 },
3252 {1, 1, 3, 0, /* 0xc5 */
3253 {{0, 0},
3254 {2, 2},
3255 {6, 7},
3256 {0, 0}
3257 }
3258 },
3259 {0, 1, 2, 0, /* 0xc6 */
3260 {{1, 2},
3261 {6, 7},
3262 {0, 0},
3263 {0, 0}
3264 }
3265 },
3266 {1, 1, 2, 0, /* 0xc7 */
3267 {{0, 2},
3268 {6, 7},
3269 {0, 0},
3270 {0, 0}
3271 }
3272 },
3273 {0, 1, 2, 0, /* 0xc8 */
3274 {{3, 3},
3275 {6, 7},
3276 {0, 0},
3277 {0, 0}
3278 }
3279 },
3280 {1, 1, 3, 0, /* 0xc9 */
3281 {{0, 0},
3282 {3, 3},
3283 {6, 7},
3284 {0, 0}
3285 }
3286 },
3287 {0, 1, 3, 0, /* 0xca */
3288 {{1, 1},
3289 {3, 3},
3290 {6, 7},
3291 {0, 0}
3292 }
3293 },
3294 {1, 1, 3, 0, /* 0xcb */
3295 {{0, 1},
3296 {3, 3},
3297 {6, 7},
3298 {0, 0}
3299 }
3300 },
3301 {0, 1, 2, 0, /* 0xcc */
3302 {{2, 3},
3303 {6, 7},
3304 {0, 0},
3305 {0, 0}
3306 }
3307 },
3308 {1, 1, 3, 0, /* 0xcd */
3309 {{0, 0},
3310 {2, 3},
3311 {6, 7},
3312 {0, 0}
3313 }
3314 },
3315 {0, 1, 2, 0, /* 0xce */
3316 {{1, 3},
3317 {6, 7},
3318 {0, 0},
3319 {0, 0}
3320 }
3321 },
3322 {1, 1, 2, 0, /* 0xcf */
3323 {{0, 3},
3324 {6, 7},
3325 {0, 0},
3326 {0, 0}
3327 }
3328 },
3329 {0, 1, 2, 0, /* 0xd0 */
3330 {{4, 4},
3331 {6, 7},
3332 {0, 0},
3333 {0, 0}
3334 }
3335 },
3336 {1, 1, 3, 0, /* 0xd1 */
3337 {{0, 0},
3338 {4, 4},
3339 {6, 7},
3340 {0, 0}
3341 }
3342 },
3343 {0, 1, 3, 0, /* 0xd2 */
3344 {{1, 1},
3345 {4, 4},
3346 {6, 7},
3347 {0, 0}
3348 }
3349 },
3350 {1, 1, 3, 0, /* 0xd3 */
3351 {{0, 1},
3352 {4, 4},
3353 {6, 7},
3354 {0, 0}
3355 }
3356 },
3357 {0, 1, 3, 0, /* 0xd4 */
3358 {{2, 2},
3359 {4, 4},
3360 {6, 7},
3361 {0, 0}
3362 }
3363 },
3364 {1, 1, 4, 0, /* 0xd5 */
3365 {{0, 0},
3366 {2, 2},
3367 {4, 4},
3368 {6, 7}
3369 }
3370 },
3371 {0, 1, 3, 0, /* 0xd6 */
3372 {{1, 2},
3373 {4, 4},
3374 {6, 7},
3375 {0, 0}
3376 }
3377 },
3378 {1, 1, 3, 0, /* 0xd7 */
3379 {{0, 2},
3380 {4, 4},
3381 {6, 7},
3382 {0, 0}
3383 }
3384 },
3385 {0, 1, 2, 0, /* 0xd8 */
3386 {{3, 4},
3387 {6, 7},
3388 {0, 0},
3389 {0, 0}
3390 }
3391 },
3392 {1, 1, 3, 0, /* 0xd9 */
3393 {{0, 0},
3394 {3, 4},
3395 {6, 7},
3396 {0, 0}
3397 }
3398 },
3399 {0, 1, 3, 0, /* 0xda */
3400 {{1, 1},
3401 {3, 4},
3402 {6, 7},
3403 {0, 0}
3404 }
3405 },
3406 {1, 1, 3, 0, /* 0xdb */
3407 {{0, 1},
3408 {3, 4},
3409 {6, 7},
3410 {0, 0}
3411 }
3412 },
3413 {0, 1, 2, 0, /* 0xdc */
3414 {{2, 4},
3415 {6, 7},
3416 {0, 0},
3417 {0, 0}
3418 }
3419 },
3420 {1, 1, 3, 0, /* 0xdd */
3421 {{0, 0},
3422 {2, 4},
3423 {6, 7},
3424 {0, 0}
3425 }
3426 },
3427 {0, 1, 2, 0, /* 0xde */
3428 {{1, 4},
3429 {6, 7},
3430 {0, 0},
3431 {0, 0}
3432 }
3433 },
3434 {1, 1, 2, 0, /* 0xdf */
3435 {{0, 4},
3436 {6, 7},
3437 {0, 0},
3438 {0, 0}
3439 }
3440 },
3441 {0, 1, 1, 0, /* 0xe0 */
3442 {{5, 7},
3443 {0, 0},
3444 {0, 0},
3445 {0, 0}
3446 }
3447 },
3448 {1, 1, 2, 0, /* 0xe1 */
3449 {{0, 0},
3450 {5, 7},
3451 {0, 0},
3452 {0, 0}
3453 }
3454 },
3455 {0, 1, 2, 0, /* 0xe2 */
3456 {{1, 1},
3457 {5, 7},
3458 {0, 0},
3459 {0, 0}
3460 }
3461 },
3462 {1, 1, 2, 0, /* 0xe3 */
3463 {{0, 1},
3464 {5, 7},
3465 {0, 0},
3466 {0, 0}
3467 }
3468 },
3469 {0, 1, 2, 0, /* 0xe4 */
3470 {{2, 2},
3471 {5, 7},
3472 {0, 0},
3473 {0, 0}
3474 }
3475 },
3476 {1, 1, 3, 0, /* 0xe5 */
3477 {{0, 0},
3478 {2, 2},
3479 {5, 7},
3480 {0, 0}
3481 }
3482 },
3483 {0, 1, 2, 0, /* 0xe6 */
3484 {{1, 2},
3485 {5, 7},
3486 {0, 0},
3487 {0, 0}
3488 }
3489 },
3490 {1, 1, 2, 0, /* 0xe7 */
3491 {{0, 2},
3492 {5, 7},
3493 {0, 0},
3494 {0, 0}
3495 }
3496 },
3497 {0, 1, 2, 0, /* 0xe8 */
3498 {{3, 3},
3499 {5, 7},
3500 {0, 0},
3501 {0, 0}
3502 }
3503 },
3504 {1, 1, 3, 0, /* 0xe9 */
3505 {{0, 0},
3506 {3, 3},
3507 {5, 7},
3508 {0, 0}
3509 }
3510 },
3511 {0, 1, 3, 0, /* 0xea */
3512 {{1, 1},
3513 {3, 3},
3514 {5, 7},
3515 {0, 0}
3516 }
3517 },
3518 {1, 1, 3, 0, /* 0xeb */
3519 {{0, 1},
3520 {3, 3},
3521 {5, 7},
3522 {0, 0}
3523 }
3524 },
3525 {0, 1, 2, 0, /* 0xec */
3526 {{2, 3},
3527 {5, 7},
3528 {0, 0},
3529 {0, 0}
3530 }
3531 },
3532 {1, 1, 3, 0, /* 0xed */
3533 {{0, 0},
3534 {2, 3},
3535 {5, 7},
3536 {0, 0}
3537 }
3538 },
3539 {0, 1, 2, 0, /* 0xee */
3540 {{1, 3},
3541 {5, 7},
3542 {0, 0},
3543 {0, 0}
3544 }
3545 },
3546 {1, 1, 2, 0, /* 0xef */
3547 {{0, 3},
3548 {5, 7},
3549 {0, 0},
3550 {0, 0}
3551 }
3552 },
3553 {0, 1, 1, 0, /* 0xf0 */
3554 {{4, 7},
3555 {0, 0},
3556 {0, 0},
3557 {0, 0}
3558 }
3559 },
3560 {1, 1, 2, 0, /* 0xf1 */
3561 {{0, 0},
3562 {4, 7},
3563 {0, 0},
3564 {0, 0}
3565 }
3566 },
3567 {0, 1, 2, 0, /* 0xf2 */
3568 {{1, 1},
3569 {4, 7},
3570 {0, 0},
3571 {0, 0}
3572 }
3573 },
3574 {1, 1, 2, 0, /* 0xf3 */
3575 {{0, 1},
3576 {4, 7},
3577 {0, 0},
3578 {0, 0}
3579 }
3580 },
3581 {0, 1, 2, 0, /* 0xf4 */
3582 {{2, 2},
3583 {4, 7},
3584 {0, 0},
3585 {0, 0}
3586 }
3587 },
3588 {1, 1, 3, 0, /* 0xf5 */
3589 {{0, 0},
3590 {2, 2},
3591 {4, 7},
3592 {0, 0}
3593 }
3594 },
3595 {0, 1, 2, 0, /* 0xf6 */
3596 {{1, 2},
3597 {4, 7},
3598 {0, 0},
3599 {0, 0}
3600 }
3601 },
3602 {1, 1, 2, 0, /* 0xf7 */
3603 {{0, 2},
3604 {4, 7},
3605 {0, 0},
3606 {0, 0}
3607 }
3608 },
3609 {0, 1, 1, 0, /* 0xf8 */
3610 {{3, 7},
3611 {0, 0},
3612 {0, 0},
3613 {0, 0}
3614 }
3615 },
3616 {1, 1, 2, 0, /* 0xf9 */
3617 {{0, 0},
3618 {3, 7},
3619 {0, 0},
3620 {0, 0}
3621 }
3622 },
3623 {0, 1, 2, 0, /* 0xfa */
3624 {{1, 1},
3625 {3, 7},
3626 {0, 0},
3627 {0, 0}
3628 }
3629 },
3630 {1, 1, 2, 0, /* 0xfb */
3631 {{0, 1},
3632 {3, 7},
3633 {0, 0},
3634 {0, 0}
3635 }
3636 },
3637 {0, 1, 1, 0, /* 0xfc */
3638 {{2, 7},
3639 {0, 0},
3640 {0, 0},
3641 {0, 0}
3642 }
3643 },
3644 {1, 1, 2, 0, /* 0xfd */
3645 {{0, 0},
3646 {2, 7},
3647 {0, 0},
3648 {0, 0}
3649 }
3650 },
3651 {0, 1, 1, 0, /* 0xfe */
3652 {{1, 7},
3653 {0, 0},
3654 {0, 0},
3655 {0, 0}
3656 }
3657 },
3658 {1, 1, 1, 0, /* 0xff */
3659 {{0, 7},
3660 {0, 0},
3661 {0, 0},
3662 {0, 0}
3663 }
3664 }
3665};
3666
3667
3668
3669int
3670sctp_is_address_in_scope(struct sctp_ifa *ifa,
3671 int ipv4_addr_legal,
3672 int ipv6_addr_legal,
3673 int loopback_scope,
3674 int ipv4_local_scope,
3675 int local_scope,
3676 int site_scope,

--- 1953 unchanged lines hidden (view full) ---

5630 flowTop = ((flowlabel & 0x000f0000) >> 16);
5631 tosTop = (((flowlabel & 0xf0) >> 4) | IPV6_VERSION);
5632 /* protect *sin6 from overwrite */
5633 sin6 = (struct sockaddr_in6 *)to;
5634 tmp = *sin6;
5635 sin6 = &tmp;
5636
5637 /* KAME hack: embed scopeid */
1863int
1864sctp_is_address_in_scope(struct sctp_ifa *ifa,
1865 int ipv4_addr_legal,
1866 int ipv6_addr_legal,
1867 int loopback_scope,
1868 int ipv4_local_scope,
1869 int local_scope,
1870 int site_scope,

--- 1953 unchanged lines hidden (view full) ---

3824 flowTop = ((flowlabel & 0x000f0000) >> 16);
3825 tosTop = (((flowlabel & 0xf0) >> 4) | IPV6_VERSION);
3826 /* protect *sin6 from overwrite */
3827 sin6 = (struct sockaddr_in6 *)to;
3828 tmp = *sin6;
3829 sin6 = &tmp;
3830
3831 /* KAME hack: embed scopeid */
5638 if (sa6_embedscope(sin6, MODULE_GLOBAL(MOD_INET6, ip6_use_defzone)) != 0) {
3832 if (sa6_embedscope(sin6, MODULE_GLOBAL(ip6_use_defzone)) != 0) {
5639 SCTP_LTRACE_ERR_RET_PKT(m, inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EINVAL);
5640 return (EINVAL);
5641 }
5642 if (net == NULL) {
5643 memset(&ip6route, 0, sizeof(ip6route));
5644 ro = (sctp_route_t *) & ip6route;
5645 memcpy(&ro->ro_dst, sin6, sin6->sin6_len);
5646 } else {

--- 37 unchanged lines hidden (view full) ---

5684 if (ro->ro_rt) {
5685 RTFREE(ro->ro_rt);
5686 ro->ro_rt = NULL;
5687 }
5688 }
5689 if (net->src_addr_selected == 0) {
5690 sin6 = (struct sockaddr_in6 *)&net->ro._l_addr;
5691 /* KAME hack: embed scopeid */
3833 SCTP_LTRACE_ERR_RET_PKT(m, inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EINVAL);
3834 return (EINVAL);
3835 }
3836 if (net == NULL) {
3837 memset(&ip6route, 0, sizeof(ip6route));
3838 ro = (sctp_route_t *) & ip6route;
3839 memcpy(&ro->ro_dst, sin6, sin6->sin6_len);
3840 } else {

--- 37 unchanged lines hidden (view full) ---

3878 if (ro->ro_rt) {
3879 RTFREE(ro->ro_rt);
3880 ro->ro_rt = NULL;
3881 }
3882 }
3883 if (net->src_addr_selected == 0) {
3884 sin6 = (struct sockaddr_in6 *)&net->ro._l_addr;
3885 /* KAME hack: embed scopeid */
5692 if (sa6_embedscope(sin6, MODULE_GLOBAL(MOD_INET6, ip6_use_defzone)) != 0) {
3886 if (sa6_embedscope(sin6, MODULE_GLOBAL(ip6_use_defzone)) != 0) {
5693 SCTP_LTRACE_ERR_RET_PKT(m, inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EINVAL);
5694 return (EINVAL);
5695 }
5696 /* Cache the source address */
5697 net->ro._s_addr = sctp_source_address_selection(inp,
5698 stcb,
5699 ro,
5700 net,

--- 6 unchanged lines hidden (view full) ---

5707 SCTPDBG(SCTP_DEBUG_OUTPUT3, "V6:No route to host\n");
5708 net->src_addr_selected = 0;
5709 goto no_route;
5710 }
5711 lsa6->sin6_addr = net->ro._s_addr->address.sin6.sin6_addr;
5712 } else {
5713 sin6 = (struct sockaddr_in6 *)&ro->ro_dst;
5714 /* KAME hack: embed scopeid */
3887 SCTP_LTRACE_ERR_RET_PKT(m, inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EINVAL);
3888 return (EINVAL);
3889 }
3890 /* Cache the source address */
3891 net->ro._s_addr = sctp_source_address_selection(inp,
3892 stcb,
3893 ro,
3894 net,

--- 6 unchanged lines hidden (view full) ---

3901 SCTPDBG(SCTP_DEBUG_OUTPUT3, "V6:No route to host\n");
3902 net->src_addr_selected = 0;
3903 goto no_route;
3904 }
3905 lsa6->sin6_addr = net->ro._s_addr->address.sin6.sin6_addr;
3906 } else {
3907 sin6 = (struct sockaddr_in6 *)&ro->ro_dst;
3908 /* KAME hack: embed scopeid */
5715 if (sa6_embedscope(sin6, MODULE_GLOBAL(MOD_INET6, ip6_use_defzone)) != 0) {
3909 if (sa6_embedscope(sin6, MODULE_GLOBAL(ip6_use_defzone)) != 0) {
5716 SCTP_LTRACE_ERR_RET_PKT(m, inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EINVAL);
5717 return (EINVAL);
5718 }
5719 if (over_addr == NULL) {
5720 struct sctp_ifa *_lsrc;
5721
5722 _lsrc = sctp_source_address_selection(inp, stcb, ro,
5723 net,

--- 277 unchanged lines hidden (view full) ---

6001 /* now the chunk header */
6002 init->ch.chunk_type = SCTP_INITIATION;
6003 init->ch.chunk_flags = 0;
6004 /* fill in later from mbuf we build */
6005 init->ch.chunk_length = 0;
6006 /* place in my tag */
6007 init->init.initiate_tag = htonl(stcb->asoc.my_vtag);
6008 /* set up some of the credits. */
3910 SCTP_LTRACE_ERR_RET_PKT(m, inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EINVAL);
3911 return (EINVAL);
3912 }
3913 if (over_addr == NULL) {
3914 struct sctp_ifa *_lsrc;
3915
3916 _lsrc = sctp_source_address_selection(inp, stcb, ro,
3917 net,

--- 277 unchanged lines hidden (view full) ---

4195 /* now the chunk header */
4196 init->ch.chunk_type = SCTP_INITIATION;
4197 init->ch.chunk_flags = 0;
4198 /* fill in later from mbuf we build */
4199 init->ch.chunk_length = 0;
4200 /* place in my tag */
4201 init->init.initiate_tag = htonl(stcb->asoc.my_vtag);
4202 /* set up some of the credits. */
6009 init->init.a_rwnd = htonl(max(SCTP_SB_LIMIT_RCV(inp->sctp_socket),
4203 init->init.a_rwnd = htonl(max(inp->sctp_socket ? SCTP_SB_LIMIT_RCV(inp->sctp_socket) : 0,
6010 SCTP_MINIMAL_RWND));
6011
6012 init->init.num_outbound_streams = htons(stcb->asoc.pre_open_streams);
6013 init->init.num_inbound_streams = htons(stcb->asoc.max_inbound_streams);
6014 init->init.initial_tsn = htonl(stcb->asoc.init_seq_number);
6015 /* now the address restriction */
6016 sup_addr = (struct sctp_supported_addr_param *)((caddr_t)init +
6017 sizeof(*init));

--- 194 unchanged lines hidden (view full) ---

6212 SCTPDBG(SCTP_DEBUG_OUTPUT4, "Sending INIT - calls lowlevel_output\n");
6213 ret = sctp_lowlevel_chunk_output(inp, stcb, net,
6214 (struct sockaddr *)&net->ro._l_addr,
6215 m, 0, NULL, 0, 0, 0, NULL, 0,
6216 inp->sctp_lport, stcb->rport, htonl(0),
6217 net->port, so_locked, NULL);
6218 SCTPDBG(SCTP_DEBUG_OUTPUT4, "lowlevel_output - %d\n", ret);
6219 SCTP_STAT_INCR_COUNTER64(sctps_outcontrolchunks);
4204 SCTP_MINIMAL_RWND));
4205
4206 init->init.num_outbound_streams = htons(stcb->asoc.pre_open_streams);
4207 init->init.num_inbound_streams = htons(stcb->asoc.max_inbound_streams);
4208 init->init.initial_tsn = htonl(stcb->asoc.init_seq_number);
4209 /* now the address restriction */
4210 sup_addr = (struct sctp_supported_addr_param *)((caddr_t)init +
4211 sizeof(*init));

--- 194 unchanged lines hidden (view full) ---

4406 SCTPDBG(SCTP_DEBUG_OUTPUT4, "Sending INIT - calls lowlevel_output\n");
4407 ret = sctp_lowlevel_chunk_output(inp, stcb, net,
4408 (struct sockaddr *)&net->ro._l_addr,
4409 m, 0, NULL, 0, 0, 0, NULL, 0,
4410 inp->sctp_lport, stcb->rport, htonl(0),
4411 net->port, so_locked, NULL);
4412 SCTPDBG(SCTP_DEBUG_OUTPUT4, "lowlevel_output - %d\n", ret);
4413 SCTP_STAT_INCR_COUNTER64(sctps_outcontrolchunks);
6220 sctp_timer_start(SCTP_TIMER_TYPE_INIT, inp, stcb, net);
6221 (void)SCTP_GETTIME_TIMEVAL(&net->last_sent_time);
6222}
6223
6224struct mbuf *
6225sctp_arethere_unrecognized_parameters(struct mbuf *in_initpkt,
6226 int param_offset, int *abort_processing, struct sctp_chunkhdr *cp, int *nat_friendly)
6227{
6228 /*

--- 716 unchanged lines hidden (view full) ---

6945 stc.scope_id = 0;
6946 if (sctp_is_address_on_local_host((struct sockaddr *)sin6, vrf_id)) {
6947 /*
6948 * FIX ME: does this have scope from
6949 * rcvif?
6950 */
6951 (void)sa6_recoverscope(sin6);
6952 stc.scope_id = sin6->sin6_scope_id;
4414 (void)SCTP_GETTIME_TIMEVAL(&net->last_sent_time);
4415}
4416
4417struct mbuf *
4418sctp_arethere_unrecognized_parameters(struct mbuf *in_initpkt,
4419 int param_offset, int *abort_processing, struct sctp_chunkhdr *cp, int *nat_friendly)
4420{
4421 /*

--- 716 unchanged lines hidden (view full) ---

5138 stc.scope_id = 0;
5139 if (sctp_is_address_on_local_host((struct sockaddr *)sin6, vrf_id)) {
5140 /*
5141 * FIX ME: does this have scope from
5142 * rcvif?
5143 */
5144 (void)sa6_recoverscope(sin6);
5145 stc.scope_id = sin6->sin6_scope_id;
6953 sa6_embedscope(sin6, MODULE_GLOBAL(MOD_INET6, ip6_use_defzone));
5146 sa6_embedscope(sin6, MODULE_GLOBAL(ip6_use_defzone));
6954 stc.loopback_scope = 1;
6955 stc.local_scope = 0;
6956 stc.site_scope = 1;
6957 stc.ipv4_scope = 1;
6958 } else if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) {
6959 /*
6960 * If the new destination is a
6961 * LINK_LOCAL we must have common

--- 19 unchanged lines hidden (view full) ---

6981 * incoming pkt
6982 */
6983 /*
6984 * FIX ME: does this have scope from
6985 * rcvif?
6986 */
6987 (void)sa6_recoverscope(sin6);
6988 stc.scope_id = sin6->sin6_scope_id;
5147 stc.loopback_scope = 1;
5148 stc.local_scope = 0;
5149 stc.site_scope = 1;
5150 stc.ipv4_scope = 1;
5151 } else if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) {
5152 /*
5153 * If the new destination is a
5154 * LINK_LOCAL we must have common

--- 19 unchanged lines hidden (view full) ---

5174 * incoming pkt
5175 */
5176 /*
5177 * FIX ME: does this have scope from
5178 * rcvif?
5179 */
5180 (void)sa6_recoverscope(sin6);
5181 stc.scope_id = sin6->sin6_scope_id;
6989 sa6_embedscope(sin6, MODULE_GLOBAL(MOD_INET6, ip6_use_defzone));
5182 sa6_embedscope(sin6, MODULE_GLOBAL(ip6_use_defzone));
6990 } else if (IN6_IS_ADDR_SITELOCAL(&sin6->sin6_addr)) {
6991 /*
6992 * If the new destination is
6993 * SITE_LOCAL then we must have site
6994 * scope in common.
6995 */
6996 stc.site_scope = 1;
6997 }

--- 442 unchanged lines hidden (view full) ---

7440 }
7441 }
7442outof_here:
7443 if (holds_lock == 0) {
7444 SCTP_TCB_SEND_UNLOCK(stcb);
7445 }
7446}
7447
5183 } else if (IN6_IS_ADDR_SITELOCAL(&sin6->sin6_addr)) {
5184 /*
5185 * If the new destination is
5186 * SITE_LOCAL then we must have site
5187 * scope in common.
5188 */
5189 stc.site_scope = 1;
5190 }

--- 442 unchanged lines hidden (view full) ---

5633 }
5634 }
5635outof_here:
5636 if (holds_lock == 0) {
5637 SCTP_TCB_SEND_UNLOCK(stcb);
5638 }
5639}
5640
7448static void
5641void
7449sctp_remove_from_wheel(struct sctp_tcb *stcb,
7450 struct sctp_association *asoc,
5642sctp_remove_from_wheel(struct sctp_tcb *stcb,
5643 struct sctp_association *asoc,
7451 struct sctp_stream_out *strq)
5644 struct sctp_stream_out *strq,
5645 int holds_lock)
7452{
7453 /* take off and then setup so we know it is not on the wheel */
5646{
5647 /* take off and then setup so we know it is not on the wheel */
7454 SCTP_TCB_SEND_LOCK(stcb);
5648 if (holds_lock == 0)
5649 SCTP_TCB_SEND_LOCK(stcb);
7455 if (TAILQ_FIRST(&strq->outqueue)) {
7456 /* more was added */
5650 if (TAILQ_FIRST(&strq->outqueue)) {
5651 /* more was added */
7457 SCTP_TCB_SEND_UNLOCK(stcb);
5652 if (holds_lock == 0)
5653 SCTP_TCB_SEND_UNLOCK(stcb);
7458 return;
7459 }
7460 TAILQ_REMOVE(&asoc->out_wheel, strq, next_spoke);
7461 strq->next_spoke.tqe_next = NULL;
7462 strq->next_spoke.tqe_prev = NULL;
5654 return;
5655 }
5656 TAILQ_REMOVE(&asoc->out_wheel, strq, next_spoke);
5657 strq->next_spoke.tqe_next = NULL;
5658 strq->next_spoke.tqe_prev = NULL;
7463 SCTP_TCB_SEND_UNLOCK(stcb);
5659 if (holds_lock == 0)
5660 SCTP_TCB_SEND_UNLOCK(stcb);
7464}
7465
7466static void
7467sctp_prune_prsctp(struct sctp_tcb *stcb,
7468 struct sctp_association *asoc,
7469 struct sctp_sndrcvinfo *srcv,
7470 int dataout)
7471{

--- 32 unchanged lines hidden (view full) ---

7504 int cause;
7505
7506 if (chk->sent > SCTP_DATAGRAM_UNSENT)
7507 cause = SCTP_RESPONSE_TO_USER_REQ | SCTP_NOTIFY_DATAGRAM_SENT;
7508 else
7509 cause = SCTP_RESPONSE_TO_USER_REQ | SCTP_NOTIFY_DATAGRAM_UNSENT;
7510 ret_spc = sctp_release_pr_sctp_chunk(stcb, chk,
7511 cause,
5661}
5662
5663static void
5664sctp_prune_prsctp(struct sctp_tcb *stcb,
5665 struct sctp_association *asoc,
5666 struct sctp_sndrcvinfo *srcv,
5667 int dataout)
5668{

--- 32 unchanged lines hidden (view full) ---

5701 int cause;
5702
5703 if (chk->sent > SCTP_DATAGRAM_UNSENT)
5704 cause = SCTP_RESPONSE_TO_USER_REQ | SCTP_NOTIFY_DATAGRAM_SENT;
5705 else
5706 cause = SCTP_RESPONSE_TO_USER_REQ | SCTP_NOTIFY_DATAGRAM_UNSENT;
5707 ret_spc = sctp_release_pr_sctp_chunk(stcb, chk,
5708 cause,
7512 &asoc->sent_queue, SCTP_SO_LOCKED);
5709 SCTP_SO_LOCKED);
7513 freed_spc += ret_spc;
7514 if (freed_spc >= dataout) {
7515 return;
7516 }
7517 } /* if chunk was present */
7518 } /* if of sufficent priority */
7519 } /* if chunk has enabled */
7520 } /* tailqforeach */

--- 8 unchanged lines hidden (view full) ---

7529 /*
7530 * We release the book_size
7531 * if the mbuf is here
7532 */
7533 int ret_spc;
7534
7535 ret_spc = sctp_release_pr_sctp_chunk(stcb, chk,
7536 SCTP_RESPONSE_TO_USER_REQ | SCTP_NOTIFY_DATAGRAM_UNSENT,
5710 freed_spc += ret_spc;
5711 if (freed_spc >= dataout) {
5712 return;
5713 }
5714 } /* if chunk was present */
5715 } /* if of sufficent priority */
5716 } /* if chunk has enabled */
5717 } /* tailqforeach */

--- 8 unchanged lines hidden (view full) ---

5726 /*
5727 * We release the book_size
5728 * if the mbuf is here
5729 */
5730 int ret_spc;
5731
5732 ret_spc = sctp_release_pr_sctp_chunk(stcb, chk,
5733 SCTP_RESPONSE_TO_USER_REQ | SCTP_NOTIFY_DATAGRAM_UNSENT,
7537 &asoc->send_queue, SCTP_SO_LOCKED);
5734 SCTP_SO_LOCKED);
7538
7539 freed_spc += ret_spc;
7540 if (freed_spc >= dataout) {
7541 return;
7542 }
7543 } /* end if chk->data */
7544 } /* end if right class */
7545 } /* end if chk pr-sctp */

--- 37 unchanged lines hidden (view full) ---

7583 if (siz % 4) {
7584 /* make it an even word boundary please */
7585 siz -= (siz % 4);
7586 }
7587 return (siz);
7588}
7589
7590static void
5735
5736 freed_spc += ret_spc;
5737 if (freed_spc >= dataout) {
5738 return;
5739 }
5740 } /* end if chk->data */
5741 } /* end if right class */
5742 } /* end if chk pr-sctp */

--- 37 unchanged lines hidden (view full) ---

5780 if (siz % 4) {
5781 /* make it an even word boundary please */
5782 siz -= (siz % 4);
5783 }
5784 return (siz);
5785}
5786
5787static void
7591sctp_set_prsctp_policy(struct sctp_tcb *stcb,
7592 struct sctp_stream_queue_pending *sp)
5788sctp_set_prsctp_policy(struct sctp_stream_queue_pending *sp)
7593{
7594 sp->pr_sctp_on = 0;
5789{
5790 sp->pr_sctp_on = 0;
7595 if (stcb->asoc.peer_supports_prsctp) {
5791 /*
5792 * We assume that the user wants PR_SCTP_TTL if the user provides a
5793 * positive lifetime but does not specify any PR_SCTP policy. This
5794 * is a BAD assumption and causes problems at least with the
5795 * U-Vancovers MPI folks. I will change this to be no policy means
5796 * NO PR-SCTP.
5797 */
5798 if (PR_SCTP_ENABLED(sp->sinfo_flags)) {
5799 sp->act_flags |= PR_SCTP_POLICY(sp->sinfo_flags);
5800 sp->pr_sctp_on = 1;
5801 } else {
5802 return;
5803 }
5804 switch (PR_SCTP_POLICY(sp->sinfo_flags)) {
5805 case CHUNK_FLAGS_PR_SCTP_BUF:
7596 /*
5806 /*
7597 * We assume that the user wants PR_SCTP_TTL if the user
7598 * provides a positive lifetime but does not specify any
7599 * PR_SCTP policy. This is a BAD assumption and causes
7600 * problems at least with the U-Vancovers MPI folks. I will
7601 * change this to be no policy means NO PR-SCTP.
5807 * Time to live is a priority stored in tv_sec when doing
5808 * the buffer drop thing.
7602 */
5809 */
7603 if (PR_SCTP_ENABLED(sp->sinfo_flags)) {
7604 sp->act_flags |= PR_SCTP_POLICY(sp->sinfo_flags);
7605 sp->pr_sctp_on = 1;
7606 } else {
7607 return;
7608 }
7609 switch (PR_SCTP_POLICY(sp->sinfo_flags)) {
7610 case CHUNK_FLAGS_PR_SCTP_BUF:
7611 /*
7612 * Time to live is a priority stored in tv_sec when
7613 * doing the buffer drop thing.
7614 */
7615 sp->ts.tv_sec = sp->timetolive;
7616 sp->ts.tv_usec = 0;
7617 break;
7618 case CHUNK_FLAGS_PR_SCTP_TTL:
7619 {
7620 struct timeval tv;
5810 sp->ts.tv_sec = sp->timetolive;
5811 sp->ts.tv_usec = 0;
5812 break;
5813 case CHUNK_FLAGS_PR_SCTP_TTL:
5814 {
5815 struct timeval tv;
7621
5816
7622 (void)SCTP_GETTIME_TIMEVAL(&sp->ts);
7623 tv.tv_sec = sp->timetolive / 1000;
7624 tv.tv_usec = (sp->timetolive * 1000) % 1000000;
7625 /*
7626 * TODO sctp_constants.h needs alternative
7627 * time macros when _KERNEL is undefined.
7628 */
7629 timevaladd(&sp->ts, &tv);
7630 }
7631 break;
7632 case CHUNK_FLAGS_PR_SCTP_RTX:
5817 (void)SCTP_GETTIME_TIMEVAL(&sp->ts);
5818 tv.tv_sec = sp->timetolive / 1000;
5819 tv.tv_usec = (sp->timetolive * 1000) % 1000000;
7633 /*
5820 /*
7634 * Time to live is a the number or retransmissions
7635 * stored in tv_sec.
5821 * TODO sctp_constants.h needs alternative time
5822 * macros when _KERNEL is undefined.
7636 */
5823 */
7637 sp->ts.tv_sec = sp->timetolive;
7638 sp->ts.tv_usec = 0;
7639 break;
7640 default:
7641 SCTPDBG(SCTP_DEBUG_USRREQ1,
7642 "Unknown PR_SCTP policy %u.\n",
7643 PR_SCTP_POLICY(sp->sinfo_flags));
7644 break;
5824 timevaladd(&sp->ts, &tv);
7645 }
5825 }
5826 break;
5827 case CHUNK_FLAGS_PR_SCTP_RTX:
5828 /*
5829 * Time to live is a the number or retransmissions stored in
5830 * tv_sec.
5831 */
5832 sp->ts.tv_sec = sp->timetolive;
5833 sp->ts.tv_usec = 0;
5834 break;
5835 default:
5836 SCTPDBG(SCTP_DEBUG_USRREQ1,
5837 "Unknown PR_SCTP policy %u.\n",
5838 PR_SCTP_POLICY(sp->sinfo_flags));
5839 break;
7646 }
7647}
7648
7649static int
7650sctp_msg_append(struct sctp_tcb *stcb,
7651 struct sctp_nets *net,
7652 struct mbuf *m,
7653 struct sctp_sndrcvinfo *srcv, int hold_stcb_lock)

--- 54 unchanged lines hidden (view full) ---

7708 sp->stream = srcv->sinfo_stream;
7709 sp->msg_is_complete = 1;
7710 sp->sender_all_done = 1;
7711 sp->some_taken = 0;
7712 sp->data = m;
7713 sp->tail_mbuf = NULL;
7714 sp->length = 0;
7715 at = m;
5840 }
5841}
5842
5843static int
5844sctp_msg_append(struct sctp_tcb *stcb,
5845 struct sctp_nets *net,
5846 struct mbuf *m,
5847 struct sctp_sndrcvinfo *srcv, int hold_stcb_lock)

--- 54 unchanged lines hidden (view full) ---

5902 sp->stream = srcv->sinfo_stream;
5903 sp->msg_is_complete = 1;
5904 sp->sender_all_done = 1;
5905 sp->some_taken = 0;
5906 sp->data = m;
5907 sp->tail_mbuf = NULL;
5908 sp->length = 0;
5909 at = m;
7716 sctp_set_prsctp_policy(stcb, sp);
5910 sctp_set_prsctp_policy(sp);
7717 /*
7718 * We could in theory (for sendall) sifa the length in, but we would
7719 * still have to hunt through the chain since we need to setup the
7720 * tail_mbuf
7721 */
7722 while (at) {
7723 if (SCTP_BUF_NEXT(at) == NULL)
7724 sp->tail_mbuf = at;

--- 186 unchanged lines hidden (view full) ---

7911}
7912
7913int
7914sctp_med_chunk_output(struct sctp_inpcb *inp,
7915 struct sctp_tcb *stcb,
7916 struct sctp_association *asoc,
7917 int *num_out,
7918 int *reason_code,
5911 /*
5912 * We could in theory (for sendall) sifa the length in, but we would
5913 * still have to hunt through the chain since we need to setup the
5914 * tail_mbuf
5915 */
5916 while (at) {
5917 if (SCTP_BUF_NEXT(at) == NULL)
5918 sp->tail_mbuf = at;

--- 186 unchanged lines hidden (view full) ---

6105}
6106
6107int
6108sctp_med_chunk_output(struct sctp_inpcb *inp,
6109 struct sctp_tcb *stcb,
6110 struct sctp_association *asoc,
6111 int *num_out,
6112 int *reason_code,
7919 int control_only, int *cwnd_full, int from_where,
6113 int control_only, int from_where,
7920 struct timeval *now, int *now_filled, int frag_point, int so_locked
7921#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING)
7922 SCTP_UNUSED
7923#endif
7924);
7925
7926static void
7927sctp_sendall_iterator(struct sctp_inpcb *inp, struct sctp_tcb *stcb, void *ptr,

--- 169 unchanged lines hidden (view full) ---

8097 (stcb->asoc.total_flight > 0) &&
8098 (un_sent < (int)(stcb->asoc.smallest_mtu - SCTP_MIN_OVERHEAD))
8099 ) {
8100 do_chunk_output = 0;
8101 }
8102 if (do_chunk_output)
8103 sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_USR_SEND, SCTP_SO_NOT_LOCKED);
8104 else if (added_control) {
6114 struct timeval *now, int *now_filled, int frag_point, int so_locked
6115#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING)
6116 SCTP_UNUSED
6117#endif
6118);
6119
6120static void
6121sctp_sendall_iterator(struct sctp_inpcb *inp, struct sctp_tcb *stcb, void *ptr,

--- 169 unchanged lines hidden (view full) ---

6291 (stcb->asoc.total_flight > 0) &&
6292 (un_sent < (int)(stcb->asoc.smallest_mtu - SCTP_MIN_OVERHEAD))
6293 ) {
6294 do_chunk_output = 0;
6295 }
6296 if (do_chunk_output)
6297 sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_USR_SEND, SCTP_SO_NOT_LOCKED);
6298 else if (added_control) {
8105 int num_out = 0, reason = 0, cwnd_full = 0, now_filled = 0;
6299 int num_out = 0, reason = 0, now_filled = 0;
8106 struct timeval now;
8107 int frag_point;
8108
8109 frag_point = sctp_get_frag_point(stcb, &stcb->asoc);
8110 (void)sctp_med_chunk_output(inp, stcb, &stcb->asoc, &num_out,
6300 struct timeval now;
6301 int frag_point;
6302
6303 frag_point = sctp_get_frag_point(stcb, &stcb->asoc);
6304 (void)sctp_med_chunk_output(inp, stcb, &stcb->asoc, &num_out,
8111 &reason, 1, &cwnd_full, 1, &now, &now_filled, frag_point, SCTP_SO_NOT_LOCKED);
6305 &reason, 1, 1, &now, &now_filled, frag_point, SCTP_SO_NOT_LOCKED);
8112 }
8113no_chunk_output:
8114 if (ret) {
8115 ca->cnt_failed++;
8116 } else {
8117 ca->cnt_sent++;
8118 }
8119}

--- 276 unchanged lines hidden (view full) ---

8396
8397 for (chk = TAILQ_FIRST(&asoc->control_send_queue);
8398 chk; chk = nchk) {
8399 nchk = TAILQ_NEXT(chk, sctp_next);
8400 if ((chk->rec.chunk_id.id == SCTP_SELECTIVE_ACK) ||
8401 (chk->rec.chunk_id.id == SCTP_NR_SELECTIVE_ACK) || /* EY */
8402 (chk->rec.chunk_id.id == SCTP_HEARTBEAT_REQUEST) ||
8403 (chk->rec.chunk_id.id == SCTP_HEARTBEAT_ACK) ||
6306 }
6307no_chunk_output:
6308 if (ret) {
6309 ca->cnt_failed++;
6310 } else {
6311 ca->cnt_sent++;
6312 }
6313}

--- 276 unchanged lines hidden (view full) ---

6590
6591 for (chk = TAILQ_FIRST(&asoc->control_send_queue);
6592 chk; chk = nchk) {
6593 nchk = TAILQ_NEXT(chk, sctp_next);
6594 if ((chk->rec.chunk_id.id == SCTP_SELECTIVE_ACK) ||
6595 (chk->rec.chunk_id.id == SCTP_NR_SELECTIVE_ACK) || /* EY */
6596 (chk->rec.chunk_id.id == SCTP_HEARTBEAT_REQUEST) ||
6597 (chk->rec.chunk_id.id == SCTP_HEARTBEAT_ACK) ||
6598 (chk->rec.chunk_id.id == SCTP_FORWARD_CUM_TSN) ||
8404 (chk->rec.chunk_id.id == SCTP_SHUTDOWN) ||
8405 (chk->rec.chunk_id.id == SCTP_SHUTDOWN_ACK) ||
8406 (chk->rec.chunk_id.id == SCTP_OPERATION_ERROR) ||
8407 (chk->rec.chunk_id.id == SCTP_PACKET_DROPPED) ||
8408 (chk->rec.chunk_id.id == SCTP_COOKIE_ACK) ||
8409 (chk->rec.chunk_id.id == SCTP_ECN_CWR) ||
8410 (chk->rec.chunk_id.id == SCTP_ASCONF_ACK)) {
8411 /* Stray chunks must be cleaned up */

--- 126 unchanged lines hidden (view full) ---

8538 }
8539 if ((sp->msg_is_complete) && (sp->length == 0)) {
8540 if (sp->sender_all_done) {
8541 /*
8542 * We are doing differed cleanup. Last time through
8543 * when we took all the data the sender_all_done was
8544 * not set.
8545 */
6599 (chk->rec.chunk_id.id == SCTP_SHUTDOWN) ||
6600 (chk->rec.chunk_id.id == SCTP_SHUTDOWN_ACK) ||
6601 (chk->rec.chunk_id.id == SCTP_OPERATION_ERROR) ||
6602 (chk->rec.chunk_id.id == SCTP_PACKET_DROPPED) ||
6603 (chk->rec.chunk_id.id == SCTP_COOKIE_ACK) ||
6604 (chk->rec.chunk_id.id == SCTP_ECN_CWR) ||
6605 (chk->rec.chunk_id.id == SCTP_ASCONF_ACK)) {
6606 /* Stray chunks must be cleaned up */

--- 126 unchanged lines hidden (view full) ---

6733 }
6734 if ((sp->msg_is_complete) && (sp->length == 0)) {
6735 if (sp->sender_all_done) {
6736 /*
6737 * We are doing differed cleanup. Last time through
6738 * when we took all the data the sender_all_done was
6739 * not set.
6740 */
8546 if (sp->put_last_out == 0) {
6741 if ((sp->put_last_out == 0) && (sp->discard_rest == 0)) {
8547 SCTP_PRINTF("Gak, put out entire msg with NO end!-1\n");
8548 SCTP_PRINTF("sender_done:%d len:%d msg_comp:%d put_last_out:%d send_lock:%d\n",
8549 sp->sender_all_done,
8550 sp->length,
8551 sp->msg_is_complete,
8552 sp->put_last_out,
8553 send_lock_up);
8554 }

--- 4 unchanged lines hidden (view full) ---

8559 atomic_subtract_int(&asoc->stream_queue_cnt, 1);
8560 TAILQ_REMOVE(&strq->outqueue, sp, next);
8561 sctp_free_remote_addr(sp->net);
8562 if (sp->data) {
8563 sctp_m_freem(sp->data);
8564 sp->data = NULL;
8565 }
8566 sctp_free_a_strmoq(stcb, sp);
6742 SCTP_PRINTF("Gak, put out entire msg with NO end!-1\n");
6743 SCTP_PRINTF("sender_done:%d len:%d msg_comp:%d put_last_out:%d send_lock:%d\n",
6744 sp->sender_all_done,
6745 sp->length,
6746 sp->msg_is_complete,
6747 sp->put_last_out,
6748 send_lock_up);
6749 }

--- 4 unchanged lines hidden (view full) ---

6754 atomic_subtract_int(&asoc->stream_queue_cnt, 1);
6755 TAILQ_REMOVE(&strq->outqueue, sp, next);
6756 sctp_free_remote_addr(sp->net);
6757 if (sp->data) {
6758 sctp_m_freem(sp->data);
6759 sp->data = NULL;
6760 }
6761 sctp_free_a_strmoq(stcb, sp);
8567
8568 /* we can't be locked to it */
8569 *locked = 0;
8570 stcb->asoc.locked_on_sending = NULL;
8571 if (send_lock_up) {
8572 SCTP_TCB_SEND_UNLOCK(stcb);
8573 send_lock_up = 0;
8574 }
8575 /* back to get the next msg */

--- 11 unchanged lines hidden (view full) ---

8587 } else {
8588 /* is there some to get */
8589 if (sp->length == 0) {
8590 /* no */
8591 *locked = 1;
8592 *giveup = 1;
8593 to_move = 0;
8594 goto out_of;
6762 /* we can't be locked to it */
6763 *locked = 0;
6764 stcb->asoc.locked_on_sending = NULL;
6765 if (send_lock_up) {
6766 SCTP_TCB_SEND_UNLOCK(stcb);
6767 send_lock_up = 0;
6768 }
6769 /* back to get the next msg */

--- 11 unchanged lines hidden (view full) ---

6781 } else {
6782 /* is there some to get */
6783 if (sp->length == 0) {
6784 /* no */
6785 *locked = 1;
6786 *giveup = 1;
6787 to_move = 0;
6788 goto out_of;
6789 } else if (sp->discard_rest) {
6790 if (send_lock_up == 0) {
6791 SCTP_TCB_SEND_LOCK(stcb);
6792 send_lock_up = 1;
6793 }
6794 /* Whack down the size */
6795 atomic_subtract_int(&stcb->asoc.total_output_queue_size, sp->length);
6796 if ((stcb->sctp_socket != NULL) && \
6797 ((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
6798 (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL))) {
6799 atomic_subtract_int(&stcb->sctp_socket->so_snd.sb_cc, sp->length);
6800 }
6801 if (sp->data) {
6802 sctp_m_freem(sp->data);
6803 sp->data = NULL;
6804 sp->tail_mbuf = NULL;
6805 }
6806 sp->length = 0;
6807 sp->some_taken = 1;
6808 *locked = 1;
6809 *giveup = 1;
6810 to_move = 0;
6811 goto out_of;
8595 }
8596 }
8597 some_taken = sp->some_taken;
8598 if (stcb->asoc.state & SCTP_STATE_CLOSED_SOCKET) {
8599 sp->msg_is_complete = 1;
8600 }
8601re_look:
8602 length = sp->length;

--- 309 unchanged lines hidden (view full) ---

8912 if ((lm = SCTP_BUF_NEXT(chk->last_mbuf)) != NULL) {
8913 /* pad added an mbuf */
8914 chk->last_mbuf = lm;
8915 }
8916 chk->send_size += pads;
8917 }
8918 /* We only re-set the policy if it is on */
8919 if (sp->pr_sctp_on) {
6812 }
6813 }
6814 some_taken = sp->some_taken;
6815 if (stcb->asoc.state & SCTP_STATE_CLOSED_SOCKET) {
6816 sp->msg_is_complete = 1;
6817 }
6818re_look:
6819 length = sp->length;

--- 309 unchanged lines hidden (view full) ---

7129 if ((lm = SCTP_BUF_NEXT(chk->last_mbuf)) != NULL) {
7130 /* pad added an mbuf */
7131 chk->last_mbuf = lm;
7132 }
7133 chk->send_size += pads;
7134 }
7135 /* We only re-set the policy if it is on */
7136 if (sp->pr_sctp_on) {
8920 sctp_set_prsctp_policy(stcb, sp);
7137 sctp_set_prsctp_policy(sp);
8921 asoc->pr_sctp_cnt++;
8922 chk->pr_sctp_on = 1;
8923 } else {
8924 chk->pr_sctp_on = 0;
8925 }
8926 if (sp->msg_is_complete && (sp->length == 0) && (sp->sender_all_done)) {
8927 /* All done pull and kill the message */
8928 atomic_subtract_int(&asoc->stream_queue_cnt, 1);

--- 149 unchanged lines hidden (view full) ---

9078 strqn = TAILQ_NEXT(asoc->last_out_stream, next_spoke);
9079 if (strqn == NULL) {
9080 strqn = TAILQ_FIRST(&asoc->out_wheel);
9081 if (strqn == NULL) {
9082 break;
9083 }
9084 }
9085 }
7138 asoc->pr_sctp_cnt++;
7139 chk->pr_sctp_on = 1;
7140 } else {
7141 chk->pr_sctp_on = 0;
7142 }
7143 if (sp->msg_is_complete && (sp->length == 0) && (sp->sender_all_done)) {
7144 /* All done pull and kill the message */
7145 atomic_subtract_int(&asoc->stream_queue_cnt, 1);

--- 149 unchanged lines hidden (view full) ---

7295 strqn = TAILQ_NEXT(asoc->last_out_stream, next_spoke);
7296 if (strqn == NULL) {
7297 strqn = TAILQ_FIRST(&asoc->out_wheel);
7298 if (strqn == NULL) {
7299 break;
7300 }
7301 }
7302 }
9086 sctp_remove_from_wheel(stcb, asoc, strq);
7303 sctp_remove_from_wheel(stcb, asoc, strq, 0);
9087 }
9088 if ((giveup) || bail) {
9089 break;
9090 }
9091 strq = strqt;
9092 if (strq == NULL) {
9093 break;
9094 }

--- 68 unchanged lines hidden (view full) ---

9163}
9164
9165int
9166sctp_med_chunk_output(struct sctp_inpcb *inp,
9167 struct sctp_tcb *stcb,
9168 struct sctp_association *asoc,
9169 int *num_out,
9170 int *reason_code,
7304 }
7305 if ((giveup) || bail) {
7306 break;
7307 }
7308 strq = strqt;
7309 if (strq == NULL) {
7310 break;
7311 }

--- 68 unchanged lines hidden (view full) ---

7380}
7381
7382int
7383sctp_med_chunk_output(struct sctp_inpcb *inp,
7384 struct sctp_tcb *stcb,
7385 struct sctp_association *asoc,
7386 int *num_out,
7387 int *reason_code,
9171 int control_only, int *cwnd_full, int from_where,
7388 int control_only, int from_where,
9172 struct timeval *now, int *now_filled, int frag_point, int so_locked
9173#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING)
9174 SCTP_UNUSED
9175#endif
9176)
9177{
9178 /*
9179 * Ok this is the generic chunk service queue. we must do the
9180 * following: - Service the stream queue that is next, moving any
9181 * message (note I must get a complete message i.e. FIRST/MIDDLE and
9182 * LAST to the out queue in one pass) and assigning TSN's - Check to
9183 * see if the cwnd/rwnd allows any output, if so we go ahead and
9184 * fomulate and send the low level chunks. Making sure to combine
9185 * any control in the control chunk queue also.
9186 */
7389 struct timeval *now, int *now_filled, int frag_point, int so_locked
7390#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING)
7391 SCTP_UNUSED
7392#endif
7393)
7394{
7395 /*
7396 * Ok this is the generic chunk service queue. we must do the
7397 * following: - Service the stream queue that is next, moving any
7398 * message (note I must get a complete message i.e. FIRST/MIDDLE and
7399 * LAST to the out queue in one pass) and assigning TSN's - Check to
7400 * see if the cwnd/rwnd allows any output, if so we go ahead and
7401 * fomulate and send the low level chunks. Making sure to combine
7402 * any control in the control chunk queue also.
7403 */
9187 struct sctp_nets *net;
7404 struct sctp_nets *net, *start_at, *old_start_at = NULL;
9188 struct mbuf *outchain, *endoutchain;
9189 struct sctp_tmit_chunk *chk, *nchk;
9190
9191 /* temp arrays for unlinking */
9192 struct sctp_tmit_chunk *data_list[SCTP_MAX_DATA_BUNDLING];
9193 int no_fragmentflg, error;
7405 struct mbuf *outchain, *endoutchain;
7406 struct sctp_tmit_chunk *chk, *nchk;
7407
7408 /* temp arrays for unlinking */
7409 struct sctp_tmit_chunk *data_list[SCTP_MAX_DATA_BUNDLING];
7410 int no_fragmentflg, error;
7411 unsigned int max_rwnd_per_dest;
9194 int one_chunk, hbflag, skip_data_for_this_net;
9195 int asconf, cookie, no_out_cnt;
7412 int one_chunk, hbflag, skip_data_for_this_net;
7413 int asconf, cookie, no_out_cnt;
9196 int bundle_at, ctl_cnt, no_data_chunks, cwnd_full_ind, eeor_mode;
7414 int bundle_at, ctl_cnt, no_data_chunks, eeor_mode;
9197 unsigned int mtu, r_mtu, omtu, mx_mtu, to_out;
7415 unsigned int mtu, r_mtu, omtu, mx_mtu, to_out;
9198 struct sctp_nets *start_at, *old_startat = NULL, *send_start_at;
9199 int tsns_sent = 0;
9200 uint32_t auth_offset = 0;
9201 struct sctp_auth_chunk *auth = NULL;
9202 uint16_t auth_keyid;
9203 int override_ok = 1;
9204 int data_auth_reqd = 0;
9205
9206 /*
9207 * JRS 5/14/07 - Add flag for whether a heartbeat is sent to the
9208 * destination.
9209 */
9210 int pf_hbflag = 0;
9211 int quit_now = 0;
9212
9213 *num_out = 0;
7416 int tsns_sent = 0;
7417 uint32_t auth_offset = 0;
7418 struct sctp_auth_chunk *auth = NULL;
7419 uint16_t auth_keyid;
7420 int override_ok = 1;
7421 int data_auth_reqd = 0;
7422
7423 /*
7424 * JRS 5/14/07 - Add flag for whether a heartbeat is sent to the
7425 * destination.
7426 */
7427 int pf_hbflag = 0;
7428 int quit_now = 0;
7429
7430 *num_out = 0;
9214 cwnd_full_ind = 0;
9215 auth_keyid = stcb->asoc.authinfo.active_keyid;
9216
9217 if ((asoc->state & SCTP_STATE_SHUTDOWN_PENDING) ||
9218 (asoc->state & SCTP_STATE_SHUTDOWN_RECEIVED) ||
9219 (sctp_is_feature_on(inp, SCTP_PCB_FLAGS_EXPLICIT_EOR))) {
9220 eeor_mode = 1;
9221 } else {
9222 eeor_mode = 0;

--- 19 unchanged lines hidden (view full) ---

9242 TAILQ_EMPTY(&asoc->asconf_send_queue) &&
9243 TAILQ_EMPTY(&asoc->send_queue) &&
9244 TAILQ_EMPTY(&asoc->out_wheel)) {
9245 *reason_code = 9;
9246 return (0);
9247 }
9248 if (asoc->peers_rwnd == 0) {
9249 /* No room in peers rwnd */
7431 auth_keyid = stcb->asoc.authinfo.active_keyid;
7432
7433 if ((asoc->state & SCTP_STATE_SHUTDOWN_PENDING) ||
7434 (asoc->state & SCTP_STATE_SHUTDOWN_RECEIVED) ||
7435 (sctp_is_feature_on(inp, SCTP_PCB_FLAGS_EXPLICIT_EOR))) {
7436 eeor_mode = 1;
7437 } else {
7438 eeor_mode = 0;

--- 19 unchanged lines hidden (view full) ---

7458 TAILQ_EMPTY(&asoc->asconf_send_queue) &&
7459 TAILQ_EMPTY(&asoc->send_queue) &&
7460 TAILQ_EMPTY(&asoc->out_wheel)) {
7461 *reason_code = 9;
7462 return (0);
7463 }
7464 if (asoc->peers_rwnd == 0) {
7465 /* No room in peers rwnd */
9250 *cwnd_full = 1;
9251 *reason_code = 1;
9252 if (asoc->total_flight > 0) {
9253 /* we are allowed one chunk in flight */
9254 no_data_chunks = 1;
9255 }
9256 }
7466 *reason_code = 1;
7467 if (asoc->total_flight > 0) {
7468 /* we are allowed one chunk in flight */
7469 no_data_chunks = 1;
7470 }
7471 }
7472 max_rwnd_per_dest = ((asoc->peers_rwnd + asoc->total_flight) / asoc->numnets);
9257 if ((no_data_chunks == 0) && (!TAILQ_EMPTY(&asoc->out_wheel))) {
7473 if ((no_data_chunks == 0) && (!TAILQ_EMPTY(&asoc->out_wheel))) {
9258 if (SCTP_BASE_SYSCTL(sctp_cmt_on_off)) {
7474 TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
9259 /*
7475 /*
9260 * for CMT we start at the next one past the one we
9261 * last added data to.
7476 * This for loop we are in takes in each net, if
7477 * its's got space in cwnd and has data sent to it
7478 * (when CMT is off) then it calls
7479 * sctp_fill_outqueue for the net. This gets data on
7480 * the send queue for that network.
7481 *
7482 * In sctp_fill_outqueue TSN's are assigned and data is
7483 * copied out of the stream buffers. Note mostly
7484 * copy by reference (we hope).
9262 */
7485 */
9263 if (TAILQ_FIRST(&asoc->send_queue) != NULL) {
9264 goto skip_the_fill_from_streams;
9265 }
9266 if (asoc->last_net_data_came_from) {
9267 net = TAILQ_NEXT(asoc->last_net_data_came_from, sctp_next);
9268 if (net == NULL) {
9269 net = TAILQ_FIRST(&asoc->nets);
9270 }
9271 } else {
9272 /* back to start */
9273 net = TAILQ_FIRST(&asoc->nets);
9274 }
9275
9276 /*
9277 * JRI-TODO: CMT-MPI. Simply set the first
9278 * destination (net) to be optimized for the next
9279 * message to be pulled out of the outwheel. 1. peek
9280 * at outwheel 2. If large message, set net =
9281 * highest_cwnd 3. If small message, set net =
9282 * lowest rtt
9283 */
9284 } else {
9285 net = asoc->primary_destination;
9286 if (net == NULL) {
9287 /* TSNH */
9288 net = TAILQ_FIRST(&asoc->nets);
9289 }
9290 }
9291 start_at = net;
9292
9293one_more_time:
9294 for (; net != NULL; net = TAILQ_NEXT(net, sctp_next)) {
9295 net->window_probe = 0;
7486 net->window_probe = 0;
9296 if (old_startat && (old_startat == net)) {
9297 break;
9298 }
9299 /*
9300 * JRI: if dest is unreachable or unconfirmed, do
9301 * not send data to it
9302 */
9303 if ((net->dest_state & SCTP_ADDR_NOT_REACHABLE) || (net->dest_state & SCTP_ADDR_UNCONFIRMED)) {
7487 if ((net->dest_state & SCTP_ADDR_NOT_REACHABLE) || (net->dest_state & SCTP_ADDR_UNCONFIRMED)) {
7488 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_CWND_LOGGING_ENABLE) {
7489 sctp_log_cwnd(stcb, net, 1,
7490 SCTP_CWND_LOG_FILL_OUTQ_CALLED);
7491 }
9304 continue;
9305 }
7492 continue;
7493 }
9306 /*
9307 * JRI: if dest is in PF state, do not send data to
9308 * it
9309 */
9310 if (SCTP_BASE_SYSCTL(sctp_cmt_on_off) &&
9311 SCTP_BASE_SYSCTL(sctp_cmt_pf) &&
9312 (net->dest_state & SCTP_ADDR_PF)) {
9313 continue;
9314 }
9315 if ((SCTP_BASE_SYSCTL(sctp_cmt_on_off) == 0) && (net->ref_count < 2)) {
9316 /* nothing can be in queue for this guy */
7494 if ((SCTP_BASE_SYSCTL(sctp_cmt_on_off) == 0) && (net->ref_count < 2)) {
7495 /* nothing can be in queue for this guy */
7496 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_CWND_LOGGING_ENABLE) {
7497 sctp_log_cwnd(stcb, net, 2,
7498 SCTP_CWND_LOG_FILL_OUTQ_CALLED);
7499 }
9317 continue;
9318 }
9319 if (net->flight_size >= net->cwnd) {
7500 continue;
7501 }
7502 if (net->flight_size >= net->cwnd) {
9320 /* skip this network, no room */
9321 cwnd_full_ind++;
7503 /* skip this network, no room - can't fill */
7504 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_CWND_LOGGING_ENABLE) {
7505 sctp_log_cwnd(stcb, net, 3,
7506 SCTP_CWND_LOG_FILL_OUTQ_CALLED);
7507 }
9322 continue;
9323 }
7508 continue;
7509 }
9324 /*
9325 * JRI : this for loop we are in takes in each net,
9326 * if its's got space in cwnd and has data sent to
9327 * it (when CMT is off) then it calls
9328 * sctp_fill_outqueue for the net. This gets data on
9329 * the send queue for that network.
9330 *
9331 * In sctp_fill_outqueue TSN's are assigned and data is
9332 * copied out of the stream buffers. Note mostly
9333 * copy by reference (we hope).
9334 */
9335 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_CWND_LOGGING_ENABLE) {
7510 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_CWND_LOGGING_ENABLE) {
9336 sctp_log_cwnd(stcb, net, 0, SCTP_CWND_LOG_FILL_OUTQ_CALLED);
7511 sctp_log_cwnd(stcb, net, 4, SCTP_CWND_LOG_FILL_OUTQ_CALLED);
9337 }
9338 sctp_fill_outqueue(stcb, net, frag_point, eeor_mode, &quit_now);
9339 if (quit_now) {
9340 /* memory alloc failure */
9341 no_data_chunks = 1;
7512 }
7513 sctp_fill_outqueue(stcb, net, frag_point, eeor_mode, &quit_now);
7514 if (quit_now) {
7515 /* memory alloc failure */
7516 no_data_chunks = 1;
9342 goto skip_the_fill_from_streams;
7517 break;
9343 }
9344 }
7518 }
7519 }
9345 if (start_at != TAILQ_FIRST(&asoc->nets)) {
9346 /* got to pick up the beginning stuff. */
9347 old_startat = start_at;
9348 start_at = net = TAILQ_FIRST(&asoc->nets);
9349 if (old_startat)
9350 goto one_more_time;
9351 }
9352 }
7520 }
9353skip_the_fill_from_streams:
9354 *cwnd_full = cwnd_full_ind;
9355
9356 /* now service each destination and send out what we can for it */
9357 /* Nothing to send? */
9358 if ((TAILQ_FIRST(&asoc->control_send_queue) == NULL) &&
9359 (TAILQ_FIRST(&asoc->asconf_send_queue) == NULL) &&
9360 (TAILQ_FIRST(&asoc->send_queue) == NULL)) {
9361 *reason_code = 8;
9362 return (0);
9363 }
7521 /* now service each destination and send out what we can for it */
7522 /* Nothing to send? */
7523 if ((TAILQ_FIRST(&asoc->control_send_queue) == NULL) &&
7524 (TAILQ_FIRST(&asoc->asconf_send_queue) == NULL) &&
7525 (TAILQ_FIRST(&asoc->send_queue) == NULL)) {
7526 *reason_code = 8;
7527 return (0);
7528 }
9364 if (no_data_chunks) {
9365 chk = TAILQ_FIRST(&asoc->asconf_send_queue);
9366 if (chk == NULL)
9367 chk = TAILQ_FIRST(&asoc->control_send_queue);
7529 if (SCTP_BASE_SYSCTL(sctp_cmt_on_off)) {
7530 /* get the last start point */
7531 start_at = asoc->last_net_cmt_send_started;
7532 if (start_at == NULL) {
7533 /* null so to beginning */
7534 start_at = TAILQ_FIRST(&asoc->nets);
7535 } else {
7536 start_at = TAILQ_NEXT(asoc->last_net_cmt_send_started, sctp_next);
7537 if (start_at == NULL) {
7538 start_at = TAILQ_FIRST(&asoc->nets);
7539 }
7540 }
7541 asoc->last_net_cmt_send_started = start_at;
9368 } else {
7542 } else {
9369 chk = TAILQ_FIRST(&asoc->send_queue);
7543 start_at = TAILQ_FIRST(&asoc->nets);
9370 }
7544 }
9371 if (chk) {
9372 send_start_at = chk->whoTo;
9373 } else {
9374 send_start_at = TAILQ_FIRST(&asoc->nets);
9375 }
9376 old_startat = NULL;
7545 old_start_at = NULL;
9377again_one_more_time:
7546again_one_more_time:
9378 for (net = send_start_at; net != NULL; net = TAILQ_NEXT(net, sctp_next)) {
7547 for (net = start_at; net != NULL; net = TAILQ_NEXT(net, sctp_next)) {
9379 /* how much can we send? */
9380 /* SCTPDBG("Examine for sending net:%x\n", (uint32_t)net); */
7548 /* how much can we send? */
7549 /* SCTPDBG("Examine for sending net:%x\n", (uint32_t)net); */
9381 if (old_startat && (old_startat == net)) {
7550 if (old_start_at && (old_start_at == net)) {
9382 /* through list ocmpletely. */
9383 break;
9384 }
7551 /* through list ocmpletely. */
7552 break;
7553 }
9385 tsns_sent = 0;
9386 if (net->ref_count < 2) {
7554 tsns_sent = 0xa;
7555 if ((SCTP_BASE_SYSCTL(sctp_cmt_on_off) == 0) && (net->ref_count < 2)) {
9387 /*
9388 * Ref-count of 1 so we cannot have data or control
7556 /*
7557 * Ref-count of 1 so we cannot have data or control
9389 * queued to this address. Skip it.
7558 * queued to this address. Skip it (non-CMT).
9390 */
9391 continue;
9392 }
7559 */
7560 continue;
7561 }
7562 if ((TAILQ_FIRST(&asoc->control_send_queue) == NULL) &&
7563 (TAILQ_FIRST(&asoc->asconf_send_queue) == NULL) &&
7564 (net->flight_size >= net->cwnd)) {
7565 /*
7566 * Nothing on control or asconf and flight is full,
7567 * we can skip even in the CMT case.
7568 */
7569 continue;
7570 }
9393 ctl_cnt = bundle_at = 0;
9394 endoutchain = outchain = NULL;
9395 no_fragmentflg = 1;
9396 one_chunk = 0;
9397 if (net->dest_state & SCTP_ADDR_UNCONFIRMED) {
9398 skip_data_for_this_net = 1;
9399 } else {
9400 skip_data_for_this_net = 0;

--- 452 unchanged lines hidden (view full) ---

9853 } else {
9854 mtu = (net->mtu - SCTP_MIN_V4_OVERHEAD);
9855 }
9856 to_out = 0;
9857 no_fragmentflg = 1;
9858 }
9859 }
9860 }
7571 ctl_cnt = bundle_at = 0;
7572 endoutchain = outchain = NULL;
7573 no_fragmentflg = 1;
7574 one_chunk = 0;
7575 if (net->dest_state & SCTP_ADDR_UNCONFIRMED) {
7576 skip_data_for_this_net = 1;
7577 } else {
7578 skip_data_for_this_net = 0;

--- 452 unchanged lines hidden (view full) ---

8031 } else {
8032 mtu = (net->mtu - SCTP_MIN_V4_OVERHEAD);
8033 }
8034 to_out = 0;
8035 no_fragmentflg = 1;
8036 }
8037 }
8038 }
8039 /* JRI: if dest is in PF state, do not send data to it */
8040 if (SCTP_BASE_SYSCTL(sctp_cmt_on_off) &&
8041 SCTP_BASE_SYSCTL(sctp_cmt_pf) &&
8042 (net->dest_state & SCTP_ADDR_PF)) {
8043 goto no_data_fill;
8044 }
8045 if (net->flight_size >= net->cwnd) {
8046 goto no_data_fill;
8047 }
8048 if ((SCTP_BASE_SYSCTL(sctp_cmt_on_off)) &&
8049 (net->flight_size > max_rwnd_per_dest)) {
8050 goto no_data_fill;
8051 }
9861 /*********************/
9862 /* Data transmission */
9863 /*********************/
9864 /*
9865 * if AUTH for DATA is required and no AUTH has been added
9866 * yet, account for this in the mtu now... if no data can be
9867 * bundled, this adjustment won't matter anyways since the
9868 * packet will be going out...

--- 19 unchanged lines hidden (view full) ---

9888 omtu = 0;
9889 break;
9890#endif
9891 default:
9892 /* TSNH */
9893 omtu = 0;
9894 break;
9895 }
8052 /*********************/
8053 /* Data transmission */
8054 /*********************/
8055 /*
8056 * if AUTH for DATA is required and no AUTH has been added
8057 * yet, account for this in the mtu now... if no data can be
8058 * bundled, this adjustment won't matter anyways since the
8059 * packet will be going out...

--- 19 unchanged lines hidden (view full) ---

8079 omtu = 0;
8080 break;
8081#endif
8082 default:
8083 /* TSNH */
8084 omtu = 0;
8085 break;
8086 }
9896 if ((((asoc->state & SCTP_STATE_OPEN) == SCTP_STATE_OPEN) && (skip_data_for_this_net == 0)) ||
8087 if ((((asoc->state & SCTP_STATE_OPEN) == SCTP_STATE_OPEN) &&
8088 (skip_data_for_this_net == 0)) ||
9897 (cookie)) {
9898 for (chk = TAILQ_FIRST(&asoc->send_queue); chk; chk = nchk) {
9899 if (no_data_chunks) {
9900 /* let only control go out */
9901 *reason_code = 1;
9902 break;
9903 }
9904 if (net->flight_size >= net->cwnd) {
9905 /* skip this net, no room for data */
9906 *reason_code = 2;
9907 break;
9908 }
9909 nchk = TAILQ_NEXT(chk, sctp_next);
8089 (cookie)) {
8090 for (chk = TAILQ_FIRST(&asoc->send_queue); chk; chk = nchk) {
8091 if (no_data_chunks) {
8092 /* let only control go out */
8093 *reason_code = 1;
8094 break;
8095 }
8096 if (net->flight_size >= net->cwnd) {
8097 /* skip this net, no room for data */
8098 *reason_code = 2;
8099 break;
8100 }
8101 nchk = TAILQ_NEXT(chk, sctp_next);
9910 if (chk->whoTo != net) {
8102 if (SCTP_BASE_SYSCTL(sctp_cmt_on_off)) {
8103 if (chk->whoTo != net) {
8104 /*
8105 * For CMT, steal the data
8106 * to this network if its
8107 * not set here.
8108 */
8109 sctp_free_remote_addr(chk->whoTo);
8110 chk->whoTo = net;
8111 atomic_add_int(&chk->whoTo->ref_count, 1);
8112 }
8113 } else if (chk->whoTo != net) {
9911 /* No, not sent to this net */
9912 continue;
9913 }
9914 if ((chk->send_size > omtu) && ((chk->flags & CHUNK_FLAGS_FRAGMENT_OK) == 0)) {
9915 /*-
9916 * strange, we have a chunk that is
9917 * to big for its destination and
9918 * yet no fragment ok flag.

--- 108 unchanged lines hidden (view full) ---

10027 * we do this by
10028 * counting when we
10029 * see a LAST
10030 * fragment only.
10031 */
10032 SCTP_STAT_INCR_COUNTER64(sctps_fragusrmsgs);
10033 }
10034 if ((mtu == 0) || (r_mtu == 0) || (one_chunk)) {
8114 /* No, not sent to this net */
8115 continue;
8116 }
8117 if ((chk->send_size > omtu) && ((chk->flags & CHUNK_FLAGS_FRAGMENT_OK) == 0)) {
8118 /*-
8119 * strange, we have a chunk that is
8120 * to big for its destination and
8121 * yet no fragment ok flag.

--- 108 unchanged lines hidden (view full) ---

8230 * we do this by
8231 * counting when we
8232 * see a LAST
8233 * fragment only.
8234 */
8235 SCTP_STAT_INCR_COUNTER64(sctps_fragusrmsgs);
8236 }
8237 if ((mtu == 0) || (r_mtu == 0) || (one_chunk)) {
10035 if (one_chunk) {
8238 if ((one_chunk) && (stcb->asoc.total_flight == 0)) {
10036 data_list[0]->window_probe = 1;
10037 net->window_probe = 1;
10038 }
10039 break;
10040 }
10041 } else {
10042 /*
10043 * Must be sent in order of the
10044 * TSN's (on a network)
10045 */
10046 break;
10047 }
10048 } /* for (chunk gather loop for this net) */
10049 } /* if asoc.state OPEN */
8239 data_list[0]->window_probe = 1;
8240 net->window_probe = 1;
8241 }
8242 break;
8243 }
8244 } else {
8245 /*
8246 * Must be sent in order of the
8247 * TSN's (on a network)
8248 */
8249 break;
8250 }
8251 } /* for (chunk gather loop for this net) */
8252 } /* if asoc.state OPEN */
8253no_data_fill:
10050 /* Is there something to send for this destination? */
10051 if (outchain) {
10052 /* We may need to start a control timer or two */
10053 if (asconf) {
10054 sctp_timer_start(SCTP_TIMER_TYPE_ASCONF, inp,
10055 stcb, net);
10056 /*
10057 * do NOT clear the asconf flag as it is

--- 132 unchanged lines hidden (view full) ---

10190 if (one_chunk) {
10191 break;
10192 }
10193 }
10194 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_CWND_LOGGING_ENABLE) {
10195 sctp_log_cwnd(stcb, net, tsns_sent, SCTP_CWND_LOG_FROM_SEND);
10196 }
10197 }
8254 /* Is there something to send for this destination? */
8255 if (outchain) {
8256 /* We may need to start a control timer or two */
8257 if (asconf) {
8258 sctp_timer_start(SCTP_TIMER_TYPE_ASCONF, inp,
8259 stcb, net);
8260 /*
8261 * do NOT clear the asconf flag as it is

--- 132 unchanged lines hidden (view full) ---

8394 if (one_chunk) {
8395 break;
8396 }
8397 }
8398 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_CWND_LOGGING_ENABLE) {
8399 sctp_log_cwnd(stcb, net, tsns_sent, SCTP_CWND_LOG_FROM_SEND);
8400 }
8401 }
10198 if (old_startat == NULL) {
10199 old_startat = send_start_at;
10200 send_start_at = TAILQ_FIRST(&asoc->nets);
10201 if (old_startat)
8402 if (old_start_at == NULL) {
8403 old_start_at = start_at;
8404 start_at = TAILQ_FIRST(&asoc->nets);
8405 if (old_start_at)
10202 goto again_one_more_time;
10203 }
10204 /*
10205 * At the end there should be no NON timed chunks hanging on this
10206 * queue.
10207 */
10208 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_CWND_LOGGING_ENABLE) {
10209 sctp_log_cwnd(stcb, net, *num_out, SCTP_CWND_LOG_FROM_SEND);

--- 1028 unchanged lines hidden (view full) ---

11238 * to combine any control in the control chunk queue also.
11239 */
11240 struct sctp_association *asoc;
11241 struct sctp_nets *net;
11242 int error = 0, num_out = 0, tot_out = 0, ret = 0, reason_code = 0,
11243 burst_cnt = 0, burst_limit = 0;
11244 struct timeval now;
11245 int now_filled = 0;
8406 goto again_one_more_time;
8407 }
8408 /*
8409 * At the end there should be no NON timed chunks hanging on this
8410 * queue.
8411 */
8412 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_CWND_LOGGING_ENABLE) {
8413 sctp_log_cwnd(stcb, net, *num_out, SCTP_CWND_LOG_FROM_SEND);

--- 1028 unchanged lines hidden (view full) ---

9442 * to combine any control in the control chunk queue also.
9443 */
9444 struct sctp_association *asoc;
9445 struct sctp_nets *net;
9446 int error = 0, num_out = 0, tot_out = 0, ret = 0, reason_code = 0,
9447 burst_cnt = 0, burst_limit = 0;
9448 struct timeval now;
9449 int now_filled = 0;
11246 int cwnd_full = 0;
11247 int nagle_on = 0;
11248 int frag_point = sctp_get_frag_point(stcb, &stcb->asoc);
11249 int un_sent = 0;
11250 int fr_done, tot_frs = 0;
11251
11252 asoc = &stcb->asoc;
11253 if (from_where == SCTP_OUTPUT_FROM_USR_SEND) {
11254 if (sctp_is_feature_on(inp, SCTP_PCB_FLAGS_NODELAY)) {

--- 34 unchanged lines hidden (view full) ---

11289 */
11290 if (from_where == SCTP_OUTPUT_FROM_COOKIE_ACK) {
11291 /*-
11292 * Special hook for handling cookiess discarded
11293 * by peer that carried data. Send cookie-ack only
11294 * and then the next call with get the retran's.
11295 */
11296 (void)sctp_med_chunk_output(inp, stcb, asoc, &num_out, &reason_code, 1,
9450 int nagle_on = 0;
9451 int frag_point = sctp_get_frag_point(stcb, &stcb->asoc);
9452 int un_sent = 0;
9453 int fr_done, tot_frs = 0;
9454
9455 asoc = &stcb->asoc;
9456 if (from_where == SCTP_OUTPUT_FROM_USR_SEND) {
9457 if (sctp_is_feature_on(inp, SCTP_PCB_FLAGS_NODELAY)) {

--- 34 unchanged lines hidden (view full) ---

9492 */
9493 if (from_where == SCTP_OUTPUT_FROM_COOKIE_ACK) {
9494 /*-
9495 * Special hook for handling cookiess discarded
9496 * by peer that carried data. Send cookie-ack only
9497 * and then the next call with get the retran's.
9498 */
9499 (void)sctp_med_chunk_output(inp, stcb, asoc, &num_out, &reason_code, 1,
11297 &cwnd_full, from_where,
9500 from_where,
11298 &now, &now_filled, frag_point, so_locked);
11299 return;
11300 } else if (from_where != SCTP_OUTPUT_FROM_HB_TMR) {
11301 /* if its not from a HB then do it */
11302 fr_done = 0;
11303 ret = sctp_chunk_retransmission(inp, stcb, asoc, &num_out, &now, &now_filled, &fr_done, so_locked);
11304 if (fr_done) {
11305 tot_frs++;

--- 8 unchanged lines hidden (view full) ---

11314 if (ret > 0) {
11315 /* Can't send anymore */
11316 /*-
11317 * now lets push out control by calling med-level
11318 * output once. this assures that we WILL send HB's
11319 * if queued too.
11320 */
11321 (void)sctp_med_chunk_output(inp, stcb, asoc, &num_out, &reason_code, 1,
9501 &now, &now_filled, frag_point, so_locked);
9502 return;
9503 } else if (from_where != SCTP_OUTPUT_FROM_HB_TMR) {
9504 /* if its not from a HB then do it */
9505 fr_done = 0;
9506 ret = sctp_chunk_retransmission(inp, stcb, asoc, &num_out, &now, &now_filled, &fr_done, so_locked);
9507 if (fr_done) {
9508 tot_frs++;

--- 8 unchanged lines hidden (view full) ---

9517 if (ret > 0) {
9518 /* Can't send anymore */
9519 /*-
9520 * now lets push out control by calling med-level
9521 * output once. this assures that we WILL send HB's
9522 * if queued too.
9523 */
9524 (void)sctp_med_chunk_output(inp, stcb, asoc, &num_out, &reason_code, 1,
11322 &cwnd_full, from_where,
9525 from_where,
11323 &now, &now_filled, frag_point, so_locked);
11324#ifdef SCTP_AUDITING_ENABLED
11325 sctp_auditing(8, inp, stcb, NULL);
11326#endif
11327 (void)sctp_timer_validation(inp, stcb, asoc, ret);
11328 return;
11329 }
11330 if (ret < 0) {

--- 10 unchanged lines hidden (view full) ---

11341 break;
11342 }
11343 if (from_where == SCTP_OUTPUT_FROM_T3) {
11344 /* Only one transmission allowed out of a timeout */
11345#ifdef SCTP_AUDITING_ENABLED
11346 sctp_auditing(10, inp, stcb, NULL);
11347#endif
11348 /* Push out any control */
9526 &now, &now_filled, frag_point, so_locked);
9527#ifdef SCTP_AUDITING_ENABLED
9528 sctp_auditing(8, inp, stcb, NULL);
9529#endif
9530 (void)sctp_timer_validation(inp, stcb, asoc, ret);
9531 return;
9532 }
9533 if (ret < 0) {

--- 10 unchanged lines hidden (view full) ---

9544 break;
9545 }
9546 if (from_where == SCTP_OUTPUT_FROM_T3) {
9547 /* Only one transmission allowed out of a timeout */
9548#ifdef SCTP_AUDITING_ENABLED
9549 sctp_auditing(10, inp, stcb, NULL);
9550#endif
9551 /* Push out any control */
11349 (void)sctp_med_chunk_output(inp, stcb, asoc, &num_out, &reason_code, 1, &cwnd_full, from_where,
9552 (void)sctp_med_chunk_output(inp, stcb, asoc, &num_out, &reason_code, 1, from_where,
11350 &now, &now_filled, frag_point, so_locked);
11351 return;
11352 }
11353 if (tot_frs > asoc->max_burst) {
11354 /* Hit FR burst limit */
11355 return;
11356 }
11357 if ((num_out == 0) && (ret == 0)) {

--- 54 unchanged lines hidden (view full) ---

11412 /* Should be decaying the cwnd here */
11413 ;
11414 }
11415 }
11416 }
11417
11418 }
11419 burst_cnt = 0;
9553 &now, &now_filled, frag_point, so_locked);
9554 return;
9555 }
9556 if (tot_frs > asoc->max_burst) {
9557 /* Hit FR burst limit */
9558 return;
9559 }
9560 if ((num_out == 0) && (ret == 0)) {

--- 54 unchanged lines hidden (view full) ---

9615 /* Should be decaying the cwnd here */
9616 ;
9617 }
9618 }
9619 }
9620
9621 }
9622 burst_cnt = 0;
11420 cwnd_full = 0;
11421 do {
11422 error = sctp_med_chunk_output(inp, stcb, asoc, &num_out,
9623 do {
9624 error = sctp_med_chunk_output(inp, stcb, asoc, &num_out,
11423 &reason_code, 0, &cwnd_full, from_where,
9625 &reason_code, 0, from_where,
11424 &now, &now_filled, frag_point, so_locked);
11425 if (error) {
11426 SCTPDBG(SCTP_DEBUG_OUTPUT1, "Error %d was returned from med-c-op\n", error);
11427 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LOG_MAXBURST_ENABLE) {
11428 sctp_log_maxburst(stcb, asoc->primary_destination, error, burst_cnt, SCTP_MAX_BURST_ERROR_STOP);
11429 }
11430 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_CWND_LOGGING_ENABLE) {
11431 sctp_log_cwnd(stcb, NULL, error, SCTP_SEND_NOW_COMPLETES);

--- 92 unchanged lines hidden (view full) ---

11524}
11525
11526void
11527send_forward_tsn(struct sctp_tcb *stcb,
11528 struct sctp_association *asoc)
11529{
11530 struct sctp_tmit_chunk *chk;
11531 struct sctp_forward_tsn_chunk *fwdtsn;
9626 &now, &now_filled, frag_point, so_locked);
9627 if (error) {
9628 SCTPDBG(SCTP_DEBUG_OUTPUT1, "Error %d was returned from med-c-op\n", error);
9629 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LOG_MAXBURST_ENABLE) {
9630 sctp_log_maxburst(stcb, asoc->primary_destination, error, burst_cnt, SCTP_MAX_BURST_ERROR_STOP);
9631 }
9632 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_CWND_LOGGING_ENABLE) {
9633 sctp_log_cwnd(stcb, NULL, error, SCTP_SEND_NOW_COMPLETES);

--- 92 unchanged lines hidden (view full) ---

9726}
9727
9728void
9729send_forward_tsn(struct sctp_tcb *stcb,
9730 struct sctp_association *asoc)
9731{
9732 struct sctp_tmit_chunk *chk;
9733 struct sctp_forward_tsn_chunk *fwdtsn;
9734 uint32_t advance_peer_ack_point;
11532
11533 SCTP_TCB_LOCK_ASSERT(stcb);
11534 TAILQ_FOREACH(chk, &asoc->control_send_queue, sctp_next) {
11535 if (chk->rec.chunk_id.id == SCTP_FORWARD_CUM_TSN) {
11536 /* mark it to unsent */
11537 chk->sent = SCTP_DATAGRAM_UNSENT;
11538 chk->snd_count = 0;
11539 /* Do we correct its output location? */

--- 61 unchanged lines hidden (view full) ---

11601 ovh = SCTP_MIN_OVERHEAD;
11602 } else {
11603 ovh = SCTP_MIN_V4_OVERHEAD;
11604 }
11605 if (cnt_of_space > (asoc->smallest_mtu - ovh)) {
11606 /* trim to a mtu size */
11607 cnt_of_space = asoc->smallest_mtu - ovh;
11608 }
9735
9736 SCTP_TCB_LOCK_ASSERT(stcb);
9737 TAILQ_FOREACH(chk, &asoc->control_send_queue, sctp_next) {
9738 if (chk->rec.chunk_id.id == SCTP_FORWARD_CUM_TSN) {
9739 /* mark it to unsent */
9740 chk->sent = SCTP_DATAGRAM_UNSENT;
9741 chk->snd_count = 0;
9742 /* Do we correct its output location? */

--- 61 unchanged lines hidden (view full) ---

9804 ovh = SCTP_MIN_OVERHEAD;
9805 } else {
9806 ovh = SCTP_MIN_V4_OVERHEAD;
9807 }
9808 if (cnt_of_space > (asoc->smallest_mtu - ovh)) {
9809 /* trim to a mtu size */
9810 cnt_of_space = asoc->smallest_mtu - ovh;
9811 }
9812 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LOG_TRY_ADVANCE) {
9813 sctp_misc_ints(SCTP_FWD_TSN_CHECK,
9814 0xff, 0, cnt_of_skipped,
9815 asoc->advanced_peer_ack_point);
9816
9817 }
9818 advance_peer_ack_point = asoc->advanced_peer_ack_point;
11609 if (cnt_of_space < space_needed) {
11610 /*-
11611 * ok we must trim down the chunk by lowering the
11612 * advance peer ack point.
11613 */
9819 if (cnt_of_space < space_needed) {
9820 /*-
9821 * ok we must trim down the chunk by lowering the
9822 * advance peer ack point.
9823 */
9824 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LOG_TRY_ADVANCE) {
9825 sctp_misc_ints(SCTP_FWD_TSN_CHECK,
9826 0xff, 0xff, cnt_of_space,
9827 space_needed);
9828 }
11614 cnt_of_skipped = (cnt_of_space -
11615 ((sizeof(struct sctp_forward_tsn_chunk)) /
11616 sizeof(struct sctp_strseq)));
11617 /*-
11618 * Go through and find the TSN that will be the one
11619 * we report.
11620 */
11621 at = TAILQ_FIRST(&asoc->sent_queue);
11622 for (i = 0; i < cnt_of_skipped; i++) {
11623 tp1 = TAILQ_NEXT(at, sctp_next);
11624 at = tp1;
11625 }
9829 cnt_of_skipped = (cnt_of_space -
9830 ((sizeof(struct sctp_forward_tsn_chunk)) /
9831 sizeof(struct sctp_strseq)));
9832 /*-
9833 * Go through and find the TSN that will be the one
9834 * we report.
9835 */
9836 at = TAILQ_FIRST(&asoc->sent_queue);
9837 for (i = 0; i < cnt_of_skipped; i++) {
9838 tp1 = TAILQ_NEXT(at, sctp_next);
9839 at = tp1;
9840 }
9841 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LOG_TRY_ADVANCE) {
9842 sctp_misc_ints(SCTP_FWD_TSN_CHECK,
9843 0xff, cnt_of_skipped, at->rec.data.TSN_seq,
9844 asoc->advanced_peer_ack_point);
9845 }
11626 last = at;
11627 /*-
11628 * last now points to last one I can report, update
11629 * peer ack point
11630 */
9846 last = at;
9847 /*-
9848 * last now points to last one I can report, update
9849 * peer ack point
9850 */
11631 asoc->advanced_peer_ack_point = last->rec.data.TSN_seq;
9851 advance_peer_ack_point = last->rec.data.TSN_seq;
11632 space_needed -= (cnt_of_skipped * sizeof(struct sctp_strseq));
11633 }
11634 chk->send_size = space_needed;
11635 /* Setup the chunk */
11636 fwdtsn = mtod(chk->data, struct sctp_forward_tsn_chunk *);
11637 fwdtsn->ch.chunk_length = htons(chk->send_size);
11638 fwdtsn->ch.chunk_flags = 0;
11639 fwdtsn->ch.chunk_type = SCTP_FORWARD_CUM_TSN;
9852 space_needed -= (cnt_of_skipped * sizeof(struct sctp_strseq));
9853 }
9854 chk->send_size = space_needed;
9855 /* Setup the chunk */
9856 fwdtsn = mtod(chk->data, struct sctp_forward_tsn_chunk *);
9857 fwdtsn->ch.chunk_length = htons(chk->send_size);
9858 fwdtsn->ch.chunk_flags = 0;
9859 fwdtsn->ch.chunk_type = SCTP_FORWARD_CUM_TSN;
11640 fwdtsn->new_cumulative_tsn = htonl(asoc->advanced_peer_ack_point);
9860 fwdtsn->new_cumulative_tsn = htonl(advance_peer_ack_point);
11641 chk->send_size = (sizeof(struct sctp_forward_tsn_chunk) +
11642 (cnt_of_skipped * sizeof(struct sctp_strseq)));
11643 SCTP_BUF_LEN(chk->data) = chk->send_size;
11644 fwdtsn++;
11645 /*-
11646 * Move pointer to after the fwdtsn and transfer to the
11647 * strseq pointer.
11648 */

--- 14 unchanged lines hidden (view full) ---

11663 for (i = 0; i < cnt_of_skipped; i++) {
11664 tp1 = TAILQ_NEXT(at, sctp_next);
11665 if (at->rec.data.rcv_flags & SCTP_DATA_UNORDERED) {
11666 /* We don't report these */
11667 i--;
11668 at = tp1;
11669 continue;
11670 }
9861 chk->send_size = (sizeof(struct sctp_forward_tsn_chunk) +
9862 (cnt_of_skipped * sizeof(struct sctp_strseq)));
9863 SCTP_BUF_LEN(chk->data) = chk->send_size;
9864 fwdtsn++;
9865 /*-
9866 * Move pointer to after the fwdtsn and transfer to the
9867 * strseq pointer.
9868 */

--- 14 unchanged lines hidden (view full) ---

9883 for (i = 0; i < cnt_of_skipped; i++) {
9884 tp1 = TAILQ_NEXT(at, sctp_next);
9885 if (at->rec.data.rcv_flags & SCTP_DATA_UNORDERED) {
9886 /* We don't report these */
9887 i--;
9888 at = tp1;
9889 continue;
9890 }
9891 if (at->rec.data.TSN_seq == advance_peer_ack_point) {
9892 at->rec.data.fwd_tsn_cnt = 0;
9893 }
11671 strseq->stream = ntohs(at->rec.data.stream_number);
11672 strseq->sequence = ntohs(at->rec.data.stream_seq);
11673 strseq++;
11674 at = tp1;
11675 }
11676 }
11677 return;
11678

--- 174 unchanged lines hidden (view full) ---

11853 sack->sack.a_rwnd = htonl(asoc->my_rwnd);
11854 asoc->my_last_reported_rwnd = asoc->my_rwnd;
11855
11856 /* reset the readers interpretation */
11857 stcb->freed_by_sorcv_sincelast = 0;
11858
11859 gap_descriptor = (struct sctp_gap_ack_block *)((caddr_t)sack + sizeof(struct sctp_sack_chunk));
11860
9894 strseq->stream = ntohs(at->rec.data.stream_number);
9895 strseq->sequence = ntohs(at->rec.data.stream_seq);
9896 strseq++;
9897 at = tp1;
9898 }
9899 }
9900 return;
9901

--- 174 unchanged lines hidden (view full) ---

10076 sack->sack.a_rwnd = htonl(asoc->my_rwnd);
10077 asoc->my_last_reported_rwnd = asoc->my_rwnd;
10078
10079 /* reset the readers interpretation */
10080 stcb->freed_by_sorcv_sincelast = 0;
10081
10082 gap_descriptor = (struct sctp_gap_ack_block *)((caddr_t)sack + sizeof(struct sctp_sack_chunk));
10083
11861 siz = (((asoc->highest_tsn_inside_map - asoc->mapping_array_base_tsn) + 1) + 7) / 8;
10084 if (asoc->highest_tsn_inside_map > asoc->mapping_array_base_tsn)
10085 siz = (((asoc->highest_tsn_inside_map - asoc->mapping_array_base_tsn) + 1) + 7) / 8;
10086 else
10087 siz = (((MAX_TSN - asoc->mapping_array_base_tsn) + 1) + asoc->highest_tsn_inside_map + 7) / 8;
10088
11862 if (compare_with_wrap(asoc->mapping_array_base_tsn, asoc->cumulative_tsn, MAX_TSN)) {
11863 offset = 1;
11864 /*-
11865 * cum-ack behind the mapping array, so we start and use all
11866 * entries.
11867 */
11868 jstart = 0;
11869 } else {

--- 111 unchanged lines hidden (view full) ---

11981 struct sctp_tmit_chunk *chk, *a_chk;
11982
11983 struct sctp_nr_sack_chunk *nr_sack;
11984
11985 struct sctp_gap_ack_block *gap_descriptor;
11986 struct sctp_nr_gap_ack_block *nr_gap_descriptor;
11987
11988 struct sack_track *selector;
10089 if (compare_with_wrap(asoc->mapping_array_base_tsn, asoc->cumulative_tsn, MAX_TSN)) {
10090 offset = 1;
10091 /*-
10092 * cum-ack behind the mapping array, so we start and use all
10093 * entries.
10094 */
10095 jstart = 0;
10096 } else {

--- 111 unchanged lines hidden (view full) ---

10208 struct sctp_tmit_chunk *chk, *a_chk;
10209
10210 struct sctp_nr_sack_chunk *nr_sack;
10211
10212 struct sctp_gap_ack_block *gap_descriptor;
10213 struct sctp_nr_gap_ack_block *nr_gap_descriptor;
10214
10215 struct sack_track *selector;
11989 struct nr_sack_track *nr_selector;
10216 struct sack_track *nr_selector;
11990
11991 /* EY do we need nr_mergeable, NO */
11992 int mergeable = 0;
11993 int offset;
11994 caddr_t limit;
11995 uint32_t *dup;
11996 int limit_reached = 0;
11997 unsigned int i, jstart, siz, j;

--- 141 unchanged lines hidden (view full) ---

12139 * CMT DAC algorithm: If 2 (i.e., 0x10) packets have been
12140 * received, then set high bit to 1, else 0. Reset
12141 * pkts_rcvd.
12142 */
12143 /* EY - TODO: which chunk flag is used in here? -The LSB */
12144 nr_sack->ch.chunk_flags |= (asoc->cmt_dac_pkts_rcvd << 6);
12145 asoc->cmt_dac_pkts_rcvd = 0;
12146 }
10217
10218 /* EY do we need nr_mergeable, NO */
10219 int mergeable = 0;
10220 int offset;
10221 caddr_t limit;
10222 uint32_t *dup;
10223 int limit_reached = 0;
10224 unsigned int i, jstart, siz, j;

--- 141 unchanged lines hidden (view full) ---

10366 * CMT DAC algorithm: If 2 (i.e., 0x10) packets have been
10367 * received, then set high bit to 1, else 0. Reset
10368 * pkts_rcvd.
10369 */
10370 /* EY - TODO: which chunk flag is used in here? -The LSB */
10371 nr_sack->ch.chunk_flags |= (asoc->cmt_dac_pkts_rcvd << 6);
10372 asoc->cmt_dac_pkts_rcvd = 0;
10373 }
12147 /*
12148 * EY - this is a never reneging receiver, that makes all gaps are
12149 * nr-gaps, set the All bit
12150 */
12151 if (SCTP_BASE_SYSCTL(sctp_do_drain) == 0) {
12152 nr_sack->ch.chunk_flags |= SCTP_NR_SACK_ALL_BIT;
12153 }
12154#ifdef SCTP_ASOCLOG_OF_TSNS
12155 stcb->asoc.cumack_logsnt[stcb->asoc.cumack_log_atsnt] = asoc->cumulative_tsn;
12156 stcb->asoc.cumack_log_atsnt++;
12157 if (stcb->asoc.cumack_log_atsnt >= SCTP_TSN_LOG_SIZE) {
12158 stcb->asoc.cumack_log_atsnt = 0;
12159 }
12160#endif
12161 nr_sack->nr_sack.cum_tsn_ack = htonl(asoc->cumulative_tsn);
12162 nr_sack->nr_sack.a_rwnd = htonl(asoc->my_rwnd);
12163 asoc->my_last_reported_rwnd = asoc->my_rwnd;
12164
12165 /* reset the readers interpretation */
12166 stcb->freed_by_sorcv_sincelast = 0;
12167
12168 gap_descriptor = (struct sctp_gap_ack_block *)((caddr_t)nr_sack + sizeof(struct sctp_nr_sack_chunk));
10374#ifdef SCTP_ASOCLOG_OF_TSNS
10375 stcb->asoc.cumack_logsnt[stcb->asoc.cumack_log_atsnt] = asoc->cumulative_tsn;
10376 stcb->asoc.cumack_log_atsnt++;
10377 if (stcb->asoc.cumack_log_atsnt >= SCTP_TSN_LOG_SIZE) {
10378 stcb->asoc.cumack_log_atsnt = 0;
10379 }
10380#endif
10381 nr_sack->nr_sack.cum_tsn_ack = htonl(asoc->cumulative_tsn);
10382 nr_sack->nr_sack.a_rwnd = htonl(asoc->my_rwnd);
10383 asoc->my_last_reported_rwnd = asoc->my_rwnd;
10384
10385 /* reset the readers interpretation */
10386 stcb->freed_by_sorcv_sincelast = 0;
10387
10388 gap_descriptor = (struct sctp_gap_ack_block *)((caddr_t)nr_sack + sizeof(struct sctp_nr_sack_chunk));
12169 nr_gap_descriptor = (struct sctp_nr_gap_ack_block *)((caddr_t)nr_sack + sizeof(struct sctp_nr_sack_chunk));
12170
10389
12171 siz = (((asoc->highest_tsn_inside_map - asoc->mapping_array_base_tsn) + 1) + 7) / 8;
10390 if (asoc->highest_tsn_inside_map > asoc->mapping_array_base_tsn)
10391 siz = (((asoc->highest_tsn_inside_map - asoc->mapping_array_base_tsn) + 1) + 7) / 8;
10392 else
10393 siz = (((MAX_TSN - asoc->mapping_array_base_tsn) + 1) + asoc->highest_tsn_inside_map + 7) / 8;
10394
12172 if (compare_with_wrap(asoc->mapping_array_base_tsn, asoc->cumulative_tsn, MAX_TSN)) {
12173 offset = 1;
12174 /*-
12175 * cum-ack behind the mapping array, so we start and use all
12176 * entries.
12177 */
12178 jstart = 0;
12179 } else {

--- 66 unchanged lines hidden (view full) ---

12246 sctp_sack_check(stcb, 0, 0, &abort_flag);
12247 }
12248 }
12249 /*---------------------------------------------------------filling the nr_gap_ack blocks----------------------------------------------------*/
12250
12251 nr_gap_descriptor = (struct sctp_nr_gap_ack_block *)gap_descriptor;
12252
12253 /* EY - there will be gaps + nr_gaps if draining is possible */
10395 if (compare_with_wrap(asoc->mapping_array_base_tsn, asoc->cumulative_tsn, MAX_TSN)) {
10396 offset = 1;
10397 /*-
10398 * cum-ack behind the mapping array, so we start and use all
10399 * entries.
10400 */
10401 jstart = 0;
10402 } else {

--- 66 unchanged lines hidden (view full) ---

10469 sctp_sack_check(stcb, 0, 0, &abort_flag);
10470 }
10471 }
10472 /*---------------------------------------------------------filling the nr_gap_ack blocks----------------------------------------------------*/
10473
10474 nr_gap_descriptor = (struct sctp_nr_gap_ack_block *)gap_descriptor;
10475
10476 /* EY - there will be gaps + nr_gaps if draining is possible */
12254 if (SCTP_BASE_SYSCTL(sctp_do_drain)) {
10477 if ((SCTP_BASE_SYSCTL(sctp_do_drain)) && (limit_reached == 0)) {
12255
12256 mergeable = 0;
12257
10478
10479 mergeable = 0;
10480
12258 siz = (((asoc->highest_tsn_inside_nr_map - asoc->nr_mapping_array_base_tsn) + 1) + 7) / 8;
10481 if (asoc->highest_tsn_inside_nr_map > asoc->nr_mapping_array_base_tsn)
10482 siz = (((asoc->highest_tsn_inside_nr_map - asoc->nr_mapping_array_base_tsn) + 1) + 7) / 8;
10483 else
10484 siz = (((MAX_TSN - asoc->nr_mapping_array_base_tsn) + 1) + asoc->highest_tsn_inside_nr_map + 7) / 8;
10485
12259 if (compare_with_wrap(asoc->nr_mapping_array_base_tsn, asoc->cumulative_tsn, MAX_TSN)) {
12260 offset = 1;
12261 /*-
12262 * cum-ack behind the mapping array, so we start and use all
12263 * entries.
12264 */
12265 jstart = 0;
12266 } else {
12267 offset = asoc->nr_mapping_array_base_tsn - asoc->cumulative_tsn;
12268 /*-
12269 * we skip the first one when the cum-ack is at or above the
12270 * mapping array base. Note this only works if
12271 */
12272 jstart = 1;
12273 }
12274 if (compare_with_wrap(asoc->highest_tsn_inside_nr_map, asoc->cumulative_tsn, MAX_TSN)) {
12275 /* we have a gap .. maybe */
12276 for (i = 0; i < siz; i++) {
10486 if (compare_with_wrap(asoc->nr_mapping_array_base_tsn, asoc->cumulative_tsn, MAX_TSN)) {
10487 offset = 1;
10488 /*-
10489 * cum-ack behind the mapping array, so we start and use all
10490 * entries.
10491 */
10492 jstart = 0;
10493 } else {
10494 offset = asoc->nr_mapping_array_base_tsn - asoc->cumulative_tsn;
10495 /*-
10496 * we skip the first one when the cum-ack is at or above the
10497 * mapping array base. Note this only works if
10498 */
10499 jstart = 1;
10500 }
10501 if (compare_with_wrap(asoc->highest_tsn_inside_nr_map, asoc->cumulative_tsn, MAX_TSN)) {
10502 /* we have a gap .. maybe */
10503 for (i = 0; i < siz; i++) {
12277 nr_selector = &nr_sack_array[asoc->nr_mapping_array[i]];
10504 nr_selector = &sack_array[asoc->nr_mapping_array[i]];
12278 if (mergeable && nr_selector->right_edge) {
12279 /*
12280 * Backup, left and right edges were
12281 * ok to merge.
12282 */
12283 num_nr_gap_blocks--;
12284 nr_gap_descriptor--;
12285 }

--- 9 unchanged lines hidden (view full) ---

12295 */
12296 mergeable = 0;
12297 } else {
12298 /*
12299 * no merge, set the
12300 * left side
12301 */
12302 mergeable = 0;
10505 if (mergeable && nr_selector->right_edge) {
10506 /*
10507 * Backup, left and right edges were
10508 * ok to merge.
10509 */
10510 num_nr_gap_blocks--;
10511 nr_gap_descriptor--;
10512 }

--- 9 unchanged lines hidden (view full) ---

10522 */
10523 mergeable = 0;
10524 } else {
10525 /*
10526 * no merge, set the
10527 * left side
10528 */
10529 mergeable = 0;
12303 nr_gap_descriptor->start = htons((nr_selector->nr_gaps[j].start + offset));
10530 nr_gap_descriptor->start = htons((nr_selector->gaps[j].start + offset));
12304 }
10531 }
12305 nr_gap_descriptor->end = htons((nr_selector->nr_gaps[j].end + offset));
10532 nr_gap_descriptor->end = htons((nr_selector->gaps[j].end + offset));
12306 num_nr_gap_blocks++;
12307 nr_gap_descriptor++;
12308 if (((caddr_t)nr_gap_descriptor + sizeof(struct sctp_nr_gap_ack_block)) > limit) {
12309 /* no more room */
12310 limit_reached = 1;
12311 break;
12312 }
12313 }

--- 5 unchanged lines hidden (view full) ---

12319 /* Reached the limit stop */
12320 break;
12321 }
12322 jstart = 0;
12323 offset += 8;
12324 }
12325 }
12326 }
10533 num_nr_gap_blocks++;
10534 nr_gap_descriptor++;
10535 if (((caddr_t)nr_gap_descriptor + sizeof(struct sctp_nr_gap_ack_block)) > limit) {
10536 /* no more room */
10537 limit_reached = 1;
10538 break;
10539 }
10540 }

--- 5 unchanged lines hidden (view full) ---

10546 /* Reached the limit stop */
10547 break;
10548 }
10549 jstart = 0;
10550 offset += 8;
10551 }
10552 }
10553 }
12327 /*---------------------------------------------------End of---filling the nr_gap_ack blocks----------------------------------------------------*/
10554 /*---------------------------------------------End of---filling the nr_gap_ack blocks----------------------------------------------------*/
12328
12329 /* now we must add any dups we are going to report. */
12330 if ((limit_reached == 0) && (asoc->numduptsns)) {
12331 dup = (uint32_t *) nr_gap_descriptor;
12332 for (i = 0; i < asoc->numduptsns; i++) {
12333 *dup = htonl(asoc->dup_tsns[i]);
12334 dup++;
12335 num_dups++;

--- 200 unchanged lines hidden (view full) ---

12536 break;
12537#ifdef INET6
12538 case IPV6_VERSION >> 4:
12539 ip6 = (struct ip6_hdr *)iph;
12540 ip6_out = mtod(mout, struct ip6_hdr *);
12541
12542 /* Fill in the IPv6 header for the ABORT */
12543 ip6_out->ip6_flow = ip6->ip6_flow;
10555
10556 /* now we must add any dups we are going to report. */
10557 if ((limit_reached == 0) && (asoc->numduptsns)) {
10558 dup = (uint32_t *) nr_gap_descriptor;
10559 for (i = 0; i < asoc->numduptsns; i++) {
10560 *dup = htonl(asoc->dup_tsns[i]);
10561 dup++;
10562 num_dups++;

--- 200 unchanged lines hidden (view full) ---

10763 break;
10764#ifdef INET6
10765 case IPV6_VERSION >> 4:
10766 ip6 = (struct ip6_hdr *)iph;
10767 ip6_out = mtod(mout, struct ip6_hdr *);
10768
10769 /* Fill in the IPv6 header for the ABORT */
10770 ip6_out->ip6_flow = ip6->ip6_flow;
12544 ip6_out->ip6_hlim = MODULE_GLOBAL(MOD_INET6, ip6_defhlim);
10771 ip6_out->ip6_hlim = MODULE_GLOBAL(ip6_defhlim);
12545 if (port) {
12546 ip6_out->ip6_nxt = IPPROTO_UDP;
12547 } else {
12548 ip6_out->ip6_nxt = IPPROTO_SCTP;
12549 }
12550 ip6_out->ip6_src = ip6->ip6_dst;
12551 ip6_out->ip6_dst = ip6->ip6_src;
12552 /*

--- 1002 unchanged lines hidden (view full) ---

13555 break;
13556#ifdef INET6
13557 case IPV6_VERSION >> 4:
13558 ip6 = (struct ip6_hdr *)iph;
13559 ip6_out = mtod(mout, struct ip6_hdr *);
13560
13561 /* Fill in the IP6 header for the ABORT */
13562 ip6_out->ip6_flow = ip6->ip6_flow;
10772 if (port) {
10773 ip6_out->ip6_nxt = IPPROTO_UDP;
10774 } else {
10775 ip6_out->ip6_nxt = IPPROTO_SCTP;
10776 }
10777 ip6_out->ip6_src = ip6->ip6_dst;
10778 ip6_out->ip6_dst = ip6->ip6_src;
10779 /*

--- 1002 unchanged lines hidden (view full) ---

11782 break;
11783#ifdef INET6
11784 case IPV6_VERSION >> 4:
11785 ip6 = (struct ip6_hdr *)iph;
11786 ip6_out = mtod(mout, struct ip6_hdr *);
11787
11788 /* Fill in the IP6 header for the ABORT */
11789 ip6_out->ip6_flow = ip6->ip6_flow;
13563 ip6_out->ip6_hlim = MODULE_GLOBAL(MOD_INET6, ip6_defhlim);
11790 ip6_out->ip6_hlim = MODULE_GLOBAL(ip6_defhlim);
13564 if (port) {
13565 ip6_out->ip6_nxt = IPPROTO_UDP;
13566 } else {
13567 ip6_out->ip6_nxt = IPPROTO_SCTP;
13568 }
13569 ip6_out->ip6_src = ip6->ip6_dst;
13570 ip6_out->ip6_dst = ip6->ip6_src;
13571

--- 210 unchanged lines hidden (view full) ---

13782 break;
13783#ifdef INET6
13784 case IPV6_VERSION >> 4:
13785 ip6 = (struct ip6_hdr *)iph;
13786 ip6_out = mtod(mout, struct ip6_hdr *);
13787
13788 /* Fill in the IP6 header for the ABORT */
13789 ip6_out->ip6_flow = ip6->ip6_flow;
11791 if (port) {
11792 ip6_out->ip6_nxt = IPPROTO_UDP;
11793 } else {
11794 ip6_out->ip6_nxt = IPPROTO_SCTP;
11795 }
11796 ip6_out->ip6_src = ip6->ip6_dst;
11797 ip6_out->ip6_dst = ip6->ip6_src;
11798

--- 210 unchanged lines hidden (view full) ---

12009 break;
12010#ifdef INET6
12011 case IPV6_VERSION >> 4:
12012 ip6 = (struct ip6_hdr *)iph;
12013 ip6_out = mtod(mout, struct ip6_hdr *);
12014
12015 /* Fill in the IP6 header for the ABORT */
12016 ip6_out->ip6_flow = ip6->ip6_flow;
13790 ip6_out->ip6_hlim = MODULE_GLOBAL(MOD_INET6, ip6_defhlim);
12017 ip6_out->ip6_hlim = MODULE_GLOBAL(ip6_defhlim);
13791 if (port) {
13792 ip6_out->ip6_nxt = IPPROTO_UDP;
13793 } else {
13794 ip6_out->ip6_nxt = IPPROTO_SCTP;
13795 }
13796 ip6_out->ip6_src = ip6->ip6_dst;
13797 ip6_out->ip6_dst = ip6->ip6_src;
13798

--- 250 unchanged lines hidden (view full) ---

14049 if (sp->sinfo_flags & SCTP_ADDR_OVER) {
14050 sp->net = net;
14051 sp->addr_over = 1;
14052 } else {
14053 sp->net = asoc->primary_destination;
14054 sp->addr_over = 0;
14055 }
14056 atomic_add_int(&sp->net->ref_count, 1);
12018 if (port) {
12019 ip6_out->ip6_nxt = IPPROTO_UDP;
12020 } else {
12021 ip6_out->ip6_nxt = IPPROTO_SCTP;
12022 }
12023 ip6_out->ip6_src = ip6->ip6_dst;
12024 ip6_out->ip6_dst = ip6->ip6_src;
12025

--- 250 unchanged lines hidden (view full) ---

12276 if (sp->sinfo_flags & SCTP_ADDR_OVER) {
12277 sp->net = net;
12278 sp->addr_over = 1;
12279 } else {
12280 sp->net = asoc->primary_destination;
12281 sp->addr_over = 0;
12282 }
12283 atomic_add_int(&sp->net->ref_count, 1);
14057 sctp_set_prsctp_policy(stcb, sp);
12284 sctp_set_prsctp_policy(sp);
14058 }
14059out_now:
14060 return (sp);
14061}
14062
14063
14064int
14065sctp_sosend(struct socket *so,

--- 166 unchanged lines hidden (view full) ---

14232 SCTP_INP_RLOCK(inp);
14233 stcb = LIST_FIRST(&inp->sctp_asoc_list);
14234 if (stcb == NULL) {
14235 SCTP_INP_RUNLOCK(inp);
14236 SCTP_LTRACE_ERR_RET(inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, ENOTCONN);
14237 error = ENOTCONN;
14238 goto out_unlocked;
14239 }
12285 }
12286out_now:
12287 return (sp);
12288}
12289
12290
12291int
12292sctp_sosend(struct socket *so,

--- 166 unchanged lines hidden (view full) ---

12459 SCTP_INP_RLOCK(inp);
12460 stcb = LIST_FIRST(&inp->sctp_asoc_list);
12461 if (stcb == NULL) {
12462 SCTP_INP_RUNLOCK(inp);
12463 SCTP_LTRACE_ERR_RET(inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, ENOTCONN);
12464 error = ENOTCONN;
12465 goto out_unlocked;
12466 }
14240 hold_tcblock = 0;
12467 SCTP_TCB_LOCK(stcb);
12468 hold_tcblock = 1;
14241 SCTP_INP_RUNLOCK(inp);
14242 if (addr) {
14243 /* Must locate the net structure if addr given */
14244 net = sctp_findnet(stcb, addr);
14245 if (net) {
14246 /* validate port was 0 or correct */
14247 struct sockaddr_in *sin;
14248

--- 1143 unchanged lines hidden (view full) ---

15392 (stcb->asoc.total_flight == 0)) {
15393 /* We get to have a probe outstanding */
15394 if (hold_tcblock == 0) {
15395 hold_tcblock = 1;
15396 SCTP_TCB_LOCK(stcb);
15397 }
15398 sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_USR_SEND, SCTP_SO_LOCKED);
15399 } else if (some_on_control) {
12469 SCTP_INP_RUNLOCK(inp);
12470 if (addr) {
12471 /* Must locate the net structure if addr given */
12472 net = sctp_findnet(stcb, addr);
12473 if (net) {
12474 /* validate port was 0 or correct */
12475 struct sockaddr_in *sin;
12476

--- 1143 unchanged lines hidden (view full) ---

13620 (stcb->asoc.total_flight == 0)) {
13621 /* We get to have a probe outstanding */
13622 if (hold_tcblock == 0) {
13623 hold_tcblock = 1;
13624 SCTP_TCB_LOCK(stcb);
13625 }
13626 sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_USR_SEND, SCTP_SO_LOCKED);
13627 } else if (some_on_control) {
15400 int num_out, reason, cwnd_full, frag_point;
13628 int num_out, reason, frag_point;
15401
15402 /* Here we do control only */
15403 if (hold_tcblock == 0) {
15404 hold_tcblock = 1;
15405 SCTP_TCB_LOCK(stcb);
15406 }
15407 frag_point = sctp_get_frag_point(stcb, &stcb->asoc);
15408 (void)sctp_med_chunk_output(inp, stcb, &stcb->asoc, &num_out,
13629
13630 /* Here we do control only */
13631 if (hold_tcblock == 0) {
13632 hold_tcblock = 1;
13633 SCTP_TCB_LOCK(stcb);
13634 }
13635 frag_point = sctp_get_frag_point(stcb, &stcb->asoc);
13636 (void)sctp_med_chunk_output(inp, stcb, &stcb->asoc, &num_out,
15409 &reason, 1, &cwnd_full, 1, &now, &now_filled, frag_point, SCTP_SO_LOCKED);
13637 &reason, 1, 1, &now, &now_filled, frag_point, SCTP_SO_LOCKED);
15410 }
15411 SCTPDBG(SCTP_DEBUG_OUTPUT1, "USR Send complete qo:%d prw:%d unsent:%d tf:%d cooq:%d toqs:%d err:%d\n",
15412 queue_only, stcb->asoc.peers_rwnd, un_sent,
15413 stcb->asoc.total_flight, stcb->asoc.chunks_on_out_queue,
15414 stcb->asoc.total_output_queue_size, error);
15415
15416out:
15417out_unlocked:

--- 108 unchanged lines hidden (view full) ---

15526 struct nd_prefix *pfx = NULL;
15527 struct nd_pfxrouter *pfxrtr = NULL;
15528 struct sockaddr_in6 gw6;
15529
15530 if (ro == NULL || ro->ro_rt == NULL || src6->sin6_family != AF_INET6)
15531 return (0);
15532
15533 /* get prefix entry of address */
13638 }
13639 SCTPDBG(SCTP_DEBUG_OUTPUT1, "USR Send complete qo:%d prw:%d unsent:%d tf:%d cooq:%d toqs:%d err:%d\n",
13640 queue_only, stcb->asoc.peers_rwnd, un_sent,
13641 stcb->asoc.total_flight, stcb->asoc.chunks_on_out_queue,
13642 stcb->asoc.total_output_queue_size, error);
13643
13644out:
13645out_unlocked:

--- 108 unchanged lines hidden (view full) ---

13754 struct nd_prefix *pfx = NULL;
13755 struct nd_pfxrouter *pfxrtr = NULL;
13756 struct sockaddr_in6 gw6;
13757
13758 if (ro == NULL || ro->ro_rt == NULL || src6->sin6_family != AF_INET6)
13759 return (0);
13760
13761 /* get prefix entry of address */
15534 LIST_FOREACH(pfx, &MODULE_GLOBAL(MOD_INET6, nd_prefix), ndpr_entry) {
13762 LIST_FOREACH(pfx, &MODULE_GLOBAL(nd_prefix), ndpr_entry) {
15535 if (pfx->ndpr_stateflags & NDPRF_DETACHED)
15536 continue;
15537 if (IN6_ARE_MASKED_ADDR_EQUAL(&pfx->ndpr_prefix.sin6_addr,
15538 &src6->sin6_addr, &pfx->ndpr_mask))
15539 break;
15540 }
15541 /* no prefix entry in the prefix list */
15542 if (pfx == NULL) {

--- 60 unchanged lines hidden ---
13763 if (pfx->ndpr_stateflags & NDPRF_DETACHED)
13764 continue;
13765 if (IN6_ARE_MASKED_ADDR_EQUAL(&pfx->ndpr_prefix.sin6_addr,
13766 &src6->sin6_addr, &pfx->ndpr_mask))
13767 break;
13768 }
13769 /* no prefix entry in the prefix list */
13770 if (pfx == NULL) {

--- 60 unchanged lines hidden ---