@@ -1773,6 +1773,30 @@ enum sctp_disposition sctp_sf_do_5_2_3_initack(
1773
1773
return sctp_sf_discard_chunk (net , ep , asoc , type , arg , commands );
1774
1774
}
1775
1775
1776
+ static int sctp_sf_do_assoc_update (struct sctp_association * asoc ,
1777
+ struct sctp_association * new ,
1778
+ struct sctp_cmd_seq * cmds )
1779
+ {
1780
+ struct net * net = asoc -> base .net ;
1781
+ struct sctp_chunk * abort ;
1782
+
1783
+ if (!sctp_assoc_update (asoc , new ))
1784
+ return 0 ;
1785
+
1786
+ abort = sctp_make_abort (asoc , NULL , sizeof (struct sctp_errhdr ));
1787
+ if (abort ) {
1788
+ sctp_init_cause (abort , SCTP_ERROR_RSRC_LOW , 0 );
1789
+ sctp_add_cmd_sf (cmds , SCTP_CMD_REPLY , SCTP_CHUNK (abort ));
1790
+ }
1791
+ sctp_add_cmd_sf (cmds , SCTP_CMD_SET_SK_ERR , SCTP_ERROR (ECONNABORTED ));
1792
+ sctp_add_cmd_sf (cmds , SCTP_CMD_ASSOC_FAILED ,
1793
+ SCTP_PERR (SCTP_ERROR_RSRC_LOW ));
1794
+ SCTP_INC_STATS (net , SCTP_MIB_ABORTEDS );
1795
+ SCTP_DEC_STATS (net , SCTP_MIB_CURRESTAB );
1796
+
1797
+ return - ENOMEM ;
1798
+ }
1799
+
1776
1800
/* Unexpected COOKIE-ECHO handler for peer restart (Table 2, action 'A')
1777
1801
*
1778
1802
* Section 5.2.4
@@ -1853,21 +1877,8 @@ static enum sctp_disposition sctp_sf_do_dupcook_a(
1853
1877
sctp_add_cmd_sf (commands , SCTP_CMD_PURGE_ASCONF_QUEUE , SCTP_NULL ());
1854
1878
1855
1879
/* Update the content of current association. */
1856
- if (sctp_assoc_update ((struct sctp_association * )asoc , new_asoc )) {
1857
- struct sctp_chunk * abort ;
1858
-
1859
- abort = sctp_make_abort (asoc , NULL , sizeof (struct sctp_errhdr ));
1860
- if (abort ) {
1861
- sctp_init_cause (abort , SCTP_ERROR_RSRC_LOW , 0 );
1862
- sctp_add_cmd_sf (commands , SCTP_CMD_REPLY , SCTP_CHUNK (abort ));
1863
- }
1864
- sctp_add_cmd_sf (commands , SCTP_CMD_SET_SK_ERR , SCTP_ERROR (ECONNABORTED ));
1865
- sctp_add_cmd_sf (commands , SCTP_CMD_ASSOC_FAILED ,
1866
- SCTP_PERR (SCTP_ERROR_RSRC_LOW ));
1867
- SCTP_INC_STATS (net , SCTP_MIB_ABORTEDS );
1868
- SCTP_DEC_STATS (net , SCTP_MIB_CURRESTAB );
1880
+ if (sctp_sf_do_assoc_update ((struct sctp_association * )asoc , new_asoc , commands ))
1869
1881
goto nomem ;
1870
- }
1871
1882
1872
1883
repl = sctp_make_cookie_ack (asoc , chunk );
1873
1884
if (!repl )
@@ -1940,14 +1951,16 @@ static enum sctp_disposition sctp_sf_do_dupcook_b(
1940
1951
if (!sctp_auth_chunk_verify (net , chunk , new_asoc ))
1941
1952
return SCTP_DISPOSITION_DISCARD ;
1942
1953
1943
- /* Update the content of current association. */
1944
- sctp_add_cmd_sf (commands , SCTP_CMD_UPDATE_ASSOC , SCTP_ASOC (new_asoc ));
1945
1954
sctp_add_cmd_sf (commands , SCTP_CMD_NEW_STATE ,
1946
1955
SCTP_STATE (SCTP_STATE_ESTABLISHED ));
1947
1956
SCTP_INC_STATS (net , SCTP_MIB_CURRESTAB );
1948
1957
sctp_add_cmd_sf (commands , SCTP_CMD_HB_TIMERS_START , SCTP_NULL ());
1949
1958
1950
- repl = sctp_make_cookie_ack (new_asoc , chunk );
1959
+ /* Update the content of current association. */
1960
+ if (sctp_sf_do_assoc_update ((struct sctp_association * )asoc , new_asoc , commands ))
1961
+ goto nomem ;
1962
+
1963
+ repl = sctp_make_cookie_ack (asoc , chunk );
1951
1964
if (!repl )
1952
1965
goto nomem ;
1953
1966
0 commit comments