webkit
2cdf99a9e3038c7e01b3c37e8ad903ecbe5eecf1
https://github.com/WebKit/webkit
|
#include <netinet/sctp_os.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>
Classes | |
struct | sack_track |
Macros | |
#define | SCTP_MAX_GAPS_INARRAY 4 |
Functions | |
int | sctp_is_address_in_scope (struct sctp_ifa *ifa, struct sctp_scoping *scope, int do_update) |
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) |
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) |
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) |
void | sctp_send_initiate (struct sctp_inpcb *inp, struct sctp_tcb *stcb, int so_locked SCTP_UNUSED) |
struct mbuf * | sctp_arethere_unrecognized_parameters (struct mbuf *in_initpkt, int param_offset, int *abort_processing, struct sctp_chunkhdr *cp, int *nat_friendly) |
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, uint32_t vrf_id, uint16_t port, int hold_inp_lock) |
int | sctp_get_frag_point (struct sctp_tcb *stcb, struct sctp_association *asoc) |
void | sctp_toss_old_cookies (struct sctp_tcb *stcb, struct sctp_association *asoc) |
void | sctp_toss_old_asconf (struct sctp_tcb *stcb) |
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, 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) |
void | sctp_chunk_output (struct sctp_inpcb *inp, struct sctp_tcb *stcb, int from_where, int so_locked SCTP_UNUSED) |
int | sctp_output (struct sctp_inpcb *inp, struct mbuf *m, struct sockaddr *addr, struct mbuf *control, struct proc *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 SCTP_UNUSED) |
void | sctp_send_abort_tcb (struct sctp_tcb *stcb, struct mbuf *operr, int so_locked SCTP_UNUSED) |
void | sctp_send_shutdown_complete (struct sctp_tcb *stcb, struct sctp_nets *net, int reflect_vtag) |
void | sctp_send_shutdown_complete2 (struct sockaddr *src, struct sockaddr *dst, struct sctphdr *sh, uint32_t vrf_id, uint16_t port) |
void | sctp_send_hb (struct sctp_tcb *stcb, struct sctp_nets *net, int so_locked SCTP_UNUSED) |
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) |
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) |
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, 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, uint32_t vrf_id, uint16_t port) |
int | sctp_sosend (struct socket *so, struct sockaddr *addr, struct uio *uio, struct mbuf *top, struct mbuf *control, int flags, struct proc *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 proc *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) |
Variables | |
const struct sack_track | sack_array [256] |
#define SCTP_MAX_GAPS_INARRAY 4 |
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 | ||
) |
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 | ||
) |
void sctp_add_stream_reset_result | ( | struct sctp_tmit_chunk * | chk, |
uint32_t | resp_seq, | ||
uint32_t | result | ||
) |
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 | ||
) |
struct mbuf* sctp_arethere_unrecognized_parameters | ( | struct mbuf * | in_initpkt, |
int | param_offset, | ||
int * | abort_processing, | ||
struct sctp_chunkhdr * | cp, | ||
int * | nat_friendly | ||
) |
void sctp_chunk_output | ( | struct sctp_inpcb * | inp, |
struct sctp_tcb * | stcb, | ||
int | from_where, | ||
int so_locked | SCTP_UNUSED | ||
) |
void sctp_fix_ecn_echo | ( | struct sctp_association * | asoc | ) |
int sctp_get_frag_point | ( | struct sctp_tcb * | stcb, |
struct sctp_association * | asoc | ||
) |
int sctp_is_addr_in_ep | ( | struct sctp_inpcb * | inp, |
struct sctp_ifa * | ifa | ||
) |
int sctp_is_address_in_scope | ( | struct sctp_ifa * | ifa, |
struct sctp_scoping * | scope, | ||
int | do_update | ||
) |
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 proc * | p | ||
) |
Pre-screen address, if one is given the sin-len must be set correctly!
int sctp_output | ( | struct sctp_inpcb * | inp, |
struct mbuf * | m, | ||
struct sockaddr * | addr, | ||
struct mbuf * | control, | ||
struct proc * | p, | ||
int | flags | ||
) |
void sctp_send_abort | ( | struct mbuf * | m, |
int | iphlen, | ||
struct sockaddr * | src, | ||
struct sockaddr * | dst, | ||
struct sctphdr * | sh, | ||
uint32_t | vtag, | ||
struct mbuf * | cause, | ||
uint32_t | vrf_id, | ||
uint16_t | port | ||
) |
int sctp_send_cookie_echo | ( | struct mbuf * | m, |
int | offset, | ||
struct sctp_tcb * | stcb, | ||
struct sctp_nets * | net | ||
) |
void sctp_send_cwr | ( | struct sctp_tcb * | stcb, |
struct sctp_nets * | net, | ||
uint32_t | high_tsn, | ||
uint8_t | override | ||
) |
void sctp_send_deferred_reset_response | ( | struct sctp_tcb * | stcb, |
struct sctp_stream_reset_list * | ent, | ||
int | response | ||
) |
void sctp_send_heartbeat_ack | ( | struct sctp_tcb * | stcb, |
struct mbuf * | m, | ||
int | offset, | ||
int | chk_length, | ||
struct sctp_nets * | net | ||
) |
void sctp_send_initiate | ( | struct sctp_inpcb * | inp, |
struct sctp_tcb * | stcb, | ||
int so_locked | SCTP_UNUSED | ||
) |
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, | ||
uint32_t | vrf_id, | ||
uint16_t | port, | ||
int | hold_inp_lock | ||
) |
void sctp_send_operr_to | ( | struct sockaddr * | src, |
struct sockaddr * | dst, | ||
struct sctphdr * | sh, | ||
uint32_t | vtag, | ||
struct mbuf * | cause, | ||
uint32_t | vrf_id, | ||
uint16_t | port | ||
) |
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.
void sctp_send_shutdown_complete | ( | struct sctp_tcb * | stcb, |
struct sctp_nets * | net, | ||
int | reflect_vtag | ||
) |
void sctp_send_shutdown_complete2 | ( | struct sockaddr * | src, |
struct sockaddr * | dst, | ||
struct sctphdr * | sh, | ||
uint32_t | vrf_id, | ||
uint16_t | port | ||
) |
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 | ||
) |
int sctp_send_stream_reset_out_if_possible | ( | struct sctp_tcb * | stcb, |
int | so_locked | ||
) |
int sctp_sosend | ( | struct socket * | so, |
struct sockaddr * | addr, | ||
struct uio * | uio, | ||
struct mbuf * | top, | ||
struct mbuf * | control, | ||
int | flags, | ||
struct proc * | p | ||
) |
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:
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
Global * Private * Huh, How will this work?
zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
Global * Linklocal * Huh, How will this work?
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:
. 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..
void sctp_toss_old_cookies | ( | struct sctp_tcb * | stcb, |
struct sctp_association * | asoc | ||
) |
void send_forward_tsn | ( | struct sctp_tcb * | stcb, |
struct sctp_association * | asoc | ||
) |
const struct sack_track sack_array[256] |