mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
sctp: implement prsctp TTL policy
prsctp TTL policy is a policy to abandon chunks when they expire at the specific time in local stack. It's similar with expires_at in struct sctp_datamsg. This patch uses sinfo->sinfo_timetolive to set the specific time for TTL policy. sinfo->sinfo_timetolive is also used for msg->expires_at. So if prsctp_enable or TTL policy is not enabled, msg->expires_at still works as before. Signed-off-by: Xin Long <lucien.xin@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
826d253d57
commit
a6c2f79287
5 changed files with 43 additions and 5 deletions
|
@ -335,13 +335,27 @@ errout:
|
|||
/* Check whether this message has expired. */
|
||||
int sctp_chunk_abandoned(struct sctp_chunk *chunk)
|
||||
{
|
||||
struct sctp_datamsg *msg = chunk->msg;
|
||||
if (!chunk->asoc->prsctp_enable ||
|
||||
!SCTP_PR_POLICY(chunk->sinfo.sinfo_flags)) {
|
||||
struct sctp_datamsg *msg = chunk->msg;
|
||||
|
||||
if (!msg->can_abandon)
|
||||
return 0;
|
||||
|
||||
if (time_after(jiffies, msg->expires_at))
|
||||
return 1;
|
||||
|
||||
if (!msg->can_abandon)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (time_after(jiffies, msg->expires_at))
|
||||
if (SCTP_PR_TTL_ENABLED(chunk->sinfo.sinfo_flags) &&
|
||||
time_after(jiffies, chunk->prsctp_param)) {
|
||||
if (chunk->sent_count)
|
||||
chunk->asoc->abandoned_sent[SCTP_PR_INDEX(TTL)]++;
|
||||
else
|
||||
chunk->asoc->abandoned_unsent[SCTP_PR_INDEX(TTL)]++;
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue