Fix bugs related to M_FLOWID:
* Store the flowid when receiving an SCTP/IPv6 packet. * Store the flowid when receiving an SCTP packet with wrong CRC. * Initilize flowid correctly. * Put test code under INVARIANTS. MFC after: 3 months.
This commit is contained in:
parent
f6e6bb86df
commit
4c97400f86
@ -2617,7 +2617,9 @@ sctp_handle_cookie_echo(struct mbuf *m, int iphlen, int offset,
|
||||
}
|
||||
if ((*netp != NULL) && (m->m_flags & M_FLOWID)) {
|
||||
(*netp)->flowid = m->m_pkthdr.flowid;
|
||||
#ifdef INVARIANTS
|
||||
(*netp)->flowidset = 1;
|
||||
#endif
|
||||
}
|
||||
/*
|
||||
* Ok, we built an association so confirm the address we sent the
|
||||
@ -5815,6 +5817,12 @@ sctp_input_with_port(struct mbuf *i_pak, int off, uint16_t port)
|
||||
}
|
||||
net->port = port;
|
||||
}
|
||||
if ((net != NULL) && (m->m_flags & M_FLOWID)) {
|
||||
net->flowid = m->m_pkthdr.flowid;
|
||||
#ifdef INVARIANTS
|
||||
net->flowidset = 1;
|
||||
#endif
|
||||
}
|
||||
if ((inp) && (stcb)) {
|
||||
sctp_send_packet_dropped(stcb, net, m, iphlen, 1);
|
||||
sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_INPUT_ERROR, SCTP_SO_NOT_LOCKED);
|
||||
@ -5846,7 +5854,9 @@ sctp_skip_csum_4:
|
||||
}
|
||||
if ((net != NULL) && (m->m_flags & M_FLOWID)) {
|
||||
net->flowid = m->m_pkthdr.flowid;
|
||||
#ifdef INVARIANTS
|
||||
net->flowidset = 1;
|
||||
#endif
|
||||
}
|
||||
/* inp's ref-count increased && stcb locked */
|
||||
if (inp == NULL) {
|
||||
|
@ -3485,12 +3485,11 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp,
|
||||
SCTP_BUF_NEXT(newm) = m;
|
||||
m = newm;
|
||||
if (net != NULL) {
|
||||
#ifdef INVARIANTS
|
||||
if (net->flowidset == 0) {
|
||||
net->flowid = stcb->asoc.my_vtag ^
|
||||
ntohs(stcb->rport) ^
|
||||
ntohs(stcb->sctp_ep->sctp_lport);
|
||||
net->flowidset = 1;
|
||||
panic("Flow ID not set");
|
||||
}
|
||||
#endif
|
||||
m->m_pkthdr.flowid = net->flowid;
|
||||
m->m_flags |= M_FLOWID;
|
||||
} else {
|
||||
@ -3821,12 +3820,11 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp,
|
||||
SCTP_BUF_NEXT(newm) = m;
|
||||
m = newm;
|
||||
if (net != NULL) {
|
||||
#ifdef INVARIANTS
|
||||
if (net->flowidset == 0) {
|
||||
net->flowid = stcb->asoc.my_vtag ^
|
||||
ntohs(stcb->rport) ^
|
||||
ntohs(stcb->sctp_ep->sctp_lport);
|
||||
net->flowidset = 1;
|
||||
panic("Flow ID not set");
|
||||
}
|
||||
#endif
|
||||
m->m_pkthdr.flowid = net->flowid;
|
||||
m->m_flags |= M_FLOWID;
|
||||
} else {
|
||||
|
@ -3962,6 +3962,13 @@ sctp_add_remote_addr(struct sctp_tcb *stcb, struct sockaddr *newaddr,
|
||||
net->find_pseudo_cumack = 1;
|
||||
net->find_rtx_pseudo_cumack = 1;
|
||||
net->src_addr_selected = 0;
|
||||
/* Choose an initial flowid. */
|
||||
net->flowid = stcb->asoc.my_vtag ^
|
||||
ntohs(stcb->rport) ^
|
||||
ntohs(stcb->sctp_ep->sctp_lport);
|
||||
#ifdef INVARIANTS
|
||||
net->flowidset = 1;
|
||||
#endif
|
||||
netfirst = TAILQ_FIRST(&stcb->asoc.nets);
|
||||
if (net->ro.ro_rt == NULL) {
|
||||
/* Since we have no route put it at the back */
|
||||
@ -4035,11 +4042,6 @@ sctp_add_remote_addr(struct sctp_tcb *stcb, struct sockaddr *newaddr,
|
||||
TAILQ_INSERT_HEAD(&stcb->asoc.nets,
|
||||
stcb->asoc.primary_destination, sctp_next);
|
||||
}
|
||||
/* Choose an initial flowid. */
|
||||
net->flowid = stcb->asoc.my_vtag ^
|
||||
ntohs(stcb->rport) ^
|
||||
ntohs(stcb->sctp_ep->sctp_lport);
|
||||
net->flowidset = 1;
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
@ -351,7 +351,9 @@ struct sctp_nets {
|
||||
/* JRS - struct used in HTCP algorithm */
|
||||
struct htcp htcp_ca;
|
||||
uint32_t flowid;
|
||||
#ifdef INVARIANTS
|
||||
uint8_t flowidset;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
|
@ -170,6 +170,12 @@ sctp6_input(struct mbuf **i_pak, int *offp, int proto)
|
||||
}
|
||||
net->port = port;
|
||||
}
|
||||
if ((net != NULL) && (m->m_flags & M_FLOWID)) {
|
||||
net->flowid = m->m_pkthdr.flowid;
|
||||
#ifdef INVARIANTS
|
||||
net->flowidset = 1;
|
||||
#endif
|
||||
}
|
||||
/* in6p's ref-count increased && stcb locked */
|
||||
if ((in6p) && (stcb)) {
|
||||
sctp_send_packet_dropped(stcb, net, m, iphlen, 1);
|
||||
@ -198,6 +204,12 @@ sctp_skip_csum:
|
||||
}
|
||||
net->port = port;
|
||||
}
|
||||
if ((net != NULL) && (m->m_flags & M_FLOWID)) {
|
||||
net->flowid = m->m_pkthdr.flowid;
|
||||
#ifdef INVARIANTS
|
||||
net->flowidset = 1;
|
||||
#endif
|
||||
}
|
||||
/* in6p's ref-count increased */
|
||||
if (in6p == NULL) {
|
||||
struct sctp_init_chunk *init_chk, chunk_buf;
|
||||
|
Loading…
x
Reference in New Issue
Block a user