Date: Sat, 5 Feb 2011 19:13:38 +0000 (UTC) From: Michael Tuexen <tuexen@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r218335 - head/sys/netinet Message-ID: <201102051913.p15JDcGA037685@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: tuexen Date: Sat Feb 5 19:13:38 2011 New Revision: 218335 URL: http://svn.freebsd.org/changeset/base/218335 Log: Add support for M_FLOWID. Modified: head/sys/netinet/sctp_input.c head/sys/netinet/sctp_output.c head/sys/netinet/sctp_pcb.c head/sys/netinet/sctp_structs.h Modified: head/sys/netinet/sctp_input.c ============================================================================== --- head/sys/netinet/sctp_input.c Sat Feb 5 19:13:34 2011 (r218334) +++ head/sys/netinet/sctp_input.c Sat Feb 5 19:13:38 2011 (r218335) @@ -2615,6 +2615,9 @@ sctp_handle_cookie_echo(struct mbuf *m, /* 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; Modified: head/sys/netinet/sctp_output.c ============================================================================== --- head/sys/netinet/sctp_output.c Sat Feb 5 19:13:34 2011 (r218334) +++ head/sys/netinet/sctp_output.c Sat Feb 5 19:13:38 2011 (r218335) @@ -3419,7 +3419,8 @@ sctp_lowlevel_chunk_output(struct sctp_i #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_i 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_i 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 *in (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_in 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 *stc (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_ 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 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 iphl 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 i 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; Modified: head/sys/netinet/sctp_pcb.c ============================================================================== --- head/sys/netinet/sctp_pcb.c Sat Feb 5 19:13:34 2011 (r218334) +++ head/sys/netinet/sctp_pcb.c Sat Feb 5 19:13:38 2011 (r218335) @@ -4035,6 +4035,10 @@ sctp_add_remote_addr(struct sctp_tcb *st 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); } Modified: head/sys/netinet/sctp_structs.h ============================================================================== --- head/sys/netinet/sctp_structs.h Sat Feb 5 19:13:34 2011 (r218334) +++ head/sys/netinet/sctp_structs.h Sat Feb 5 19:13:38 2011 (r218335) @@ -350,6 +350,7 @@ struct sctp_nets { uint8_t lan_type; /* JRS - struct used in HTCP algorithm */ struct htcp htcp_ca; + uint32_t flowid; };
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201102051913.p15JDcGA037685>