sctp: initialize sequence numbers for ECN correctly
MFC after: 3 days Reported by: Junseok Yang (for the userland stack)
This commit is contained in:
parent
914b6a0122
commit
c7f048ab35
@ -2053,7 +2053,8 @@ sctp_process_cookie_new(struct mbuf *m, int iphlen, int offset,
|
||||
* getting a cookie, we cannot be unbound.
|
||||
*/
|
||||
stcb = sctp_aloc_assoc(inp, init_src, &error,
|
||||
ntohl(initack_cp->init.initiate_tag), vrf_id,
|
||||
ntohl(initack_cp->init.initiate_tag),
|
||||
ntohl(initack_cp->init.initial_tsn), vrf_id,
|
||||
ntohs(initack_cp->init.num_outbound_streams),
|
||||
port,
|
||||
(struct thread *)NULL,
|
||||
@ -2097,15 +2098,7 @@ sctp_process_cookie_new(struct mbuf *m, int iphlen, int offset,
|
||||
return (NULL);
|
||||
}
|
||||
/* process the INIT-ACK info (my info) */
|
||||
asoc->my_vtag = ntohl(initack_cp->init.initiate_tag);
|
||||
asoc->my_rwnd = ntohl(initack_cp->init.a_rwnd);
|
||||
asoc->init_seq_number = ntohl(initack_cp->init.initial_tsn);
|
||||
asoc->sending_seq = asoc->asconf_seq_out = asoc->str_reset_seq_out = asoc->init_seq_number;
|
||||
asoc->asconf_seq_out_acked = asoc->asconf_seq_out - 1;
|
||||
asoc->asconf_seq_in = asoc->last_acked_seq = asoc->init_seq_number - 1;
|
||||
asoc->str_reset_seq_in = asoc->init_seq_number;
|
||||
|
||||
asoc->advanced_peer_ack_point = asoc->last_acked_seq;
|
||||
|
||||
/* process the INIT info (peer's info) */
|
||||
if (sctp_process_init(init_cp, stcb) < 0) {
|
||||
|
@ -12703,7 +12703,7 @@ sctp_lower_sosend(struct socket *so,
|
||||
panic("Error, should hold create lock and I don't?");
|
||||
}
|
||||
#endif
|
||||
stcb = sctp_aloc_assoc(inp, addr, &error, 0, vrf_id,
|
||||
stcb = sctp_aloc_assoc(inp, addr, &error, 0, 0, vrf_id,
|
||||
inp->sctp_ep.pre_open_stream_count,
|
||||
inp->sctp_ep.port,
|
||||
p,
|
||||
|
@ -4154,8 +4154,8 @@ sctp_aloc_a_assoc_id(struct sctp_inpcb *inp, struct sctp_tcb *stcb)
|
||||
*/
|
||||
struct sctp_tcb *
|
||||
sctp_aloc_assoc(struct sctp_inpcb *inp, struct sockaddr *firstaddr,
|
||||
int *error, uint32_t override_tag, uint32_t vrf_id,
|
||||
uint16_t o_streams, uint16_t port,
|
||||
int *error, uint32_t override_tag, uint32_t initial_tsn,
|
||||
uint32_t vrf_id, uint16_t o_streams, uint16_t port,
|
||||
struct thread *p,
|
||||
int initialize_auth_params)
|
||||
{
|
||||
@ -4312,7 +4312,7 @@ sctp_aloc_assoc(struct sctp_inpcb *inp, struct sockaddr *firstaddr,
|
||||
/* setup back pointer's */
|
||||
stcb->sctp_ep = inp;
|
||||
stcb->sctp_socket = inp->sctp_socket;
|
||||
if ((err = sctp_init_asoc(inp, stcb, override_tag, vrf_id, o_streams))) {
|
||||
if ((err = sctp_init_asoc(inp, stcb, override_tag, initial_tsn, vrf_id, o_streams))) {
|
||||
/* failed */
|
||||
SCTP_TCB_LOCK_DESTROY(stcb);
|
||||
SCTP_TCB_SEND_LOCK_DESTROY(stcb);
|
||||
|
@ -573,8 +573,8 @@ void sctp_inpcb_free(struct sctp_inpcb *, int, int);
|
||||
|
||||
struct sctp_tcb *
|
||||
sctp_aloc_assoc(struct sctp_inpcb *, struct sockaddr *,
|
||||
int *, uint32_t, uint32_t, uint16_t, uint16_t, struct thread *,
|
||||
int);
|
||||
int *, uint32_t, uint32_t, uint32_t, uint16_t, uint16_t,
|
||||
struct thread *, int);
|
||||
|
||||
int sctp_free_assoc(struct sctp_inpcb *, struct sctp_tcb *, int, int);
|
||||
|
||||
|
@ -1425,7 +1425,7 @@ sctp_do_connect_x(struct socket *so, struct sctp_inpcb *inp, void *optval,
|
||||
vrf_id = inp->def_vrf_id;
|
||||
|
||||
/* We are GOOD to go */
|
||||
stcb = sctp_aloc_assoc(inp, sa, &error, 0, vrf_id,
|
||||
stcb = sctp_aloc_assoc(inp, sa, &error, 0, 0, vrf_id,
|
||||
inp->sctp_ep.pre_open_stream_count,
|
||||
inp->sctp_ep.port,
|
||||
(struct thread *)p,
|
||||
@ -7076,7 +7076,7 @@ sctp_connect(struct socket *so, struct sockaddr *addr, struct thread *p)
|
||||
|
||||
vrf_id = inp->def_vrf_id;
|
||||
/* We are GOOD to go */
|
||||
stcb = sctp_aloc_assoc(inp, addr, &error, 0, vrf_id,
|
||||
stcb = sctp_aloc_assoc(inp, addr, &error, 0, 0, vrf_id,
|
||||
inp->sctp_ep.pre_open_stream_count,
|
||||
inp->sctp_ep.port, p,
|
||||
SCTP_INITIALIZE_AUTH_PARAMS);
|
||||
|
@ -1112,7 +1112,8 @@ sctp_map_assoc_state(int kernel_state)
|
||||
|
||||
int
|
||||
sctp_init_asoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
|
||||
uint32_t override_tag, uint32_t vrf_id, uint16_t o_strms)
|
||||
uint32_t override_tag, uint32_t initial_tsn, uint32_t vrf_id,
|
||||
uint16_t o_strms)
|
||||
{
|
||||
struct sctp_association *asoc;
|
||||
|
||||
@ -1190,9 +1191,15 @@ sctp_init_asoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
|
||||
#endif
|
||||
asoc->refcnt = 0;
|
||||
asoc->assoc_up_sent = 0;
|
||||
asoc->asconf_seq_out = asoc->str_reset_seq_out = asoc->init_seq_number = asoc->sending_seq =
|
||||
sctp_select_initial_TSN(&inp->sctp_ep);
|
||||
asoc->asconf_seq_out_acked = asoc->asconf_seq_out - 1;
|
||||
if (override_tag) {
|
||||
asoc->init_seq_number = initial_tsn;
|
||||
} else {
|
||||
asoc->init_seq_number = sctp_select_initial_TSN(&inp->sctp_ep);
|
||||
}
|
||||
asoc->asconf_seq_out = asoc->init_seq_number;
|
||||
asoc->str_reset_seq_out = asoc->init_seq_number;
|
||||
asoc->sending_seq = asoc->init_seq_number;
|
||||
asoc->asconf_seq_out_acked = asoc->init_seq_number - 1;
|
||||
/* we are optimisitic here */
|
||||
asoc->peer_supports_nat = 0;
|
||||
asoc->sent_queue_retran_cnt = 0;
|
||||
@ -1200,13 +1207,12 @@ sctp_init_asoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
|
||||
/* for CMT */
|
||||
asoc->last_net_cmt_send_started = NULL;
|
||||
|
||||
/* This will need to be adjusted */
|
||||
asoc->last_acked_seq = asoc->init_seq_number - 1;
|
||||
asoc->advanced_peer_ack_point = asoc->last_acked_seq;
|
||||
asoc->asconf_seq_in = asoc->last_acked_seq;
|
||||
asoc->advanced_peer_ack_point = asoc->init_seq_number - 1;
|
||||
asoc->asconf_seq_in = asoc->init_seq_number - 1;
|
||||
|
||||
/* here we are different, we hold the next one we expect */
|
||||
asoc->str_reset_seq_in = asoc->last_acked_seq + 1;
|
||||
asoc->str_reset_seq_in = asoc->init_seq_number;
|
||||
|
||||
asoc->initial_init_rto_max = inp->sctp_ep.initial_init_rto_max;
|
||||
asoc->initial_rto = inp->sctp_ep.initial_rto;
|
||||
|
@ -79,7 +79,7 @@ uint32_t sctp_select_initial_TSN(struct sctp_pcb *);
|
||||
|
||||
uint32_t sctp_select_a_tag(struct sctp_inpcb *, uint16_t lport, uint16_t rport, int);
|
||||
|
||||
int sctp_init_asoc(struct sctp_inpcb *, struct sctp_tcb *, uint32_t, uint32_t, uint16_t);
|
||||
int sctp_init_asoc(struct sctp_inpcb *, struct sctp_tcb *, uint32_t, uint32_t, uint32_t, uint16_t);
|
||||
|
||||
void sctp_fill_random_store(struct sctp_pcb *);
|
||||
|
||||
|
@ -943,7 +943,7 @@ sctp6_connect(struct socket *so, struct sockaddr *addr, struct thread *p)
|
||||
return (EALREADY);
|
||||
}
|
||||
/* We are GOOD to go */
|
||||
stcb = sctp_aloc_assoc(inp, addr, &error, 0, vrf_id,
|
||||
stcb = sctp_aloc_assoc(inp, addr, &error, 0, 0, vrf_id,
|
||||
inp->sctp_ep.pre_open_stream_count,
|
||||
inp->sctp_ep.port, p,
|
||||
SCTP_INITIALIZE_AUTH_PARAMS);
|
||||
|
Loading…
Reference in New Issue
Block a user