aboutsummaryrefslogtreecommitdiffstats
path: root/net/sctp
diff options
context:
space:
mode:
Diffstat (limited to 'net/sctp')
-rw-r--r--net/sctp/associola.c4
-rw-r--r--net/sctp/outqueue.c10
-rw-r--r--net/sctp/sm_sideeffect.c1
-rw-r--r--net/sctp/sm_statefuns.c15
-rw-r--r--net/sctp/socket.c40
-rw-r--r--net/sctp/sysctl.c51
-rw-r--r--net/sctp/transport.c8
7 files changed, 43 insertions, 86 deletions
diff --git a/net/sctp/associola.c b/net/sctp/associola.c
index 8450960df24f..7eed77a39d0d 100644
--- a/net/sctp/associola.c
+++ b/net/sctp/associola.c
@@ -1485,15 +1485,13 @@ void sctp_assoc_rwnd_decrease(struct sctp_association *asoc, unsigned len)
1485 * local endpoint and the remote peer. 1485 * local endpoint and the remote peer.
1486 */ 1486 */
1487int sctp_assoc_set_bind_addr_from_ep(struct sctp_association *asoc, 1487int sctp_assoc_set_bind_addr_from_ep(struct sctp_association *asoc,
1488 gfp_t gfp) 1488 sctp_scope_t scope, gfp_t gfp)
1489{ 1489{
1490 sctp_scope_t scope;
1491 int flags; 1490 int flags;
1492 1491
1493 /* Use scoping rules to determine the subset of addresses from 1492 /* Use scoping rules to determine the subset of addresses from
1494 * the endpoint. 1493 * the endpoint.
1495 */ 1494 */
1496 scope = sctp_scope(&asoc->peer.active_path->ipaddr);
1497 flags = (PF_INET6 == asoc->base.sk->sk_family) ? SCTP_ADDR6_ALLOWED : 0; 1495 flags = (PF_INET6 == asoc->base.sk->sk_family) ? SCTP_ADDR6_ALLOWED : 0;
1498 if (asoc->peer.ipv4_address) 1496 if (asoc->peer.ipv4_address)
1499 flags |= SCTP_ADDR4_PEERSUPP; 1497 flags |= SCTP_ADDR4_PEERSUPP;
diff --git a/net/sctp/outqueue.c b/net/sctp/outqueue.c
index c9f20e28521b..23e5e97aa617 100644
--- a/net/sctp/outqueue.c
+++ b/net/sctp/outqueue.c
@@ -423,16 +423,6 @@ void sctp_retransmit_mark(struct sctp_outq *q,
423 if ((reason == SCTP_RTXR_FAST_RTX && 423 if ((reason == SCTP_RTXR_FAST_RTX &&
424 (chunk->fast_retransmit == SCTP_NEED_FRTX)) || 424 (chunk->fast_retransmit == SCTP_NEED_FRTX)) ||
425 (reason != SCTP_RTXR_FAST_RTX && !chunk->tsn_gap_acked)) { 425 (reason != SCTP_RTXR_FAST_RTX && !chunk->tsn_gap_acked)) {
426 /* If this chunk was sent less then 1 rto ago, do not
427 * retransmit this chunk, but give the peer time
428 * to acknowlege it. Do this only when
429 * retransmitting due to T3 timeout.
430 */
431 if (reason == SCTP_RTXR_T3_RTX &&
432 time_before(jiffies, chunk->sent_at +
433 transport->last_rto))
434 continue;
435
436 /* RFC 2960 6.2.1 Processing a Received SACK 426 /* RFC 2960 6.2.1 Processing a Received SACK
437 * 427 *
438 * C) Any time a DATA chunk is marked for 428 * C) Any time a DATA chunk is marked for
diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c
index 8674d4919556..efa516b47e81 100644
--- a/net/sctp/sm_sideeffect.c
+++ b/net/sctp/sm_sideeffect.c
@@ -480,7 +480,6 @@ static void sctp_do_8_2_transport_strike(struct sctp_association *asoc,
480 * that indicates that we have an outstanding HB. 480 * that indicates that we have an outstanding HB.
481 */ 481 */
482 if (!is_hb || transport->hb_sent) { 482 if (!is_hb || transport->hb_sent) {
483 transport->last_rto = transport->rto;
484 transport->rto = min((transport->rto * 2), transport->asoc->rto_max); 483 transport->rto = min((transport->rto * 2), transport->asoc->rto_max);
485 } 484 }
486} 485}
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
index c8fae1983dd1..d4df45022ffa 100644
--- a/net/sctp/sm_statefuns.c
+++ b/net/sctp/sm_statefuns.c
@@ -384,6 +384,11 @@ sctp_disposition_t sctp_sf_do_5_1B_init(const struct sctp_endpoint *ep,
384 if (!new_asoc) 384 if (!new_asoc)
385 goto nomem; 385 goto nomem;
386 386
387 if (sctp_assoc_set_bind_addr_from_ep(new_asoc,
388 sctp_scope(sctp_source(chunk)),
389 GFP_ATOMIC) < 0)
390 goto nomem_init;
391
387 /* The call, sctp_process_init(), can fail on memory allocation. */ 392 /* The call, sctp_process_init(), can fail on memory allocation. */
388 if (!sctp_process_init(new_asoc, chunk->chunk_hdr->type, 393 if (!sctp_process_init(new_asoc, chunk->chunk_hdr->type,
389 sctp_source(chunk), 394 sctp_source(chunk),
@@ -401,9 +406,6 @@ sctp_disposition_t sctp_sf_do_5_1B_init(const struct sctp_endpoint *ep,
401 len = ntohs(err_chunk->chunk_hdr->length) - 406 len = ntohs(err_chunk->chunk_hdr->length) -
402 sizeof(sctp_chunkhdr_t); 407 sizeof(sctp_chunkhdr_t);
403 408
404 if (sctp_assoc_set_bind_addr_from_ep(new_asoc, GFP_ATOMIC) < 0)
405 goto nomem_init;
406
407 repl = sctp_make_init_ack(new_asoc, chunk, GFP_ATOMIC, len); 409 repl = sctp_make_init_ack(new_asoc, chunk, GFP_ATOMIC, len);
408 if (!repl) 410 if (!repl)
409 goto nomem_init; 411 goto nomem_init;
@@ -1452,6 +1454,10 @@ static sctp_disposition_t sctp_sf_do_unexpected_init(
1452 if (!new_asoc) 1454 if (!new_asoc)
1453 goto nomem; 1455 goto nomem;
1454 1456
1457 if (sctp_assoc_set_bind_addr_from_ep(new_asoc,
1458 sctp_scope(sctp_source(chunk)), GFP_ATOMIC) < 0)
1459 goto nomem;
1460
1455 /* In the outbound INIT ACK the endpoint MUST copy its current 1461 /* In the outbound INIT ACK the endpoint MUST copy its current
1456 * Verification Tag and Peers Verification tag into a reserved 1462 * Verification Tag and Peers Verification tag into a reserved
1457 * place (local tie-tag and per tie-tag) within the state cookie. 1463 * place (local tie-tag and per tie-tag) within the state cookie.
@@ -1488,9 +1494,6 @@ static sctp_disposition_t sctp_sf_do_unexpected_init(
1488 sizeof(sctp_chunkhdr_t); 1494 sizeof(sctp_chunkhdr_t);
1489 } 1495 }
1490 1496
1491 if (sctp_assoc_set_bind_addr_from_ep(new_asoc, GFP_ATOMIC) < 0)
1492 goto nomem;
1493
1494 repl = sctp_make_init_ack(new_asoc, chunk, GFP_ATOMIC, len); 1497 repl = sctp_make_init_ack(new_asoc, chunk, GFP_ATOMIC, len);
1495 if (!repl) 1498 if (!repl)
1496 goto nomem; 1499 goto nomem;
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index c8d05758661d..3a95fcb17a9e 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -1080,6 +1080,13 @@ static int __sctp_connect(struct sock* sk,
1080 err = -ENOMEM; 1080 err = -ENOMEM;
1081 goto out_free; 1081 goto out_free;
1082 } 1082 }
1083
1084 err = sctp_assoc_set_bind_addr_from_ep(asoc, scope,
1085 GFP_KERNEL);
1086 if (err < 0) {
1087 goto out_free;
1088 }
1089
1083 } 1090 }
1084 1091
1085 /* Prime the peer's transport structures. */ 1092 /* Prime the peer's transport structures. */
@@ -1095,11 +1102,6 @@ static int __sctp_connect(struct sock* sk,
1095 walk_size += af->sockaddr_len; 1102 walk_size += af->sockaddr_len;
1096 } 1103 }
1097 1104
1098 err = sctp_assoc_set_bind_addr_from_ep(asoc, GFP_KERNEL);
1099 if (err < 0) {
1100 goto out_free;
1101 }
1102
1103 /* In case the user of sctp_connectx() wants an association 1105 /* In case the user of sctp_connectx() wants an association
1104 * id back, assign one now. 1106 * id back, assign one now.
1105 */ 1107 */
@@ -1274,22 +1276,30 @@ SCTP_STATIC int sctp_setsockopt_connectx(struct sock* sk,
1274} 1276}
1275 1277
1276/* 1278/*
1277 * New (hopefully final) interface for the API. The option buffer is used 1279 * New (hopefully final) interface for the API.
1278 * both for the returned association id and the addresses. 1280 * We use the sctp_getaddrs_old structure so that use-space library
1281 * can avoid any unnecessary allocations. The only defferent part
1282 * is that we store the actual length of the address buffer into the
1283 * addrs_num structure member. That way we can re-use the existing
1284 * code.
1279 */ 1285 */
1280SCTP_STATIC int sctp_getsockopt_connectx3(struct sock* sk, int len, 1286SCTP_STATIC int sctp_getsockopt_connectx3(struct sock* sk, int len,
1281 char __user *optval, 1287 char __user *optval,
1282 int __user *optlen) 1288 int __user *optlen)
1283{ 1289{
1290 struct sctp_getaddrs_old param;
1284 sctp_assoc_t assoc_id = 0; 1291 sctp_assoc_t assoc_id = 0;
1285 int err = 0; 1292 int err = 0;
1286 1293
1287 if (len < sizeof(assoc_id)) 1294 if (len < sizeof(param))
1288 return -EINVAL; 1295 return -EINVAL;
1289 1296
1297 if (copy_from_user(&param, optval, sizeof(param)))
1298 return -EFAULT;
1299
1290 err = __sctp_setsockopt_connectx(sk, 1300 err = __sctp_setsockopt_connectx(sk,
1291 (struct sockaddr __user *)(optval + sizeof(assoc_id)), 1301 (struct sockaddr __user *)param.addrs,
1292 len - sizeof(assoc_id), &assoc_id); 1302 param.addr_num, &assoc_id);
1293 1303
1294 if (err == 0 || err == -EINPROGRESS) { 1304 if (err == 0 || err == -EINPROGRESS) {
1295 if (copy_to_user(optval, &assoc_id, sizeof(assoc_id))) 1305 if (copy_to_user(optval, &assoc_id, sizeof(assoc_id)))
@@ -1689,6 +1699,11 @@ SCTP_STATIC int sctp_sendmsg(struct kiocb *iocb, struct sock *sk,
1689 goto out_unlock; 1699 goto out_unlock;
1690 } 1700 }
1691 asoc = new_asoc; 1701 asoc = new_asoc;
1702 err = sctp_assoc_set_bind_addr_from_ep(asoc, scope, GFP_KERNEL);
1703 if (err < 0) {
1704 err = -ENOMEM;
1705 goto out_free;
1706 }
1692 1707
1693 /* If the SCTP_INIT ancillary data is specified, set all 1708 /* If the SCTP_INIT ancillary data is specified, set all
1694 * the association init values accordingly. 1709 * the association init values accordingly.
@@ -1718,11 +1733,6 @@ SCTP_STATIC int sctp_sendmsg(struct kiocb *iocb, struct sock *sk,
1718 err = -ENOMEM; 1733 err = -ENOMEM;
1719 goto out_free; 1734 goto out_free;
1720 } 1735 }
1721 err = sctp_assoc_set_bind_addr_from_ep(asoc, GFP_KERNEL);
1722 if (err < 0) {
1723 err = -ENOMEM;
1724 goto out_free;
1725 }
1726 } 1736 }
1727 1737
1728 /* ASSERT: we have a valid association at this point. */ 1738 /* ASSERT: we have a valid association at this point. */
diff --git a/net/sctp/sysctl.c b/net/sctp/sysctl.c
index ab7151da120f..d50a042f9552 100644
--- a/net/sctp/sysctl.c
+++ b/net/sctp/sysctl.c
@@ -59,180 +59,145 @@ extern int sysctl_sctp_wmem[3];
59 59
60static ctl_table sctp_table[] = { 60static ctl_table sctp_table[] = {
61 { 61 {
62 .ctl_name = NET_SCTP_RTO_INITIAL,
63 .procname = "rto_initial", 62 .procname = "rto_initial",
64 .data = &sctp_rto_initial, 63 .data = &sctp_rto_initial,
65 .maxlen = sizeof(unsigned int), 64 .maxlen = sizeof(unsigned int),
66 .mode = 0644, 65 .mode = 0644,
67 .proc_handler = proc_dointvec_minmax, 66 .proc_handler = proc_dointvec_minmax,
68 .strategy = sysctl_intvec,
69 .extra1 = &one, 67 .extra1 = &one,
70 .extra2 = &timer_max 68 .extra2 = &timer_max
71 }, 69 },
72 { 70 {
73 .ctl_name = NET_SCTP_RTO_MIN,
74 .procname = "rto_min", 71 .procname = "rto_min",
75 .data = &sctp_rto_min, 72 .data = &sctp_rto_min,
76 .maxlen = sizeof(unsigned int), 73 .maxlen = sizeof(unsigned int),
77 .mode = 0644, 74 .mode = 0644,
78 .proc_handler = proc_dointvec_minmax, 75 .proc_handler = proc_dointvec_minmax,
79 .strategy = sysctl_intvec,
80 .extra1 = &one, 76 .extra1 = &one,
81 .extra2 = &timer_max 77 .extra2 = &timer_max
82 }, 78 },
83 { 79 {
84 .ctl_name = NET_SCTP_RTO_MAX,
85 .procname = "rto_max", 80 .procname = "rto_max",
86 .data = &sctp_rto_max, 81 .data = &sctp_rto_max,
87 .maxlen = sizeof(unsigned int), 82 .maxlen = sizeof(unsigned int),
88 .mode = 0644, 83 .mode = 0644,
89 .proc_handler = proc_dointvec_minmax, 84 .proc_handler = proc_dointvec_minmax,
90 .strategy = sysctl_intvec,
91 .extra1 = &one, 85 .extra1 = &one,
92 .extra2 = &timer_max 86 .extra2 = &timer_max
93 }, 87 },
94 { 88 {
95 .ctl_name = NET_SCTP_VALID_COOKIE_LIFE,
96 .procname = "valid_cookie_life", 89 .procname = "valid_cookie_life",
97 .data = &sctp_valid_cookie_life, 90 .data = &sctp_valid_cookie_life,
98 .maxlen = sizeof(unsigned int), 91 .maxlen = sizeof(unsigned int),
99 .mode = 0644, 92 .mode = 0644,
100 .proc_handler = proc_dointvec_minmax, 93 .proc_handler = proc_dointvec_minmax,
101 .strategy = sysctl_intvec,
102 .extra1 = &one, 94 .extra1 = &one,
103 .extra2 = &timer_max 95 .extra2 = &timer_max
104 }, 96 },
105 { 97 {
106 .ctl_name = NET_SCTP_MAX_BURST,
107 .procname = "max_burst", 98 .procname = "max_burst",
108 .data = &sctp_max_burst, 99 .data = &sctp_max_burst,
109 .maxlen = sizeof(int), 100 .maxlen = sizeof(int),
110 .mode = 0644, 101 .mode = 0644,
111 .proc_handler = proc_dointvec_minmax, 102 .proc_handler = proc_dointvec_minmax,
112 .strategy = sysctl_intvec,
113 .extra1 = &zero, 103 .extra1 = &zero,
114 .extra2 = &int_max 104 .extra2 = &int_max
115 }, 105 },
116 { 106 {
117 .ctl_name = NET_SCTP_ASSOCIATION_MAX_RETRANS,
118 .procname = "association_max_retrans", 107 .procname = "association_max_retrans",
119 .data = &sctp_max_retrans_association, 108 .data = &sctp_max_retrans_association,
120 .maxlen = sizeof(int), 109 .maxlen = sizeof(int),
121 .mode = 0644, 110 .mode = 0644,
122 .proc_handler = proc_dointvec_minmax, 111 .proc_handler = proc_dointvec_minmax,
123 .strategy = sysctl_intvec,
124 .extra1 = &one, 112 .extra1 = &one,
125 .extra2 = &int_max 113 .extra2 = &int_max
126 }, 114 },
127 { 115 {
128 .ctl_name = NET_SCTP_SNDBUF_POLICY,
129 .procname = "sndbuf_policy", 116 .procname = "sndbuf_policy",
130 .data = &sctp_sndbuf_policy, 117 .data = &sctp_sndbuf_policy,
131 .maxlen = sizeof(int), 118 .maxlen = sizeof(int),
132 .mode = 0644, 119 .mode = 0644,
133 .proc_handler = proc_dointvec, 120 .proc_handler = proc_dointvec,
134 .strategy = sysctl_intvec
135 }, 121 },
136 { 122 {
137 .ctl_name = NET_SCTP_RCVBUF_POLICY,
138 .procname = "rcvbuf_policy", 123 .procname = "rcvbuf_policy",
139 .data = &sctp_rcvbuf_policy, 124 .data = &sctp_rcvbuf_policy,
140 .maxlen = sizeof(int), 125 .maxlen = sizeof(int),
141 .mode = 0644, 126 .mode = 0644,
142 .proc_handler = proc_dointvec, 127 .proc_handler = proc_dointvec,
143 .strategy = sysctl_intvec
144 }, 128 },
145 { 129 {
146 .ctl_name = NET_SCTP_PATH_MAX_RETRANS,
147 .procname = "path_max_retrans", 130 .procname = "path_max_retrans",
148 .data = &sctp_max_retrans_path, 131 .data = &sctp_max_retrans_path,
149 .maxlen = sizeof(int), 132 .maxlen = sizeof(int),
150 .mode = 0644, 133 .mode = 0644,
151 .proc_handler = proc_dointvec_minmax, 134 .proc_handler = proc_dointvec_minmax,
152 .strategy = sysctl_intvec,
153 .extra1 = &one, 135 .extra1 = &one,
154 .extra2 = &int_max 136 .extra2 = &int_max
155 }, 137 },
156 { 138 {
157 .ctl_name = NET_SCTP_MAX_INIT_RETRANSMITS,
158 .procname = "max_init_retransmits", 139 .procname = "max_init_retransmits",
159 .data = &sctp_max_retrans_init, 140 .data = &sctp_max_retrans_init,
160 .maxlen = sizeof(int), 141 .maxlen = sizeof(int),
161 .mode = 0644, 142 .mode = 0644,
162 .proc_handler = proc_dointvec_minmax, 143 .proc_handler = proc_dointvec_minmax,
163 .strategy = sysctl_intvec,
164 .extra1 = &one, 144 .extra1 = &one,
165 .extra2 = &int_max 145 .extra2 = &int_max
166 }, 146 },
167 { 147 {
168 .ctl_name = NET_SCTP_HB_INTERVAL,
169 .procname = "hb_interval", 148 .procname = "hb_interval",
170 .data = &sctp_hb_interval, 149 .data = &sctp_hb_interval,
171 .maxlen = sizeof(unsigned int), 150 .maxlen = sizeof(unsigned int),
172 .mode = 0644, 151 .mode = 0644,
173 .proc_handler = proc_dointvec_minmax, 152 .proc_handler = proc_dointvec_minmax,
174 .strategy = sysctl_intvec,
175 .extra1 = &one, 153 .extra1 = &one,
176 .extra2 = &timer_max 154 .extra2 = &timer_max
177 }, 155 },
178 { 156 {
179 .ctl_name = NET_SCTP_PRESERVE_ENABLE,
180 .procname = "cookie_preserve_enable", 157 .procname = "cookie_preserve_enable",
181 .data = &sctp_cookie_preserve_enable, 158 .data = &sctp_cookie_preserve_enable,
182 .maxlen = sizeof(int), 159 .maxlen = sizeof(int),
183 .mode = 0644, 160 .mode = 0644,
184 .proc_handler = proc_dointvec, 161 .proc_handler = proc_dointvec,
185 .strategy = sysctl_intvec
186 }, 162 },
187 { 163 {
188 .ctl_name = NET_SCTP_RTO_ALPHA,
189 .procname = "rto_alpha_exp_divisor", 164 .procname = "rto_alpha_exp_divisor",
190 .data = &sctp_rto_alpha, 165 .data = &sctp_rto_alpha,
191 .maxlen = sizeof(int), 166 .maxlen = sizeof(int),
192 .mode = 0444, 167 .mode = 0444,
193 .proc_handler = proc_dointvec, 168 .proc_handler = proc_dointvec,
194 .strategy = sysctl_intvec
195 }, 169 },
196 { 170 {
197 .ctl_name = NET_SCTP_RTO_BETA,
198 .procname = "rto_beta_exp_divisor", 171 .procname = "rto_beta_exp_divisor",
199 .data = &sctp_rto_beta, 172 .data = &sctp_rto_beta,
200 .maxlen = sizeof(int), 173 .maxlen = sizeof(int),
201 .mode = 0444, 174 .mode = 0444,
202 .proc_handler = proc_dointvec, 175 .proc_handler = proc_dointvec,
203 .strategy = sysctl_intvec
204 }, 176 },
205 { 177 {
206 .ctl_name = NET_SCTP_ADDIP_ENABLE,
207 .procname = "addip_enable", 178 .procname = "addip_enable",
208 .data = &sctp_addip_enable, 179 .data = &sctp_addip_enable,
209 .maxlen = sizeof(int), 180 .maxlen = sizeof(int),
210 .mode = 0644, 181 .mode = 0644,
211 .proc_handler = proc_dointvec, 182 .proc_handler = proc_dointvec,
212 .strategy = sysctl_intvec
213 }, 183 },
214 { 184 {
215 .ctl_name = NET_SCTP_PRSCTP_ENABLE,
216 .procname = "prsctp_enable", 185 .procname = "prsctp_enable",
217 .data = &sctp_prsctp_enable, 186 .data = &sctp_prsctp_enable,
218 .maxlen = sizeof(int), 187 .maxlen = sizeof(int),
219 .mode = 0644, 188 .mode = 0644,
220 .proc_handler = proc_dointvec, 189 .proc_handler = proc_dointvec,
221 .strategy = sysctl_intvec
222 }, 190 },
223 { 191 {
224 .ctl_name = NET_SCTP_SACK_TIMEOUT,
225 .procname = "sack_timeout", 192 .procname = "sack_timeout",
226 .data = &sctp_sack_timeout, 193 .data = &sctp_sack_timeout,
227 .maxlen = sizeof(int), 194 .maxlen = sizeof(int),
228 .mode = 0644, 195 .mode = 0644,
229 .proc_handler = proc_dointvec_minmax, 196 .proc_handler = proc_dointvec_minmax,
230 .strategy = sysctl_intvec,
231 .extra1 = &sack_timer_min, 197 .extra1 = &sack_timer_min,
232 .extra2 = &sack_timer_max, 198 .extra2 = &sack_timer_max,
233 }, 199 },
234 { 200 {
235 .ctl_name = CTL_UNNUMBERED,
236 .procname = "sctp_mem", 201 .procname = "sctp_mem",
237 .data = &sysctl_sctp_mem, 202 .data = &sysctl_sctp_mem,
238 .maxlen = sizeof(sysctl_sctp_mem), 203 .maxlen = sizeof(sysctl_sctp_mem),
@@ -240,7 +205,6 @@ static ctl_table sctp_table[] = {
240 .proc_handler = proc_dointvec, 205 .proc_handler = proc_dointvec,
241 }, 206 },
242 { 207 {
243 .ctl_name = CTL_UNNUMBERED,
244 .procname = "sctp_rmem", 208 .procname = "sctp_rmem",
245 .data = &sysctl_sctp_rmem, 209 .data = &sysctl_sctp_rmem,
246 .maxlen = sizeof(sysctl_sctp_rmem), 210 .maxlen = sizeof(sysctl_sctp_rmem),
@@ -248,7 +212,6 @@ static ctl_table sctp_table[] = {
248 .proc_handler = proc_dointvec, 212 .proc_handler = proc_dointvec,
249 }, 213 },
250 { 214 {
251 .ctl_name = CTL_UNNUMBERED,
252 .procname = "sctp_wmem", 215 .procname = "sctp_wmem",
253 .data = &sysctl_sctp_wmem, 216 .data = &sysctl_sctp_wmem,
254 .maxlen = sizeof(sysctl_sctp_wmem), 217 .maxlen = sizeof(sysctl_sctp_wmem),
@@ -256,40 +219,34 @@ static ctl_table sctp_table[] = {
256 .proc_handler = proc_dointvec, 219 .proc_handler = proc_dointvec,
257 }, 220 },
258 { 221 {
259 .ctl_name = CTL_UNNUMBERED,
260 .procname = "auth_enable", 222 .procname = "auth_enable",
261 .data = &sctp_auth_enable, 223 .data = &sctp_auth_enable,
262 .maxlen = sizeof(int), 224 .maxlen = sizeof(int),
263 .mode = 0644, 225 .mode = 0644,
264 .proc_handler = proc_dointvec, 226 .proc_handler = proc_dointvec,
265 .strategy = sysctl_intvec
266 }, 227 },
267 { 228 {
268 .ctl_name = CTL_UNNUMBERED,
269 .procname = "addip_noauth_enable", 229 .procname = "addip_noauth_enable",
270 .data = &sctp_addip_noauth, 230 .data = &sctp_addip_noauth,
271 .maxlen = sizeof(int), 231 .maxlen = sizeof(int),
272 .mode = 0644, 232 .mode = 0644,
273 .proc_handler = proc_dointvec, 233 .proc_handler = proc_dointvec,
274 .strategy = sysctl_intvec
275 }, 234 },
276 { 235 {
277 .ctl_name = CTL_UNNUMBERED,
278 .procname = "addr_scope_policy", 236 .procname = "addr_scope_policy",
279 .data = &sctp_scope_policy, 237 .data = &sctp_scope_policy,
280 .maxlen = sizeof(int), 238 .maxlen = sizeof(int),
281 .mode = 0644, 239 .mode = 0644,
282 .proc_handler = &proc_dointvec_minmax, 240 .proc_handler = proc_dointvec_minmax,
283 .strategy = &sysctl_intvec,
284 .extra1 = &zero, 241 .extra1 = &zero,
285 .extra2 = &addr_scope_max, 242 .extra2 = &addr_scope_max,
286 }, 243 },
287 { .ctl_name = 0 } 244 { }
288}; 245};
289 246
290static struct ctl_path sctp_path[] = { 247static struct ctl_path sctp_path[] = {
291 { .procname = "net", .ctl_name = CTL_NET, }, 248 { .procname = "net", },
292 { .procname = "sctp", .ctl_name = NET_SCTP, }, 249 { .procname = "sctp", },
293 { } 250 { }
294}; 251};
295 252
diff --git a/net/sctp/transport.c b/net/sctp/transport.c
index c256e4839316..37a1184d789f 100644
--- a/net/sctp/transport.c
+++ b/net/sctp/transport.c
@@ -74,7 +74,7 @@ static struct sctp_transport *sctp_transport_init(struct sctp_transport *peer,
74 * given destination transport address, set RTO to the protocol 74 * given destination transport address, set RTO to the protocol
75 * parameter 'RTO.Initial'. 75 * parameter 'RTO.Initial'.
76 */ 76 */
77 peer->last_rto = peer->rto = msecs_to_jiffies(sctp_rto_initial); 77 peer->rto = msecs_to_jiffies(sctp_rto_initial);
78 peer->rtt = 0; 78 peer->rtt = 0;
79 peer->rttvar = 0; 79 peer->rttvar = 0;
80 peer->srtt = 0; 80 peer->srtt = 0;
@@ -308,7 +308,8 @@ void sctp_transport_route(struct sctp_transport *transport,
308 /* Initialize sk->sk_rcv_saddr, if the transport is the 308 /* Initialize sk->sk_rcv_saddr, if the transport is the
309 * association's active path for getsockname(). 309 * association's active path for getsockname().
310 */ 310 */
311 if (asoc && (transport == asoc->peer.active_path)) 311 if (asoc && (!asoc->peer.primary_path ||
312 (transport == asoc->peer.active_path)))
312 opt->pf->af->to_sk_saddr(&transport->saddr, 313 opt->pf->af->to_sk_saddr(&transport->saddr,
313 asoc->base.sk); 314 asoc->base.sk);
314 } else 315 } else
@@ -385,7 +386,6 @@ void sctp_transport_update_rto(struct sctp_transport *tp, __u32 rtt)
385 tp->rto = tp->asoc->rto_max; 386 tp->rto = tp->asoc->rto_max;
386 387
387 tp->rtt = rtt; 388 tp->rtt = rtt;
388 tp->last_rto = tp->rto;
389 389
390 /* Reset rto_pending so that a new RTT measurement is started when a 390 /* Reset rto_pending so that a new RTT measurement is started when a
391 * new data chunk is sent. 391 * new data chunk is sent.
@@ -601,7 +601,7 @@ void sctp_transport_reset(struct sctp_transport *t)
601 */ 601 */
602 t->cwnd = min(4*asoc->pathmtu, max_t(__u32, 2*asoc->pathmtu, 4380)); 602 t->cwnd = min(4*asoc->pathmtu, max_t(__u32, 2*asoc->pathmtu, 4380));
603 t->ssthresh = asoc->peer.i.a_rwnd; 603 t->ssthresh = asoc->peer.i.a_rwnd;
604 t->last_rto = t->rto = asoc->rto_initial; 604 t->rto = asoc->rto_initial;
605 t->rtt = 0; 605 t->rtt = 0;
606 t->srtt = 0; 606 t->srtt = 0;
607 t->rttvar = 0; 607 t->rttvar = 0;