Add support for M_FLOWID.

This commit is contained in:
Michael Tuexen 2011-02-05 19:13:38 +00:00
parent 2774633be1
commit a4ae38f117
4 changed files with 52 additions and 10 deletions

View File

@ -2615,6 +2615,9 @@ sctp_handle_cookie_echo(struct mbuf *m, int iphlen, int offset,
/* still no TCB... must be bad cookie-echo */
return (NULL);
}
if ((*netp != NULL) && (m->m_flags & M_FLOWID)) {
(*netp)->flowid = m->m_pkthdr.flowid;
}
/*
* Ok, we built an association so confirm the address we sent the
* INIT-ACK to.
@ -5840,6 +5843,9 @@ 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;
}
/* inp's ref-count increased && stcb locked */
if (inp == NULL) {
struct sctp_init_chunk *init_chk, chunk_buf;

View File

@ -3419,7 +3419,8 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp,
#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING)
SCTP_UNUSED
#endif
union sctp_sockstore *over_addr
union sctp_sockstore *over_addr,
struct mbuf *init
)
/* nofragment_flag to tell if IP_DF should be set (IPv4 only) */
{
@ -3483,6 +3484,15 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp,
SCTP_BUF_LEN(newm) = len;
SCTP_BUF_NEXT(newm) = m;
m = newm;
if (net != NULL) {
m->m_pkthdr.flowid = net->flowid;
m->m_flags |= M_FLOWID;
} else {
if ((init != NULL) && (init->m_flags & M_FLOWID)) {
m->m_pkthdr.flowid = init->m_pkthdr.flowid;
m->m_flags |= M_FLOWID;
}
}
packet_length = sctp_calculate_len(m);
ip = mtod(m, struct ip *);
ip->ip_v = IPVERSION;
@ -3804,6 +3814,15 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp,
SCTP_BUF_LEN(newm) = len;
SCTP_BUF_NEXT(newm) = m;
m = newm;
if (net != NULL) {
m->m_pkthdr.flowid = net->flowid;
m->m_flags |= M_FLOWID;
} else {
if ((init != NULL) && (init->m_flags & M_FLOWID)) {
m->m_pkthdr.flowid = init->m_pkthdr.flowid;
m->m_flags |= M_FLOWID;
}
}
packet_length = sctp_calculate_len(m);
ip6h = mtod(m, struct ip6_hdr *);
@ -4365,7 +4384,7 @@ sctp_send_initiate(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int so_locked
(struct sockaddr *)&net->ro._l_addr,
m, 0, NULL, 0, 0, 0, NULL, 0,
inp->sctp_lport, stcb->rport, htonl(0),
net->port, so_locked, NULL);
net->port, so_locked, NULL, NULL);
SCTPDBG(SCTP_DEBUG_OUTPUT4, "lowlevel_output - %d\n", ret);
SCTP_STAT_INCR_COUNTER64(sctps_outcontrolchunks);
(void)SCTP_GETTIME_TIMEVAL(&net->last_sent_time);
@ -5536,7 +5555,7 @@ sctp_send_initiate_ack(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
(void)sctp_lowlevel_chunk_output(inp, NULL, NULL, to, m, 0, NULL, 0, 0,
0, NULL, 0,
inp->sctp_lport, sh->src_port, init_chk->init.initiate_tag,
port, SCTP_SO_NOT_LOCKED, over_addr);
port, SCTP_SO_NOT_LOCKED, over_addr, init_pkt);
SCTP_STAT_INCR_COUNTER64(sctps_outcontrolchunks);
}
@ -7564,7 +7583,7 @@ sctp_med_chunk_output(struct sctp_inpcb *inp,
no_fragmentflg, 0, NULL, asconf,
inp->sctp_lport, stcb->rport,
htonl(stcb->asoc.peer_vtag),
net->port, so_locked, NULL))) {
net->port, so_locked, NULL, NULL))) {
if (error == ENOBUFS) {
asoc->ifp_had_enobuf = 1;
SCTP_STAT_INCR(sctps_lowlevelerr);
@ -7820,7 +7839,7 @@ sctp_med_chunk_output(struct sctp_inpcb *inp,
no_fragmentflg, 0, NULL, asconf,
inp->sctp_lport, stcb->rport,
htonl(stcb->asoc.peer_vtag),
net->port, so_locked, NULL))) {
net->port, so_locked, NULL, NULL))) {
if (error == ENOBUFS) {
asoc->ifp_had_enobuf = 1;
SCTP_STAT_INCR(sctps_lowlevelerr);
@ -8151,7 +8170,7 @@ sctp_med_chunk_output(struct sctp_inpcb *inp,
asconf,
inp->sctp_lport, stcb->rport,
htonl(stcb->asoc.peer_vtag),
net->port, so_locked, NULL))) {
net->port, so_locked, NULL, NULL))) {
/* error, we could not output */
if (error == ENOBUFS) {
SCTP_STAT_INCR(sctps_lowlevelerr);
@ -8861,7 +8880,7 @@ sctp_chunk_retransmission(struct sctp_inpcb *inp,
auth_offset, auth, stcb->asoc.authinfo.active_keyid,
no_fragmentflg, 0, NULL, 0,
inp->sctp_lport, stcb->rport, htonl(stcb->asoc.peer_vtag),
chk->whoTo->port, so_locked, NULL))) {
chk->whoTo->port, so_locked, NULL, NULL))) {
SCTP_STAT_INCR(sctps_lowlevelerr);
return (error);
}
@ -9119,7 +9138,7 @@ sctp_chunk_retransmission(struct sctp_inpcb *inp,
auth_offset, auth, auth_keyid,
no_fragmentflg, 0, NULL, 0,
inp->sctp_lport, stcb->rport, htonl(stcb->asoc.peer_vtag),
net->port, so_locked, NULL))) {
net->port, so_locked, NULL, NULL))) {
/* error, we could not output */
SCTP_STAT_INCR(sctps_lowlevelerr);
return (error);
@ -10232,7 +10251,7 @@ sctp_send_abort_tcb(struct sctp_tcb *stcb, struct mbuf *operr, int so_locked
(struct sockaddr *)&stcb->asoc.primary_destination->ro._l_addr,
m_out, auth_offset, auth, stcb->asoc.authinfo.active_keyid, 1, 0, NULL, 0,
stcb->sctp_ep->sctp_lport, stcb->rport, htonl(stcb->asoc.peer_vtag),
stcb->asoc.primary_destination->port, so_locked, NULL);
stcb->asoc.primary_destination->port, so_locked, NULL, NULL);
SCTP_STAT_INCR_COUNTER64(sctps_outcontrolchunks);
}
@ -10269,7 +10288,7 @@ sctp_send_shutdown_complete(struct sctp_tcb *stcb,
m_shutdown_comp, 0, NULL, 0, 1, 0, NULL, 0,
stcb->sctp_ep->sctp_lport, stcb->rport,
htonl(vtag),
net->port, SCTP_SO_NOT_LOCKED, NULL);
net->port, SCTP_SO_NOT_LOCKED, NULL, NULL);
SCTP_STAT_INCR_COUNTER64(sctps_outcontrolchunks);
return;
}
@ -10314,6 +10333,10 @@ sctp_send_shutdown_complete2(struct mbuf *m, int iphlen, struct sctphdr *sh,
SCTP_BUF_RESV_UF(mout, max_linkhdr);
SCTP_BUF_LEN(mout) = len;
SCTP_BUF_NEXT(mout) = NULL;
if (m->m_flags & M_FLOWID) {
mout->m_pkthdr.flowid = m->m_pkthdr.flowid;
mout->m_flags |= M_FLOWID;
}
iph_out = NULL;
#ifdef INET6
ip6_out = NULL;
@ -11378,6 +11401,10 @@ sctp_send_abort(struct mbuf *m, int iphlen, struct sctphdr *sh, uint32_t vtag,
SCTP_BUF_RESV_UF(mout, max_linkhdr);
SCTP_BUF_LEN(mout) = len;
SCTP_BUF_NEXT(mout) = err_cause;
if (m->m_flags & M_FLOWID) {
mout->m_pkthdr.flowid = m->m_pkthdr.flowid;
mout->m_flags |= M_FLOWID;
}
iph_out = NULL;
#ifdef INET6
ip6_out = NULL;
@ -11623,6 +11650,10 @@ sctp_send_operr_to(struct mbuf *m, int iphlen, struct mbuf *scm, uint32_t vtag,
SCTP_BUF_RESV_UF(mout, max_linkhdr);
SCTP_BUF_LEN(mout) = len;
SCTP_BUF_NEXT(mout) = scm;
if (m->m_flags & M_FLOWID) {
mout->m_pkthdr.flowid = m->m_pkthdr.flowid;
mout->m_flags |= M_FLOWID;
}
iph_out = NULL;
#ifdef INET6
ip6_out = NULL;

View File

@ -4035,6 +4035,10 @@ 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);
return (0);
}

View File

@ -350,6 +350,7 @@ struct sctp_nets {
uint8_t lan_type;
/* JRS - struct used in HTCP algorithm */
struct htcp htcp_ca;
uint32_t flowid;
};