Commit be4947bf authored by Xin Long's avatar Xin Long Committed by David S. Miller

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: a6c2f792 ("sctp: implement prsctp TTL policy")
Signed-off-by: default avatarXin Long <lucien.xin@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 0605483f
...@@ -179,7 +179,7 @@ struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *asoc, ...@@ -179,7 +179,7 @@ struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *asoc,
msg, msg->expires_at, jiffies); msg, msg->expires_at, jiffies);
} }
if (asoc->prsctp_enable && if (asoc->peer.prsctp_capable &&
SCTP_PR_TTL_ENABLED(sinfo->sinfo_flags)) SCTP_PR_TTL_ENABLED(sinfo->sinfo_flags))
msg->expires_at = msg->expires_at =
jiffies + msecs_to_jiffies(sinfo->sinfo_timetolive); jiffies + msecs_to_jiffies(sinfo->sinfo_timetolive);
...@@ -340,7 +340,7 @@ struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *asoc, ...@@ -340,7 +340,7 @@ struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *asoc,
/* Check whether this message has expired. */ /* Check whether this message has expired. */
int sctp_chunk_abandoned(struct sctp_chunk *chunk) int sctp_chunk_abandoned(struct sctp_chunk *chunk)
{ {
if (!chunk->asoc->prsctp_enable || if (!chunk->asoc->peer.prsctp_capable ||
!SCTP_PR_POLICY(chunk->sinfo.sinfo_flags)) { !SCTP_PR_POLICY(chunk->sinfo.sinfo_flags)) {
struct sctp_datamsg *msg = chunk->msg; struct sctp_datamsg *msg = chunk->msg;
......
...@@ -326,7 +326,7 @@ int sctp_outq_tail(struct sctp_outq *q, struct sctp_chunk *chunk, gfp_t gfp) ...@@ -326,7 +326,7 @@ int sctp_outq_tail(struct sctp_outq *q, struct sctp_chunk *chunk, gfp_t gfp)
sctp_chunk_hold(chunk); sctp_chunk_hold(chunk);
sctp_outq_tail_data(q, chunk); sctp_outq_tail_data(q, chunk);
if (chunk->asoc->prsctp_enable && if (chunk->asoc->peer.prsctp_capable &&
SCTP_PR_PRIO_ENABLED(chunk->sinfo.sinfo_flags)) SCTP_PR_PRIO_ENABLED(chunk->sinfo.sinfo_flags))
chunk->asoc->sent_cnt_removable++; chunk->asoc->sent_cnt_removable++;
if (chunk->chunk_hdr->flags & SCTP_DATA_UNORDERED) if (chunk->chunk_hdr->flags & SCTP_DATA_UNORDERED)
...@@ -442,7 +442,7 @@ void sctp_prsctp_prune(struct sctp_association *asoc, ...@@ -442,7 +442,7 @@ void sctp_prsctp_prune(struct sctp_association *asoc,
{ {
struct sctp_transport *transport; struct sctp_transport *transport;
if (!asoc->prsctp_enable || !asoc->sent_cnt_removable) if (!asoc->peer.prsctp_capable || !asoc->sent_cnt_removable)
return; return;
msg_len = sctp_prsctp_prune_sent(asoc, sinfo, 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,7 +1055,7 @@ static int sctp_outq_flush(struct sctp_outq *q, int rtx_timeout, gfp_t gfp)
/* Mark as failed send. */ /* Mark as failed send. */
sctp_chunk_fail(chunk, SCTP_ERROR_INV_STRM); sctp_chunk_fail(chunk, SCTP_ERROR_INV_STRM);
if (asoc->prsctp_enable && if (asoc->peer.prsctp_capable &&
SCTP_PR_PRIO_ENABLED(chunk->sinfo.sinfo_flags)) SCTP_PR_PRIO_ENABLED(chunk->sinfo.sinfo_flags))
asoc->sent_cnt_removable--; asoc->sent_cnt_removable--;
sctp_chunk_free(chunk); sctp_chunk_free(chunk);
...@@ -1347,7 +1347,7 @@ int sctp_outq_sack(struct sctp_outq *q, struct sctp_chunk *chunk) ...@@ -1347,7 +1347,7 @@ int sctp_outq_sack(struct sctp_outq *q, struct sctp_chunk *chunk)
tsn = ntohl(tchunk->subh.data_hdr->tsn); tsn = ntohl(tchunk->subh.data_hdr->tsn);
if (TSN_lte(tsn, ctsn)) { if (TSN_lte(tsn, ctsn)) {
list_del_init(&tchunk->transmitted_list); list_del_init(&tchunk->transmitted_list);
if (asoc->prsctp_enable && if (asoc->peer.prsctp_capable &&
SCTP_PR_PRIO_ENABLED(chunk->sinfo.sinfo_flags)) SCTP_PR_PRIO_ENABLED(chunk->sinfo.sinfo_flags))
asoc->sent_cnt_removable--; asoc->sent_cnt_removable--;
sctp_chunk_free(tchunk); sctp_chunk_free(tchunk);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment