* address management functions */
| 1885 | * address management functions |
| 1886 | */ |
| 1887 | static void |
| 1888 | sctp_addr_mgmt_assoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb, |
| 1889 | struct sctp_ifa *ifa, uint16_t type, int addr_locked) |
| 1890 | { |
| 1891 | int status; |
| 1892 | |
| 1893 | if ((inp->sctp_flags & SCTP_PCB_FLAGS_BOUNDALL) == 0 || |
| 1894 | sctp_is_feature_off(inp, SCTP_PCB_FLAGS_DO_ASCONF)) { |
| 1895 | /* subset bound, no ASCONF allowed case, so ignore */ |
| 1896 | return; |
| 1897 | } |
| 1898 | /* |
| 1899 | * note: we know this is not the subset bound, no ASCONF case eg. |
| 1900 | * this is boundall or subset bound w/ASCONF allowed |
| 1901 | */ |
| 1902 | |
| 1903 | /* first, make sure that the address is IPv4 or IPv6 and not jailed */ |
| 1904 | switch (ifa->address.sa.sa_family) { |
| 1905 | #ifdef INET6 |
| 1906 | case AF_INET6: |
| 1907 | if (prison_check_ip6(inp->ip_inp.inp.inp_cred, |
| 1908 | &ifa->address.sin6.sin6_addr) != 0) { |
| 1909 | return; |
| 1910 | } |
| 1911 | break; |
| 1912 | #endif |
| 1913 | #ifdef INET |
| 1914 | case AF_INET: |
| 1915 | if (prison_check_ip4(inp->ip_inp.inp.inp_cred, |
| 1916 | &ifa->address.sin.sin_addr) != 0) { |
| 1917 | return; |
| 1918 | } |
| 1919 | break; |
| 1920 | #endif |
| 1921 | default: |
| 1922 | return; |
| 1923 | } |
| 1924 | #ifdef INET6 |
| 1925 | /* make sure we're "allowed" to add this type of addr */ |
| 1926 | if (ifa->address.sa.sa_family == AF_INET6) { |
| 1927 | /* invalid if we're not a v6 endpoint */ |
| 1928 | if ((inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) == 0) |
| 1929 | return; |
| 1930 | /* is the v6 addr really valid ? */ |
| 1931 | if (ifa->localifa_flags & SCTP_ADDR_IFA_UNUSEABLE) { |
| 1932 | return; |
| 1933 | } |
| 1934 | } |
| 1935 | #endif |
| 1936 | /* put this address on the "pending/do not use yet" list */ |
| 1937 | sctp_add_local_addr_restricted(stcb, ifa); |
| 1938 | /* |
| 1939 | * check address scope if address is out of scope, don't queue |
| 1940 | * anything... note: this would leave the address on both inp and |
| 1941 | * asoc lists |
| 1942 | */ |
| 1943 | switch (ifa->address.sa.sa_family) { |
| 1944 | #ifdef INET6 |
no test coverage detected