FreeBSD kernel IPv4 code
sctp_output.c File Reference
#include <sys/cdefs.h>
#include <netinet/sctp_os.h>
#include <sys/proc.h>
#include <netinet/sctp_var.h>
#include <netinet/sctp_sysctl.h>
#include <netinet/sctp_header.h>
#include <netinet/sctp_pcb.h>
#include <netinet/sctputil.h>
#include <netinet/sctp_output.h>
#include <netinet/sctp_uio.h>
#include <netinet/sctp_auth.h>
#include <netinet/sctp_timer.h>
#include <netinet/sctp_asconf.h>
#include <netinet/sctp_indata.h>
#include <netinet/sctp_bsd_addr.h>
#include <netinet/sctp_input.h>
#include <netinet/sctp_crc32.h>
#include <netinet/sctp_kdtrace.h>
#include <netinet/udp_var.h>
#include <machine/in_cksum.h>
Include dependency graph for sctp_output.c:

Go to the source code of this file.

Data Structures

struct  sack_track
 

Macros

#define SCTP_MAX_GAPS_INARRAY   4
 

Functions

 __FBSDID ("$FreeBSD$")
 
int sctp_is_address_in_scope (struct sctp_ifa *ifa, struct sctp_scoping *scope, int do_update)
 
static struct mbuf * sctp_add_addr_to_mbuf (struct mbuf *m, struct sctp_ifa *ifa, uint16_t *len)
 
struct mbuf * sctp_add_addresses_to_i_ia (struct sctp_inpcb *inp, struct sctp_tcb *stcb, struct sctp_scoping *scope, struct mbuf *m_at, int cnt_inits_to, uint16_t *padding_len, uint16_t *chunk_len)
 
static struct sctp_ifasctp_is_ifa_addr_preferred (struct sctp_ifa *ifa, uint8_t dest_is_loop, uint8_t dest_is_priv, sa_family_t fam)
 
static struct sctp_ifasctp_is_ifa_addr_acceptable (struct sctp_ifa *ifa, uint8_t dest_is_loop, uint8_t dest_is_priv, sa_family_t fam)
 
int sctp_is_addr_restricted (struct sctp_tcb *stcb, struct sctp_ifa *ifa)
 
int sctp_is_addr_in_ep (struct sctp_inpcb *inp, struct sctp_ifa *ifa)
 
static struct sctp_ifasctp_choose_boundspecific_inp (struct sctp_inpcb *inp, sctp_route_t *ro, uint32_t vrf_id, int non_asoc_addr_ok, uint8_t dest_is_priv, uint8_t dest_is_loop, sa_family_t fam)
 
static struct sctp_ifasctp_choose_boundspecific_stcb (struct sctp_inpcb *inp, struct sctp_tcb *stcb, sctp_route_t *ro, uint32_t vrf_id, uint8_t dest_is_priv, uint8_t dest_is_loop, int non_asoc_addr_ok, sa_family_t fam)
 
static struct sctp_ifasctp_select_nth_preferred_addr_from_ifn_boundall (struct sctp_ifn *ifn, struct sctp_inpcb *inp, struct sctp_tcb *stcb, int non_asoc_addr_ok, uint8_t dest_is_loop, uint8_t dest_is_priv, int addr_wanted, sa_family_t fam, sctp_route_t *ro)
 
static int sctp_count_num_preferred_boundall (struct sctp_ifn *ifn, struct sctp_inpcb *inp, struct sctp_tcb *stcb, int non_asoc_addr_ok, uint8_t dest_is_loop, uint8_t dest_is_priv, sa_family_t fam)
 
static struct sctp_ifasctp_choose_boundall (struct sctp_inpcb *inp, struct sctp_tcb *stcb, struct sctp_nets *net, sctp_route_t *ro, uint32_t vrf_id, uint8_t dest_is_priv, uint8_t dest_is_loop, int non_asoc_addr_ok, sa_family_t fam)
 
struct sctp_ifasctp_source_address_selection (struct sctp_inpcb *inp, struct sctp_tcb *stcb, sctp_route_t *ro, struct sctp_nets *net, int non_asoc_addr_ok, uint32_t vrf_id)
 
static int sctp_find_cmsg (int c_type, void *data, struct mbuf *control, size_t cpsize)
 
static int sctp_process_cmsgs_for_init (struct sctp_tcb *stcb, struct mbuf *control, int *error)
 
static struct mbuf * sctp_add_cookie (struct mbuf *init, int init_offset, struct mbuf *initack, int initack_offset, struct sctp_state_cookie *stc_in, uint8_t **signature)
 
static uint8_t sctp_get_ect (struct sctp_tcb *stcb)
 
static int sctp_lowlevel_chunk_output (struct sctp_inpcb *inp, struct sctp_tcb *stcb, struct sctp_nets *net, struct sockaddr *to, struct mbuf *m, uint32_t auth_offset, struct sctp_auth_chunk *auth, uint16_t auth_keyid, int nofragment_flag, int ecn_ok, int out_of_asoc_ok, uint16_t src_port, uint16_t dest_port, uint32_t v_tag, uint16_t port, union sctp_sockstore *over_addr, uint8_t mflowtype, uint32_t mflowid, int so_locked)
 
void sctp_send_initiate (struct sctp_inpcb *inp, struct sctp_tcb *stcb, int so_locked)
 
struct mbuf * sctp_arethere_unrecognized_parameters (struct mbuf *in_initpkt, int param_offset, int *abort_processing, struct sctp_chunkhdr *cp, int *nat_friendly, int *cookie_found)
 
static bool sctp_are_there_new_addresses (struct sctp_association *asoc, struct mbuf *in_initpkt, int offset, int limit, struct sockaddr *src, struct mbuf **op_err)
 
void sctp_send_initiate_ack (struct sctp_inpcb *inp, struct sctp_tcb *stcb, struct sctp_nets *src_net, struct mbuf *init_pkt, int iphlen, int offset, struct sockaddr *src, struct sockaddr *dst, struct sctphdr *sh, struct sctp_init_chunk *init_chk, uint8_t mflowtype, uint32_t mflowid, uint32_t vrf_id, uint16_t port)
 
static void sctp_prune_prsctp (struct sctp_tcb *stcb, struct sctp_association *asoc, struct sctp_sndrcvinfo *srcv, int dataout)
 
uint32_t sctp_get_frag_point (struct sctp_tcb *stcb)
 
static void sctp_set_prsctp_policy (struct sctp_stream_queue_pending *sp)
 
static int sctp_msg_append (struct sctp_tcb *stcb, struct sctp_nets *net, struct mbuf *m, struct sctp_sndrcvinfo *srcv, int hold_stcb_lock)
 
static struct mbuf * sctp_copy_mbufchain (struct mbuf *clonechain, struct mbuf *outchain, struct mbuf **endofchain, int can_take_mbuf, int sizeofcpy, uint8_t copy_by_ref)
 
static int sctp_med_chunk_output (struct sctp_inpcb *inp, struct sctp_tcb *stcb, struct sctp_association *asoc, int *num_out, int *reason_code, int control_only, int from_where, struct timeval *now, int *now_filled, uint32_t frag_point, int so_locked)
 
static void sctp_sendall_iterator (struct sctp_inpcb *inp, struct sctp_tcb *stcb, void *ptr, uint32_t val SCTP_UNUSED)
 
static void sctp_sendall_completes (void *ptr, uint32_t val SCTP_UNUSED)
 
static struct mbuf * sctp_copy_out_all (struct uio *uio, ssize_t len)
 
static int sctp_sendall (struct sctp_inpcb *inp, struct uio *uio, struct mbuf *m, struct sctp_sndrcvinfo *srcv)
 
void sctp_toss_old_cookies (struct sctp_tcb *stcb, struct sctp_association *asoc)
 
void sctp_toss_old_asconf (struct sctp_tcb *stcb)
 
static void sctp_clean_up_datalist (struct sctp_tcb *stcb, struct sctp_association *asoc, struct sctp_tmit_chunk **data_list, int bundle_at, struct sctp_nets *net)
 
static void sctp_clean_up_ctl (struct sctp_tcb *stcb, struct sctp_association *asoc, int so_locked)
 
static uint32_t sctp_can_we_split_this (struct sctp_tcb *stcb, uint32_t length, uint32_t space_left, uint32_t frag_point, int eeor_on)
 
static uint32_t sctp_move_to_outqueue (struct sctp_tcb *stcb, struct sctp_nets *net, struct sctp_stream_out *strq, uint32_t space_left, uint32_t frag_point, int *giveup, int eeor_mode, int *bail, int so_locked)
 
static void sctp_fill_outqueue (struct sctp_tcb *stcb, struct sctp_nets *net, uint32_t frag_point, int eeor_mode, int *quit_now, int so_locked)
 
void sctp_fix_ecn_echo (struct sctp_association *asoc)
 
void sctp_move_chunks_from_net (struct sctp_tcb *stcb, struct sctp_nets *net)
 
void sctp_queue_op_err (struct sctp_tcb *stcb, struct mbuf *op_err)
 
int sctp_send_cookie_echo (struct mbuf *m, int offset, int limit, struct sctp_tcb *stcb, struct sctp_nets *net)
 
void sctp_send_heartbeat_ack (struct sctp_tcb *stcb, struct mbuf *m, int offset, int chk_length, struct sctp_nets *net)
 
void sctp_send_cookie_ack (struct sctp_tcb *stcb)
 
void sctp_send_shutdown_ack (struct sctp_tcb *stcb, struct sctp_nets *net)
 
void sctp_send_shutdown (struct sctp_tcb *stcb, struct sctp_nets *net)
 
void sctp_send_asconf (struct sctp_tcb *stcb, struct sctp_nets *net, int addr_locked)
 
void sctp_send_asconf_ack (struct sctp_tcb *stcb)
 
static int sctp_chunk_retransmission (struct sctp_inpcb *inp, struct sctp_tcb *stcb, struct sctp_association *asoc, int *cnt_out, struct timeval *now, int *now_filled, int *fr_done, int so_locked)
 
static void sctp_timer_validation (struct sctp_inpcb *inp, struct sctp_tcb *stcb, struct sctp_association *asoc)
 
void sctp_chunk_output (struct sctp_inpcb *inp, struct sctp_tcb *stcb, int from_where, int so_locked)
 
int sctp_output (struct sctp_inpcb *inp, struct mbuf *m, struct sockaddr *addr, struct mbuf *control, struct thread *p, int flags)
 
void send_forward_tsn (struct sctp_tcb *stcb, struct sctp_association *asoc)
 
void sctp_send_sack (struct sctp_tcb *stcb, int so_locked)
 
void sctp_send_abort_tcb (struct sctp_tcb *stcb, struct mbuf *operr, int so_locked)
 
void sctp_send_shutdown_complete (struct sctp_tcb *stcb, struct sctp_nets *net, int reflect_vtag)
 
static void sctp_send_resp_msg (struct sockaddr *src, struct sockaddr *dst, struct sctphdr *sh, uint32_t vtag, uint8_t type, struct mbuf *cause, uint8_t mflowtype, uint32_t mflowid, uint16_t fibnum, uint32_t vrf_id, uint16_t port)
 
void sctp_send_shutdown_complete2 (struct sockaddr *src, struct sockaddr *dst, struct sctphdr *sh, uint8_t mflowtype, uint32_t mflowid, uint16_t fibnum, uint32_t vrf_id, uint16_t port)
 
void sctp_send_hb (struct sctp_tcb *stcb, struct sctp_nets *net, int so_locked)
 
void sctp_send_ecn_echo (struct sctp_tcb *stcb, struct sctp_nets *net, uint32_t high_tsn)
 
void sctp_send_packet_dropped (struct sctp_tcb *stcb, struct sctp_nets *net, struct mbuf *m, int len, int iphlen, int bad_crc)
 
void sctp_send_cwr (struct sctp_tcb *stcb, struct sctp_nets *net, uint32_t high_tsn, uint8_t override)
 
static int sctp_add_stream_reset_out (struct sctp_tcb *stcb, struct sctp_tmit_chunk *chk, uint32_t seq, uint32_t resp_seq, uint32_t last_sent)
 
static void sctp_add_stream_reset_in (struct sctp_tmit_chunk *chk, int number_entries, uint16_t *list, uint32_t seq)
 
static void sctp_add_stream_reset_tsn (struct sctp_tmit_chunk *chk, uint32_t seq)
 
void sctp_add_stream_reset_result (struct sctp_tmit_chunk *chk, uint32_t resp_seq, uint32_t result)
 
void sctp_send_deferred_reset_response (struct sctp_tcb *stcb, struct sctp_stream_reset_list *ent, int response)
 
void sctp_add_stream_reset_result_tsn (struct sctp_tmit_chunk *chk, uint32_t resp_seq, uint32_t result, uint32_t send_una, uint32_t recv_next)
 
static void sctp_add_an_out_stream (struct sctp_tmit_chunk *chk, uint32_t seq, uint16_t adding)
 
static void sctp_add_an_in_stream (struct sctp_tmit_chunk *chk, uint32_t seq, uint16_t adding)
 
int sctp_send_stream_reset_out_if_possible (struct sctp_tcb *stcb, int so_locked)
 
int sctp_send_str_reset_req (struct sctp_tcb *stcb, uint16_t number_entries, uint16_t *list, uint8_t send_in_req, uint8_t send_tsn_req, uint8_t add_stream, uint16_t adding_o, uint16_t adding_i, uint8_t peer_asked)
 
void sctp_send_abort (struct mbuf *m, int iphlen, struct sockaddr *src, struct sockaddr *dst, struct sctphdr *sh, uint32_t vtag, struct mbuf *cause, uint8_t mflowtype, uint32_t mflowid, uint16_t fibnum, uint32_t vrf_id, uint16_t port)
 
void sctp_send_operr_to (struct sockaddr *src, struct sockaddr *dst, struct sctphdr *sh, uint32_t vtag, struct mbuf *cause, uint8_t mflowtype, uint32_t mflowid, uint16_t fibnum, uint32_t vrf_id, uint16_t port)
 
static struct mbuf * sctp_copy_resume (struct uio *uio, int max_send_len, int user_marks_eor, int *error, uint32_t *sndout, struct mbuf **new_tail)
 
static int sctp_copy_one (struct sctp_stream_queue_pending *sp, struct uio *uio, int resv_upfront)
 
static struct sctp_stream_queue_pendingsctp_copy_it_in (struct sctp_tcb *stcb, struct sctp_association *asoc, struct sctp_sndrcvinfo *srcv, struct uio *uio, struct sctp_nets *net, ssize_t max_send_len, int user_marks_eor, int *error)
 
int sctp_sosend (struct socket *so, struct sockaddr *addr, struct uio *uio, struct mbuf *top, struct mbuf *control, int flags, struct thread *p)
 
int sctp_lower_sosend (struct socket *so, struct sockaddr *addr, struct uio *uio, struct mbuf *i_pak, struct mbuf *control, int flags, struct sctp_sndrcvinfo *srcv, struct thread *p)
 
struct mbuf * sctp_add_auth_chunk (struct mbuf *m, struct mbuf **m_end, struct sctp_auth_chunk **auth_ret, uint32_t *offset, struct sctp_tcb *stcb, uint8_t chunk)
 
int sctp_v4src_match_nexthop (struct sctp_ifa *sifa, sctp_route_t *ro)
 

Variables

const struct sack_track sack_array [256]
 

Macro Definition Documentation

◆ SCTP_MAX_GAPS_INARRAY

#define SCTP_MAX_GAPS_INARRAY   4

Definition at line 62 of file sctp_output.c.

Function Documentation

◆ __FBSDID()

__FBSDID ( "$FreeBSD$"  )

◆ sctp_add_addr_to_mbuf()

static struct mbuf * sctp_add_addr_to_mbuf ( struct mbuf *  m,
struct sctp_ifa ifa,
uint16_t len 
)
static

◆ sctp_add_addresses_to_i_ia()

◆ sctp_add_an_in_stream()

◆ sctp_add_an_out_stream()

◆ sctp_add_auth_chunk()

◆ sctp_add_cookie()

static struct mbuf * sctp_add_cookie ( struct mbuf *  init,
int  init_offset,
struct mbuf *  initack,
int  initack_offset,
struct sctp_state_cookie stc_in,
uint8_t **  signature 
)
static

Definition at line 3815 of file sctp_output.c.

References sctp_paramhdr::param_length, sctp_paramhdr::param_type, SCTP_BASE_SYSCTL, SCTP_BUF_LEN, SCTP_BUF_NEXT, sctp_get_mbuf_for_msg(), SCTP_M_COPYM, sctp_m_freem, SCTP_MBUF_ICOPY, SCTP_MBUF_LOGGING_ENABLE, SCTP_SIGNATURE_SIZE, and SCTP_STATE_COOKIE.

Referenced by sctp_send_initiate_ack().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sctp_add_stream_reset_in()

◆ sctp_add_stream_reset_out()

◆ sctp_add_stream_reset_result()

◆ sctp_add_stream_reset_result_tsn()

◆ sctp_add_stream_reset_tsn()

◆ sctp_are_there_new_addresses()

static bool sctp_are_there_new_addresses ( struct sctp_association asoc,
struct mbuf *  in_initpkt,
int  offset,
int  limit,
struct sockaddr *  src,
struct mbuf **  op_err 
)
static

◆ sctp_arethere_unrecognized_parameters()

◆ sctp_can_we_split_this()

static uint32_t sctp_can_we_split_this ( struct sctp_tcb stcb,
uint32_t  length,
uint32_t  space_left,
uint32_t  frag_point,
int  eeor_on 
)
static

Definition at line 7090 of file sctp_output.c.

References sctp_tcb::asoc, SCTP_BASE_SYSCTL, SCTP_SB_LIMIT_SND, sctp_tcb::sctp_socket, and sctp_association::total_flight.

Referenced by sctp_move_to_outqueue().

Here is the caller graph for this function:

◆ sctp_choose_boundall()

◆ sctp_choose_boundspecific_inp()

◆ sctp_choose_boundspecific_stcb()

◆ sctp_chunk_output()

void sctp_chunk_output ( struct sctp_inpcb inp,
struct sctp_tcb stcb,
int  from_where,
int  so_locked 
)

Definition at line 9960 of file sctp_output.c.

References sctp_association::asconf_send_queue, sctp_tcb::asoc, sctp_association::burst_limit_applied, sctp_association::cc_functions, sctp_association::control_send_queue, sctp_nets::cwnd, sctp_association::dack_timer, sctp_nets::dest_state, sctp_association::ecn_echo_cnt_onq, sctp_nets::fast_retran_ip, sctp_nets::flight_size, sctp_association::fr_max_burst, sctp_association::max_burst, sctp_nets::mtu, sctp_association::nets, sctp_association::primary_destination, sctp_nets::ref_count, SCTP_ADDR_REACHABLE, SCTP_BASE_SYSCTL, sctp_chunk_retransmission(), SCTP_CWND_LOGGING_ENABLE, sctp_cc_functions::sctp_cwnd_update_after_output, SCTP_DEBUG_OUTPUT1, SCTP_DEBUG_OUTPUT3, sctp_tcb::sctp_ep, sctp_fix_ecn_echo(), SCTP_FROM_SCTP_OUTPUT, sctp_get_frag_point(), sctp_is_feature_on, sctp_is_there_unsent_data(), SCTP_LOC_3, sctp_log_cwnd(), sctp_log_maxburst(), SCTP_LOG_MAXBURST_ENABLE, SCTP_MAX_BURST_APPLIED, SCTP_MAX_BURST_ERROR_STOP, sctp_med_chunk_output(), SCTP_MIN_OVERHEAD, sctp_move_chunks_from_net(), SCTP_OS_TIMER_PENDING, SCTP_OUTPUT_FROM_COOKIE_ACK, SCTP_OUTPUT_FROM_HB_TMR, SCTP_OUTPUT_FROM_T3, SCTP_OUTPUT_FROM_USR_SEND, SCTP_PCB_FLAGS_NODELAY, SCTP_RETRAN_EXIT, SCTP_SEND_NOW_COMPLETES, sctp_send_sack(), sctp_send_stream_reset_out_if_possible(), SCTP_STAT_INCR, SCTP_TCB_LOCK_ASSERT, sctp_timer_stop(), SCTP_TIMER_TYPE_RECV, sctp_timer_validation(), SCTPDBG, sctp_association::send_queue, sctp_association::sent_queue_retran_cnt, sctp_association::smallest_mtu, sctp_timer::timer, sctp_association::total_flight, sctp_association::total_output_queue_size, and sctp_association::trigger_reset.

Referenced by sctp_assoc_immediate_retrans(), sctp_audit_stream_queues_for_size(), sctp_autoclose_timer(), sctp_common_input_processing(), sctp_disconnect(), sctp_drain_mbufs(), sctp_handle_init(), sctp_inpcb_free(), sctp_iterator_work(), sctp_lower_sosend(), sctp_net_immediate_retrans(), sctp_process_control(), sctp_process_cookie_existing(), sctp_sendall_iterator(), sctp_setopt(), sctp_shutdown(), sctp_start_net_timers(), sctp_timeout_handler(), and sctp_user_rcvd().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sctp_chunk_retransmission()

static int sctp_chunk_retransmission ( struct sctp_inpcb inp,
struct sctp_tcb stcb,
struct sctp_association asoc,
int *  cnt_out,
struct timeval *  now,
int *  now_filled,
int *  fr_done,
int  so_locked 
)
static

Definition at line 9413 of file sctp_output.c.

References sctp_net_route::_l_addr, sctp_authinformation::active_keyid, sctp_tcb::asoc, sctp_tmit_chunk::auth_keyid, sctp_association::authinfo, sctp_tmit_chunk::book_size, sctp_tmit_chunk::book_size_scale, CHUNK_FLAGS_FRAGMENT_OK, sctp_tmit_chunk::chunk_id, sctp_data_chunkrec::chunk_was_revoked, sctp_association::control_send_queue, sctp_tmit_chunk::copy_by_ref, sctp_nets::cwnd, sctp_tmit_chunk::data, sctp_data_chunkrec::doing_fast_retransmit, sctp_nets::fast_retran_ip, sctp_tmit_chunk::flags, sctp_nets::flight_size, chk_id::id, sctp_association::ifp_had_enobuf, sctp_association::last_acked_seq, sctp_nets::mtu, sctp_association::peer_auth_chunks, sctp_association::peer_hmac_id, sctp_association::peer_vtag, sctp_association::peers_rwnd, sctp_nets::port, sctp_tmit_chunk::rec, sctp_association::refcnt, sctp_nets::ro, sctp_tcb::rport, sctp_nets::rxt_timer, sctp_sockstore::sa, sctp_abort_an_association(), sctp_add_auth_chunk(), SCTP_ASCONF, sctp_auth_is_required_chunk, SCTP_BASE_SYSCTL, sctp_clean_up_ctl(), SCTP_COOKIE_ECHO, sctp_copy_mbufchain(), SCTP_CWND_LOG_FROM_RESEND, SCTP_CWND_LOGGING_ENABLE, SCTP_DATA, SCTP_DATAGRAM_RESEND, SCTP_DATAGRAM_SENT, SCTP_DEBUG_OUTPUT1, SCTP_DEBUG_OUTPUT3, SCTP_DECREASE_PEER_RWND, SCTP_DIAG_INFO_LEN, sctp_inpcb::sctp_ep, sctp_tcb::sctp_ep, SCTP_FLIGHT_LOG_UP_RSND, SCTP_FLIGHT_LOGGING_ENABLE, sctp_flight_size_increase, SCTP_FORWARD_CUM_TSN, SCTP_FROM_SCTP_OUTPUT, sctp_generate_cause(), sctp_get_auth_chunk_len(), SCTP_GET_STATE, SCTP_GETTIME_TIMEVAL, SCTP_LOC_2, sctp_log_cwnd(), sctp_log_rwnd(), SCTP_LOG_RWND_ENABLE, sctp_lowlevel_chunk_output(), SCTP_LTRACE_ERR_RET, SCTP_MAX_DATA_BUNDLING, SCTP_MIN_OVERHEAD, SCTP_MIN_V4_OVERHEAD, sctp_misc_ints(), SCTP_OS_TIMER_PENDING, SCTP_PRINTF, SCTP_RETRAN_DONE, SCTP_RETRAN_EXIT, sctp_sbspace_sub, SCTP_SNPRINTF, SCTP_STAT_INCR, SCTP_STAT_INCR_COUNTER64, SCTP_STATE_COOKIE_ECHOED, SCTP_STATE_COOKIE_WAIT, SCTP_STREAM_RESET, sctp_pcb::sctp_sws_sender, SCTP_TCB_LOCK, SCTP_TCB_LOCK_ASSERT, sctp_timer_start(), sctp_timer_stop(), SCTP_TIMER_TYPE_ASCONF, SCTP_TIMER_TYPE_COOKIE, SCTP_TIMER_TYPE_SEND, sctp_total_flight_increase, sctp_ucount_decr, SCTPDBG, sctp_tmit_chunk::send_size, sctp_tmit_chunk::sent, sctp_association::sent_queue, sctp_association::sent_queue_cnt, sctp_association::sent_queue_cnt_removeable, sctp_association::sent_queue_retran_cnt, sctp_tmit_chunk::sent_rcv_time, sctp_tmit_chunk::snd_count, sctp_association::str_reset, sctp_association::time_last_sent, sctp_timer::timer, sctp_association::total_flight, sctp_data_chunkrec::tsn, sctp_tmit_chunk::whoTo, sctp_nets::window_probe, and sctp_tmit_chunk::window_probe.

Referenced by sctp_chunk_output().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sctp_clean_up_ctl()

◆ sctp_clean_up_datalist()

◆ sctp_copy_it_in()

static struct sctp_stream_queue_pending * sctp_copy_it_in ( struct sctp_tcb stcb,
struct sctp_association asoc,
struct sctp_sndrcvinfo srcv,
struct uio *  uio,
struct sctp_nets net,
ssize_t  max_send_len,
int  user_marks_eor,
int *  error 
)
static

Definition at line 12347 of file sctp_output.c.

References sctp_stream_queue_pending::act_flags, sctp_authinformation::active_keyid, sctp_tcb::asoc, sctp_stream_queue_pending::auth_keyid, sctp_association::authinfo, sctp_stream_queue_pending::context, sctp_stream_queue_pending::data, sctp_stream_queue_pending::fsn, sctp_stream_queue_pending::holds_key_ref, sctp_stream_queue_pending::length, sctp_stream_queue_pending::msg_is_complete, sctp_stream_queue_pending::net, sctp_association::peer_auth_chunks, sctp_stream_queue_pending::ppid, sctp_stream_queue_pending::put_last_out, sctp_nets::ref_count, SCTP_ADDR_OVER, sctp_alloc_a_strmoq, sctp_auth_is_required_chunk, sctp_auth_key_acquire(), sctp_copy_one(), SCTP_DATA, SCTP_DATA_CHUNK_OVERHEAD, SCTP_EOF, SCTP_EOR, sctp_free_a_strmoq, SCTP_FROM_SCTP_OUTPUT, SCTP_GET_STATE, SCTP_GETTIME_TIMEVAL, SCTP_LTRACE_ERR_RET, sctp_set_prsctp_policy(), SCTP_SO_LOCKED, SCTP_STATE_SHUTDOWN_ACK_SENT, SCTP_STATE_SHUTDOWN_PENDING, SCTP_STATE_SHUTDOWN_RECEIVED, SCTP_STATE_SHUTDOWN_SENT, sctp_stream_queue_pending::sender_all_done, sctp_stream_queue_pending::sid, sctp_sndrcvinfo::sinfo_context, sctp_stream_queue_pending::sinfo_flags, sctp_sndrcvinfo::sinfo_flags, sctp_sndrcvinfo::sinfo_keynumber, sctp_sndrcvinfo::sinfo_keynumber_valid, sctp_sndrcvinfo::sinfo_ppid, sctp_sndrcvinfo::sinfo_stream, sctp_sndrcvinfo::sinfo_timetolive, sctp_stream_queue_pending::some_taken, sctp_association::state, sctp_stream_queue_pending::tail_mbuf, sctp_stream_queue_pending::timetolive, and sctp_stream_queue_pending::ts.

Referenced by sctp_lower_sosend().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sctp_copy_mbufchain()

static struct mbuf * sctp_copy_mbufchain ( struct mbuf *  clonechain,
struct mbuf *  outchain,
struct mbuf **  endofchain,
int  can_take_mbuf,
int  sizeofcpy,
uint8_t  copy_by_ref 
)
static

Definition at line 6419 of file sctp_output.c.

References SCTP_BASE_SYSCTL, SCTP_BUF_LEN, SCTP_BUF_NEXT, SCTP_BUF_RESV_UF, SCTP_FIRST_MBUF_RESV, sctp_get_mbuf_for_msg(), SCTP_M_COPYM, sctp_m_freem, SCTP_MBUF_ICOPY, and SCTP_MBUF_LOGGING_ENABLE.

Referenced by sctp_add_auth_chunk(), sctp_chunk_retransmission(), and sctp_med_chunk_output().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sctp_copy_one()

static int sctp_copy_one ( struct sctp_stream_queue_pending sp,
struct uio *  uio,
int  resv_upfront 
)
static

◆ sctp_copy_out_all()

static struct mbuf * sctp_copy_out_all ( struct uio *  uio,
ssize_t  len 
)
static

Definition at line 6791 of file sctp_output.c.

References SCTP_BUF_LEN, SCTP_BUF_NEXT, SCTP_BUF_NEXT_PKT, sctp_get_mbuf_for_msg(), and sctp_m_freem.

Referenced by sctp_sendall().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sctp_copy_resume()

static struct mbuf * sctp_copy_resume ( struct uio *  uio,
int  max_send_len,
int  user_marks_eor,
int *  error,
uint32_t sndout,
struct mbuf **  new_tail 
)
static

Definition at line 12309 of file sctp_output.c.

References SCTP_FROM_SCTP_OUTPUT, and SCTP_LTRACE_ERR_RET.

Referenced by sctp_lower_sosend().

Here is the caller graph for this function:

◆ sctp_count_num_preferred_boundall()

static int sctp_count_num_preferred_boundall ( struct sctp_ifn ifn,
struct sctp_inpcb inp,
struct sctp_tcb stcb,
int  non_asoc_addr_ok,
uint8_t  dest_is_loop,
uint8_t  dest_is_priv,
sa_family_t  fam 
)
static

◆ sctp_fill_outqueue()

static void sctp_fill_outqueue ( struct sctp_tcb stcb,
struct sctp_nets net,
uint32_t  frag_point,
int  eeor_mode,
int *  quit_now,
int  so_locked 
)
static

◆ sctp_find_cmsg()

static int sctp_find_cmsg ( int  c_type,
void *  data,
struct mbuf *  control,
size_t  cpsize 
)
static

◆ sctp_fix_ecn_echo()

void sctp_fix_ecn_echo ( struct sctp_association asoc)

◆ sctp_get_ect()

static uint8_t sctp_get_ect ( struct sctp_tcb stcb)
static

Definition at line 3900 of file sctp_output.c.

References sctp_tcb::asoc, sctp_association::ecn_supported, and SCTP_ECT0_BIT.

Referenced by sctp_lowlevel_chunk_output().

Here is the caller graph for this function:

◆ sctp_get_frag_point()

◆ sctp_is_addr_in_ep()

int sctp_is_addr_in_ep ( struct sctp_inpcb inp,
struct sctp_ifa ifa 
)

◆ sctp_is_addr_restricted()

◆ sctp_is_address_in_scope()

◆ sctp_is_ifa_addr_acceptable()

static struct sctp_ifa * sctp_is_ifa_addr_acceptable ( struct sctp_ifa ifa,
uint8_t  dest_is_loop,
uint8_t  dest_is_priv,
sa_family_t  fam 
)
static

Here we determine if its a acceptable address. A acceptable address means it is the same scope or higher scope but we can allow for NAT which means its ok to have a global dest and a private src.

L = loopback, P = private, G = global

src | dest | result

L | L | yes

P | L | yes-v4 no-v6

G | L | yes

L | P | no

P | P | yes

G | P | yes - May not work

L | G | no

P | G | yes - May not work

G | G | yes

Definition at line 2321 of file sctp_output.c.

References sctp_ifa::ifa, SCTP_ADDR_IFA_UNUSEABLE, SCTP_DEBUG_OUTPUT3, SCTPDBG, and SCTPDBG_ADDR.

Referenced by sctp_choose_boundall(), sctp_choose_boundspecific_inp(), and sctp_choose_boundspecific_stcb().

Here is the caller graph for this function:

◆ sctp_is_ifa_addr_preferred()

static struct sctp_ifa * sctp_is_ifa_addr_preferred ( struct sctp_ifa ifa,
uint8_t  dest_is_loop,
uint8_t  dest_is_priv,
sa_family_t  fam 
)
static

Here we determine if its a preferred address. A preferred address means it is the same scope or higher scope then the destination.

L = loopback, P = private, G = global

src | dest | result

L | L | yes

P | L | yes-v4 no-v6

G | L | yes-v4 no-v6

L | P | no

P | P | yes

G | P | no

L | G | no

P | G | no

G | G | yes

Definition at line 2221 of file sctp_output.c.

References sctp_ifa::ifa, SCTP_ADDR_IFA_UNUSEABLE, SCTP_DEBUG_OUTPUT2, SCTP_DEBUG_OUTPUT3, SCTPDBG, and SCTPDBG_ADDR.

Referenced by sctp_choose_boundspecific_inp(), sctp_choose_boundspecific_stcb(), sctp_count_num_preferred_boundall(), and sctp_select_nth_preferred_addr_from_ifn_boundall().

Here is the caller graph for this function:

◆ sctp_lower_sosend()

int sctp_lower_sosend ( struct socket *  so,
struct sockaddr *  addr,
struct uio *  uio,
struct mbuf *  i_pak,
struct mbuf *  control,
int  flags,
struct sctp_sndrcvinfo srcv,
struct thread *  p 
)

Pre-screen address, if one is given the sin-len must be set correctly!

Definition at line 12489 of file sctp_output.c.

References sctp_association::alternate, sctp_tcb::asoc, sctp_tcb::block_entry, sctp_association::chunks_on_out_queue, sctp_association::control_send_queue, sctp_nets::cwnd, sctp_stream_queue_pending::data, sctp_inpcb::def_send, sctp_association::def_send, sctp_inpcb::def_vrf_id, sctp_block_entry::error, sctp_nets::flight_size, sctp_association::idata_supported, sctp_association::ifp_had_enobuf, sctp_inpcb::inp, INVALID_SINFO_FLAG, sctp_stream_out::last_msg_incomplete, sctp_stream_queue_pending::length, sctp_stream_queue_pending::msg_is_complete, sctp_nets::mtu, next, sctp_stream_out::outqueue, sctp_paramhdr::param_length, sctp_paramhdr::param_type, sctp_association::peers_rwnd, sctp_pcb::port, PR_SCTP_INVALID_POLICY, sctp_pcb::pre_open_stream_count, sctp_association::primary_destination, sctp_stream_queue_pending::processing, sctp_association::prsctp_supported, sctp_association::refcnt, sctp_tcb::rport, sctp_sockstore::sa, sctp_association::sb_send_resv, SCTP_ABORT, sctp_abort_an_association(), SCTP_ADD_SUBSTATE, SCTP_ADDR_OVER, SCTP_ALL_ASSOC, sctp_aloc_assoc_connected(), SCTP_ASOC_CREATE_LOCK, SCTP_ASOC_CREATE_UNLOCK, sctp_inpcb::sctp_asoc_list, SCTP_BASE_SYSCTL, SCTP_BLK_LOGGING_ENABLE, SCTP_BLOCK_LOG_INTO_BLK, SCTP_BLOCK_LOG_INTO_BLKA, SCTP_BLOCK_LOG_OUTOF_BLK, SCTP_BUF_LEN, SCTP_BUF_NEXT, SCTP_CAUSE_USER_INITIATED_ABT, sctp_chunk_output(), sctp_association::sctp_cmt_on_off, sctp_copy_it_in(), sctp_copy_resume(), SCTP_CWNDLOG_PRESEND, SCTP_DATA_CHUNK_OVERHEAD, SCTP_DEBUG_OUTPUT1, SCTP_DEFAULT_ADD_MORE, SCTP_DIAG_INFO_LEN, SCTP_EOF, SCTP_EOR, sctp_inpcb::sctp_ep, sctp_tcb::sctp_ep, sctp_feature_off, sctp_findassociation_ep_addr(), sctp_findassociation_ep_asocid(), sctp_findnet(), sctp_inpcb::sctp_flags, sctp_free_assoc(), SCTP_FROM_SCTP_OUTPUT, sctp_generate_cause(), sctp_get_frag_point(), sctp_get_mbuf_for_msg(), SCTP_GET_STATE, SCTP_GETTIME_TIMEVAL, SCTP_HEADER_LEN, SCTP_HEADER_TO_CHAIN, SCTP_INITIALIZE_AUTH_PARAMS, SCTP_INP_DECR_REF, SCTP_INP_INCR_REF, SCTP_INP_RLOCK, SCTP_INP_RUNLOCK, SCTP_INP_WLOCK, SCTP_INP_WUNLOCK, sctp_is_feature_off, sctp_is_feature_on, SCTP_IS_LISTENING, sctp_is_there_unsent_data(), SCTP_LOC_6, sctp_log_block(), sctp_log_nagle_event(), SCTP_LTRACE_ERR_RET, sctp_m_freem, SCTP_MAX_DATA_BUNDLING, sctp_med_chunk_output(), SCTP_MIN_OVERHEAD, sctp_misc_ints(), sctp_msg_append(), SCTP_NAGLE_APPLIED, SCTP_NAGLE_LOGGING_ENABLE, SCTP_NAGLE_SKIPPED, SCTP_NORMAL_PROC, SCTP_OUTPUT_FROM_USR_SEND, SCTP_PCB_FLAGS_BOUND_V6, SCTP_PCB_FLAGS_CONNECTED, SCTP_PCB_FLAGS_EXPLICIT_EOR, SCTP_PCB_FLAGS_IN_TCPPOOL, SCTP_PCB_FLAGS_NO_FRAGMENT, SCTP_PCB_FLAGS_NODELAY, SCTP_PCB_FLAGS_SOCKET_ALLGONE, SCTP_PCB_FLAGS_SOCKET_GONE, SCTP_PCB_FLAGS_TCPTYPE, SCTP_PRINTF, sctp_process_cmsgs_for_init(), sctp_prune_prsctp(), SCTP_RELEASE_PKT, SCTP_SACK_IMMEDIATELY, SCTP_SB_LIMIT_SND, sctp_send_initiate(), sctp_send_shutdown(), sctp_sendall(), SCTP_SENDALL, SCTP_SET_STATE, sctp_snd_sb_alloc, SCTP_SNPRINTF, SCTP_SO_IS_NBIO, SCTP_SO_LOCKED, sctp_tcb::sctp_socket, sctp_ss_functions::sctp_ss_add_to_stream, sctp_ss_functions::sctp_ss_is_user_msgs_incomplete, SCTP_STAT_DECR_GAUGE32, SCTP_STAT_INCR, SCTP_STATE_ABOUT_TO_BE_FREED, SCTP_STATE_COOKIE_ECHOED, SCTP_STATE_COOKIE_WAIT, SCTP_STATE_OPEN, SCTP_STATE_PARTIAL_MSG_LEFT, SCTP_STATE_SHUTDOWN_ACK_SENT, SCTP_STATE_SHUTDOWN_PENDING, SCTP_STATE_SHUTDOWN_RECEIVED, SCTP_STATE_SHUTDOWN_SENT, SCTP_STATE_WAS_ABORTED, sctp_stop_timers_for_shutdown(), SCTP_STREAM_OPEN, SCTP_STREAM_OPENING, SCTP_TCB_LOCK, SCTP_TCB_LOCK_ASSERT, SCTP_TCB_SEND_LOCK, SCTP_TCB_SEND_UNLOCK, SCTP_TCB_TRYLOCK, SCTP_TCB_UNLOCK, sctp_timer_start(), SCTP_TIMER_TYPE_SHUTDOWN, SCTP_TIMER_TYPE_SHUTDOWNGUARD, SCTP_UNORDERED, SCTPDBG, sctp_association::send_queue, sctp_stream_queue_pending::sender_all_done, sctp_association::sent_queue, sctp_association::sent_queue_cnt_removeable, sctp_sockstore::sin, sctp_sockstore::sin6, sockaddr_in::sin_len, sockaddr_in::sin_port, sctp_nonpad_sndrcvinfo::sinfo_assoc_id, sctp_sndrcvinfo::sinfo_assoc_id, sctp_stream_queue_pending::sinfo_flags, sctp_nonpad_sndrcvinfo::sinfo_flags, sctp_sndrcvinfo::sinfo_flags, sctp_sndrcvinfo::sinfo_stream, sctp_association::smallest_mtu, sctp_association::ss_functions, sctp_stream_out::state, sctp_association::state, sctp_association::stream_locked, sctp_association::stream_locked_on, sctp_association::stream_queue_cnt, sctp_association::streamoutcnt, sctp_association::strmout, sctp_stream_queue_pending::tail_mbuf, sctp_tcb::tcb_mtx, sctp_tcb::tcb_send_mtx, sctp_association::time_entered, sctp_association::total_flight, sctp_association::total_flight_count, sctp_association::total_output_queue_size, and sctp_tcb::total_sends.

Referenced by sctp_sosend(), sys_sctp_generic_sendmsg(), and sys_sctp_generic_sendmsg_iov().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sctp_lowlevel_chunk_output()

static int sctp_lowlevel_chunk_output ( struct sctp_inpcb inp,
struct sctp_tcb stcb,
struct sctp_nets net,
struct sockaddr *  to,
struct mbuf *  m,
uint32_t  auth_offset,
struct sctp_auth_chunk auth,
uint16_t  auth_keyid,
int  nofragment_flag,
int  ecn_ok,
int  out_of_asoc_ok,
uint16_t  src_port,
uint16_t  dest_port,
uint32_t  v_tag,
uint16_t  port,
union sctp_sockstore over_addr,
uint8_t  mflowtype,
uint32_t  mflowid,
int  so_locked 
)
static

Given a mbuf chain (via SCTP_BUF_NEXT()) that holds a packet header WITH an SCTPHDR but no IP header, endpoint inp and sa structure:

  • fill in the HMAC digest of any AUTH chunk in the packet.
  • calculate and fill in the SCTP checksum.
  • prepend an IP address header.
  • if boundall use INADDR_ANY.
  • if boundspecific do source address selection.
  • set fragmentation option for ipV4.
  • On return from IP output, check/adjust mtu size of output interface and smallest_mtu size as well.

Definition at line 3956 of file sctp_output.c.

References sctp_net_route::_l_addr, sctp_net_route::_s_addr, sctp_ifa::address, sctp_tcb::asoc, sctphdr::checksum, sctp_inpcb::def_vrf_id, sctp_pcb::default_dscp, sctp_association::default_dscp, sctphdr::dest_port, sctp_nets::dest_state, sctp_nets::dscp, sctp_inpcb::fibnum, sctp_nets::flowid, sctp_nets::flowtype, in_pseudo(), sctp_inpcb::inp, inpcb::inp_ip_tos, inpcb::inp_ip_ttl, ip6_hdr::ip6_dst, ip6_hdr::ip6_src, IP_DF, ip::ip_dst, ip_fillid(), ip::ip_hl, sctp_inpcb::ip_inp, ip::ip_len, ip::ip_off, ip::ip_p, ip::ip_sum, ip::ip_tos, ip::ip_ttl, ip::ip_v, IPPROTO_SCTP, IPPROTO_UDP, IPVERSION, sctp_ifa::localifa_flags, MODULE_GLOBAL, sctp_nets::mtu, sctp_nets::port, sctp_nets::ro, in_addr::s_addr, sctp_sockstore::sa, SCTP_ADDR_IFA_UNUSEABLE, SCTP_ADDR_NO_PMTUD, SCTP_ADDR_OUT_OF_SCOPE, SCTP_ALIGN_TO_END, SCTP_ATTACH_CHAIN, SCTP_BASE_SYSCTL, SCTP_BEING_DELETED, SCTP_BUF_LEN, SCTP_BUF_NEXT, sctp_calculate_cksum(), sctp_calculate_len(), SCTP_DEBUG_OUTPUT1, SCTP_DEBUG_OUTPUT3, SCTP_ENABLE_UDP_CSUM, sctp_inpcb::sctp_ep, sctp_fill_hmac_digest_m(), sctp_free_ifa(), SCTP_FROM_SCTP_OUTPUT, SCTP_GATHER_MTU_FROM_ROUTE, sctp_get_ect(), SCTP_GET_HEADER_FOR_OUTPUT, SCTP_GET_HLIM, SCTP_GET_IFN_VOID_FROM_ROUTE, sctp_get_mbuf_for_msg(), SCTP_IP6_OUTPUT, SCTP_IP_OUTPUT, SCTP_LAST_PACKET_TRACING, SCTP_LTRACE_ERR_RET, SCTP_LTRACE_ERR_RET_PKT, sctp_m_freem, SCTP_MIN_OVERHEAD, SCTP_MIN_V4_OVERHEAD, sctp_pathmtu_adjustment(), SCTP_PROBE5, SCTP_RTALLOC, sctp_source_address_selection(), SCTP_STAT_INCR, SCTP_STAT_INCR_COUNTER64, SCTPDBG, SCTPDBG_ADDR, sctp_sockstore::sin, sctp_sockstore::sin6, sockaddr_in::sin_addr, sctp_association::smallest_mtu, sctp_nets::src_addr_selected, sctphdr::src_port, UDPSTAT_INC, udphdr::uh_dport, udphdr::uh_sport, udphdr::uh_sum, udphdr::uh_ulen, sctphdr::v_tag, V_udp_cksum, sctp_ifa::vrf_id, and sctp_association::vrf_id.

Referenced by sctp_chunk_retransmission(), sctp_med_chunk_output(), sctp_send_abort_tcb(), sctp_send_initiate(), sctp_send_initiate_ack(), and sctp_send_shutdown_complete().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sctp_med_chunk_output()

int sctp_med_chunk_output ( struct sctp_inpcb inp,
struct sctp_tcb stcb,
struct sctp_association asoc,
int *  num_out,
int *  reason_code,
int  control_only,
int  from_where,
struct timeval *  now,
int *  now_filled,
uint32_t  frag_point,
int  so_locked 
)
static

Ok this is the generic chunk service queue. we must do the following:

  • Service the stream queue that is next, moving any message (note I must get a complete message i.e. FIRST/MIDDLE and LAST to the out queue in one pass) and assigning TSN's. This only applys though if the peer does not support NDATA. For NDATA chunks its ok to not send the entire message ;-)
  • Check to see if the cwnd/rwnd allows any output, if so we go ahead and fomulate and send the low level chunks. Making sure to combine any control in the control chunk queue also.

Definition at line 7797 of file sctp_output.c.

References sctp_net_route::_l_addr, sctp_authinformation::active_keyid, sctp_association::alternate, sctp_association::asconf_send_queue, sctp_tcb::asoc, sctp_tmit_chunk::auth_keyid, sctp_association::authinfo, chk_id::can_take_data, sctp_association::cc_functions, sctp_data_chunk::ch, sctp_chunkhdr::chunk_flags, CHUNK_FLAGS_FRAGMENT_OK, sctp_tmit_chunk::chunk_id, sctp_association::control_send_queue, cookie, sctp_tmit_chunk::copy_by_ref, sctp_association::ctrl_queue_cnt, sctp_nets::cwnd, sctp_association::dack_timer, sctp_tmit_chunk::data, sctp_nets::dest_state, sctp_tmit_chunk::do_rtt, sctp_association::ecn_echo_cnt_onq, sctp_tmit_chunk::flags, sctp_nets::flight_size, chk_id::id, sctp_association::ifp_had_enobuf, sctp_association::last_net_cmt_send_started, sctp_nets::last_sent_time, sctp_nets::mtu, sctp_association::nets, sctp_association::numnets, sctp_association::peer_auth_chunks, sctp_association::peer_hmac_id, sctp_association::peer_vtag, sctp_association::peers_rwnd, sctp_nets::port, sctp_association::primary_destination, sctp_data_chunkrec::rcv_flags, sctp_tmit_chunk::rec, sctp_nets::ref_count, sctp_nets::ro, sctp_tcb::rport, sctp_nets::rto_needed, sctp_nets::rxt_timer, sctp_sockstore::sa, sctp_add_auth_chunk(), SCTP_ADDR_PF, SCTP_ADDR_REACHABLE, SCTP_ADDR_UNCONFIRMED, SCTP_ASCONF, SCTP_ASCONF_ACK, sctp_auth_is_required_chunk, SCTP_BASE_SYSCTL, sctp_clean_up_ctl(), sctp_clean_up_datalist(), sctp_association::sctp_cmt_on_off, SCTP_COOKIE_ACK, SCTP_COOKIE_ECHO, sctp_copy_mbufchain(), SCTP_CWND_LOG_FILL_OUTQ_CALLED, SCTP_CWND_LOG_FROM_SEND, SCTP_CWND_LOGGING_ENABLE, sctp_cc_functions::sctp_cwnd_new_transmission_begins, SCTP_DATA, SCTP_DATA_FIRST_FRAG, SCTP_DATA_LAST_FRAG, SCTP_DATA_SACK_IMMEDIATELY, SCTP_DATA_UNORDERED, SCTP_DATAGRAM_RESEND, SCTP_DATAGRAM_SENT, SCTP_DATAGRAM_UNSENT, SCTP_DEBUG_OUTPUT3, SCTP_ECN_CWR, SCTP_ECN_ECHO, sctp_fill_outqueue(), SCTP_FROM_SCTP_OUTPUT, sctp_get_auth_chunk_len(), SCTP_GET_STATE, SCTP_GETTIME_TIMEVAL, SCTP_HEARTBEAT_ACK, SCTP_HEARTBEAT_REQUEST, sctp_is_feature_on, sctp_is_there_unsent_data(), SCTP_LOC_1, sctp_log_cwnd(), sctp_lowlevel_chunk_output(), SCTP_LTRACE_ERR_RET, SCTP_MAX_DATA_BUNDLING, SCTP_MIN_OVERHEAD, SCTP_MIN_V4_OVERHEAD, sctp_move_chunks_from_net(), SCTP_NR_SELECTIVE_ACK, SCTP_OPERATION_ERROR, SCTP_OS_TIMER_PENDING, SCTP_PACKET_DROPPED, SCTP_PCB_FLAGS_EXPLICIT_EOR, SCTP_PRINTF, SCTP_RECV_BUFFER_SPLITTING, SCTP_SB_LIMIT_SND, SCTP_SELECTIVE_ACK, SCTP_SEND_BUFFER_SPLITTING, SCTP_SHUTDOWN, SCTP_SHUTDOWN_ACK, sctp_tcb::sctp_socket, sctp_ss_functions::sctp_ss_is_empty, SCTP_STAT_INCR, SCTP_STAT_INCR_BY, SCTP_STAT_INCR_COUNTER64, SCTP_STATE_OPEN, SCTP_STATE_SHUTDOWN_PENDING, SCTP_STATE_SHUTDOWN_RECEIVED, SCTP_TCB_LOCK_ASSERT, sctp_timer_start(), sctp_timer_stop(), SCTP_TIMER_TYPE_ASCONF, SCTP_TIMER_TYPE_COOKIE, SCTP_TIMER_TYPE_RECV, SCTP_TIMER_TYPE_SEND, SCTPDBG, sctp_association::send_queue, sctp_tmit_chunk::send_size, sctp_tmit_chunk::sent, sctp_tmit_chunk::snd_count, sctp_association::ss_functions, sctp_association::state, sctp_association::time_last_sent, sctp_timer::timer, sctp_association::total_flight, sctp_data_chunkrec::tsn, sctp_tmit_chunk::whoTo, sctp_nets::window_probe, and sctp_tmit_chunk::window_probe.

Referenced by sctp_chunk_output(), sctp_lower_sosend(), and sctp_sendall_iterator().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sctp_move_chunks_from_net()

◆ sctp_move_to_outqueue()

static uint32_t sctp_move_to_outqueue ( struct sctp_tcb stcb,
struct sctp_nets net,
struct sctp_stream_out strq,
uint32_t  space_left,
uint32_t  frag_point,
int *  giveup,
int  eeor_mode,
int *  bail,
int  so_locked 
)
static

Definition at line 7149 of file sctp_output.c.

References sctp_stream_queue_pending::act_flags, sctp_tcb::asoc, sctp_tmit_chunk::asoc, sctp_tmit_chunk::auth_keyid, sctp_stream_queue_pending::auth_keyid, sctp_tmit_chunk::book_size, sctp_tmit_chunk::book_size_scale, sctp_data_chunk::ch, sctp_idata_chunk::ch, sctp_chunkhdr::chunk_flags, sctp_chunkhdr::chunk_length, sctp_chunkhdr::chunk_type, sctp_association::chunks_on_out_queue, sctp_stream_out::chunks_on_queues, sctp_data_chunkrec::context, sctp_stream_queue_pending::context, sctp_tmit_chunk::copy_by_ref, sctp_tmit_chunk::data, sctp_stream_queue_pending::data, sctp_stream_queue_pending::discard_rest, sctp_data_chunkrec::doing_fast_retransmit, sctp_data_chunk::dp, sctp_idata_chunk::dp, sctp_tmit_chunk::flags, sctp_idata::fsn, sctp_stream_queue_pending::fsn, sctp_tmit_chunk::holds_key_ref, sctp_stream_queue_pending::holds_key_ref, sctp_association::idata_supported, sctp_tmit_chunk::last_mbuf, sctp_stream_out::last_msg_incomplete, sctp_stream_queue_pending::length, sctp_idata::mid, sctp_data_chunkrec::mid, sctp_stream_queue_pending::msg_is_complete, sctp_stream_queue_pending::net, next, sctp_stream_out::next_mid_ordered, sctp_stream_out::next_mid_unordered, sctp_tmit_chunk::no_fr_allowed, sctp_stream_out::outqueue, sctp_tmit_chunk::pad_inplace, sctp_data::ppid, sctp_idata::ppid, sctp_data_chunkrec::ppid, sctp_stream_queue_pending::ppid, sctp_idata::ppid_fsn, sctp_association::pr_sctp_cnt, PR_SCTP_ENABLED, sctp_stream_queue_pending::put_last_out, sctp_data_chunkrec::rcv_flags, sctp_tmit_chunk::rec, sctp_nets::ref_count, sctp_idata::reserved, sctp_alloc_a_chunk, sctp_auth_key_acquire(), SCTP_BASE_SYSCTL, SCTP_BUF_IS_EXTENDED, SCTP_BUF_LEN, SCTP_BUF_NEXT, SCTP_BUF_PREPEND, sctp_can_we_split_this(), SCTP_DATA, SCTP_DATA_CHUNK_OVERHEAD, SCTP_DATA_FIRST_FRAG, SCTP_DATA_LAST_FRAG, SCTP_DATA_NOT_FRAG, SCTP_DATA_SACK_IMMEDIATELY, SCTP_DATA_UNORDERED, SCTP_DATAGRAM_UNSENT, SCTP_EOF, sctp_tcb::sctp_ep, sctp_inpcb::sctp_flags, sctp_free_a_chunk, sctp_free_a_strmoq, sctp_free_remote_addr, sctp_get_mbuf_for_msg(), SCTP_IDATA, sctp_is_feature_on, SCTP_LOG_AT_SEND_2_OUTQ, SCTP_M_COPYM, sctp_m_free, sctp_m_freem, SCTP_MBUF_ICOPY, SCTP_MBUF_LOGGING_ENABLE, sctp_misc_ints(), sctp_pad_lastmbuf(), SCTP_PCB_FLAGS_EXPLICIT_EOR, SCTP_PCB_FLAGS_IN_TCPPOOL, SCTP_PCB_FLAGS_TCPTYPE, SCTP_PRINTF, SCTP_SACK_IMMEDIATELY, SCTP_SIZE32, sctp_snd_sb_alloc, sctp_tcb::sctp_socket, sctp_ss_functions::sctp_ss_remove_from_stream, sctp_ss_functions::sctp_ss_scheduled, SCTP_STREAM_RESET_PENDING, SCTP_STRMOUT_LOG_SEND, SCTP_TCB_LOCK_ASSERT, SCTP_TCB_SEND_LOCK, SCTP_TCB_SEND_UNLOCK, SCTP_TSN_LOG_SIZE, SCTP_UNORDERED, sctp_association::send_queue, sctp_association::send_queue_cnt, sctp_tmit_chunk::send_size, sctp_stream_queue_pending::sender_all_done, sctp_association::sending_seq, sctp_tmit_chunk::sent, sctp_data::sid, sctp_idata::sid, sctp_data_chunkrec::sid, sctp_stream_queue_pending::sid, sctp_stream_out::sid, sctp_stream_queue_pending::sinfo_flags, sctp_stream_queue_pending::some_taken, sctp_association::ss_functions, sctp_data::ssn, sctp_stream_out::state, sctp_association::stream_queue_cnt, sctp_stream_queue_pending::tail_mbuf, sctp_data_chunkrec::timetodrop, sctp_association::total_output_queue_size, sctp_association::trigger_reset, sctp_stream_queue_pending::ts, sctp_data::tsn, sctp_idata::tsn, sctp_data_chunkrec::tsn, and sctp_tmit_chunk::whoTo.

Referenced by sctp_fill_outqueue().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sctp_msg_append()

static int sctp_msg_append ( struct sctp_tcb stcb,
struct sctp_nets net,
struct mbuf *  m,
struct sctp_sndrcvinfo srcv,
int  hold_stcb_lock 
)
static

Definition at line 6318 of file sctp_output.c.

References sctp_authinformation::active_keyid, sctp_tcb::asoc, sctp_stream_queue_pending::auth_keyid, sctp_association::authinfo, sctp_stream_queue_pending::context, sctp_stream_queue_pending::data, sctp_stream_queue_pending::fsn, sctp_stream_queue_pending::holds_key_ref, sctp_stream_queue_pending::length, sctp_stream_queue_pending::msg_is_complete, sctp_stream_queue_pending::net, next, sctp_stream_out::outqueue, sctp_association::peer_auth_chunks, sctp_stream_queue_pending::ppid, sctp_nets::ref_count, SCTP_ADDR_OVER, sctp_alloc_a_strmoq, sctp_auth_is_required_chunk, sctp_auth_key_acquire(), SCTP_BUF_LEN, SCTP_BUF_NEXT, SCTP_DATA, SCTP_FROM_SCTP_OUTPUT, SCTP_GET_STATE, SCTP_GETTIME_TIMEVAL, SCTP_LTRACE_ERR_RET, SCTP_LTRACE_ERR_RET_PKT, sctp_m_freem, sctp_set_prsctp_policy(), sctp_snd_sb_alloc, sctp_ss_functions::sctp_ss_add_to_stream, SCTP_STATE_SHUTDOWN_ACK_SENT, SCTP_STATE_SHUTDOWN_PENDING, SCTP_STATE_SHUTDOWN_RECEIVED, SCTP_STATE_SHUTDOWN_SENT, SCTP_TCB_SEND_LOCK, SCTP_TCB_SEND_UNLOCK, sctp_stream_queue_pending::sender_all_done, sctp_stream_queue_pending::sid, sctp_sndrcvinfo::sinfo_context, sctp_stream_queue_pending::sinfo_flags, sctp_sndrcvinfo::sinfo_flags, sctp_sndrcvinfo::sinfo_keynumber, sctp_sndrcvinfo::sinfo_keynumber_valid, sctp_sndrcvinfo::sinfo_ppid, sctp_sndrcvinfo::sinfo_stream, sctp_sndrcvinfo::sinfo_timetolive, sctp_stream_queue_pending::some_taken, sctp_association::ss_functions, sctp_association::state, sctp_association::stream_locked, sctp_association::stream_locked_on, sctp_association::stream_queue_cnt, sctp_association::streamoutcnt, sctp_association::strmout, sctp_stream_queue_pending::tail_mbuf, sctp_stream_queue_pending::timetolive, and sctp_stream_queue_pending::ts.

Referenced by sctp_lower_sosend(), and sctp_sendall_iterator().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sctp_output()

int sctp_output ( struct sctp_inpcb inp,
struct mbuf *  m,
struct sockaddr *  addr,
struct mbuf *  control,
struct thread *  p,
int  flags 
)

Definition at line 10237 of file sctp_output.c.

References SCTP_FROM_SCTP_OUTPUT, SCTP_LTRACE_ERR_RET_PKT, sctp_inpcb::sctp_socket, and sctp_sosend().

Referenced by sctp_sendm().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sctp_process_cmsgs_for_init()

◆ sctp_prune_prsctp()

◆ sctp_queue_op_err()

◆ sctp_select_nth_preferred_addr_from_ifn_boundall()

◆ sctp_send_abort()

void sctp_send_abort ( struct mbuf *  m,
int  iphlen,
struct sockaddr *  src,
struct sockaddr *  dst,
struct sctphdr sh,
uint32_t  vtag,
struct mbuf *  cause,
uint8_t  mflowtype,
uint32_t  mflowid,
uint16_t  fibnum,
uint32_t  vrf_id,
uint16_t  port 
)

◆ sctp_send_abort_tcb()

◆ sctp_send_asconf()

◆ sctp_send_asconf_ack()

◆ sctp_send_cookie_ack()

◆ sctp_send_cookie_echo()

◆ sctp_send_cwr()

◆ sctp_send_deferred_reset_response()

◆ sctp_send_ecn_echo()

◆ sctp_send_hb()

void sctp_send_hb ( struct sctp_tcb stcb,
struct sctp_nets net,
int  so_locked 
)

Definition at line 11287 of file sctp_output.c.

References sctp_net_route::_l_addr, sctp_heartbeat_info_param::addr_family, sctp_heartbeat_info_param::addr_len, sctp_heartbeat_info_param::address, sctp_tcb::asoc, sctp_tmit_chunk::asoc, chk_id::can_take_data, sctp_heartbeat_chunk::ch, sctp_chunkhdr::chunk_flags, sctp_tmit_chunk::chunk_id, sctp_chunkhdr::chunk_length, sctp_chunkhdr::chunk_type, sctp_association::control_send_queue, sctp_tmit_chunk::copy_by_ref, sctp_association::ctrl_queue_cnt, sctp_tmit_chunk::data, sctp_nets::dest_state, sctp_tmit_chunk::flags, sctp_heartbeat::hb_info, sctp_nets::hb_responded, sctp_heartbeat_chunk::heartbeat, sctp_nets::heartbeat_random1, sctp_nets::heartbeat_random2, chk_id::id, sctp_paramhdr::param_length, sctp_paramhdr::param_type, sctp_heartbeat_info_param::ph, sctp_heartbeat_info_param::random_value1, sctp_heartbeat_info_param::random_value2, sctp_tmit_chunk::rec, sctp_nets::ref_count, sctp_nets::ro, sctp_sockstore::sa, SCTP_ADDR_UNCONFIRMED, sctp_alloc_a_chunk, SCTP_BUF_LEN, SCTP_BUF_RESV_UF, SCTP_DATAGRAM_UNSENT, SCTP_DEBUG_OUTPUT4, sctp_inpcb::sctp_ep, sctp_tcb::sctp_ep, sctp_free_a_chunk, sctp_get_mbuf_for_msg(), SCTP_GETTIME_TIMEVAL, SCTP_HEARTBEAT_INFO, SCTP_HEARTBEAT_REQUEST, sctp_m_freem, SCTP_MIN_OVERHEAD, sctp_select_initial_TSN(), SCTP_STAT_INCR, SCTP_TCB_LOCK_ASSERT, SCTPDBG, sctp_tmit_chunk::send_size, sctp_tmit_chunk::sent, sctp_sockstore::sin, sctp_sockstore::sin6, sockaddr_in::sin_addr, sctp_tmit_chunk::snd_count, sctp_heartbeat_info_param::time_value_1, sctp_heartbeat_info_param::time_value_2, and sctp_tmit_chunk::whoTo.

Referenced by process_chunk_drop(), sctp_heartbeat_timer(), sctp_process_asconf_add_ip(), sctp_setopt(), sctp_start_net_timers(), sctp_t3rxt_timer(), and sctp_threshold_management().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sctp_send_heartbeat_ack()

◆ sctp_send_initiate()

void sctp_send_initiate ( struct sctp_inpcb inp,
struct sctp_tcb stcb,
int  so_locked 
)

Definition at line 4615 of file sctp_output.c.

References sctp_net_route::_l_addr, sctp_init::a_rwnd, sctp_pcb::adaptation_layer_indicator, sctp_pcb::adaptation_layer_indicator_provided, sctp_supported_addr_param::addr_type, sctp_association::asconf_supported, sctp_tcb::asoc, sctp_association::auth_supported, sctp_association::authinfo, sctp_init_chunk::ch, sctp_chunkhdr::chunk_flags, sctp_chunkhdr::chunk_length, sctp_chunkhdr::chunk_type, sctp_supported_chunk_types_param::chunk_types, sctp_auth_chunk_list::chunk_types, sctp_association::cookie_preserve_req, sctp_nets::dest_state, sctp_association::ecn_supported, sctp_auth_hmac_algo::hmac_ids, sctp_association::idata_supported, sctp_association::ifp_had_enobuf, sctp_adaptation_layer_indication::indication, sctp_init_chunk::init, sctp_association::init_seq_number, sctp_init::initial_tsn, sctp_init::initiate_tag, sctp_scoping::ipv4_addr_legal, sctp_scoping::ipv6_addr_legal, sctp_key::key, sctp_nets::last_sent_time, sctp_association::local_auth_chunks, sctp_association::local_hmacs, sctp_association::max_inbound_streams, sctp_association::my_vtag, sctp_association::nets, sctp_association::nrsack_supported, sctp_hmaclist::num_algo, sctp_init::num_inbound_streams, sctp_init::num_outbound_streams, sctp_paramhdr::param_length, sctp_paramhdr::param_type, sctp_cookie_perserve_param::ph, sctp_supported_addr_param::ph, sctp_supported_chunk_types_param::ph, sctp_adaptation_layer_indication::ph, sctp_auth_chunk_list::ph, sctp_auth_hmac_algo::ph, sctp_association::pktdrop_supported, sctp_nets::port, sctp_association::pre_open_streams, sctp_association::primary_destination, sctp_association::prsctp_supported, sctp_authinformation::random, sctp_authinformation::random_len, sctp_association::reconfig_supported, sctp_nets::ro, sctp_tcb::rport, sctp_nets::rxt_timer, sctp_sockstore::sa, sctp_association::scope, sctp_add_addresses_to_i_ia(), sctp_add_pad_tombuf(), SCTP_ASCONF, SCTP_ASCONF_ACK, sctp_auth_get_chklist_size(), SCTP_AUTHENTICATION, SCTP_BASE_SYSCTL, SCTP_BUF_LEN, SCTP_CHUNK_LIST, SCTP_COOKIE_PRESERVE, SCTP_DEBUG_OUTPUT4, SCTP_ECN_CAPABLE, sctp_inpcb::sctp_ep, SCTP_FORWARD_CUM_TSN, sctp_get_mbuf_for_msg(), SCTP_GETTIME_TIMEVAL, SCTP_HAS_NAT_SUPPORT, SCTP_HMAC_LIST, SCTP_IDATA, SCTP_IFORWARD_CUM_TSN, SCTP_INITIATION, SCTP_IPV4_ADDRESS, SCTP_IPV6_ADDRESS, sctp_lowlevel_chunk_output(), sctp_m_freem, SCTP_MINIMAL_RWND, SCTP_NR_SELECTIVE_ACK, SCTP_OS_TIMER_PENDING, SCTP_PACKET_DROPPED, SCTP_PRSCTP_SUPPORTED, SCTP_SB_LIMIT_RCV, sctp_serialize_auth_chunks(), sctp_serialize_hmaclist(), sctp_set_primary_addr(), SCTP_SIZE32, sctp_inpcb::sctp_socket, SCTP_STAT_INCR, SCTP_STAT_INCR_COUNTER64, SCTP_STREAM_RESET, SCTP_SUPPORTED_ADDRTYPE, SCTP_SUPPORTED_CHUNK_EXT, sctp_timer_start(), SCTP_TIMER_TYPE_INIT, SCTP_ULP_ADAPTATION, SCTPDBG, sctp_sockstore::sin6, sctp_cookie_perserve_param::time, and sctp_timer::timer.

Referenced by process_chunk_drop(), sctp_do_connect_x(), sctp_handle_error(), sctp_handle_nat_colliding_state(), sctp_lower_sosend(), sctp_setopt(), and sctp_t1init_timer().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sctp_send_initiate_ack()

void sctp_send_initiate_ack ( struct sctp_inpcb inp,
struct sctp_tcb stcb,
struct sctp_nets src_net,
struct mbuf *  init_pkt,
int  iphlen,
int  offset,
struct sockaddr *  src,
struct sockaddr *  dst,
struct sctphdr sh,
struct sctp_init_chunk init_chk,
uint8_t  mflowtype,
uint32_t  mflowid,
uint32_t  vrf_id,
uint16_t  port 
)

Definition at line 5457 of file sctp_output.c.

References sctp_net_route::_l_addr, sctp_net_route::_s_addr, sctp_pcb::adaptation_layer_indicator, sctp_pcb::adaptation_layer_indicator_provided, sctp_state_cookie::addr_type, sctp_state_cookie::address, sctp_ifa::address, sctp_inpcb::asconf_supported, sctp_association::asconf_supported, sctp_tcb::asoc, sctp_inpcb::auth_supported, sctp_association::auth_supported, sctp_init_chunk::ch, sctp_chunkhdr::chunk_length, sctp_supported_chunk_types_param::chunk_types, sctp_auth_chunk_list::chunk_types, sctp_state_cookie::cookie_life, sctp_association::cookie_life, sctp_pcb::current_secret_number, sctp_pcb::def_cookie_life, sctphdr::dest_port, sctp_inpcb::ecn_supported, sctp_association::ecn_supported, sctp_inpcb::fibnum, sctp_auth_hmac_algo::hmac_ids, sctp_inpcb::idata_supported, sctp_association::idata_supported, sctp_state_cookie::identification, sctp_association::ifp_had_enobuf, IN4_ISPRIVATE_ADDRESS, sctp_adaptation_layer_indication::indication, sctp_init_chunk::init, sctp_association::init_seq_number, sctp_init::initiate_tag, sctp_state_cookie::ipv4_addr_legal, sctp_scoping::ipv4_addr_legal, sctp_scoping::ipv4_local_scope, sctp_state_cookie::ipv4_scope, sctp_state_cookie::ipv6_addr_legal, sctp_scoping::ipv6_addr_legal, sctp_state_cookie::laddr_type, sctp_state_cookie::laddress, sctp_pcb::local_auth_chunks, sctp_pcb::local_hmacs, sctp_state_cookie::local_scope, sctp_scoping::local_scope, sctp_state_cookie::loopback_scope, sctp_scoping::loopback_scope, sctp_pcb::max_open_streams_intome, sctp_state_cookie::my_vtag, sctp_association::my_vtag, sctp_association::my_vtag_nonce, sctp_state_cookie::myport, sctp_association::nets, sctp_inpcb::nrsack_supported, sctp_association::nrsack_supported, sctp_init::num_inbound_streams, sctp_paramhdr::param_length, sctp_paramhdr::param_type, sctp_association::peer_supports_nat, sctp_association::peer_vtag_nonce, sctp_state_cookie::peerport, sctp_state_cookie::peers_vtag, sctp_supported_chunk_types_param::ph, sctp_adaptation_layer_indication::ph, sctp_auth_random::ph, sctp_auth_chunk_list::ph, sctp_auth_hmac_algo::ph, sctp_inpcb::pktdrop_supported, sctp_association::pktdrop_supported, sctp_nets::port, sctp_pcb::pre_open_stream_count, sctp_association::pre_open_streams, sctp_association::primary_destination, sctp_inpcb::prsctp_supported, sctp_association::prsctp_supported, sctp_auth_random::random_data, sctp_inpcb::reconfig_supported, sctp_association::reconfig_supported, sctp_association::refcnt, sctp_state_cookie::reserved, sctp_nets::ro, in_addr::s_addr, sctp_association::scope, sctp_state_cookie::scope_id, sctp_add_addresses_to_i_ia(), sctp_add_cookie(), sctp_add_pad_tombuf(), sctp_are_there_new_addresses(), sctp_arethere_unrecognized_parameters(), SCTP_ASCONF, SCTP_ASCONF_ACK, SCTP_AUTH_RANDOM_SIZE_DEFAULT, SCTP_AUTHENTICATION, SCTP_BASE_SYSCTL, SCTP_BUF_LEN, SCTP_BUF_NEXT, SCTP_CHUNK_LIST, SCTP_DEBUG_OUTPUT4, SCTP_DIAG_INFO_LEN, SCTP_ECN_CAPABLE, sctp_inpcb::sctp_ep, sctp_inpcb::sctp_flags, SCTP_FORWARD_CUM_TSN, sctp_generate_cause(), sctp_get_mbuf_for_msg(), SCTP_GET_STATE, SCTP_GETTIME_TIMEVAL, SCTP_HAS_NAT_SUPPORT, SCTP_HMAC, SCTP_HMAC_LIST, sctp_hmac_m(), SCTP_IDATA, SCTP_IFORWARD_CUM_TSN, sctp_init_ack_chunk, SCTP_INITIATION_ACK, SCTP_INP_DECR_REF, SCTP_INP_INCR_REF, SCTP_INP_INFO_RLOCK, SCTP_INP_INFO_RUNLOCK, SCTP_INP_RLOCK, SCTP_INP_RUNLOCK, SCTP_IPV4_ADDRESS, SCTP_IPV6_ADDRESS, SCTP_IPV6_V6ONLY, sctp_is_address_on_local_host(), sctp_lowlevel_chunk_output(), sctp_m_freem, SCTP_MINIMAL_RWND, SCTP_NR_SELECTIVE_ACK, SCTP_PACKET_DROPPED, SCTP_PCB_FLAGS_BOUND_V6, SCTP_PRSCTP_SUPPORTED, SCTP_RANDOM, SCTP_READ_RANDOM, SCTP_RESERVE_SPACE, SCTP_SB_LIMIT_RCV, SCTP_SECRET_SIZE, sctp_select_a_tag(), sctp_select_initial_TSN(), sctp_send_abort(), sctp_serialize_auth_chunks(), sctp_serialize_hmaclist(), SCTP_SIGNATURE_SIZE, SCTP_SIZE32, SCTP_SNPRINTF, SCTP_SO_NOT_LOCKED, sctp_inpcb::sctp_socket, sctp_source_address_selection(), SCTP_STAT_INCR, SCTP_STAT_INCR_COUNTER64, SCTP_STATE_COOKIE_ECHOED, SCTP_STATE_COOKIE_WAIT, SCTP_STATE_INUSE, SCTP_STREAM_RESET, SCTP_SUPPORTED_CHUNK_EXT, SCTP_TCB_LOCK, SCTP_TCB_UNLOCK, SCTP_ULP_ADAPTATION, SCTP_VERSION_STRING, SCTPDBG, sctp_pcb::secret_key, sctp_sockstore::sin, sctp_sockstore::sin6, sockaddr_in::sin_addr, sctp_state_cookie::site_scope, sctp_scoping::site_scope, sctp_nets::src_addr_selected, sctphdr::src_port, sctp_association::streamoutcnt, sctp_state_cookie::tie_tag_my_vtag, sctp_state_cookie::tie_tag_peer_vtag, and sctp_state_cookie::time_entered.

Referenced by sctp_handle_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sctp_send_operr_to()

void sctp_send_operr_to ( struct sockaddr *  src,
struct sockaddr *  dst,
struct sctphdr sh,
uint32_t  vtag,
struct mbuf *  cause,
uint8_t  mflowtype,
uint32_t  mflowid,
uint16_t  fibnum,
uint32_t  vrf_id,
uint16_t  port 
)

Definition at line 12297 of file sctp_output.c.

References SCTP_OPERATION_ERROR, and sctp_send_resp_msg().

Referenced by sctp_handle_cookie_echo(), and sctp_process_cookie_existing().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sctp_send_packet_dropped()

void sctp_send_packet_dropped ( struct sctp_tcb stcb,
struct sctp_nets net,
struct mbuf *  m,
int  len,
int  iphlen,
int  bad_crc 
)

We don't respond with an PKT-DROP to an ABORT or PKT-DROP. We also do not respond to an INIT-ACK, because we can't know if the initiation tag is correct or not.

Definition at line 11457 of file sctp_output.c.

References sctp_tcb::asoc, sctp_tmit_chunk::asoc, sctp_tmit_chunk::book_size, sctp_tmit_chunk::book_size_scale, sctp_pktdrop_chunk::bottle_bw, chk_id::can_take_data, sctp_pktdrop_chunk::ch, sctp_chunkhdr::chunk_flags, sctp_tmit_chunk::chunk_id, sctp_chunkhdr::chunk_length, sctp_chunkhdr::chunk_type, sctp_association::control_send_queue, sctp_tmit_chunk::copy_by_ref, sctp_association::ctrl_queue_cnt, sctp_pktdrop_chunk::current_onq, sctp_pktdrop_chunk::data, sctp_tmit_chunk::data, sctp_tmit_chunk::flags, chk_id::id, sctp_association::my_rwnd, sctp_association::my_rwnd_control_len, sctp_association::pktdrop_supported, sctp_tmit_chunk::rec, sctp_nets::ref_count, sctp_pktdrop_chunk::reserved, SCTP_ABORT_ASSOCIATION, sctp_alloc_a_chunk, SCTP_BADCRC, SCTP_BUF_LEN, SCTP_BUF_RESV_UF, SCTP_DATAGRAM_UNSENT, sctp_free_a_chunk, sctp_get_mbuf_for_msg(), SCTP_INITIATION_ACK, sctp_m_freem, sctp_m_getptr(), SCTP_MAX_OVERHEAD, SCTP_MED_OVERHEAD, SCTP_MIN_OVERHEAD, SCTP_PACKET_DROPPED, SCTP_PACKET_TRUNCATED, SCTP_SB_LIMIT_RCV, SCTP_SIZE32, SCTP_SO_NOT_LOCKED, sctp_tcb::sctp_socket, SCTP_TCB_LOCK_ASSERT, sctp_tmit_chunk::send_size, sctp_tmit_chunk::sent, sctp_association::size_on_all_streams, sctp_association::size_on_reasm_queue, sctp_association::smallest_mtu, sctp_tmit_chunk::snd_count, sctp_pktdrop_chunk::trunc_len, and sctp_tmit_chunk::whoTo.

Referenced by sctp_common_input_processing(), and sctp_process_data().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sctp_send_resp_msg()

◆ sctp_send_sack()

void sctp_send_sack ( struct sctp_tcb stcb,
int  so_locked 
)

Definition at line 10478 of file sctp_output.c.

References sctp_sack::a_rwnd, sctp_nr_sack::a_rwnd, sctp_tcb::asoc, sctp_tmit_chunk::asoc, chk_id::can_take_data, sctp_sack_chunk::ch, sctp_chunkhdr::chunk_flags, sctp_tmit_chunk::chunk_id, sctp_chunkhdr::chunk_length, sctp_chunkhdr::chunk_type, sctp_association::cmt_dac_pkts_rcvd, sctp_association::control_send_queue, sctp_tmit_chunk::copy_by_ref, sctp_association::ctrl_queue_cnt, sctp_sack::cum_tsn_ack, sctp_nr_sack::cum_tsn_ack, sctp_association::cumulative_tsn, sctp_tmit_chunk::data, sctp_association::data_pkts_seen, sctp_association::delayed_ack, sctp_nets::dest_state, sctp_association::dup_tsns, sctp_gap_ack_block::end, sctp_tmit_chunk::flags, sctp_tcb::freed_by_sorcv_sincelast, sack_track::gaps, sctp_association::highest_tsn_inside_map, sctp_association::highest_tsn_inside_nr_map, chk_id::id, sctp_association::last_data_chunk_from, sack_track::left_edge, sctp_association::mapping_array, sctp_association::mapping_array_base_tsn, MAX_TSN, sctp_nets::mtu, sctp_association::my_last_reported_rwnd, sctp_association::my_rwnd, sctp_association::nr_mapping_array, sctp_nr_sack_chunk::nr_sack, sctp_association::nrsack_supported, sctp_sack::num_dup_tsns, sctp_nr_sack::num_dup_tsns, sack_track::num_entries, sctp_sack::num_gap_ack_blks, sctp_nr_sack::num_gap_ack_blks, sctp_nr_sack::num_nr_gap_ack_blks, sctp_association::numduptsns, sctp_tmit_chunk::rec, sctp_nets::ref_count, sctp_nr_sack::reserved, sack_track::right_edge, sctp_sack_chunk::sack, sack_array, SCTP_ADDR_REACHABLE, sctp_alloc_a_chunk, SCTP_BASE_SYSCTL, SCTP_BUF_LEN, SCTP_BUF_RESV_UF, sctp_association::sctp_cmt_on_off, SCTP_DATAGRAM_UNSENT, sctp_tcb::sctp_ep, sctp_find_alternate_net(), sctp_free_a_chunk, sctp_free_remote_addr, SCTP_FROM_SCTP_OUTPUT, sctp_get_mbuf_for_msg(), SCTP_LOC_4, SCTP_LOC_5, sctp_m_freem, SCTP_MIN_OVERHEAD, SCTP_NR_SELECTIVE_ACK, SCTP_SELECTIVE_ACK, sctp_set_rwnd(), sctp_slide_mapping_arrays(), SCTP_STAT_INCR, SCTP_TCB_LOCK_ASSERT, sctp_timer_start(), sctp_timer_stop(), SCTP_TIMER_TYPE_RECV, SCTP_TSN_GT, SCTP_TSN_LOG_SIZE, sctp_association::send_sack, sctp_tmit_chunk::send_size, sctp_tmit_chunk::sent, sctp_tmit_chunk::snd_count, sctp_gap_ack_block::start, and sctp_tmit_chunk::whoTo.

Referenced by process_chunk_drop(), sctp_chunk_output(), sctp_drain_mbufs(), sctp_sack_check(), sctp_send_str_reset_req(), sctp_send_stream_reset_out_if_possible(), sctp_timeout_handler(), and sctp_user_rcvd().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sctp_send_shutdown()

◆ sctp_send_shutdown_ack()

◆ sctp_send_shutdown_complete()

◆ sctp_send_shutdown_complete2()

void sctp_send_shutdown_complete2 ( struct sockaddr *  src,
struct sockaddr *  dst,
struct sctphdr sh,
uint8_t  mflowtype,
uint32_t  mflowid,
uint16_t  fibnum,
uint32_t  vrf_id,
uint16_t  port 
)

Definition at line 11276 of file sctp_output.c.

References sctp_send_resp_msg(), and SCTP_SHUTDOWN_COMPLETE.

Referenced by sctp_common_input_processing(), and sctp_handle_ootb().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sctp_send_str_reset_req()

int sctp_send_str_reset_req ( struct sctp_tcb stcb,
uint16_t  number_entries,
uint16_t list,
uint8_t  send_in_req,
uint8_t  send_tsn_req,
uint8_t  add_stream,
uint16_t  adding_o,
uint16_t  adding_i,
uint8_t  peer_asked 
)

Definition at line 12070 of file sctp_output.c.

References sctp_stream_out::abandoned_sent, sctp_stream_out::abandoned_unsent, sctp_association::alternate, sctp_tcb::asoc, sctp_tmit_chunk::asoc, sctp_tmit_chunk::book_size, sctp_tmit_chunk::book_size_scale, chk_id::can_take_data, sctp_chunkhdr::chunk_flags, sctp_tmit_chunk::chunk_id, sctp_chunkhdr::chunk_length, sctp_chunkhdr::chunk_type, sctp_stream_out::chunks_on_queues, sctp_association::control_send_queue, sctp_tmit_chunk::copy_by_ref, sctp_association::ctrl_queue_cnt, sctp_tmit_chunk::data, sctp_tmit_chunk::flags, chk_id::id, sctp_stream_out::last_msg_incomplete, next, sctp_stream_out::next_mid_ordered, sctp_stream_out::next_mid_unordered, sctp_stream_out::outqueue, sctp_association::peer_req_out, sctp_association::primary_destination, sctp_tmit_chunk::rec, sctp_nets::ref_count, sctp_add_an_in_stream(), sctp_add_an_out_stream(), sctp_add_stream_reset_in(), sctp_add_stream_reset_out(), sctp_add_stream_reset_tsn(), sctp_alloc_a_chunk, SCTP_BUF_LEN, SCTP_BUF_RESV_UF, SCTP_DATAGRAM_UNSENT, sctp_tcb::sctp_ep, SCTP_FREE, sctp_free_a_chunk, SCTP_FROM_SCTP_OUTPUT, sctp_get_mbuf_for_msg(), SCTP_LTRACE_ERR_RET, SCTP_MALLOC, SCTP_MIN_OVERHEAD, SCTP_PR_SCTP_MAX, sctp_send_sack(), SCTP_SIZE32, SCTP_SO_LOCKED, sctp_ss_functions::sctp_ss_clear, sctp_ss_functions::sctp_ss_init, sctp_ss_functions::sctp_ss_init_stream, SCTP_STREAM_CLOSED, SCTP_STREAM_RESET, SCTP_TCB_SEND_LOCK, SCTP_TCB_SEND_UNLOCK, sctp_timer_start(), SCTP_TIMER_TYPE_STRRESET, sctp_association::send_sack, sctp_tmit_chunk::send_size, sctp_association::sending_seq, sctp_tmit_chunk::sent, sctp_stream_out::sid, sctp_tmit_chunk::snd_count, sctp_association::ss_functions, sctp_stream_out::state, sctp_association::str_reset, sctp_association::str_reset_seq_in, sctp_association::str_reset_seq_out, sctp_association::stream_reset_outstanding, sctp_association::streamoutcnt, sctp_association::strm_pending_add_size, sctp_association::strm_realoutsize, sctp_association::strmout, and sctp_tmit_chunk::whoTo.

Referenced by sctp_handle_str_reset_add_out_strm(), and sctp_setopt().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sctp_send_stream_reset_out_if_possible()

int sctp_send_stream_reset_out_if_possible ( struct sctp_tcb stcb,
int  so_locked 
)

◆ sctp_sendall()

◆ sctp_sendall_completes()

static void sctp_sendall_completes ( void *  ptr,
uint32_t val  SCTP_UNUSED 
)
static

Definition at line 6765 of file sctp_output.c.

References sctp_copy_all::inp, sctp_copy_all::m, sctp_inpcb::sctp_flags, SCTP_FREE, SCTP_INP_WLOCK, SCTP_INP_WUNLOCK, and sctp_m_freem.

Referenced by sctp_sendall().

Here is the caller graph for this function:

◆ sctp_sendall_iterator()

static void sctp_sendall_iterator ( struct sctp_inpcb inp,
struct sctp_tcb stcb,
void *  ptr,
uint32_t val  SCTP_UNUSED 
)
static

Definition at line 6582 of file sctp_output.c.

References sctp_association::alternate, sctp_tcb::asoc, sctp_copy_all::cnt_failed, sctp_copy_all::cnt_sent, sctp_copy_all::inp, sctp_copy_all::m, sctp_paramhdr::param_length, sctp_paramhdr::param_type, sctp_association::primary_destination, sctp_association::refcnt, SCTP_ABORT, sctp_abort_an_association(), SCTP_ADD_SUBSTATE, SCTP_BASE_SYSCTL, SCTP_BUF_LEN, SCTP_BUF_PREPEND, SCTP_CAUSE_USER_INITIATED_ABT, sctp_chunk_output(), SCTP_DATA_CHUNK_OVERHEAD, SCTP_DIAG_INFO_LEN, SCTP_EOF, sctp_tcb::sctp_ep, sctp_generate_cause(), sctp_get_frag_point(), sctp_get_mbuf_for_msg(), SCTP_GET_STATE, sctp_is_feature_off, sctp_is_there_unsent_data(), SCTP_M_COPYM, SCTP_MBUF_ICOPY, SCTP_MBUF_LOGGING_ENABLE, sctp_med_chunk_output(), SCTP_MIN_OVERHEAD, sctp_msg_append(), SCTP_OUTPUT_FROM_USR_SEND, SCTP_PCB_FLAGS_NODELAY, sctp_send_shutdown(), SCTP_SET_STATE, SCTP_SNPRINTF, SCTP_SO_NOT_LOCKED, sctp_ss_functions::sctp_ss_is_user_msgs_incomplete, SCTP_STAT_DECR_GAUGE32, SCTP_STATE_OPEN, SCTP_STATE_PARTIAL_MSG_LEFT, SCTP_STATE_SHUTDOWN_ACK_SENT, SCTP_STATE_SHUTDOWN_PENDING, SCTP_STATE_SHUTDOWN_RECEIVED, SCTP_STATE_SHUTDOWN_SENT, sctp_stop_timers_for_shutdown(), SCTP_TCB_LOCK, SCTP_TCB_LOCK_ASSERT, sctp_timer_start(), SCTP_TIMER_TYPE_SHUTDOWN, SCTP_TIMER_TYPE_SHUTDOWNGUARD, sctp_association::send_queue, sctp_association::sent_queue, sctp_sndrcvinfo::sinfo_flags, sctp_association::smallest_mtu, sctp_copy_all::sndlen, sctp_copy_all::sndrcv, sctp_association::ss_functions, sctp_association::state, sctp_association::stream_queue_cnt, sctp_association::total_flight, and sctp_association::total_output_queue_size.

Referenced by sctp_sendall().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sctp_set_prsctp_policy()

◆ sctp_sosend()

int sctp_sosend ( struct socket *  so,
struct sockaddr *  addr,
struct uio *  uio,
struct mbuf *  top,
struct mbuf *  control,
int  flags,
struct thread *  p 
)

Definition at line 12439 of file sctp_output.c.

References sctp_find_cmsg(), SCTP_FROM_SCTP_OUTPUT, sctp_lower_sosend(), SCTP_LTRACE_ERR_RET, and SCTP_SNDRCV.

Referenced by sctp_output().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sctp_source_address_selection()

struct sctp_ifa * sctp_source_address_selection ( struct sctp_inpcb inp,
struct sctp_tcb stcb,
sctp_route_t ro,
struct sctp_nets net,
int  non_asoc_addr_ok,
uint32_t  vrf_id 
)

Rules:

  • Find the route if needed, cache if I can.
  • Look at interface address in route, Is it in the bound list. If so we have the best source.
  • If not we must rotate amongst the addresses.

Cavets and issues

Do we need to pay attention to scope. We can have a private address or a global address we are sourcing or sending to. So if we draw it out zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz

For V4

source * dest * result

<a> Private * Global * NAT

<b> Private * Private * No problem

<c> Global * Private * Huh, How will this work?

<d> Global * Global * No Problem

zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz

For V6

source * dest * result

<a> Linklocal * Global *

<b> Linklocal * Linklocal * No problem

<c> Global * Linklocal * Huh, How will this work?

<d> Global * Global * No Problem

zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz

And then we add to that what happens if there are multiple addresses assigned to an interface. Remember the ifa on a ifn is a linked list of addresses. So one interface can have more than one IP address. What happens if we have both a private and a global address? Do we then use context of destination to sort out which one is best? And what about NAT's sending P->G may get you a NAT translation, or should you select the G thats on the interface in preference.

Decisions:

  • count the number of addresses on the interface.
  • if it is one, no problem except case . For we will assume a NAT out there.
  • if there are more than one, then we need to worry about scope P or G. We should prefer G -> G and P -> P if possible. Then as a secondary fall back to mixed types G->P being a last ditch one.
  • The above all works for bound all, but bound specific we need to use the same concept but instead only consider the bound addresses. If the bound set is NOT assigned to the interface then we must use rotation amongst the bound addresses..

Definition at line 3297 of file sctp_output.c.

References sctp_nets::addr_is_local, sctp_inpcb::fibnum, IN4_ISLOOPBACK_ADDRESS, IN4_ISPRIVATE_ADDRESS, sctp_choose_boundall(), sctp_choose_boundspecific_inp(), sctp_choose_boundspecific_stcb(), SCTP_DEBUG_OUTPUT2, sctp_inpcb::sctp_flags, SCTP_IPI_ADDR_RLOCK, SCTP_IPI_ADDR_RUNLOCK, SCTP_PCB_FLAGS_BOUNDALL, SCTP_ROUTE_IS_REAL_LOOP, SCTP_RTALLOC, SCTPDBG, SCTPDBG_ADDR, and sockaddr_in::sin_addr.

Referenced by sctp_add_remote_addr(), sctp_lowlevel_chunk_output(), sctp_pathmtu_timer(), and sctp_send_initiate_ack().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sctp_timer_validation()

static void sctp_timer_validation ( struct sctp_inpcb inp,
struct sctp_tcb stcb,
struct sctp_association asoc 
)
static

◆ sctp_toss_old_asconf()

◆ sctp_toss_old_cookies()

◆ sctp_v4src_match_nexthop()

int sctp_v4src_match_nexthop ( struct sctp_ifa sifa,
sctp_route_t ro 
)

◆ send_forward_tsn()

void send_forward_tsn ( struct sctp_tcb stcb,
struct sctp_association asoc 
)

Definition at line 10264 of file sctp_output.c.

References sctp_association::advanced_peer_ack_point, sctp_tmit_chunk::asoc, chk_id::can_take_data, sctp_forward_tsn_chunk::ch, sctp_chunkhdr::chunk_flags, sctp_tmit_chunk::chunk_id, sctp_chunkhdr::chunk_length, sctp_chunkhdr::chunk_type, sctp_association::control_send_queue, sctp_tmit_chunk::copy_by_ref, sctp_association::ctrl_queue_cnt, sctp_tmit_chunk::data, sctp_strseq_mid::flags, sctp_tmit_chunk::flags, sctp_data_chunkrec::fwd_tsn_cnt, sctp_association::fwd_tsn_cnt, chk_id::id, sctp_association::idata_supported, sctp_strseq_mid::mid, sctp_data_chunkrec::mid, sctp_forward_tsn_chunk::new_cumulative_tsn, PR_SCTP_UNORDERED_FLAG, sctp_data_chunkrec::rcv_flags, sctp_tmit_chunk::rec, sctp_alloc_a_chunk, SCTP_BASE_SYSCTL, SCTP_BUF_LEN, SCTP_BUF_RESV_UF, SCTP_DATA_UNORDERED, SCTP_DATAGRAM_NR_ACKED, SCTP_DATAGRAM_UNSENT, sctp_tcb::sctp_ep, sctp_inpcb::sctp_flags, SCTP_FORWARD_CUM_TSN, SCTP_FORWARD_TSN_SKIP, sctp_free_a_chunk, sctp_free_remote_addr, SCTP_FWD_TSN_CHECK, sctp_get_mbuf_for_msg(), SCTP_IFORWARD_CUM_TSN, SCTP_LOG_TRY_ADVANCE, SCTP_MIN_OVERHEAD, SCTP_MIN_V4_OVERHEAD, sctp_misc_ints(), SCTP_PCB_FLAGS_BOUND_V6, SCTP_SO_NOT_LOCKED, SCTP_TCB_LOCK_ASSERT, sctp_tmit_chunk::send_size, sctp_tmit_chunk::sent, sctp_association::sent_queue, sctp_strseq::sid, sctp_strseq_mid::sid, sctp_data_chunkrec::sid, sctp_association::smallest_mtu, sctp_tmit_chunk::snd_count, sctp_strseq::ssn, sctp_data_chunkrec::tsn, and sctp_tmit_chunk::whoTo.

Referenced by process_chunk_drop(), sctp_express_handle_sack(), sctp_handle_sack(), and sctp_t3rxt_timer().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ sack_array

const struct sack_track sack_array[256]

Definition at line 71 of file sctp_output.c.

Referenced by sctp_send_sack().