MCPcopy Create free account
hub / github.com/F-Stack/f-stack / sctp_select_initial_TSN

Function sctp_select_initial_TSN

freebsd/netinet/sctputil.c:1010–1046  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1008}
1009
1010uint32_t
1011sctp_select_initial_TSN(struct sctp_pcb *inp)
1012{
1013 /*
1014 * A true implementation should use random selection process to get
1015 * the initial stream sequence number, using RFC1750 as a good
1016 * guideline
1017 */
1018 uint32_t x, *xp;
1019 uint8_t *p;
1020 int store_at, new_store;
1021
1022 if (inp->initial_sequence_debug != 0) {
1023 uint32_t ret;
1024
1025 ret = inp->initial_sequence_debug;
1026 inp->initial_sequence_debug++;
1027 return (ret);
1028 }
1029retry:
1030 store_at = inp->store_at;
1031 new_store = store_at + sizeof(uint32_t);
1032 if (new_store >= (SCTP_SIGNATURE_SIZE - 3)) {
1033 new_store = 0;
1034 }
1035 if (!atomic_cmpset_int(&inp->store_at, store_at, new_store)) {
1036 goto retry;
1037 }
1038 if (new_store == 0) {
1039 /* Refill the random store */
1040 sctp_fill_random_store(inp);
1041 }
1042 p = &inp->random_store[store_at];
1043 xp = (uint32_t *)p;
1044 x = *xp;
1045 return (x);
1046}
1047
1048uint32_t
1049sctp_select_a_tag(struct sctp_inpcb *inp, uint16_t lport, uint16_t rport, int check)

Callers 9

sctp_send_initiate_ackFunction · 0.85
sctp_send_hbFunction · 0.85
sctp_select_a_tagFunction · 0.85
sctp_init_asocFunction · 0.85
sctp_timeout_handlerFunction · 0.85
sctp_timer_startFunction · 0.85
sctp_inpcb_allocFunction · 0.85
sctp_inpcb_bindFunction · 0.85
sctp_find_alternate_netFunction · 0.85

Calls 1

sctp_fill_random_storeFunction · 0.85

Tested by

no test coverage detected