diff options
author | Marco Varlese <marco.varlese@suse.com> | 2018-01-31 11:00:01 +0100 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2018-02-01 23:45:03 +0000 |
commit | 91389ac2c28ae10f2b7f766e4dfe7a7fd96dc5e0 (patch) | |
tree | 8a0286cca7960df4f1365f7e20a9a34ced835c4c /src/vnet/sctp/sctp.h | |
parent | 75e7d1301475d49311d14e202936c62df0c07d10 (diff) |
Out-of-order data chunks handling and more
This patch addresses the need to handle out-of-order data chunks
received by a peer. To do that effectively, we had to add the handling
of data chunks flags (E/B/U bit) to understand whether the stream is
fragmenting user-message data and in that case if a fragment is the
FIRST/MIDDLE/LAST one of a transmission.
The same patch also addresses the security requirement to have a HMAC
calculated and incorporated in the INIT_ACK and COOKIE_ECHO chunks. The
algorithm used is the HMAC-SHA1.
Change-Id: Ib6a9a80492e2aafe5c8480d6e02da895efe9f90b
Signed-off-by: Marco Varlese <marco.varlese@suse.com>
Diffstat (limited to 'src/vnet/sctp/sctp.h')
-rw-r--r-- | src/vnet/sctp/sctp.h | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/src/vnet/sctp/sctp.h b/src/vnet/sctp/sctp.h index 3e3750ea92a..8f80d840c33 100644 --- a/src/vnet/sctp/sctp.h +++ b/src/vnet/sctp/sctp.h @@ -110,9 +110,25 @@ typedef struct } sctp_options_t; -#define SetBit(A,k) ( A[(k/32)] |= (1 << (k%32)) ) -#define ClearBit(A,k) ( A[(k/32)] &= ~(1 << (k%32)) ) -#define TestBit(A,k) ( A[(k/32)] & (1 << (k%32)) ) +/* Useful macros to deal with the out_of_order_map (array of bit) */ +#define SET_BIT(A,k) ( A[(k/32)] |= (1 << (k%32)) ) +#define CLEAR_BIT(A,k) ( A[(k/32)] &= ~(1 << (k%32)) ) +#define TEST_BIT(A,k) ( A[(k/32)] & (1 << (k%32)) ) + +always_inline void +_bytes_swap (void *pv, size_t n) +{ + char *p = pv; + size_t lo, hi; + for (lo = 0, hi = n - 1; hi > lo; lo++, hi--) + { + char tmp = p[lo]; + p[lo] = p[hi]; + p[hi] = tmp; + } +} + +#define ENDIANESS_SWAP(x) _bytes_swap(&x, sizeof(x)); #define MAX_INFLIGHT_PACKETS 128 #define MAX_ENQUEABLE_SACKS 2 @@ -182,6 +198,10 @@ typedef struct _sctp_connection u32 rtt_ts; u32 rtt_seq; + u8 overall_sending_status; /**< 0 indicates first fragment of a user message + 1 indicates normal stream + 2 indicates last fragment of a user message */ + sctp_options_t rcv_opts; sctp_options_t snd_opts; |