diff options
| author | Sridhar Samudrala <sridhar@dyn9-47-18-140.beaverton.ibm.com> | 2002-10-15 02:33:01 -0700 |
|---|---|---|
| committer | Sridhar Samudrala <sridhar@dyn9-47-18-140.beaverton.ibm.com> | 2002-10-15 02:33:01 -0700 |
| commit | 0ab86310a8caafd178c8722357680e9db647e579 (patch) | |
| tree | 8dbccf366ff2d81c051753e7df182294be6babee /include/net | |
| parent | d7b59481637b5650d58b57483dd00a1824f0a0ee (diff) | |
sctp: VTAG checks for ABORT & SHUTDOWN_COMPLETE chunks (ardelle.fan)
Diffstat (limited to 'include/net')
| -rw-r--r-- | include/net/sctp/sm.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/include/net/sctp/sm.h b/include/net/sctp/sm.h index fc9940ff2651..dcbe05457478 100644 --- a/include/net/sctp/sm.h +++ b/include/net/sctp/sm.h @@ -432,4 +432,36 @@ static inline void sctp_add_cmd_sf(sctp_cmd_seq_t *seq, sctp_verb_t verb, sctp_a BUG(); } +/* Check VTAG of the packet matches the sender's own tag OR its peer's + * tag and the T bit is set in the Chunk Flags. + */ +static inline int +sctp_vtag_verify_either(const sctp_chunk_t *chunk, + const sctp_association_t *asoc) +{ + /* RFC 2960 Section 8.5.1, sctpimpguide-06 Section 2.13.2 + * + * B) The receiver of a ABORT shall accept the packet if the + * Verification Tag field of the packet matches its own tag OR it + * is set to its peer's tag and the T bit is set in the Chunk + * Flags. Otherwise, the receiver MUST silently discard the packet + * and take no further action. + * + * (C) The receiver of a SHUTDOWN COMPLETE shall accept the + * packet if the Verification Tag field of the packet + * matches its own tag OR it is set to its peer's tag and + * the T bit is set in the Chunk Flags. Otherwise, the + * receiver MUST silently discard the packet and take no + * further action.... + * + */ + if ((ntohl(chunk->sctp_hdr->vtag) == asoc->c.my_vtag) || + (sctp_test_T_bit(chunk) && (ntohl(chunk->sctp_hdr->vtag) + == asoc->c.peer_vtag))) { + return 1; + } + + return 0; +} + #endif /* __sctp_sm_h__ */ |
