Commit f32357be authored by Michael Tuexen's avatar Michael Tuexen
Browse files

sctp: use the correct traffic class when sending SCTP/IPv6 packets

When sending packets the stcb was used to access the inp and then
access the endpoint specific IPv6 level options. This fails when
there exists an inp, but no stcb yet. This is the case for sending
an INIT-ACK in response to an INIT when no association already
exists. Fix this by just providing the inp instead of the stcb.

PR:		260120
MFC after:	1 week
parent 13e3f334
......@@ -411,28 +411,30 @@ typedef struct route sctp_route_t;
/*
* IP output routines
*/
#define SCTP_IP_OUTPUT(result, o_pak, ro, stcb, vrf_id) \
{ \
int o_flgs = IP_RAWOUTPUT; \
struct sctp_tcb *local_stcb = stcb; \
if (local_stcb && \
local_stcb->sctp_ep && \
local_stcb->sctp_ep->sctp_socket) \
o_flgs |= local_stcb->sctp_ep->sctp_socket->so_options & SO_DONTROUTE; \
m_clrprotoflags(o_pak); \
result = ip_output(o_pak, NULL, ro, o_flgs, 0, NULL); \
#define SCTP_IP_OUTPUT(result, o_pak, ro, _inp, vrf_id) \
{ \
struct sctp_inpcb *local_inp = _inp; \
int o_flgs = IP_RAWOUTPUT; \
\
m_clrprotoflags(o_pak); \
if ((local_inp != NULL) && (local_inp->sctp_socket != NULL)) { \
o_flgs |= local_inp->sctp_socket->so_options & SO_DONTROUTE; \
} \
result = ip_output(o_pak, NULL, ro, o_flgs, 0, NULL); \
}
#define SCTP_IP6_OUTPUT(result, o_pak, ro, ifp, stcb, vrf_id) \
{ \
struct sctp_tcb *local_stcb = stcb; \
m_clrprotoflags(o_pak); \
if (local_stcb && local_stcb->sctp_ep) \
result = ip6_output(o_pak, \
((struct inpcb *)(local_stcb->sctp_ep))->in6p_outputopts, \
(ro), 0, 0, ifp, NULL); \
else \
result = ip6_output(o_pak, NULL, (ro), 0, 0, ifp, NULL); \
#define SCTP_IP6_OUTPUT(result, o_pak, ro, ifp, _inp, vrf_id) \
{ \
struct sctp_inpcb *local_inp = _inp; \
\
m_clrprotoflags(o_pak); \
if (local_inp != NULL) { \
result = ip6_output(o_pak, \
local_inp->ip_inp.inp.in6p_outputopts, \
(ro), 0, 0, ifp, NULL); \
} else { \
result = ip6_output(o_pak, NULL, (ro), 0, 0, ifp, NULL); \
} \
}
struct mbuf *
......
......@@ -4220,7 +4220,7 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp,
#endif
/* send it out. table id is taken from stcb */
SCTP_PROBE5(send, NULL, stcb, ip, stcb, sctphdr);
SCTP_IP_OUTPUT(ret, o_pak, ro, stcb, vrf_id);
SCTP_IP_OUTPUT(ret, o_pak, ro, inp, vrf_id);
if (port) {
UDPSTAT_INC(udps_opackets);
}
......@@ -4544,7 +4544,7 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp,
sctp_packet_log(o_pak);
#endif
SCTP_PROBE5(send, NULL, stcb, ip6h, stcb, sctphdr);
SCTP_IP6_OUTPUT(ret, o_pak, (struct route_in6 *)ro, &ifp, stcb, vrf_id);
SCTP_IP6_OUTPUT(ret, o_pak, (struct route_in6 *)ro, &ifp, inp, vrf_id);
if (net) {
/* for link local this must be done */
sin6->sin6_scope_id = prev_scope;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment