diff options
author | tuexen <tuexen@FreeBSD.org> | 2011-02-05 19:13:38 +0000 |
---|---|---|
committer | tuexen <tuexen@FreeBSD.org> | 2011-02-05 19:13:38 +0000 |
commit | 0410b9c4fd31dc29ce008f99b4f751d2a0dc37fe (patch) | |
tree | 38d7f54330e92b9c62cd152916044dd841a28acb /sys/netinet | |
parent | 19d8742e12bdedd09f7d86fdd781a99dee8b7f34 (diff) | |
download | FreeBSD-src-0410b9c4fd31dc29ce008f99b4f751d2a0dc37fe.zip FreeBSD-src-0410b9c4fd31dc29ce008f99b4f751d2a0dc37fe.tar.gz |
Add support for M_FLOWID.
Diffstat (limited to 'sys/netinet')
-rw-r--r-- | sys/netinet/sctp_input.c | 6 | ||||
-rw-r--r-- | sys/netinet/sctp_output.c | 51 | ||||
-rw-r--r-- | sys/netinet/sctp_pcb.c | 4 | ||||
-rw-r--r-- | sys/netinet/sctp_structs.h | 1 |
4 files changed, 52 insertions, 10 deletions
diff --git a/sys/netinet/sctp_input.c b/sys/netinet/sctp_input.c index 250500e..b7340dc 100644 --- a/sys/netinet/sctp_input.c +++ b/sys/netinet/sctp_input.c @@ -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_skip_csum_4: } 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; diff --git a/sys/netinet/sctp_output.c b/sys/netinet/sctp_output.c index 670b41b..17cb020 100644 --- a/sys/netinet/sctp_output.c +++ b/sys/netinet/sctp_output.c @@ -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 @@ do_a_abort: (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 @@ again_one_more_time: 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 @@ again_one_more_time: 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 @@ no_data_fill: 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 @@ one_chunk_around: 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; diff --git a/sys/netinet/sctp_pcb.c b/sys/netinet/sctp_pcb.c index 3516109..2630ab9 100644 --- a/sys/netinet/sctp_pcb.c +++ b/sys/netinet/sctp_pcb.c @@ -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); } diff --git a/sys/netinet/sctp_structs.h b/sys/netinet/sctp_structs.h index 726bb96..f8fdc90 100644 --- a/sys/netinet/sctp_structs.h +++ b/sys/netinet/sctp_structs.h @@ -350,6 +350,7 @@ struct sctp_nets { uint8_t lan_type; /* JRS - struct used in HTCP algorithm */ struct htcp htcp_ca; + uint32_t flowid; }; |