aboutsummaryrefslogtreecommitdiffstats
path: root/net/sctp
diff options
context:
space:
mode:
authorXin Long <lucien.xin@gmail.com>2016-09-28 14:37:28 -0400
committerDavid S. Miller <davem@davemloft.net>2016-09-30 02:07:05 -0400
commitbe4947bf46cb0e7a7d089e03c61bab35f1e695ce (patch)
tree859152992bd65e3da93767dbda6fbdf7e011e69c /net/sctp
parent0605483f6ace1f6b63e397c819a115ddcd13af0d (diff)
sctp: change to check peer prsctp_capable when using prsctp polices
Now before using prsctp polices, sctp uses asoc->prsctp_enable to check if prsctp is enabled. However asoc->prsctp_enable is set only means local host support prsctp, sctp should not abandon packet if peer host doesn't enable prsctp. So this patch is to use asoc->peer.prsctp_capable to check if prsctp is enabled on both side, instead of asoc->prsctp_enable, as asoc's peer.prsctp_capable is set only when local and peer both enable prsctp. Fixes: a6c2f792873a ("sctp: implement prsctp TTL policy") Signed-off-by: Xin Long <lucien.xin@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sctp')
-rw-r--r--net/sctp/chunk.c4
-rw-r--r--net/sctp/outqueue.c8
2 files changed, 6 insertions, 6 deletions
diff --git a/net/sctp/chunk.c b/net/sctp/chunk.c
index 14990e21cf55..0a3dbec0a8fb 100644
--- a/net/sctp/chunk.c
+++ b/net/sctp/chunk.c
@@ -179,7 +179,7 @@ struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *asoc,
179 msg, msg->expires_at, jiffies); 179 msg, msg->expires_at, jiffies);
180 } 180 }
181 181
182 if (asoc->prsctp_enable && 182 if (asoc->peer.prsctp_capable &&
183 SCTP_PR_TTL_ENABLED(sinfo->sinfo_flags)) 183 SCTP_PR_TTL_ENABLED(sinfo->sinfo_flags))
184 msg->expires_at = 184 msg->expires_at =
185 jiffies + msecs_to_jiffies(sinfo->sinfo_timetolive); 185 jiffies + msecs_to_jiffies(sinfo->sinfo_timetolive);
@@ -340,7 +340,7 @@ errout:
340/* Check whether this message has expired. */ 340/* Check whether this message has expired. */
341int sctp_chunk_abandoned(struct sctp_chunk *chunk) 341int sctp_chunk_abandoned(struct sctp_chunk *chunk)
342{ 342{
343 if (!chunk->asoc->prsctp_enable || 343 if (!chunk->asoc->peer.prsctp_capable ||
344 !SCTP_PR_POLICY(chunk->sinfo.sinfo_flags)) { 344 !SCTP_PR_POLICY(chunk->sinfo.sinfo_flags)) {
345 struct sctp_datamsg *msg = chunk->msg; 345 struct sctp_datamsg *msg = chunk->msg;
346 346
diff --git a/net/sctp/outqueue.c b/net/sctp/outqueue.c
index e084f35d40d2..107233da5cc9 100644
--- a/net/sctp/outqueue.c
+++ b/net/sctp/outqueue.c
@@ -326,7 +326,7 @@ int sctp_outq_tail(struct sctp_outq *q, struct sctp_chunk *chunk, gfp_t gfp)
326 326
327 sctp_chunk_hold(chunk); 327 sctp_chunk_hold(chunk);
328 sctp_outq_tail_data(q, chunk); 328 sctp_outq_tail_data(q, chunk);
329 if (chunk->asoc->prsctp_enable && 329 if (chunk->asoc->peer.prsctp_capable &&
330 SCTP_PR_PRIO_ENABLED(chunk->sinfo.sinfo_flags)) 330 SCTP_PR_PRIO_ENABLED(chunk->sinfo.sinfo_flags))
331 chunk->asoc->sent_cnt_removable++; 331 chunk->asoc->sent_cnt_removable++;
332 if (chunk->chunk_hdr->flags & SCTP_DATA_UNORDERED) 332 if (chunk->chunk_hdr->flags & SCTP_DATA_UNORDERED)
@@ -442,7 +442,7 @@ void sctp_prsctp_prune(struct sctp_association *asoc,
442{ 442{
443 struct sctp_transport *transport; 443 struct sctp_transport *transport;
444 444
445 if (!asoc->prsctp_enable || !asoc->sent_cnt_removable) 445 if (!asoc->peer.prsctp_capable || !asoc->sent_cnt_removable)
446 return; 446 return;
447 447
448 msg_len = sctp_prsctp_prune_sent(asoc, sinfo, 448 msg_len = sctp_prsctp_prune_sent(asoc, sinfo,
@@ -1055,7 +1055,7 @@ static int sctp_outq_flush(struct sctp_outq *q, int rtx_timeout, gfp_t gfp)
1055 1055
1056 /* Mark as failed send. */ 1056 /* Mark as failed send. */
1057 sctp_chunk_fail(chunk, SCTP_ERROR_INV_STRM); 1057 sctp_chunk_fail(chunk, SCTP_ERROR_INV_STRM);
1058 if (asoc->prsctp_enable && 1058 if (asoc->peer.prsctp_capable &&
1059 SCTP_PR_PRIO_ENABLED(chunk->sinfo.sinfo_flags)) 1059 SCTP_PR_PRIO_ENABLED(chunk->sinfo.sinfo_flags))
1060 asoc->sent_cnt_removable--; 1060 asoc->sent_cnt_removable--;
1061 sctp_chunk_free(chunk); 1061 sctp_chunk_free(chunk);
@@ -1347,7 +1347,7 @@ int sctp_outq_sack(struct sctp_outq *q, struct sctp_chunk *chunk)
1347 tsn = ntohl(tchunk->subh.data_hdr->tsn); 1347 tsn = ntohl(tchunk->subh.data_hdr->tsn);
1348 if (TSN_lte(tsn, ctsn)) { 1348 if (TSN_lte(tsn, ctsn)) {
1349 list_del_init(&tchunk->transmitted_list); 1349 list_del_init(&tchunk->transmitted_list);
1350 if (asoc->prsctp_enable && 1350 if (asoc->peer.prsctp_capable &&
1351 SCTP_PR_PRIO_ENABLED(chunk->sinfo.sinfo_flags)) 1351 SCTP_PR_PRIO_ENABLED(chunk->sinfo.sinfo_flags))
1352 asoc->sent_cnt_removable--; 1352 asoc->sent_cnt_removable--;
1353 sctp_chunk_free(tchunk); 1353 sctp_chunk_free(tchunk);