- Sysctl's move to seperate file
- moved away from ifn/ifa access to sctp_ifa/sctp_ifn built and managed by the add-ip code. - cleaned up add-ip code to use the iterator - made iterator be a thread, which enables auto-asconf now. - rewrote and cleaned up source address selection (also made it use new structures). - Fixed a couple of memory leaks. - DACK now settable as to how many packets to delay as well as time. - connectx() to latest socket API, new associd arg. - Fixed issue with revoking and loosing potential to send when we inflate the flight size. We now inflate the cwnd too and deflate it later when the revoked chunk is sent or acked. - Got rid of some temp debug code - src addr selection moved to a common file (sctp_output.c) - Support for simple VRF's (we have support for multi-vfr via compile switch that is scrubbed from BSD but we won't need multi-vrf until we first get VRF :-D) - Rest of mib work for address information now done - Limit number of addresses in INIT/INIT-ACK to a #def (30). Reviewed by: gnn
This commit is contained in:
parent
e6a4641532
commit
42551e993f
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=167598
@ -164,13 +164,14 @@ sctp_getaddrlen(sa_family_t family)
|
||||
}
|
||||
|
||||
int
|
||||
sctp_connectx(int sd, const struct sockaddr *addrs, int addrcnt)
|
||||
sctp_connectx(int sd, const struct sockaddr *addrs, int addrcnt, sctp_assoc_t * id)
|
||||
{
|
||||
char buf[SCTP_STACK_BUF_SIZE];
|
||||
int i, ret, cnt, *aa;
|
||||
char *cpto;
|
||||
const struct sockaddr *at;
|
||||
size_t len = sizeof(int);
|
||||
sctp_assoc_t *p_id;
|
||||
|
||||
at = addrs;
|
||||
cnt = 0;
|
||||
@ -211,7 +212,11 @@ sctp_connectx(int sd, const struct sockaddr *addrs, int addrcnt)
|
||||
aa = (int *)buf;
|
||||
*aa = cnt;
|
||||
ret = setsockopt(sd, IPPROTO_SCTP, SCTP_CONNECT_X, (void *)buf,
|
||||
(socklen_t) len);
|
||||
(socklen_t)len);
|
||||
if ((ret == 0) && id) {
|
||||
p_id = (sctp_assoc_t *) buf;
|
||||
*id = *p_id;
|
||||
}
|
||||
return (ret);
|
||||
}
|
||||
|
||||
@ -300,7 +305,7 @@ sctp_getpaddrs(int sd, sctp_assoc_t id, struct sockaddr **raddrs)
|
||||
asoc = id;
|
||||
siz = sizeof(sctp_assoc_t);
|
||||
if (getsockopt(sd, IPPROTO_SCTP, SCTP_GET_REMOTE_ADDR_SIZE,
|
||||
&asoc, &siz) != 0) {
|
||||
&asoc, &siz) != 0) {
|
||||
errno = ENOMEM;
|
||||
return (-1);
|
||||
}
|
||||
@ -316,7 +321,7 @@ sctp_getpaddrs(int sd, sctp_assoc_t id, struct sockaddr **raddrs)
|
||||
addrs->sget_assoc_id = id;
|
||||
/* Now lets get the array of addresses */
|
||||
if (getsockopt(sd, IPPROTO_SCTP, SCTP_GET_PEER_ADDRESSES,
|
||||
addrs, &siz) != 0) {
|
||||
addrs, &siz) != 0) {
|
||||
free(addrs);
|
||||
errno = ENOMEM;
|
||||
return (-1);
|
||||
@ -333,7 +338,7 @@ sctp_getpaddrs(int sd, sctp_assoc_t id, struct sockaddr **raddrs)
|
||||
return (cnt);
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
sctp_freepaddrs(struct sockaddr *addrs)
|
||||
{
|
||||
/* Take away the hidden association id */
|
||||
@ -398,7 +403,7 @@ sctp_getladdrs(int sd, sctp_assoc_t id, struct sockaddr **raddrs)
|
||||
return (cnt);
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
sctp_freeladdrs(struct sockaddr *addrs)
|
||||
{
|
||||
/* Take away the hidden association id */
|
||||
|
@ -1786,6 +1786,7 @@ netinet/sctp_asconf.c optional inet inet6 sctp
|
||||
netinet/sctp_peeloff.c optional inet inet6 sctp
|
||||
netinet/sctp_crc32.c optional inet inet6 sctp
|
||||
netinet/sctp_auth.c optional inet inet6 sctp
|
||||
netinet/sctp_sysctl.c optional inet inet6 sctp
|
||||
netinet/tcp_debug.c optional tcpdebug
|
||||
netinet/tcp_hostcache.c optional inet
|
||||
netinet/tcp_input.c optional inet
|
||||
|
@ -157,7 +157,44 @@ struct sctp_paramhdr {
|
||||
#define SCTP_PCB_STATUS 0x00001105
|
||||
#define SCTP_GET_NONCE_VALUES 0x00001106
|
||||
|
||||
/* Special hook for dynamically setting primary for all assoc's,
|
||||
* this is a write only option that requires root privledge.
|
||||
*/
|
||||
#define SCTP_SET_DYNAMIC_PRIMARY 0x00002001
|
||||
|
||||
/* VRF (virtual router feature) and multi-VRF support
|
||||
* options. VRF's provide splits within a router
|
||||
* that give the views of multiple routers. A
|
||||
* standard host, without VRF support, is just
|
||||
* a single VRF. If VRF's are supported then
|
||||
* the transport must be VRF aware. This means
|
||||
* that every socket call coming in must be directed
|
||||
* within the endpoint to one of the VRF's it belongs
|
||||
* to. The endpoint, before binding, may select
|
||||
* the "default" VRF it is in by using a set socket
|
||||
* option with SCTP_VRF_ID. This will also
|
||||
* get propegated to the default VRF. Once the
|
||||
* endpoint binds an address then it CANNOT add
|
||||
* additional VRF's to become a Multi-VRF endpoint.
|
||||
*
|
||||
* Before BINDING additional VRF's can be added with
|
||||
* the SCTP_ADD_VRF_ID call or deleted with
|
||||
* SCTP_DEL_VRF_ID.
|
||||
*
|
||||
* Associations are ALWAYS contained inside a single
|
||||
* VRF. They cannot reside in two (or more) VRF's. Incoming
|
||||
* packets, assuming the router is VRF aware, can always
|
||||
* tell us what VRF they arrived on. A host not supporting
|
||||
* any VRF's will find that the packets always arrived on the
|
||||
* single VRF that the host has.
|
||||
*
|
||||
*/
|
||||
|
||||
#define SCTP_VRF_ID 0x00003001
|
||||
#define SCTP_ADD_VRF_ID 0x00003002
|
||||
#define SCTP_GET_VRF_IDS 0x00003003
|
||||
#define SCTP_GET_ASOC_VRF 0x00003004
|
||||
#define SCTP_DEL_VRF_ID 0x00003005
|
||||
/*
|
||||
* hidden implementation specific options these are NOT user visible (should
|
||||
* move out of sctp.h)
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -55,19 +55,21 @@ sctp_handle_asconf_ack(struct mbuf *, int,
|
||||
|
||||
extern uint32_t
|
||||
sctp_addr_mgmt_ep_sa(struct sctp_inpcb *, struct sockaddr *,
|
||||
uint16_t);
|
||||
uint32_t, uint32_t);
|
||||
|
||||
extern void sctp_add_ip_address(struct ifaddr *);
|
||||
|
||||
extern void sctp_delete_ip_address(struct ifaddr *);
|
||||
int sctp_iterator_ep(struct sctp_inpcb *inp, void *ptr, uint32_t val);
|
||||
void sctp_iterator_stcb(struct sctp_inpcb *inp, struct sctp_tcb *stcb, void *ptr, uint32_t type);
|
||||
int sctp_iterator_ep_end(struct sctp_inpcb *inp, void *ptr, uint32_t val);
|
||||
void sctp_iterator_end(void *ptr, uint32_t val);
|
||||
|
||||
extern void sctp_addr_change(struct ifaddr *ifa, int cmd);
|
||||
|
||||
extern int32_t
|
||||
sctp_set_primary_ip_address_sa(struct sctp_tcb *,
|
||||
struct sockaddr *);
|
||||
|
||||
extern void sctp_set_primary_ip_address(struct ifaddr *);
|
||||
extern void
|
||||
sctp_set_primary_ip_address(struct sctp_ifa *ifa);
|
||||
|
||||
extern void
|
||||
sctp_check_address_list(struct sctp_tcb *, struct mbuf *, int, int,
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*-
|
||||
* Copyright (c) 2001-2006, Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2001-2007, Cisco Systems, Inc. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@ -36,14 +36,13 @@ __FBSDID("$FreeBSD$");
|
||||
#include <netinet/sctp_header.h>
|
||||
#include <netinet/sctp_pcb.h>
|
||||
#include <netinet/sctp_var.h>
|
||||
#include <netinet/sctp_sysctl.h>
|
||||
#include <netinet/sctputil.h>
|
||||
#include <netinet/sctp_indata.h>
|
||||
#include <netinet/sctp_output.h>
|
||||
#include <netinet/sctp_auth.h>
|
||||
|
||||
#ifdef SCTP_DEBUG
|
||||
extern uint32_t sctp_debug_on;
|
||||
|
||||
#define SCTP_AUTH_DEBUG (sctp_debug_on & SCTP_DEBUG_AUTH1)
|
||||
#define SCTP_AUTH_DEBUG2 (sctp_debug_on & SCTP_DEBUG_AUTH2)
|
||||
#endif /* SCTP_DEBUG */
|
||||
@ -1935,7 +1934,7 @@ sctp_initialize_auth_params(struct sctp_inpcb *inp, struct sctp_tcb *stcb)
|
||||
{
|
||||
uint16_t chunks_len = 0;
|
||||
uint16_t hmacs_len = 0;
|
||||
uint16_t random_len = sctp_auth_random_len;
|
||||
uint16_t random_len = SCTP_AUTH_RANDOM_SIZE_DEFAULT;
|
||||
sctp_key_t *new_key;
|
||||
uint16_t keylen;
|
||||
|
||||
|
@ -98,17 +98,10 @@ typedef struct sctp_authinfo {
|
||||
} sctp_authinfo_t;
|
||||
|
||||
|
||||
/*
|
||||
* global variables
|
||||
*/
|
||||
extern uint32_t sctp_asconf_auth_nochk; /* sysctl to disable ASCONF auth chk */
|
||||
extern uint32_t sctp_auth_disable; /* sysctl for temp feature interop */
|
||||
extern uint32_t sctp_auth_random_len; /* sysctl */
|
||||
|
||||
/*
|
||||
* Macros
|
||||
*/
|
||||
|
||||
#define sctp_auth_is_required_chunk(chunk, list) ((list == NULL) ? (0) : (list->chunks[chunk] != 0))
|
||||
|
||||
/*
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -38,27 +38,18 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
#if defined(_KERNEL)
|
||||
|
||||
int sctp_is_addr_restricted(struct sctp_tcb *, struct sockaddr *);
|
||||
#if defined(SCTP_USE_THREAD_BASED_ITERATOR)
|
||||
void sctp_wakeup_iterator(void);
|
||||
|
||||
void sctp_startup_iterator(void);
|
||||
|
||||
#endif
|
||||
|
||||
void
|
||||
sctp_gather_internal_ifa_flags(struct sctp_ifa *ifa);
|
||||
|
||||
|
||||
struct in_addr
|
||||
sctp_ipv4_source_address_selection(struct sctp_inpcb *inp,
|
||||
struct sctp_tcb *stcb,
|
||||
struct route *ro, struct sctp_nets *net,
|
||||
int non_asoc_addr_ok);
|
||||
|
||||
struct in6_addr
|
||||
sctp_ipv6_source_address_selection(struct sctp_inpcb *,
|
||||
struct sctp_tcb *, struct route *,
|
||||
struct sctp_nets *, int);
|
||||
|
||||
|
||||
struct mbuf *
|
||||
sctp_add_addresses_to_i_ia(struct sctp_inpcb *inp,
|
||||
struct sctp_scoping *scope,
|
||||
struct mbuf *m_at,
|
||||
int cnt_inits_to);
|
||||
|
||||
extern void sctp_addr_change(struct ifaddr *ifa, int cmd);
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
@ -36,12 +36,55 @@ __FBSDID("$FreeBSD$");
|
||||
#ifndef __sctp_constants_h__
|
||||
#define __sctp_constants_h__
|
||||
|
||||
/* Number of packets to get before sack sent by default */
|
||||
#define SCTP_DEFAULT_SACK_FREQ 2
|
||||
|
||||
/* Address limit - This variable is calculated
|
||||
* based on an 1500 byte mtu. We take out 100 bytes
|
||||
* for the cookie, 40 bytes for a v6 header and 32
|
||||
* bytes for the init structure. A second init structure
|
||||
* for the init-ack and then finally a third one for the
|
||||
* imbedded init. This yeilds 100+40+(3 * 32) = 236 bytes.
|
||||
* This leaves 1264 bytes for addresses. Now whatever we
|
||||
* send in the INIT() we need to allow to get back in the
|
||||
* INIT-ACK plus all the values from INIT and INIT-ACK
|
||||
* listed in the cookie. Plus we need some overhead for
|
||||
* maybe copied parameters in the COOKIE. If we
|
||||
* allow 20 addresses, and each side has 20 V6 addresses
|
||||
* that will be 400 bytes. In the INIT-ACK we will
|
||||
* see the INIT-ACK 400 + 800 in the cookie. This leaves
|
||||
* 64 bytes slack for misc things in the cookie. Otherwise
|
||||
* we need to allow IP fragmentation.. which I believe
|
||||
* the INIT-ACK and COOKIE do, I don't think we do that
|
||||
* to the INIT though. So the max you could make this
|
||||
* value is 60 addresses.
|
||||
*/
|
||||
#define SCTP_ADDRESS_LIMIT 20
|
||||
|
||||
/* Number of addresses where we just skip the counting */
|
||||
#define SCTP_COUNT_LIMIT 40
|
||||
|
||||
/* Number of ticks to delay before running
|
||||
* iterator on an address change.
|
||||
*/
|
||||
#define SCTP_ADDRESS_TICK_DELAY 2
|
||||
|
||||
#define SCTP_VERSION_STRING "KAME-BSD 1.1"
|
||||
/* #define SCTP_AUDITING_ENABLED 1 used for debug/auditing */
|
||||
#define SCTP_AUDIT_SIZE 256
|
||||
#define SCTP_STAT_LOG_SIZE 80000
|
||||
|
||||
#define SCTP_USE_THREAD_BASED_ITERATOR 1
|
||||
|
||||
#define SCTP_KTRHEAD_NAME "sctp_iterator"
|
||||
#define SCTP_KTHREAD_PAGES 2
|
||||
|
||||
|
||||
/* If you support Multi-VRF how big to
|
||||
* make the initial array of VRF's to.
|
||||
*/
|
||||
#define SCTP_DEFAULT_VRF_SIZE 4
|
||||
|
||||
/* Places that CWND log can happen from */
|
||||
#define SCTP_CWND_LOG_FROM_FR 1
|
||||
#define SCTP_CWND_LOG_FROM_RTX 2
|
||||
@ -188,7 +231,11 @@ __FBSDID("$FreeBSD$");
|
||||
#define SCTP_SCALE_FOR_ADDR 2
|
||||
|
||||
/* default AUTO_ASCONF mode enable(1)/disable(0) value (sysctl) */
|
||||
#define SCTP_DEFAULT_AUTO_ASCONF 0
|
||||
#if defined (__APPLE__) && !defined(SCTP_APPLE_AUTO_ASCONF)
|
||||
#define SCTP_DEFAULT_AUTO_ASCONF 0
|
||||
#else
|
||||
#define SCTP_DEFAULT_AUTO_ASCONF 1
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Theshold for rwnd updates, we have to read (sb_hiwat >>
|
||||
@ -305,6 +352,7 @@ __FBSDID("$FreeBSD$");
|
||||
#define SCTP_OUTPUT_FROM_STRRST_REQ 12
|
||||
#define SCTP_OUTPUT_FROM_USR_RCVD 13
|
||||
#define SCTP_OUTPUT_FROM_COOKIE_ACK 14
|
||||
#define SCTP_OUTPUT_FROM_DRAIN 15
|
||||
/* SCTP chunk types are moved sctp.h for application (NAT, FW) use */
|
||||
|
||||
/* align to 32-bit sizes */
|
||||
@ -425,7 +473,7 @@ __FBSDID("$FreeBSD$");
|
||||
#define SCTP_ADDR_OUT_OF_SCOPE 0x080
|
||||
#define SCTP_ADDR_DOUBLE_SWITCH 0x100
|
||||
#define SCTP_ADDR_UNCONFIRMED 0x200
|
||||
|
||||
#define SCTP_ADDR_REQ_PRIMARY 0x400
|
||||
#define SCTP_REACHABLE_MASK 0x203
|
||||
|
||||
/* bound address types (e.g. valid address types to allow) */
|
||||
@ -551,11 +599,15 @@ __FBSDID("$FreeBSD$");
|
||||
*/
|
||||
#define SCTP_ASOC_MAX_CHUNKS_ON_QUEUE 512
|
||||
|
||||
#define MSEC_TO_TICKS(x) ((hz == 1000) ? x : (((x) * hz) / 1000))
|
||||
#define TICKS_TO_MSEC(x) ((hz == 1000) ? x : (((x) * 1000) / hz))
|
||||
/* The conversion from time to ticks and vice versa is done by rounding
|
||||
* upwards. This way we can test in the code the time to be positive and
|
||||
* know that this corresponds to a positive number of ticks.
|
||||
*/
|
||||
#define MSEC_TO_TICKS(x) ((hz == 1000) ? x : ((((x) * hz) + 999) / 1000))
|
||||
#define TICKS_TO_MSEC(x) ((hz == 1000) ? x : ((((x) * 1000) + (hz - 1)) / hz))
|
||||
|
||||
#define SEC_TO_TICKS(x) ((x) * hz)
|
||||
#define TICKS_TO_SEC(x) ((x) / hz)
|
||||
#define TICKS_TO_SEC(x) (((x) + (hz - 1)) / hz)
|
||||
|
||||
/*
|
||||
* Basically the minimum amount of time before I do a early FR. Making this
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*-
|
||||
* Copyright (c) 2001-2006, Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2001-2007, Cisco Systems, Inc. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@ -49,9 +49,12 @@ struct sctp_ipv4addr_param {
|
||||
uint32_t addr; /* IPV4 address */
|
||||
};
|
||||
|
||||
#define SCTP_V6_ADDR_BYTES 16
|
||||
|
||||
|
||||
struct sctp_ipv6addr_param {
|
||||
struct sctp_paramhdr ph;/* type=SCTP_IPV6_PARAM_TYPE, len=20 */
|
||||
uint8_t addr[16]; /* IPV6 address */
|
||||
uint8_t addr[SCTP_V6_ADDR_BYTES]; /* IPV6 address */
|
||||
};
|
||||
|
||||
/* Cookie Preservative */
|
||||
@ -60,16 +63,19 @@ struct sctp_cookie_perserve_param {
|
||||
uint32_t time; /* time in ms to extend cookie */
|
||||
};
|
||||
|
||||
#define SCTP_ARRAY_MIN_LEN 1
|
||||
|
||||
/* Host Name Address */
|
||||
struct sctp_host_name_param {
|
||||
struct sctp_paramhdr ph;/* type=SCTP_HOSTNAME_ADDRESS */
|
||||
char name[1]; /* host name */
|
||||
char name[SCTP_ARRAY_MIN_LEN]; /* host name */
|
||||
};
|
||||
|
||||
/* supported address type */
|
||||
struct sctp_supported_addr_param {
|
||||
struct sctp_paramhdr ph;/* type=SCTP_SUPPORTED_ADDRTYPE */
|
||||
uint16_t addr_type[1]; /* array of supported address types */
|
||||
uint16_t addr_type[SCTP_ARRAY_MIN_LEN]; /* array of supported address
|
||||
* types */
|
||||
};
|
||||
|
||||
/* ECN parameter */
|
||||
@ -157,18 +163,20 @@ struct sctp_init {
|
||||
/* optional param's follow */
|
||||
};
|
||||
|
||||
#define SCTP_IDENTIFICATION_SIZE 16
|
||||
#define SCTP_ADDRESS_SIZE 4
|
||||
/* state cookie header */
|
||||
struct sctp_state_cookie { /* this is our definition... */
|
||||
uint8_t identification[16]; /* id of who we are */
|
||||
uint8_t identification[SCTP_IDENTIFICATION_SIZE]; /* id of who we are */
|
||||
uint32_t cookie_life; /* life I will award this cookie */
|
||||
uint32_t tie_tag_my_vtag; /* my tag in old association */
|
||||
uint32_t tie_tag_peer_vtag; /* peers tag in old association */
|
||||
uint32_t peers_vtag; /* peers tag in INIT (for quick ref) */
|
||||
uint32_t my_vtag; /* my tag in INIT-ACK (for quick ref) */
|
||||
struct timeval time_entered; /* the time I built cookie */
|
||||
uint32_t address[4]; /* 4 ints/128 bits */
|
||||
uint32_t address[SCTP_ADDRESS_SIZE]; /* 4 ints/128 bits */
|
||||
uint32_t addr_type; /* address type */
|
||||
uint32_t laddress[4]; /* my local from address */
|
||||
uint32_t laddress[SCTP_ADDRESS_SIZE]; /* my local from address */
|
||||
uint32_t laddr_type; /* my local from address type */
|
||||
uint32_t scope_id; /* v6 scope id for link-locals */
|
||||
uint16_t peerport; /* port address of the peer in the INIT */
|
||||
@ -519,7 +527,7 @@ struct sctp_auth_invalid_hmac {
|
||||
* feel is worth it for now.
|
||||
*/
|
||||
#ifndef SCTP_MAX_OVERHEAD
|
||||
#ifdef AF_INET6
|
||||
#ifdef INET6
|
||||
#define SCTP_MAX_OVERHEAD (sizeof(struct sctp_data_chunk) + \
|
||||
sizeof(struct sctphdr) + \
|
||||
sizeof(struct sctp_ecne_chunk) + \
|
||||
@ -549,7 +557,7 @@ struct sctp_auth_invalid_hmac {
|
||||
#define SCTP_MIN_OVERHEAD (sizeof(struct ip) + \
|
||||
sizeof(struct sctphdr))
|
||||
|
||||
#endif /* AF_INET6 */
|
||||
#endif /* INET6 */
|
||||
#endif /* !SCTP_MAX_OVERHEAD */
|
||||
|
||||
#define SCTP_MED_V4_OVERHEAD (sizeof(struct sctp_data_chunk) + \
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*-
|
||||
* Copyright (c) 2001-2006, Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2001-2007, Cisco Systems, Inc. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
#include <netinet/sctp_os.h>
|
||||
#include <netinet/sctp_var.h>
|
||||
#include <netinet/sctp_sysctl.h>
|
||||
#include <netinet/sctp_pcb.h>
|
||||
#include <netinet/sctp_header.h>
|
||||
#include <netinet/sctputil.h>
|
||||
@ -45,11 +46,6 @@ __FBSDID("$FreeBSD$");
|
||||
#include <netinet/sctp_timer.h>
|
||||
|
||||
|
||||
#ifdef SCTP_DEBUG
|
||||
extern uint32_t sctp_debug_on;
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* NOTES: On the outbound side of things I need to check the sack timer to
|
||||
* see if I should generate a sack into the chunk queue (if I have data to
|
||||
@ -60,8 +56,6 @@ extern uint32_t sctp_debug_on;
|
||||
* the list.
|
||||
*/
|
||||
|
||||
extern int sctp_strict_sacks;
|
||||
|
||||
__inline void
|
||||
sctp_set_rwnd(struct sctp_tcb *stcb, struct sctp_association *asoc)
|
||||
{
|
||||
@ -1438,7 +1432,6 @@ sctp_does_tsn_belong_to_reasm(struct sctp_association *asoc,
|
||||
}
|
||||
|
||||
|
||||
extern unsigned int sctp_max_chunks_on_queue;
|
||||
static int
|
||||
sctp_process_a_data_chunk(struct sctp_tcb *stcb, struct sctp_association *asoc,
|
||||
struct mbuf **m, int offset, struct sctp_data_chunk *ch, int chk_length,
|
||||
@ -1505,15 +1498,7 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struct sctp_association *asoc,
|
||||
asoc->dup_tsns[asoc->numduptsns] = tsn;
|
||||
asoc->numduptsns++;
|
||||
}
|
||||
if (!SCTP_OS_TIMER_PENDING(&asoc->dack_timer.timer)) {
|
||||
/*
|
||||
* By starting the timer we assure that we WILL sack
|
||||
* at the end of the packet when sctp_sack_check
|
||||
* gets called.
|
||||
*/
|
||||
sctp_timer_start(SCTP_TIMER_TYPE_RECV, stcb->sctp_ep,
|
||||
stcb, NULL);
|
||||
}
|
||||
asoc->send_sack = 1;
|
||||
return (0);
|
||||
}
|
||||
/*
|
||||
@ -2382,19 +2367,18 @@ sctp_sack_check(struct sctp_tcb *stcb, int ok_to_sack, int was_a_gap, int *abort
|
||||
*/
|
||||
stcb->asoc.cmt_dac_pkts_rcvd++;
|
||||
|
||||
if ((stcb->asoc.first_ack_sent == 0) || /* First time we send a
|
||||
* sack */
|
||||
if ((stcb->asoc.send_sack == 1) || /* We need to send a
|
||||
* SACK */
|
||||
((was_a_gap) && (is_a_gap == 0)) || /* was a gap, but no
|
||||
* longer is one */
|
||||
(stcb->asoc.numduptsns) || /* we have dup's */
|
||||
(is_a_gap) || /* is still a gap */
|
||||
(stcb->asoc.delayed_ack == 0) ||
|
||||
(SCTP_OS_TIMER_PENDING(&stcb->asoc.dack_timer.timer)) /* timer was up . second
|
||||
* packet */
|
||||
(stcb->asoc.delayed_ack == 0) || /* Delayed sack disabled */
|
||||
(stcb->asoc.data_pkts_seen >= stcb->asoc.sack_freq) /* hit limit of pkts */
|
||||
) {
|
||||
|
||||
if ((sctp_cmt_on_off) && (sctp_cmt_use_dac) &&
|
||||
(stcb->asoc.first_ack_sent == 1) &&
|
||||
(stcb->asoc.send_sack == 0) &&
|
||||
(stcb->asoc.numduptsns == 0) &&
|
||||
(stcb->asoc.delayed_ack) &&
|
||||
(!SCTP_OS_TIMER_PENDING(&stcb->asoc.dack_timer.timer))) {
|
||||
@ -2420,13 +2404,14 @@ sctp_sack_check(struct sctp_tcb *stcb, int ok_to_sack, int was_a_gap, int *abort
|
||||
* first packet OR there are gaps or
|
||||
* duplicates.
|
||||
*/
|
||||
stcb->asoc.first_ack_sent = 1;
|
||||
SCTP_OS_TIMER_STOP(&stcb->asoc.dack_timer.timer);
|
||||
sctp_send_sack(stcb);
|
||||
}
|
||||
} else {
|
||||
sctp_timer_start(SCTP_TIMER_TYPE_RECV,
|
||||
stcb->sctp_ep, stcb, NULL);
|
||||
if (!SCTP_OS_TIMER_PENDING(&stcb->asoc.dack_timer.timer)) {
|
||||
sctp_timer_start(SCTP_TIMER_TYPE_RECV,
|
||||
stcb->sctp_ep, stcb, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2488,8 +2473,6 @@ sctp_service_queues(struct sctp_tcb *stcb, struct sctp_association *asoc)
|
||||
}
|
||||
}
|
||||
|
||||
extern int sctp_strict_data_order;
|
||||
|
||||
int
|
||||
sctp_process_data(struct mbuf **mm, int iphlen, int *offset, int length,
|
||||
struct sctphdr *sh, struct sctp_inpcb *inp, struct sctp_tcb *stcb,
|
||||
@ -2573,6 +2556,7 @@ sctp_process_data(struct mbuf **mm, int iphlen, int *offset, int length,
|
||||
*/
|
||||
*high_tsn = asoc->cumulative_tsn;
|
||||
break_flag = 0;
|
||||
asoc->data_pkts_seen++;
|
||||
while (stop_proc == 0) {
|
||||
/* validate chunk length */
|
||||
chk_length = ntohs(ch->ch.chunk_length);
|
||||
@ -2753,26 +2737,21 @@ sctp_process_data(struct mbuf **mm, int iphlen, int *offset, int length,
|
||||
sctp_service_queues(stcb, asoc);
|
||||
|
||||
if (SCTP_GET_STATE(asoc) == SCTP_STATE_SHUTDOWN_SENT) {
|
||||
/*
|
||||
* Assure that we ack right away by making sure that a d-ack
|
||||
* timer is running. So the sack_check will send a sack.
|
||||
*/
|
||||
sctp_timer_start(SCTP_TIMER_TYPE_RECV, stcb->sctp_ep, stcb,
|
||||
net);
|
||||
/* Assure that we ack right away */
|
||||
stcb->asoc.send_sack = 1;
|
||||
}
|
||||
/* Start a sack timer or QUEUE a SACK for sending */
|
||||
if ((stcb->asoc.cumulative_tsn == stcb->asoc.highest_tsn_inside_map) &&
|
||||
(stcb->asoc.first_ack_sent)) {
|
||||
/* Everything is in order */
|
||||
if (stcb->asoc.mapping_array[0] == 0xff) {
|
||||
/* need to do the slide */
|
||||
sctp_sack_check(stcb, 1, was_a_gap, &abort_flag);
|
||||
} else {
|
||||
(stcb->asoc.mapping_array[0] != 0xff)) {
|
||||
if ((stcb->asoc.data_pkts_seen >= stcb->asoc.sack_freq) ||
|
||||
(stcb->asoc.delayed_ack == 0) ||
|
||||
(stcb->asoc.send_sack == 1)) {
|
||||
if (SCTP_OS_TIMER_PENDING(&stcb->asoc.dack_timer.timer)) {
|
||||
stcb->asoc.first_ack_sent = 1;
|
||||
SCTP_OS_TIMER_STOP(&stcb->asoc.dack_timer.timer);
|
||||
sctp_send_sack(stcb);
|
||||
} else {
|
||||
}
|
||||
sctp_send_sack(stcb);
|
||||
} else {
|
||||
if (!SCTP_OS_TIMER_PENDING(&stcb->asoc.dack_timer.timer)) {
|
||||
sctp_timer_start(SCTP_TIMER_TYPE_RECV,
|
||||
stcb->sctp_ep, stcb, NULL);
|
||||
}
|
||||
@ -3016,6 +2995,7 @@ sctp_handle_segments(struct sctp_tcb *stcb, struct sctp_association *asoc,
|
||||
tp1->whoTo->flight_size -= tp1->book_size;
|
||||
else
|
||||
tp1->whoTo->flight_size = 0;
|
||||
|
||||
if (asoc->total_flight >= tp1->book_size) {
|
||||
asoc->total_flight -= tp1->book_size;
|
||||
if (asoc->total_flight_count > 0)
|
||||
@ -3069,6 +3049,11 @@ sctp_handle_segments(struct sctp_tcb *stcb, struct sctp_association *asoc,
|
||||
(*ecn_seg_sums) &= SCTP_SACK_NONCE_SUM;
|
||||
|
||||
tp1->sent = SCTP_DATAGRAM_MARKED;
|
||||
if (tp1->rec.data.chunk_was_revoked) {
|
||||
/* deflate the cwnd */
|
||||
tp1->whoTo->cwnd -= tp1->book_size;
|
||||
tp1->rec.data.chunk_was_revoked = 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
} /* if (tp1->TSN_seq == j) */
|
||||
@ -3108,43 +3093,30 @@ sctp_check_for_revoked(struct sctp_association *asoc, uint32_t cumack,
|
||||
*/
|
||||
if (tp1->sent == SCTP_DATAGRAM_ACKED) {
|
||||
/* it has been revoked */
|
||||
tp1->sent = SCTP_DATAGRAM_SENT;
|
||||
tp1->rec.data.chunk_was_revoked = 1;
|
||||
/*
|
||||
* We must add this stuff back in to assure
|
||||
* timers and such get started.
|
||||
*/
|
||||
tp1->whoTo->flight_size += tp1->book_size;
|
||||
/*
|
||||
* We inflate the cwnd to compensate for our
|
||||
* artificial inflation of the flight_size.
|
||||
*/
|
||||
tp1->whoTo->cwnd += tp1->book_size;
|
||||
asoc->total_flight_count++;
|
||||
asoc->total_flight += tp1->book_size;
|
||||
|
||||
if (sctp_cmt_on_off) {
|
||||
/*
|
||||
* If CMT is ON, leave "sent" at
|
||||
* ACKED. CMT causes reordering of
|
||||
* data and acks (received on
|
||||
* different interfaces) can be
|
||||
* persistently reordered. Acking
|
||||
* followed by apparent revoking and
|
||||
* re-acking causes unexpected weird
|
||||
* behavior. So, at this time, CMT
|
||||
* does not respect renegs. Renegs
|
||||
* cannot be recovered. I will fix
|
||||
* this once I am sure that things
|
||||
* are working right again with CMT.
|
||||
*/
|
||||
} else {
|
||||
tp1->sent = SCTP_DATAGRAM_SENT;
|
||||
tp1->rec.data.chunk_was_revoked = 1;
|
||||
/*
|
||||
* We must add this stuff back in to
|
||||
* assure timers and such get
|
||||
* started.
|
||||
*/
|
||||
tp1->whoTo->flight_size += tp1->book_size;
|
||||
asoc->total_flight_count++;
|
||||
asoc->total_flight += tp1->book_size;
|
||||
tot_revoked++;
|
||||
tot_revoked++;
|
||||
#ifdef SCTP_SACK_LOGGING
|
||||
sctp_log_sack(asoc->last_acked_seq,
|
||||
cumack,
|
||||
tp1->rec.data.TSN_seq,
|
||||
0,
|
||||
0,
|
||||
SCTP_LOG_TSN_REVOKED);
|
||||
sctp_log_sack(asoc->last_acked_seq,
|
||||
cumack,
|
||||
tp1->rec.data.TSN_seq,
|
||||
0,
|
||||
0,
|
||||
SCTP_LOG_TSN_REVOKED);
|
||||
#endif
|
||||
}
|
||||
} else if (tp1->sent == SCTP_DATAGRAM_MARKED) {
|
||||
/* it has been re-acked in this SACK */
|
||||
tp1->sent = SCTP_DATAGRAM_ACKED;
|
||||
@ -3173,8 +3145,6 @@ sctp_check_for_revoked(struct sctp_association *asoc, uint32_t cumack,
|
||||
}
|
||||
}
|
||||
|
||||
extern int sctp_peer_chunk_oh;
|
||||
|
||||
static void
|
||||
sctp_strike_gap_ack_chunks(struct sctp_tcb *stcb, struct sctp_association *asoc,
|
||||
u_long biggest_tsn_acked, u_long biggest_tsn_newly_acked, u_long this_sack_lowest_newack, int accum_moved)
|
||||
@ -3301,9 +3271,11 @@ sctp_strike_gap_ack_chunks(struct sctp_tcb *stcb, struct sctp_association *asoc,
|
||||
* the tsn... otherwise we CAN strike the TSN.
|
||||
*/
|
||||
/*
|
||||
* @@@ JRI: Check for CMT
|
||||
* @@@ JRI: Check for CMT if (accum_moved &&
|
||||
* asoc->fast_retran_loss_recovery && (sctp_cmt_on_off ==
|
||||
* 0)) {
|
||||
*/
|
||||
if (accum_moved && asoc->fast_retran_loss_recovery && (sctp_cmt_on_off == 0)) {
|
||||
if (accum_moved && asoc->fast_retran_loss_recovery) {
|
||||
/*
|
||||
* Strike the TSN if in fast-recovery and cum-ack
|
||||
* moved.
|
||||
@ -3400,8 +3372,8 @@ sctp_strike_gap_ack_chunks(struct sctp_tcb *stcb, struct sctp_association *asoc,
|
||||
}
|
||||
}
|
||||
/*
|
||||
* @@@ JRI: TODO: remove code for HTNA algo. CMT's
|
||||
* SFR algo covers HTNA.
|
||||
* JRI: TODO: remove code for HTNA algo. CMT's SFR
|
||||
* algo covers HTNA.
|
||||
*/
|
||||
} else if (compare_with_wrap(tp1->rec.data.TSN_seq,
|
||||
biggest_tsn_newly_acked, MAX_TSN)) {
|
||||
@ -3462,7 +3434,6 @@ sctp_strike_gap_ack_chunks(struct sctp_tcb *stcb, struct sctp_association *asoc,
|
||||
* CMT: Using RTX_SSTHRESH policy for CMT.
|
||||
* If CMT is being used, then pick dest with
|
||||
* largest ssthresh for any retransmission.
|
||||
* (iyengar@cis.udel.edu, 2005/08/12)
|
||||
*/
|
||||
tp1->no_fr_allowed = 1;
|
||||
alt = tp1->whoTo;
|
||||
@ -3863,9 +3834,6 @@ sctp_hs_cwnd_decrease(struct sctp_tcb *stcb, struct sctp_nets *net)
|
||||
|
||||
#endif
|
||||
|
||||
extern int sctp_early_fr;
|
||||
extern int sctp_L2_abc_variable;
|
||||
|
||||
|
||||
static __inline void
|
||||
sctp_cwnd_update(struct sctp_tcb *stcb,
|
||||
@ -3878,7 +3846,8 @@ sctp_cwnd_update(struct sctp_tcb *stcb,
|
||||
/* update cwnd and Early FR */
|
||||
/******************************/
|
||||
TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
|
||||
#ifdef JANA_CODE_WHY_THIS
|
||||
|
||||
#ifdef JANA_CMT_FAST_RECOVERY
|
||||
/*
|
||||
* CMT fast recovery code. Need to debug.
|
||||
*/
|
||||
@ -3952,22 +3921,26 @@ sctp_cwnd_update(struct sctp_tcb *stcb,
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef JANA_CODE_WHY_THIS
|
||||
#ifdef JANA_CMT_FAST_RECOVERY
|
||||
/*
|
||||
* Cannot skip for CMT. Need to come back and check these
|
||||
* variables for CMT. CMT fast recovery code. Need to debug.
|
||||
* CMT fast recovery code
|
||||
*/
|
||||
/*
|
||||
* if (sctp_cmt_on_off == 1 &&
|
||||
* net->fast_retran_loss_recovery &&
|
||||
* net->will_exit_fast_recovery == 0) { // @@@ Do something
|
||||
* } else if (sctp_cmt_on_off == 0 &&
|
||||
* asoc->fast_retran_loss_recovery && will_exit == 0) {
|
||||
*/
|
||||
if (sctp_cmt_on_off == 1 &&
|
||||
net->fast_retran_loss_recovery &&
|
||||
net->will_exit_fast_recovery == 0)
|
||||
#endif
|
||||
if (sctp_cmt_on_off == 0 && asoc->fast_retran_loss_recovery && will_exit == 0) {
|
||||
/*
|
||||
* If we are in loss recovery we skip any
|
||||
* cwnd update
|
||||
*/
|
||||
goto skip_cwnd_update;
|
||||
}
|
||||
|
||||
if (asoc->fast_retran_loss_recovery && will_exit == 0) {
|
||||
/*
|
||||
* If we are in loss recovery we skip any cwnd
|
||||
* update
|
||||
*/
|
||||
goto skip_cwnd_update;
|
||||
}
|
||||
/*
|
||||
* CMT: CUC algorithm. Update cwnd if pseudo-cumack has
|
||||
* moved.
|
||||
@ -4172,6 +4145,7 @@ sctp_express_handle_sack(struct sctp_tcb *stcb, uint32_t cumack,
|
||||
} else {
|
||||
tp1->whoTo->flight_size = 0;
|
||||
}
|
||||
|
||||
if (asoc->total_flight >= tp1->book_size) {
|
||||
asoc->total_flight -= tp1->book_size;
|
||||
if (asoc->total_flight_count > 0)
|
||||
@ -4206,6 +4180,11 @@ sctp_express_handle_sack(struct sctp_tcb *stcb, uint32_t cumack,
|
||||
if (tp1->sent == SCTP_DATAGRAM_RESEND) {
|
||||
sctp_ucount_decr(asoc->sent_queue_retran_cnt);
|
||||
}
|
||||
if (tp1->rec.data.chunk_was_revoked) {
|
||||
/* deflate the cwnd */
|
||||
tp1->whoTo->cwnd -= tp1->book_size;
|
||||
tp1->rec.data.chunk_was_revoked = 0;
|
||||
}
|
||||
tp1->sent = SCTP_DATAGRAM_ACKED;
|
||||
}
|
||||
} else {
|
||||
@ -4657,7 +4636,8 @@ sctp_handle_sack(struct sctp_sack_chunk *ch, struct sctp_tcb *stcb,
|
||||
net->net_ack2 = 0;
|
||||
|
||||
/*
|
||||
* CMT: Reset CUC algo variable before SACK processing
|
||||
* CMT: Reset CUC and Fast recovery algo variables before
|
||||
* SACK processing
|
||||
*/
|
||||
net->new_pseudo_cumack = 0;
|
||||
net->will_exit_fast_recovery = 0;
|
||||
@ -4775,6 +4755,11 @@ sctp_handle_sack(struct sctp_sack_chunk *ch, struct sctp_tcb *stcb,
|
||||
(asoc->sent_queue_retran_cnt & 0x000000ff));
|
||||
#endif
|
||||
}
|
||||
if (tp1->rec.data.chunk_was_revoked) {
|
||||
/* deflate the cwnd */
|
||||
tp1->whoTo->cwnd -= tp1->book_size;
|
||||
tp1->rec.data.chunk_was_revoked = 0;
|
||||
}
|
||||
tp1->sent = SCTP_DATAGRAM_ACKED;
|
||||
}
|
||||
} else {
|
||||
@ -4919,7 +4904,7 @@ sctp_handle_sack(struct sctp_sack_chunk *ch, struct sctp_tcb *stcb,
|
||||
#endif
|
||||
}
|
||||
|
||||
if ((sctp_cmt_on_off == 0) && asoc->fast_retran_loss_recovery && accum_moved) {
|
||||
if (asoc->fast_retran_loss_recovery && accum_moved) {
|
||||
if (compare_with_wrap(asoc->last_acked_seq,
|
||||
asoc->fast_recovery_tsn, MAX_TSN) ||
|
||||
asoc->last_acked_seq == asoc->fast_recovery_tsn) {
|
||||
@ -4951,6 +4936,14 @@ sctp_handle_sack(struct sctp_sack_chunk *ch, struct sctp_tcb *stcb,
|
||||
tp1->sent = SCTP_DATAGRAM_SENT;
|
||||
tp1->rec.data.chunk_was_revoked = 1;
|
||||
tp1->whoTo->flight_size += tp1->book_size;
|
||||
/*
|
||||
* To ensure that this increase in
|
||||
* flightsize, which is artificial,
|
||||
* does not throttle the sender, we
|
||||
* also increase the cwnd
|
||||
* artificially.
|
||||
*/
|
||||
tp1->whoTo->cwnd += tp1->book_size;
|
||||
asoc->total_flight_count++;
|
||||
asoc->total_flight += tp1->book_size;
|
||||
cnt_revoked++;
|
||||
@ -5139,10 +5132,12 @@ sctp_handle_sack(struct sctp_sack_chunk *ch, struct sctp_tcb *stcb,
|
||||
}
|
||||
/*
|
||||
* CMT fast recovery code. Need to debug. ((sctp_cmt_on_off == 1) &&
|
||||
* (net->fast_retran_loss_recovery == 0)))
|
||||
* (net->fast_retran_loss_recovery == 0))) if
|
||||
* ((asoc->fast_retran_loss_recovery == 0) || (sctp_cmt_on_off ==
|
||||
* 1)) {
|
||||
*/
|
||||
TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
|
||||
if ((asoc->fast_retran_loss_recovery == 0) || (sctp_cmt_on_off == 1)) {
|
||||
if (asoc->fast_retran_loss_recovery == 0) {
|
||||
/* out of a RFC2582 Fast recovery window? */
|
||||
if (net->net_ack > 0) {
|
||||
/*
|
||||
@ -5287,6 +5282,9 @@ sctp_handle_sack(struct sctp_sack_chunk *ch, struct sctp_tcb *stcb,
|
||||
/* end satellite t3 loss recovery */
|
||||
asoc->sat_t3_loss_recovery = 0;
|
||||
}
|
||||
/*
|
||||
* CMT Fast recovery
|
||||
*/
|
||||
TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
|
||||
if (net->will_exit_fast_recovery) {
|
||||
/* Ok, we must exit fast recovery */
|
||||
|
@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
#include <netinet/sctp_os.h>
|
||||
#include <netinet/sctp_var.h>
|
||||
#include <netinet/sctp_sysctl.h>
|
||||
#include <netinet/sctp_pcb.h>
|
||||
#include <netinet/sctp_header.h>
|
||||
#include <netinet/sctputil.h>
|
||||
@ -45,15 +46,6 @@ __FBSDID("$FreeBSD$");
|
||||
#include <netinet/sctp_asconf.h>
|
||||
|
||||
|
||||
#ifdef SCTP_DEBUG
|
||||
extern uint32_t sctp_debug_on;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
struct sctp_foo_stuff sctp_logoff[30000];
|
||||
int sctp_logoff_stuff = 0;
|
||||
|
||||
|
||||
static void
|
||||
@ -476,6 +468,22 @@ sctp_handle_heartbeat_ack(struct sctp_heartbeat_chunk *cp,
|
||||
* confirm the destination.
|
||||
*/
|
||||
r_net->dest_state &= ~SCTP_ADDR_UNCONFIRMED;
|
||||
if (r_net->dest_state & SCTP_ADDR_REQ_PRIMARY) {
|
||||
stcb->asoc.primary_destination = r_net;
|
||||
r_net->dest_state &= ~SCTP_ADDR_WAS_PRIMARY;
|
||||
r_net->dest_state &= ~SCTP_ADDR_REQ_PRIMARY;
|
||||
r_net = TAILQ_FIRST(&stcb->asoc.nets);
|
||||
if (r_net != stcb->asoc.primary_destination) {
|
||||
/*
|
||||
* first one on the list is NOT the primary
|
||||
* sctp_cmpaddr() is much more efficent if
|
||||
* the primary is the first on the list,
|
||||
* make it so.
|
||||
*/
|
||||
TAILQ_REMOVE(&stcb->asoc.nets, stcb->asoc.primary_destination, sctp_next);
|
||||
TAILQ_INSERT_HEAD(&stcb->asoc.nets, stcb->asoc.primary_destination, sctp_next);
|
||||
}
|
||||
}
|
||||
sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_CONFIRMED,
|
||||
stcb, 0, (void *)r_net);
|
||||
}
|
||||
@ -1528,6 +1536,7 @@ sctp_process_cookie_new(struct mbuf *m, int iphlen, int offset,
|
||||
struct sockaddr_in *sin;
|
||||
struct sockaddr_in6 *sin6;
|
||||
struct sctp_association *asoc;
|
||||
uint32_t vrf;
|
||||
int chk_length;
|
||||
int init_offset, initack_offset, initack_limit;
|
||||
int retval;
|
||||
@ -1535,6 +1544,8 @@ sctp_process_cookie_new(struct mbuf *m, int iphlen, int offset,
|
||||
uint32_t old_tag;
|
||||
uint8_t auth_chunk_buf[SCTP_PARAM_BUFFER_SIZE];
|
||||
|
||||
vrf = SCTP_DEFAULT_VRFID;
|
||||
|
||||
/*
|
||||
* find and validate the INIT chunk in the cookie (peer's info) the
|
||||
* INIT should start after the cookie-echo header struct (chunk
|
||||
@ -1596,7 +1607,7 @@ sctp_process_cookie_new(struct mbuf *m, int iphlen, int offset,
|
||||
* and popluate
|
||||
*/
|
||||
stcb = sctp_aloc_assoc(inp, init_src, 0, &error,
|
||||
ntohl(initack_cp->init.initiate_tag));
|
||||
ntohl(initack_cp->init.initiate_tag), vrf);
|
||||
if (stcb == NULL) {
|
||||
struct mbuf *op_err;
|
||||
|
||||
@ -3498,9 +3509,6 @@ sctp_handle_packet_dropped(struct sctp_pktdrop_chunk *cp,
|
||||
}
|
||||
}
|
||||
|
||||
extern int sctp_strict_init;
|
||||
extern int sctp_abort_if_one_2_one_hits_limit;
|
||||
|
||||
/*
|
||||
* handles all control chunks in a packet inputs: - m: mbuf chain, assumed to
|
||||
* still contain IP/SCTP header - stcb: is the tcb found for this packet -
|
||||
@ -4662,11 +4670,6 @@ sctp_common_input_processing(struct mbuf **mm, int iphlen, int offset,
|
||||
return (0);
|
||||
}
|
||||
|
||||
extern int sctp_no_csum_on_loopback;
|
||||
|
||||
|
||||
int sctp_buf_index = 0;
|
||||
uint8_t sctp_list_of_chunks[30000];
|
||||
|
||||
|
||||
void
|
||||
@ -4799,16 +4802,6 @@ sctp_input(i_pak, off)
|
||||
if (mlen < (ip->ip_len - iphlen)) {
|
||||
SCTP_STAT_INCR(sctps_hdrops);
|
||||
goto bad;
|
||||
} {
|
||||
/* TEMP log the first chunk */
|
||||
int x;
|
||||
|
||||
x = atomic_fetchadd_int(&sctp_buf_index, 1);
|
||||
if (x >= 30000) {
|
||||
sctp_buf_index = 1;
|
||||
x = 0;;
|
||||
}
|
||||
sctp_list_of_chunks[x] = ch->chunk_type;
|
||||
}
|
||||
/*
|
||||
* Locate pcb and tcb for datagram sctp_findassociation_addr() wants
|
||||
|
@ -106,9 +106,8 @@ extern int sctp_logoff_stuff;
|
||||
} while (0)
|
||||
|
||||
|
||||
|
||||
#define SCTP_IPI_ADDR_INIT() \
|
||||
mtx_init(&sctppcbinfo.ipi_addr_mtx, "sctp-addr-wq", "sctp_addr_wq", MTX_DEF)
|
||||
mtx_init(&sctppcbinfo.ipi_addr_mtx, "sctp-addr", "sctp_addr", MTX_DEF)
|
||||
|
||||
#define SCTP_IPI_ADDR_DESTROY() \
|
||||
mtx_destroy(&sctppcbinfo.ipi_addr_mtx)
|
||||
@ -119,6 +118,24 @@ extern int sctp_logoff_stuff;
|
||||
|
||||
#define SCTP_IPI_ADDR_UNLOCK() mtx_unlock(&sctppcbinfo.ipi_addr_mtx)
|
||||
|
||||
|
||||
|
||||
#define SCTP_IPI_ITERATOR_WQ_INIT() \
|
||||
mtx_init(&sctppcbinfo.ipi_iterator_wq_mtx, "sctp-it-wq", "sctp_it_wq", MTX_DEF)
|
||||
|
||||
#define SCTP_IPI_ITERATOR_WQ_DESTROY() \
|
||||
mtx_destroy(&sctppcbinfo.ipi_iterator_wq_mtx)
|
||||
|
||||
#define SCTP_IPI_ITERATOR_WQ_LOCK() do { \
|
||||
mtx_lock(&sctppcbinfo.ipi_iterator_wq_mtx); \
|
||||
} while (0)
|
||||
|
||||
#define SCTP_IPI_ITERATOR_WQ_UNLOCK() mtx_unlock(&sctppcbinfo.ipi_iterator_wq_mtx)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#define SCTP_INP_INFO_RUNLOCK() mtx_unlock(&sctppcbinfo.ipi_ep_mtx)
|
||||
#define SCTP_INP_INFO_WUNLOCK() mtx_unlock(&sctppcbinfo.ipi_ep_mtx)
|
||||
|
||||
@ -190,36 +207,9 @@ extern int sctp_logoff_stuff;
|
||||
|
||||
#define SCTP_TCB_SEND_UNLOCK(_tcb) mtx_unlock(&(_tcb)->tcb_send_mtx)
|
||||
|
||||
#ifdef INVARIANTS
|
||||
|
||||
#define SCTP_INP_INCR_REF(_inp) { int x; \
|
||||
atomic_add_int(&((_inp)->refcount), 1); \
|
||||
x = atomic_fetchadd_int(&sctp_logoff_stuff, 1); \
|
||||
if(x == 30000) \
|
||||
sctp_logoff_stuff = x = 0; \
|
||||
sctp_logoff[x].inp = _inp; \
|
||||
sctp_logoff[x].ticks = ticks; \
|
||||
sctp_logoff[x].lineno = __LINE__; \
|
||||
sctp_logoff[x].updown = 1; \
|
||||
}
|
||||
|
||||
#define SCTP_INP_DECR_REF(_inp) { int x; \
|
||||
if (atomic_fetchadd_int(&((_inp)->refcount), -1) == 0 ) panic("refcount goes negative"); \
|
||||
x = atomic_fetchadd_int(&sctp_logoff_stuff, 1); \
|
||||
if(x == 30000) \
|
||||
sctp_logoff_stuff = x = 0; \
|
||||
sctp_logoff[x].inp = _inp; \
|
||||
sctp_logoff[x].ticks = ticks; \
|
||||
sctp_logoff[x].lineno = __LINE__; \
|
||||
sctp_logoff[x].updown = 0; \
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#define SCTP_INP_INCR_REF(_inp) atomic_add_int(&((_inp)->refcount), 1)
|
||||
#define SCTP_INP_DECR_REF(_inp) atomic_add_int(&((_inp)->refcount), -1)
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef SCTP_LOCK_LOGGING
|
||||
#define SCTP_ASOC_CREATE_LOCK(_inp) \
|
||||
|
@ -62,4 +62,11 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
|
||||
|
||||
/* All os's must implement this address gatherer. If
|
||||
* no VRF's exist, then vrf 0 is the only one and all
|
||||
* addresses and ifn's live here.
|
||||
*/
|
||||
#define SCTP_DEFAULT_VRF 0
|
||||
void sctp_init_vrf_list(int vrfid);
|
||||
|
||||
#endif
|
||||
|
@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/resourcevar.h>
|
||||
#include <sys/uio.h>
|
||||
#include <sys/kthread.h>
|
||||
#include <sys/priv.h>
|
||||
#include <sys/random.h>
|
||||
#include <sys/limits.h>
|
||||
@ -108,6 +109,23 @@ __FBSDID("$FreeBSD$");
|
||||
#define USER_ADDR_NULL (NULL) /* FIX ME: temp */
|
||||
#define SCTP_LIST_EMPTY(list) LIST_EMPTY(list)
|
||||
|
||||
/*
|
||||
* Local address and interface list handling
|
||||
*/
|
||||
#define SCTP_MAX_VRF_ID 0
|
||||
#define SCTP_SIZE_OF_VRF_HASH 3
|
||||
#define SCTP_IFNAMSIZ IFNAMSIZ
|
||||
#define SCTP_DEFAULT_VRFID 0
|
||||
|
||||
#define SCTP_IFN_IS_IFT_LOOP(ifn) ((ifn)->ifn_type == IFT_LOOP)
|
||||
|
||||
/*
|
||||
* Access to IFN's to help with src-addr-selection
|
||||
*/
|
||||
/* This could return VOID if the index works but for BSD we provide both. */
|
||||
#define SCTP_GET_IFN_VOID_FROM_ROUTE(ro) (void *)ro->ro_rt->rt_ifp
|
||||
#define SCTP_GET_IF_INDEX_FROM_ROUTE(ro) ro->ro_rt->rt_ifp->if_index
|
||||
|
||||
/*
|
||||
* general memory allocation
|
||||
*/
|
||||
@ -125,6 +143,8 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
#define SCTP_FREE_SONAME(var) FREE(var, M_SONAME)
|
||||
|
||||
#define SCTP_PROCESS_STRUCT struct proc *
|
||||
|
||||
/*
|
||||
* zone allocation functions
|
||||
*/
|
||||
@ -168,7 +188,6 @@ typedef struct callout sctp_os_timer_t;
|
||||
/*
|
||||
* Functions
|
||||
*/
|
||||
|
||||
/* Mbuf manipulation and access macros */
|
||||
#define SCTP_BUF_LEN(m) (m->m_len)
|
||||
#define SCTP_BUF_NEXT(m) (m->m_next)
|
||||
@ -224,7 +243,12 @@ typedef struct callout sctp_os_timer_t;
|
||||
|
||||
/* is the endpoint v6only? */
|
||||
#define SCTP_IPV6_V6ONLY(inp) (((struct inpcb *)inp)->inp_flags & IN6P_IPV6_V6ONLY)
|
||||
|
||||
/* is the socket non-blocking? */
|
||||
#define SCTP_SO_IS_NBIO(so) ((so)->so_state & SS_NBIO)
|
||||
#define SCTP_SET_SO_NBIO(so) ((so)->so_state |= SS_NBIO)
|
||||
#define SCTP_CLEAR_SO_NBIO(so) ((so)->so_state &= ~SS_NBIO)
|
||||
/* get the socket type */
|
||||
#define SCTP_SO_TYPE(so) ((so)->so_type)
|
||||
|
||||
/*
|
||||
* SCTP AUTH
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -39,6 +39,43 @@ __FBSDID("$FreeBSD$");
|
||||
#include <netinet/sctp_header.h>
|
||||
|
||||
#if defined(_KERNEL)
|
||||
|
||||
struct mbuf *
|
||||
sctp_get_mbuf_for_msg(unsigned int space_needed,
|
||||
int want_header, int how, int allonebuf, int type);
|
||||
|
||||
|
||||
|
||||
struct mbuf *
|
||||
sctp_add_addresses_to_i_ia(struct sctp_inpcb *inp,
|
||||
struct sctp_scoping *scope,
|
||||
struct mbuf *m_at,
|
||||
int cnt_inits_to);
|
||||
|
||||
|
||||
int sctp_is_addr_restricted(struct sctp_tcb *, struct sctp_ifa *);
|
||||
|
||||
|
||||
int
|
||||
sctp_is_address_in_scope(struct sctp_ifa *ifa,
|
||||
int ipv4_addr_legal,
|
||||
int ipv6_addr_legal,
|
||||
int loopback_scope,
|
||||
int ipv4_local_scope,
|
||||
int local_scope,
|
||||
int site_scope,
|
||||
int do_update);
|
||||
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,
|
||||
struct route *ro, struct sctp_nets *net,
|
||||
int non_asoc_addr_ok, uint32_t vrf_id);
|
||||
|
||||
|
||||
|
||||
void sctp_send_initiate(struct sctp_inpcb *, struct sctp_tcb *);
|
||||
|
||||
void
|
||||
@ -111,10 +148,6 @@ sctp_send_packet_dropped(struct sctp_tcb *, struct sctp_nets *, struct mbuf *,
|
||||
void sctp_send_cwr(struct sctp_tcb *, struct sctp_nets *, uint32_t);
|
||||
|
||||
|
||||
struct mbuf *
|
||||
sctp_get_mbuf_for_msg(unsigned int space_needed,
|
||||
int want_header, int how, int allonebuf, int type);
|
||||
|
||||
void
|
||||
sctp_add_stream_reset_out(struct sctp_tmit_chunk *chk,
|
||||
int number_entries, uint16_t * list,
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -44,12 +44,16 @@ LIST_HEAD(sctppcbhead, sctp_inpcb);
|
||||
LIST_HEAD(sctpasochead, sctp_tcb);
|
||||
LIST_HEAD(sctpladdr, sctp_laddr);
|
||||
LIST_HEAD(sctpvtaghead, sctp_tagblock);
|
||||
LIST_HEAD(sctp_vrflist, sctp_vrf);
|
||||
LIST_HEAD(sctp_ifnlist, sctp_ifn);
|
||||
LIST_HEAD(sctp_ifalist, sctp_ifa);
|
||||
TAILQ_HEAD(sctp_readhead, sctp_queued_to_read);
|
||||
TAILQ_HEAD(sctp_streamhead, sctp_stream_queue_pending);
|
||||
|
||||
#include <netinet/sctp_structs.h>
|
||||
#include <netinet/sctp_uio.h>
|
||||
#include <netinet/sctp_auth.h>
|
||||
#include <netinet/sctp_bsd_addr.h>
|
||||
|
||||
/*
|
||||
* PCB flags (in sctp_flags bitmask)
|
||||
@ -106,10 +110,60 @@ TAILQ_HEAD(sctp_streamhead, sctp_stream_queue_pending);
|
||||
#define SCTP_PCBHASH_ALLADDR(port, mask) (port & mask)
|
||||
#define SCTP_PCBHASH_ASOC(tag, mask) (tag & mask)
|
||||
|
||||
struct sctp_vrf {
|
||||
LIST_ENTRY(sctp_vrf) next_vrf;
|
||||
struct sctp_ifnlist ifnlist;
|
||||
uint32_t vrf_id;
|
||||
uint32_t total_ifa_count;
|
||||
};
|
||||
|
||||
struct sctp_ifn {
|
||||
struct sctp_ifalist ifalist;
|
||||
struct sctp_vrf *vrf;
|
||||
LIST_ENTRY(sctp_ifn) next_ifn;
|
||||
void *ifn_p; /* never access without appropriate lock */
|
||||
uint32_t ifn_type;
|
||||
uint32_t ifn_index; /* shorthand way to look at ifn for reference */
|
||||
uint32_t refcount; /* number of reference held should be >=
|
||||
* ifa_count */
|
||||
uint32_t ifa_count; /* IFA's we hold (in our list - ifalist) */
|
||||
char ifn_name[SCTP_IFNAMSIZ];
|
||||
};
|
||||
|
||||
/* SCTP local IFA flags */
|
||||
#define SCTP_ADDR_VALID 0x00000001 /* its up and active */
|
||||
#define SCTP_BEING_DELETED 0x00000002 /* being deleted, when
|
||||
* refcount = 0. Note that it
|
||||
* is pulled from the ifn list
|
||||
* and ifa_p is nulled right
|
||||
* away but it cannot be freed
|
||||
* until the last *net
|
||||
* pointing to it is deleted. */
|
||||
#define SCTP_ADDR_DEFER_USE 0x00000004 /* Hold off using this one */
|
||||
#define SCTP_ADDR_IFA_UNUSEABLE 0x00000008
|
||||
|
||||
struct sctp_ifa {
|
||||
LIST_ENTRY(sctp_ifa) next_ifa;
|
||||
struct sctp_ifn *ifn_p; /* back pointer to parent ifn */
|
||||
void *ifa; /* pointer to ifa, needed for flag update for
|
||||
* that we MUST lock appropriate locks. This
|
||||
* is for V6. */
|
||||
union sctp_sockstore address;
|
||||
uint32_t refcount; /* number of folks refering to this */
|
||||
uint32_t flags;
|
||||
uint32_t localifa_flags;
|
||||
uint8_t src_is_loop;
|
||||
uint8_t src_is_priv;
|
||||
uint8_t src_is_glob;
|
||||
uint8_t resv;
|
||||
};
|
||||
|
||||
struct sctp_laddr {
|
||||
LIST_ENTRY(sctp_laddr) sctp_nxt_addr; /* next in list */
|
||||
struct ifaddr *ifa;
|
||||
int action; /* Only used in delayed asconf stuff */
|
||||
struct sctp_ifa *ifa;
|
||||
uint32_t action; /* Used during asconf and adding if no-zero
|
||||
* src-addr selection will not consider this
|
||||
* address. */
|
||||
};
|
||||
|
||||
struct sctp_block_entry {
|
||||
@ -126,7 +180,6 @@ struct sctp_tagblock {
|
||||
struct sctp_timewait vtag_block[SCTP_NUMBER_IN_VTAG_BLOCK];
|
||||
};
|
||||
|
||||
|
||||
struct sctp_epinfo {
|
||||
struct sctpasochead *sctp_asochash;
|
||||
u_long hashasocmark;
|
||||
@ -153,6 +206,9 @@ struct sctp_epinfo {
|
||||
u_long hashtcpmark;
|
||||
uint32_t hashtblsize;
|
||||
|
||||
struct sctp_vrflist *sctp_vrfhash;
|
||||
u_long hashvrfmark;
|
||||
|
||||
struct sctppcbhead listhead;
|
||||
struct sctpladdr addr_wq;
|
||||
|
||||
@ -169,8 +225,8 @@ struct sctp_epinfo {
|
||||
|
||||
struct mtx ipi_ep_mtx;
|
||||
struct mtx it_mtx;
|
||||
struct mtx ipi_iterator_wq_mtx;
|
||||
struct mtx ipi_addr_mtx;
|
||||
struct mtx timer_mtx;
|
||||
uint32_t ipi_count_ep;
|
||||
|
||||
/* assoc/tcb zone info */
|
||||
@ -197,12 +253,15 @@ struct sctp_epinfo {
|
||||
|
||||
struct sctpvtaghead vtag_timewait[SCTP_STACK_VTAG_HASH_SIZE];
|
||||
|
||||
/* address work queue handling */
|
||||
#if defined(SCTP_USE_THREAD_BASED_ITERATOR)
|
||||
uint32_t iterator_running;
|
||||
SCTP_PROCESS_STRUCT thread_proc;
|
||||
#endif
|
||||
struct sctp_timer addr_wq_timer;
|
||||
|
||||
};
|
||||
|
||||
extern struct sctpstat sctpstat;
|
||||
|
||||
/*
|
||||
* Here we have all the relevant information for each SCTP entity created. We
|
||||
* will need to modify this as approprate. We also need to figure out how to
|
||||
@ -218,9 +277,9 @@ struct sctp_pcb {
|
||||
unsigned int sctp_minrto;
|
||||
unsigned int sctp_maxrto;
|
||||
unsigned int initial_rto;
|
||||
|
||||
int initial_init_rto_max;
|
||||
|
||||
unsigned int sctp_sack_freq;
|
||||
uint32_t sctp_sws_sender;
|
||||
uint32_t sctp_sws_receiver;
|
||||
|
||||
@ -294,11 +353,15 @@ struct sctp_inpcb {
|
||||
LIST_ENTRY(sctp_inpcb) sctp_hash;
|
||||
/* count of local addresses bound, 0 if bound all */
|
||||
int laddr_count;
|
||||
/* list of addrs in use by the EP */
|
||||
|
||||
/* list of addrs in use by the EP, NULL if bound-all */
|
||||
struct sctpladdr sctp_addr_list;
|
||||
/* used for source address selection rotation */
|
||||
/*
|
||||
* used for source address selection rotation when we are subset
|
||||
* bound
|
||||
*/
|
||||
struct sctp_laddr *next_addr_touse;
|
||||
struct ifnet *next_ifn_touse;
|
||||
|
||||
/* back pointer to our socket */
|
||||
struct socket *sctp_socket;
|
||||
uint32_t sctp_flags; /* INP state flag set */
|
||||
@ -329,6 +392,7 @@ struct sctp_inpcb {
|
||||
struct mtx inp_create_mtx;
|
||||
struct mtx inp_rdata_mtx;
|
||||
int32_t refcount;
|
||||
uint32_t def_vrf_id;
|
||||
uint32_t total_sends;
|
||||
uint32_t total_recvs;
|
||||
uint32_t last_abort_code;
|
||||
@ -371,15 +435,36 @@ struct sctp_tcb {
|
||||
#if defined(_KERNEL)
|
||||
|
||||
extern struct sctp_epinfo sctppcbinfo;
|
||||
extern int sctp_auto_asconf;
|
||||
|
||||
int SCTP6_ARE_ADDR_EQUAL(struct in6_addr *a, struct in6_addr *b);
|
||||
|
||||
void sctp_fill_pcbinfo(struct sctp_pcbinfo *);
|
||||
|
||||
struct sctp_ifn *
|
||||
sctp_find_ifn(struct sctp_vrf *vrf, void *ifn, uint32_t ifn_index);
|
||||
|
||||
struct sctp_vrf *sctp_allocate_vrf(int vrfid);
|
||||
|
||||
struct sctp_vrf *sctp_find_vrf(uint32_t vrfid);
|
||||
|
||||
struct sctp_ifa *
|
||||
sctp_add_addr_to_vrf(uint32_t vrfid,
|
||||
void *ifn, uint32_t ifn_index, uint32_t ifn_type,
|
||||
const char *if_name,
|
||||
void *ifa, struct sockaddr *addr, uint32_t ifa_flags);
|
||||
|
||||
void sctp_free_ifa(struct sctp_ifa *sctp_ifap);
|
||||
|
||||
struct sctp_ifa *
|
||||
sctp_del_addr_from_vrf(uint32_t vrfid, struct sockaddr *addr,
|
||||
uint32_t ifn_index);
|
||||
|
||||
|
||||
|
||||
|
||||
struct sctp_nets *sctp_findnet(struct sctp_tcb *, struct sockaddr *);
|
||||
|
||||
struct sctp_inpcb *sctp_pcb_findep(struct sockaddr *, int, int);
|
||||
struct sctp_inpcb *sctp_pcb_findep(struct sockaddr *, int, int, uint32_t);
|
||||
|
||||
int sctp_inpcb_bind(struct socket *, struct sockaddr *, struct thread *);
|
||||
|
||||
@ -391,7 +476,7 @@ sctp_findassociation_addr(struct mbuf *, int, int,
|
||||
|
||||
struct sctp_tcb *
|
||||
sctp_findassociation_addr_sa(struct sockaddr *,
|
||||
struct sockaddr *, struct sctp_inpcb **, struct sctp_nets **, int);
|
||||
struct sockaddr *, struct sctp_inpcb **, struct sctp_nets **, int, uint32_t);
|
||||
|
||||
void
|
||||
sctp_move_pcb_and_assoc(struct sctp_inpcb *, struct sctp_inpcb *,
|
||||
@ -418,28 +503,29 @@ sctp_findassociation_ep_asconf(struct mbuf *, int, int,
|
||||
|
||||
int sctp_inpcb_alloc(struct socket *);
|
||||
|
||||
int sctp_is_address_on_local_host(struct sockaddr *addr);
|
||||
int sctp_is_address_on_local_host(struct sockaddr *addr, uint32_t vrf_id);
|
||||
|
||||
void sctp_inpcb_free(struct sctp_inpcb *, int, int);
|
||||
|
||||
struct sctp_tcb *
|
||||
sctp_aloc_assoc(struct sctp_inpcb *, struct sockaddr *,
|
||||
int, int *, uint32_t);
|
||||
int, int *, uint32_t, uint32_t);
|
||||
|
||||
int sctp_free_assoc(struct sctp_inpcb *, struct sctp_tcb *, int, int);
|
||||
|
||||
void
|
||||
sctp_add_vtag_to_timewait(struct sctp_inpcb *, uint32_t, uint32_t);
|
||||
|
||||
int sctp_add_local_addr_ep(struct sctp_inpcb *, struct ifaddr *);
|
||||
int sctp_add_local_addr_ep(struct sctp_inpcb *, struct sctp_ifa *, uint32_t);
|
||||
|
||||
int sctp_insert_laddr(struct sctpladdr *, struct ifaddr *);
|
||||
int sctp_insert_laddr(struct sctpladdr *, struct sctp_ifa *, uint32_t);
|
||||
|
||||
void sctp_remove_laddr(struct sctp_laddr *);
|
||||
|
||||
int sctp_del_local_addr_ep(struct sctp_inpcb *, struct ifaddr *);
|
||||
int sctp_del_local_addr_ep(struct sctp_inpcb *, struct sctp_ifa *);
|
||||
|
||||
void sctp_set_initial_cc_param(struct sctp_tcb *, struct sctp_nets *net);
|
||||
|
||||
int sctp_del_local_addr_ep_sa(struct sctp_inpcb *, struct sockaddr *);
|
||||
|
||||
int sctp_add_remote_addr(struct sctp_tcb *, struct sockaddr *, int, int);
|
||||
|
||||
@ -449,11 +535,9 @@ int sctp_del_remote_addr(struct sctp_tcb *, struct sockaddr *);
|
||||
|
||||
void sctp_pcb_init(void);
|
||||
|
||||
int sctp_add_local_addr_assoc(struct sctp_tcb *, struct ifaddr *);
|
||||
int sctp_add_local_addr_assoc(struct sctp_tcb *, struct sctp_ifa *, int);
|
||||
|
||||
int sctp_del_local_addr_assoc(struct sctp_tcb *, struct ifaddr *);
|
||||
|
||||
int sctp_del_local_addr_assoc_sa(struct sctp_tcb *, struct sockaddr *);
|
||||
int sctp_del_local_addr_assoc(struct sctp_tcb *, struct sctp_ifa *);
|
||||
|
||||
int
|
||||
sctp_load_addresses_from_init(struct sctp_tcb *, struct mbuf *, int, int,
|
||||
@ -474,8 +558,15 @@ int sctp_destination_is_reachable(struct sctp_tcb *, struct sockaddr *);
|
||||
* indicates run on ONLY assoc's of the specified endpoint.
|
||||
*/
|
||||
int
|
||||
sctp_initiate_iterator(inp_func inpf, asoc_func af, uint32_t, uint32_t,
|
||||
uint32_t, void *, uint32_t, end_func ef, struct sctp_inpcb *, uint8_t co_off);
|
||||
sctp_initiate_iterator(inp_func inpf,
|
||||
asoc_func af,
|
||||
inp_func inpe,
|
||||
uint32_t, uint32_t,
|
||||
uint32_t, void *,
|
||||
uint32_t,
|
||||
end_func ef,
|
||||
struct sctp_inpcb *,
|
||||
uint8_t co_off);
|
||||
|
||||
|
||||
#endif /* _KERNEL */
|
||||
|
@ -174,7 +174,7 @@ sctp_get_peeloff(struct socket *head, sctp_assoc_t assoc_id, int *error)
|
||||
SCTP_FROM_SCTP_PEELOFF + SCTP_LOC_1);
|
||||
}
|
||||
/* Turn off any non-blocking semantic. */
|
||||
newso->so_state &= ~SS_NBIO;
|
||||
SCTP_CLEAR_SO_NBIO(newso);
|
||||
newso->so_state |= SS_ISCONNECTED;
|
||||
/* We remove it right away */
|
||||
#ifdef SCTP_LOCK_LOGGING
|
||||
|
@ -96,7 +96,7 @@ TAILQ_HEAD(sctp_resethead, sctp_stream_reset_list);
|
||||
|
||||
/*
|
||||
* Users of the iterator need to malloc a iterator with a call to
|
||||
* sctp_initiate_iterator(inp_func, assoc_func, pcb_flags, pcb_features,
|
||||
* sctp_initiate_iterator(inp_func, assoc_func, inp_func, pcb_flags, pcb_features,
|
||||
* asoc_state, void-ptr-arg, uint32-arg, end_func, inp);
|
||||
*
|
||||
* Use the following two defines if you don't care what pcb flags are on the EP
|
||||
@ -114,16 +114,17 @@ TAILQ_HEAD(sctp_resethead, sctp_stream_reset_list);
|
||||
|
||||
typedef void (*asoc_func) (struct sctp_inpcb *, struct sctp_tcb *, void *ptr,
|
||||
uint32_t val);
|
||||
typedef void (*inp_func) (struct sctp_inpcb *, void *ptr, uint32_t val);
|
||||
typedef int (*inp_func) (struct sctp_inpcb *, void *ptr, uint32_t val);
|
||||
typedef void (*end_func) (void *ptr, uint32_t val);
|
||||
|
||||
struct sctp_iterator {
|
||||
LIST_ENTRY(sctp_iterator) sctp_nxt_itr;
|
||||
TAILQ_ENTRY(sctp_iterator) sctp_nxt_itr;
|
||||
struct sctp_timer tmr;
|
||||
struct sctp_inpcb *inp; /* current endpoint */
|
||||
struct sctp_tcb *stcb; /* current* assoc */
|
||||
asoc_func function_assoc; /* per assoc function */
|
||||
inp_func function_inp; /* per endpoint function */
|
||||
inp_func function_inp_end; /* end INP function */
|
||||
end_func function_atend;/* iterator completion function */
|
||||
void *pointer; /* pointer for apply func to use */
|
||||
uint32_t val; /* value for apply func to use */
|
||||
@ -132,13 +133,14 @@ struct sctp_iterator {
|
||||
uint32_t asoc_state; /* assoc state being checked */
|
||||
uint32_t iterator_flags;
|
||||
uint8_t no_chunk_output;
|
||||
uint8_t done_current_ep;
|
||||
};
|
||||
|
||||
/* iterator_flags values */
|
||||
#define SCTP_ITERATOR_DO_ALL_INP 0x00000001
|
||||
#define SCTP_ITERATOR_DO_SINGLE_INP 0x00000002
|
||||
|
||||
LIST_HEAD(sctpiterators, sctp_iterator);
|
||||
TAILQ_HEAD(sctpiterators, sctp_iterator);
|
||||
|
||||
struct sctp_copy_all {
|
||||
struct sctp_inpcb *inp; /* ep */
|
||||
@ -149,6 +151,12 @@ struct sctp_copy_all {
|
||||
int cnt_failed;
|
||||
};
|
||||
|
||||
struct sctp_asconf_iterator {
|
||||
struct sctpladdr list_of_work;
|
||||
int cnt;
|
||||
};
|
||||
|
||||
|
||||
struct sctp_nets {
|
||||
TAILQ_ENTRY(sctp_nets) sctp_next; /* next link */
|
||||
|
||||
@ -165,7 +173,7 @@ struct sctp_nets {
|
||||
struct sctp_route {
|
||||
struct rtentry *ro_rt;
|
||||
union sctp_sockstore _l_addr; /* remote peer addr */
|
||||
union sctp_sockstore _s_addr; /* our selected src addr */
|
||||
struct sctp_ifa *_s_addr; /* our selected src addr */
|
||||
} ro;
|
||||
/* mtu discovered so far */
|
||||
uint32_t mtu;
|
||||
@ -435,7 +443,7 @@ TAILQ_HEAD(sctp_asconf_addrhead, sctp_asconf_addr);
|
||||
struct sctp_asconf_addr {
|
||||
TAILQ_ENTRY(sctp_asconf_addr) next;
|
||||
struct sctp_asconf_addr_param ap;
|
||||
struct ifaddr *ifa; /* save the ifa for add/del ip */
|
||||
struct sctp_ifa *ifa; /* save the ifa for add/del ip */
|
||||
uint8_t sent; /* has this been sent yet? */
|
||||
};
|
||||
|
||||
@ -483,7 +491,8 @@ struct sctp_association {
|
||||
struct sctp_timer delayed_event_timer; /* timer for delayed events */
|
||||
|
||||
/* list of local addresses when add/del in progress */
|
||||
struct sctpladdr sctp_local_addr_list;
|
||||
struct sctpladdr sctp_restricted_addrs;
|
||||
|
||||
struct sctpnetlisthead nets;
|
||||
|
||||
/* Free chunk list */
|
||||
@ -573,6 +582,8 @@ struct sctp_association {
|
||||
/* queue of chunks waiting to be sent into the local stack */
|
||||
struct sctp_readhead pending_reply_queue;
|
||||
|
||||
uint32_t vrf_id;
|
||||
|
||||
uint32_t cookie_preserve_req;
|
||||
/* ASCONF next seq I am sending out, inits at init-tsn */
|
||||
uint32_t asconf_seq_out;
|
||||
@ -739,6 +750,9 @@ struct sctp_association {
|
||||
unsigned int cookie_life;
|
||||
/* time to delay acks for */
|
||||
unsigned int delayed_ack;
|
||||
unsigned int old_delayed_ack;
|
||||
unsigned int sack_freq;
|
||||
unsigned int data_pkts_seen;
|
||||
|
||||
unsigned int numduptsns;
|
||||
int dup_tsns[SCTP_MAX_DUP_TSNS];
|
||||
@ -813,10 +827,10 @@ struct sctp_association {
|
||||
uint8_t stream_locked;
|
||||
uint8_t authenticated; /* packet authenticated ok */
|
||||
/*
|
||||
* This flag indicates that we need to send the first SACK. If in
|
||||
* place it says we have NOT yet sent a SACK and need to.
|
||||
* This flag indicates that a SACK need to be sent. Initially this
|
||||
* is 1 to send the first sACK immediately.
|
||||
*/
|
||||
uint8_t first_ack_sent;
|
||||
uint8_t send_sack;
|
||||
|
||||
/* max burst after fast retransmit completes */
|
||||
uint8_t max_burst;
|
||||
|
500
sys/netinet/sctp_sysctl.c
Normal file
500
sys/netinet/sctp_sysctl.c
Normal file
@ -0,0 +1,500 @@
|
||||
/*-
|
||||
* Copyright (c) 2007, Cisco Systems, Inc. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* a) Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* b) Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* c) Neither the name of Cisco Systems, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
* THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <netinet/sctp_os.h>
|
||||
#include <netinet/sctp_constants.h>
|
||||
#include <netinet/sctp_sysctl.h>
|
||||
#include <netinet/sctp_pcb.h>
|
||||
#include <netinet/sctputil.h>
|
||||
|
||||
/*
|
||||
* sysctl tunable variables
|
||||
*/
|
||||
uint32_t sctp_sendspace = (128 * 1024);
|
||||
uint32_t sctp_recvspace = 128 * (1024 +
|
||||
#ifdef INET6
|
||||
sizeof(struct sockaddr_in6)
|
||||
#else
|
||||
sizeof(struct sockaddr_in)
|
||||
#endif
|
||||
);
|
||||
uint32_t sctp_mbuf_threshold_count = SCTP_DEFAULT_MBUFS_IN_CHAIN;
|
||||
uint32_t sctp_auto_asconf = SCTP_DEFAULT_AUTO_ASCONF;
|
||||
uint32_t sctp_ecn_enable = 1;
|
||||
uint32_t sctp_ecn_nonce = 0;
|
||||
uint32_t sctp_strict_sacks = 0;
|
||||
uint32_t sctp_no_csum_on_loopback = 1;
|
||||
uint32_t sctp_strict_init = 1;
|
||||
uint32_t sctp_abort_if_one_2_one_hits_limit = 0;
|
||||
uint32_t sctp_strict_data_order = 0;
|
||||
|
||||
uint32_t sctp_peer_chunk_oh = sizeof(struct mbuf);
|
||||
uint32_t sctp_max_burst_default = SCTP_DEF_MAX_BURST;
|
||||
uint32_t sctp_use_cwnd_based_maxburst = 1;
|
||||
uint32_t sctp_do_drain = 1;
|
||||
uint32_t sctp_hb_maxburst = SCTP_DEF_MAX_BURST;
|
||||
|
||||
uint32_t sctp_max_chunks_on_queue = SCTP_ASOC_MAX_CHUNKS_ON_QUEUE;
|
||||
uint32_t sctp_delayed_sack_time_default = SCTP_RECV_MSEC;
|
||||
uint32_t sctp_sack_freq_default = SCTP_DEFAULT_SACK_FREQ;
|
||||
uint32_t sctp_heartbeat_interval_default = SCTP_HB_DEFAULT_MSEC;
|
||||
uint32_t sctp_pmtu_raise_time_default = SCTP_DEF_PMTU_RAISE_SEC;
|
||||
uint32_t sctp_shutdown_guard_time_default = SCTP_DEF_MAX_SHUTDOWN_SEC;
|
||||
uint32_t sctp_secret_lifetime_default = SCTP_DEFAULT_SECRET_LIFE_SEC;
|
||||
uint32_t sctp_rto_max_default = SCTP_RTO_UPPER_BOUND;
|
||||
uint32_t sctp_rto_min_default = SCTP_RTO_LOWER_BOUND;
|
||||
uint32_t sctp_rto_initial_default = SCTP_RTO_INITIAL;
|
||||
uint32_t sctp_init_rto_max_default = SCTP_RTO_UPPER_BOUND;
|
||||
uint32_t sctp_valid_cookie_life_default = SCTP_DEFAULT_COOKIE_LIFE;
|
||||
uint32_t sctp_init_rtx_max_default = SCTP_DEF_MAX_INIT;
|
||||
uint32_t sctp_assoc_rtx_max_default = SCTP_DEF_MAX_SEND;
|
||||
uint32_t sctp_path_rtx_max_default = SCTP_DEF_MAX_PATH_RTX;
|
||||
uint32_t sctp_nr_outgoing_streams_default = SCTP_OSTREAM_INITIAL;
|
||||
uint32_t sctp_add_more_threshold = SCTP_DEFAULT_ADD_MORE;
|
||||
uint32_t sctp_asoc_free_resc_limit = SCTP_DEF_ASOC_RESC_LIMIT;
|
||||
uint32_t sctp_system_free_resc_limit = SCTP_DEF_SYSTEM_RESC_LIMIT;
|
||||
|
||||
uint32_t sctp_min_split_point = SCTP_DEFAULT_SPLIT_POINT_MIN;
|
||||
uint32_t sctp_pcbtblsize = SCTP_PCBHASHSIZE;
|
||||
uint32_t sctp_hashtblsize = SCTP_TCBHASHSIZE;
|
||||
uint32_t sctp_chunkscale = SCTP_CHUNKQUEUE_SCALE;
|
||||
|
||||
uint32_t sctp_cmt_on_off = 0;
|
||||
uint32_t sctp_cmt_use_dac = 0;
|
||||
|
||||
uint32_t sctp_L2_abc_variable = 1;
|
||||
uint32_t sctp_early_fr = 0;
|
||||
uint32_t sctp_early_fr_msec = SCTP_MINFR_MSEC_TIMER;
|
||||
uint32_t sctp_use_rttvar_cc = 0;
|
||||
uint32_t sctp_says_check_for_deadlock = 0;
|
||||
uint32_t sctp_asconf_auth_nochk = 0;
|
||||
uint32_t sctp_auth_disable = 0;
|
||||
uint32_t sctp_nat_friendly = 1;
|
||||
struct sctpstat sctpstat;
|
||||
|
||||
#ifdef SCTP_DEBUG
|
||||
uint32_t sctp_debug_on = 0;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* sysctl functions
|
||||
*/
|
||||
static int
|
||||
sctp_assoclist(SYSCTL_HANDLER_ARGS)
|
||||
{
|
||||
unsigned int number_of_endpoints;
|
||||
unsigned int number_of_local_addresses;
|
||||
unsigned int number_of_associations;
|
||||
unsigned int number_of_remote_addresses;
|
||||
unsigned int n;
|
||||
int error;
|
||||
struct sctp_inpcb *inp;
|
||||
struct sctp_tcb *stcb;
|
||||
struct sctp_nets *net;
|
||||
struct sctp_laddr *laddr;
|
||||
struct xsctp_inpcb xinpcb;
|
||||
struct xsctp_tcb xstcb;
|
||||
|
||||
/* struct xsctp_laddr xladdr; */
|
||||
struct xsctp_raddr xraddr;
|
||||
|
||||
number_of_endpoints = 0;
|
||||
number_of_local_addresses = 0;
|
||||
number_of_associations = 0;
|
||||
number_of_remote_addresses = 0;
|
||||
|
||||
SCTP_INP_INFO_RLOCK();
|
||||
if (req->oldptr == USER_ADDR_NULL) {
|
||||
LIST_FOREACH(inp, &sctppcbinfo.listhead, sctp_list) {
|
||||
SCTP_INP_RLOCK(inp);
|
||||
number_of_endpoints++;
|
||||
/* FIXME MT */
|
||||
LIST_FOREACH(laddr, &inp->sctp_addr_list, sctp_nxt_addr) {
|
||||
number_of_local_addresses++;
|
||||
}
|
||||
LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
|
||||
number_of_associations++;
|
||||
TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
|
||||
number_of_remote_addresses++;
|
||||
}
|
||||
}
|
||||
SCTP_INP_RUNLOCK(inp);
|
||||
}
|
||||
SCTP_INP_INFO_RUNLOCK();
|
||||
n = (number_of_endpoints + 1) * sizeof(struct xsctp_inpcb) +
|
||||
number_of_local_addresses * sizeof(struct xsctp_laddr) +
|
||||
number_of_associations * sizeof(struct xsctp_tcb) +
|
||||
number_of_remote_addresses * sizeof(struct xsctp_raddr);
|
||||
#ifdef SCTP_DEBUG
|
||||
printf("inps = %u, stcbs = %u, laddrs = %u, raddrs = %u\n",
|
||||
number_of_endpoints, number_of_associations,
|
||||
number_of_local_addresses, number_of_remote_addresses);
|
||||
#endif
|
||||
/* request some more memory than needed */
|
||||
req->oldidx = (n + n / 8);
|
||||
return 0;
|
||||
}
|
||||
if (req->newptr != USER_ADDR_NULL) {
|
||||
SCTP_INP_INFO_RUNLOCK();
|
||||
return EPERM;
|
||||
}
|
||||
LIST_FOREACH(inp, &sctppcbinfo.listhead, sctp_list) {
|
||||
SCTP_INP_RLOCK(inp);
|
||||
number_of_local_addresses = 0;
|
||||
number_of_associations = 0;
|
||||
/*
|
||||
* LIST_FOREACH(laddr, &inp->sctp_addr_list, sctp_nxt_addr)
|
||||
* { number_of_local_addresses++; }
|
||||
*/
|
||||
LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
|
||||
number_of_associations++;
|
||||
}
|
||||
xinpcb.last = 0;
|
||||
xinpcb.local_port = ntohs(inp->sctp_lport);
|
||||
xinpcb.number_local_addresses = number_of_local_addresses;
|
||||
xinpcb.number_associations = number_of_associations;
|
||||
xinpcb.flags = inp->sctp_flags;
|
||||
xinpcb.features = inp->sctp_features;
|
||||
xinpcb.total_sends = inp->total_sends;
|
||||
xinpcb.total_recvs = inp->total_recvs;
|
||||
xinpcb.total_nospaces = inp->total_nospaces;
|
||||
SCTP_INP_INCR_REF(inp);
|
||||
SCTP_INP_RUNLOCK(inp);
|
||||
SCTP_INP_INFO_RUNLOCK();
|
||||
error = SYSCTL_OUT(req, &xinpcb, sizeof(struct xsctp_inpcb));
|
||||
if (error) {
|
||||
return error;
|
||||
}
|
||||
SCTP_INP_INFO_RLOCK();
|
||||
SCTP_INP_RLOCK(inp);
|
||||
/* FIXME MT */
|
||||
/*
|
||||
* LIST_FOREACH(laddr, &inp->sctp_addr_list, sctp_nxt_addr)
|
||||
* { error = SYSCTL_OUT(req, &xladdr, sizeof(struct
|
||||
* xsctp_laddr)); if (error) { #if
|
||||
* defined(SCTP_PER_SOCKET_LOCKING)
|
||||
* SCTP_SOCKET_UNLOCK(SCTP_INP_SO(inp), 1);
|
||||
* SCTP_UNLOCK_SHARED(sctppcbinfo.ipi_ep_mtx); #endif
|
||||
* SCTP_INP_RUNLOCK(inp); SCTP_INP_INFO_RUNLOCK(); return
|
||||
* error; } }
|
||||
*/
|
||||
LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
|
||||
SCTP_TCB_LOCK(stcb);
|
||||
atomic_add_int(&stcb->asoc.refcnt, 1);
|
||||
SCTP_TCB_UNLOCK(stcb);
|
||||
number_of_local_addresses = 0;
|
||||
number_of_remote_addresses = 0;
|
||||
TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
|
||||
number_of_remote_addresses++;
|
||||
}
|
||||
xstcb.LocalPort = ntohs(inp->sctp_lport);
|
||||
xstcb.RemPort = ntohs(stcb->rport);
|
||||
if (stcb->asoc.primary_destination != NULL)
|
||||
xstcb.RemPrimAddr = stcb->asoc.primary_destination->ro._l_addr;
|
||||
xstcb.HeartBeatInterval = stcb->asoc.heart_beat_delay;
|
||||
xstcb.State = SCTP_GET_STATE(&stcb->asoc); /* FIXME */
|
||||
xstcb.InStreams = stcb->asoc.streamincnt;
|
||||
xstcb.OutStreams = stcb->asoc.streamoutcnt;
|
||||
xstcb.MaxRetr = stcb->asoc.overall_error_count;
|
||||
xstcb.PrimProcess = 0; /* not really supported yet */
|
||||
xstcb.T1expireds = stcb->asoc.timoinit + stcb->asoc.timocookie;
|
||||
xstcb.T2expireds = stcb->asoc.timoshutdown + stcb->asoc.timoshutdownack;
|
||||
xstcb.RtxChunks = stcb->asoc.marked_retrans;
|
||||
xstcb.StartTime = stcb->asoc.start_time;
|
||||
xstcb.DiscontinuityTime = stcb->asoc.discontinuity_time;
|
||||
|
||||
xstcb.number_local_addresses = number_of_local_addresses;
|
||||
xstcb.number_remote_addresses = number_of_remote_addresses;
|
||||
xstcb.total_sends = stcb->total_sends;
|
||||
xstcb.total_recvs = stcb->total_recvs;
|
||||
xstcb.local_tag = stcb->asoc.my_vtag;
|
||||
xstcb.remote_tag = stcb->asoc.peer_vtag;
|
||||
xstcb.initial_tsn = stcb->asoc.init_seq_number;
|
||||
xstcb.highest_tsn = stcb->asoc.sending_seq - 1;
|
||||
xstcb.cumulative_tsn = stcb->asoc.last_acked_seq;
|
||||
xstcb.cumulative_tsn_ack = stcb->asoc.cumulative_tsn;
|
||||
SCTP_INP_RUNLOCK(inp);
|
||||
SCTP_INP_INFO_RUNLOCK();
|
||||
error = SYSCTL_OUT(req, &xstcb, sizeof(struct xsctp_tcb));
|
||||
if (error) {
|
||||
atomic_add_int(&stcb->asoc.refcnt, -1);
|
||||
return error;
|
||||
}
|
||||
TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
|
||||
xraddr.RemAddr = net->ro._l_addr;
|
||||
xraddr.RemAddrActive = ((net->dest_state & SCTP_ADDR_REACHABLE) == SCTP_ADDR_REACHABLE);
|
||||
xraddr.RemAddrConfirmed = ((net->dest_state & SCTP_ADDR_UNCONFIRMED) == 0);
|
||||
xraddr.RemAddrHBActive = ((net->dest_state & SCTP_ADDR_NOHB) == 0);
|
||||
xraddr.RemAddrRTO = net->RTO;
|
||||
xraddr.RemAddrMaxPathRtx = net->failure_threshold;
|
||||
xraddr.RemAddrRtx = net->marked_retrans;
|
||||
xraddr.RemAddrErrorCounter = net->error_count;
|
||||
xraddr.RemAddrCwnd = net->cwnd;
|
||||
xraddr.RemAddrFlightSize = net->flight_size;
|
||||
xraddr.RemAddrStartTime = net->start_time;
|
||||
error = SYSCTL_OUT(req, &xraddr, sizeof(struct xsctp_raddr));
|
||||
if (error) {
|
||||
atomic_add_int(&stcb->asoc.refcnt, -1);
|
||||
return error;
|
||||
}
|
||||
}
|
||||
atomic_add_int(&stcb->asoc.refcnt, -1);
|
||||
SCTP_INP_INFO_RLOCK();
|
||||
SCTP_INP_RLOCK(inp);
|
||||
}
|
||||
SCTP_INP_DECR_REF(inp);
|
||||
SCTP_INP_RUNLOCK(inp);
|
||||
}
|
||||
SCTP_INP_INFO_RUNLOCK();
|
||||
|
||||
xinpcb.last = 1;
|
||||
xinpcb.local_port = 0;
|
||||
xinpcb.number_local_addresses = 0;
|
||||
xinpcb.number_associations = 0;
|
||||
xinpcb.flags = 0;
|
||||
xinpcb.features = 0;
|
||||
error = SYSCTL_OUT(req, &xinpcb, sizeof(struct xsctp_inpcb));
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* sysctl definitions
|
||||
*/
|
||||
|
||||
SYSCTL_INT(_net_inet_sctp, OID_AUTO, sendspace, CTLFLAG_RW,
|
||||
&sctp_sendspace, 0, "Maximum outgoing SCTP buffer size");
|
||||
|
||||
SYSCTL_INT(_net_inet_sctp, OID_AUTO, recvspace, CTLFLAG_RW,
|
||||
&sctp_recvspace, 0, "Maximum incoming SCTP buffer size");
|
||||
|
||||
#if defined(__FreeBSD__) || defined(SCTP_APPLE_AUTO_ASCONF)
|
||||
SYSCTL_INT(_net_inet_sctp, OID_AUTO, auto_asconf, CTLFLAG_RW,
|
||||
&sctp_auto_asconf, 0, "Enable SCTP Auto-ASCONF");
|
||||
#endif
|
||||
|
||||
SYSCTL_INT(_net_inet_sctp, OID_AUTO, ecn_enable, CTLFLAG_RW,
|
||||
&sctp_ecn_enable, 0, "Enable SCTP ECN");
|
||||
|
||||
SYSCTL_INT(_net_inet_sctp, OID_AUTO, ecn_nonce, CTLFLAG_RW,
|
||||
&sctp_ecn_nonce, 0, "Enable SCTP ECN Nonce");
|
||||
|
||||
SYSCTL_INT(_net_inet_sctp, OID_AUTO, strict_sacks, CTLFLAG_RW,
|
||||
&sctp_strict_sacks, 0, "Enable SCTP Strict SACK checking");
|
||||
|
||||
SYSCTL_INT(_net_inet_sctp, OID_AUTO, loopback_nocsum, CTLFLAG_RW,
|
||||
&sctp_no_csum_on_loopback, 0,
|
||||
"Enable NO Csum on packets sent on loopback");
|
||||
|
||||
SYSCTL_INT(_net_inet_sctp, OID_AUTO, strict_init, CTLFLAG_RW,
|
||||
&sctp_strict_init, 0,
|
||||
"Enable strict INIT/INIT-ACK singleton enforcement");
|
||||
|
||||
SYSCTL_INT(_net_inet_sctp, OID_AUTO, peer_chkoh, CTLFLAG_RW,
|
||||
&sctp_peer_chunk_oh, 0,
|
||||
"Amount to debit peers rwnd per chunk sent");
|
||||
|
||||
SYSCTL_INT(_net_inet_sctp, OID_AUTO, maxburst, CTLFLAG_RW,
|
||||
&sctp_max_burst_default, 0,
|
||||
"Default max burst for sctp endpoints");
|
||||
|
||||
SYSCTL_INT(_net_inet_sctp, OID_AUTO, maxchunks, CTLFLAG_RW,
|
||||
&sctp_max_chunks_on_queue, 0,
|
||||
"Default max chunks on queue per asoc");
|
||||
|
||||
SYSCTL_INT(_net_inet_sctp, OID_AUTO, tcbhashsize, CTLFLAG_RW,
|
||||
&sctp_hashtblsize, 0,
|
||||
"Tuneable for Hash table sizes");
|
||||
|
||||
SYSCTL_INT(_net_inet_sctp, OID_AUTO, min_split_point, CTLFLAG_RW,
|
||||
&sctp_min_split_point, 0,
|
||||
"Minimum size when splitting a chunk");
|
||||
|
||||
SYSCTL_INT(_net_inet_sctp, OID_AUTO, pcbhashsize, CTLFLAG_RW,
|
||||
&sctp_pcbtblsize, 0,
|
||||
"Tuneable for PCB Hash table sizes");
|
||||
|
||||
SYSCTL_INT(_net_inet_sctp, OID_AUTO, sys_resource, CTLFLAG_RW,
|
||||
&sctp_system_free_resc_limit, 0,
|
||||
"Max number of cached resources in the system");
|
||||
|
||||
SYSCTL_INT(_net_inet_sctp, OID_AUTO, asoc_resource, CTLFLAG_RW,
|
||||
&sctp_asoc_free_resc_limit, 0,
|
||||
"Max number of cached resources in an asoc");
|
||||
|
||||
SYSCTL_INT(_net_inet_sctp, OID_AUTO, chunkscale, CTLFLAG_RW,
|
||||
&sctp_chunkscale, 0,
|
||||
"Tuneable for Scaling of number of chunks and messages");
|
||||
|
||||
SYSCTL_UINT(_net_inet_sctp, OID_AUTO, delayed_sack_time, CTLFLAG_RW,
|
||||
&sctp_delayed_sack_time_default, 0,
|
||||
"Default delayed SACK timer in msec");
|
||||
|
||||
SYSCTL_UINT(_net_inet_sctp, OID_AUTO, sack_freq, CTLFLAG_RW,
|
||||
&sctp_sack_freq_default, 0,
|
||||
"Default SACK frequency");
|
||||
|
||||
SYSCTL_UINT(_net_inet_sctp, OID_AUTO, heartbeat_interval, CTLFLAG_RW,
|
||||
&sctp_heartbeat_interval_default, 0,
|
||||
"Default heartbeat interval in msec");
|
||||
|
||||
SYSCTL_UINT(_net_inet_sctp, OID_AUTO, pmtu_raise_time, CTLFLAG_RW,
|
||||
&sctp_pmtu_raise_time_default, 0,
|
||||
"Default PMTU raise timer in sec");
|
||||
|
||||
SYSCTL_UINT(_net_inet_sctp, OID_AUTO, shutdown_guard_time, CTLFLAG_RW,
|
||||
&sctp_shutdown_guard_time_default, 0,
|
||||
"Default shutdown guard timer in sec");
|
||||
|
||||
SYSCTL_UINT(_net_inet_sctp, OID_AUTO, secret_lifetime, CTLFLAG_RW,
|
||||
&sctp_secret_lifetime_default, 0,
|
||||
"Default secret lifetime in sec");
|
||||
|
||||
SYSCTL_UINT(_net_inet_sctp, OID_AUTO, rto_max, CTLFLAG_RW,
|
||||
&sctp_rto_max_default, 0,
|
||||
"Default maximum retransmission timeout in msec");
|
||||
|
||||
SYSCTL_UINT(_net_inet_sctp, OID_AUTO, rto_min, CTLFLAG_RW,
|
||||
&sctp_rto_min_default, 0,
|
||||
"Default minimum retransmission timeout in msec");
|
||||
|
||||
SYSCTL_UINT(_net_inet_sctp, OID_AUTO, rto_initial, CTLFLAG_RW,
|
||||
&sctp_rto_initial_default, 0,
|
||||
"Default initial retransmission timeout in msec");
|
||||
|
||||
SYSCTL_UINT(_net_inet_sctp, OID_AUTO, init_rto_max, CTLFLAG_RW,
|
||||
&sctp_init_rto_max_default, 0,
|
||||
"Default maximum retransmission timeout during association setup in msec");
|
||||
|
||||
SYSCTL_UINT(_net_inet_sctp, OID_AUTO, valid_cookie_life, CTLFLAG_RW,
|
||||
&sctp_valid_cookie_life_default, 0,
|
||||
"Default cookie lifetime in sec");
|
||||
|
||||
SYSCTL_UINT(_net_inet_sctp, OID_AUTO, init_rtx_max, CTLFLAG_RW,
|
||||
&sctp_init_rtx_max_default, 0,
|
||||
"Default maximum number of retransmission for INIT chunks");
|
||||
|
||||
SYSCTL_UINT(_net_inet_sctp, OID_AUTO, assoc_rtx_max, CTLFLAG_RW,
|
||||
&sctp_assoc_rtx_max_default, 0,
|
||||
"Default maximum number of retransmissions per association");
|
||||
|
||||
SYSCTL_UINT(_net_inet_sctp, OID_AUTO, path_rtx_max, CTLFLAG_RW,
|
||||
&sctp_path_rtx_max_default, 0,
|
||||
"Default maximum of retransmissions per path");
|
||||
|
||||
SYSCTL_UINT(_net_inet_sctp, OID_AUTO, add_more_on_output, CTLFLAG_RW,
|
||||
&sctp_add_more_threshold, 0,
|
||||
"When space wise is it worthwhile to try to add more to a socket send buffer");
|
||||
|
||||
SYSCTL_UINT(_net_inet_sctp, OID_AUTO, outgoing_streams, CTLFLAG_RW,
|
||||
&sctp_nr_outgoing_streams_default, 0,
|
||||
"Default number of outgoing streams");
|
||||
|
||||
SYSCTL_UINT(_net_inet_sctp, OID_AUTO, cmt_on_off, CTLFLAG_RW,
|
||||
&sctp_cmt_on_off, 0,
|
||||
"CMT ON/OFF flag");
|
||||
|
||||
SYSCTL_UINT(_net_inet_sctp, OID_AUTO, cwnd_maxburst, CTLFLAG_RW,
|
||||
&sctp_use_cwnd_based_maxburst, 0,
|
||||
"Use a CWND adjusting maxburst");
|
||||
|
||||
SYSCTL_UINT(_net_inet_sctp, OID_AUTO, early_fast_retran, CTLFLAG_RW,
|
||||
&sctp_early_fr, 0,
|
||||
"Early Fast Retransmit with timer");
|
||||
|
||||
SYSCTL_UINT(_net_inet_sctp, OID_AUTO, use_rttvar_congctrl, CTLFLAG_RW,
|
||||
&sctp_use_rttvar_cc, 0,
|
||||
"Use congestion control via rtt variation");
|
||||
|
||||
SYSCTL_UINT(_net_inet_sctp, OID_AUTO, deadlock_detect, CTLFLAG_RW,
|
||||
&sctp_says_check_for_deadlock, 0,
|
||||
"SMP Deadlock detection on/off");
|
||||
|
||||
SYSCTL_UINT(_net_inet_sctp, OID_AUTO, early_fast_retran_msec, CTLFLAG_RW,
|
||||
&sctp_early_fr_msec, 0,
|
||||
"Early Fast Retransmit minimum timer value");
|
||||
|
||||
SYSCTL_UINT(_net_inet_sctp, OID_AUTO, asconf_auth_nochk, CTLFLAG_RW,
|
||||
&sctp_asconf_auth_nochk, 0,
|
||||
"Disable SCTP ASCONF AUTH requirement");
|
||||
|
||||
SYSCTL_UINT(_net_inet_sctp, OID_AUTO, auth_disable, CTLFLAG_RW,
|
||||
&sctp_auth_disable, 0,
|
||||
"Disable SCTP AUTH function");
|
||||
|
||||
SYSCTL_UINT(_net_inet_sctp, OID_AUTO, nat_friendly, CTLFLAG_RW,
|
||||
&sctp_nat_friendly, 0,
|
||||
"SCTP NAT friendly operation");
|
||||
|
||||
SYSCTL_INT(_net_inet_sctp, OID_AUTO, abc_l_var, CTLFLAG_RW,
|
||||
&sctp_L2_abc_variable, 0,
|
||||
"SCTP ABC max increase per SACK (L)");
|
||||
|
||||
SYSCTL_INT(_net_inet_sctp, OID_AUTO, max_chained_mbufs, CTLFLAG_RW,
|
||||
&sctp_mbuf_threshold_count, 0,
|
||||
"Default max number of small mbufs on a chain");
|
||||
|
||||
SYSCTL_UINT(_net_inet_sctp, OID_AUTO, cmt_use_dac, CTLFLAG_RW,
|
||||
&sctp_cmt_use_dac, 0,
|
||||
"CMT DAC ON/OFF flag");
|
||||
|
||||
SYSCTL_INT(_net_inet_sctp, OID_AUTO, do_sctp_drain, CTLFLAG_RW,
|
||||
&sctp_do_drain, 0,
|
||||
"Should SCTP respond to the drain calls");
|
||||
|
||||
SYSCTL_INT(_net_inet_sctp, OID_AUTO, hb_max_burst, CTLFLAG_RW,
|
||||
&sctp_hb_maxburst, 0,
|
||||
"Confirmation Heartbeat max burst?");
|
||||
|
||||
SYSCTL_INT(_net_inet_sctp, OID_AUTO, abort_at_limit, CTLFLAG_RW,
|
||||
&sctp_abort_if_one_2_one_hits_limit, 0,
|
||||
"When one-2-one hits qlimit abort");
|
||||
|
||||
SYSCTL_INT(_net_inet_sctp, OID_AUTO, strict_data_order, CTLFLAG_RW,
|
||||
&sctp_strict_data_order, 0,
|
||||
"Enforce strict data ordering, abort if control inside data");
|
||||
|
||||
SYSCTL_STRUCT(_net_inet_sctp, OID_AUTO, stats, CTLFLAG_RW,
|
||||
&sctpstat, sctpstat,
|
||||
"SCTP statistics (struct sctps_stat, netinet/sctp.h");
|
||||
|
||||
SYSCTL_PROC(_net_inet_sctp, OID_AUTO, assoclist, CTLFLAG_RD,
|
||||
0, 0, sctp_assoclist,
|
||||
"S,xassoc", "List of active SCTP associations");
|
||||
|
||||
#ifdef SCTP_DEBUG
|
||||
SYSCTL_INT(_net_inet_sctp, OID_AUTO, debug, CTLFLAG_RW,
|
||||
&sctp_debug_on, 0, "Configure debug output");
|
||||
#endif /* SCTP_DEBUG */
|
581
sys/netinet/sctp_sysctl.h
Normal file
581
sys/netinet/sctp_sysctl.h
Normal file
@ -0,0 +1,581 @@
|
||||
/*-
|
||||
* Copyright (c) 2007, Cisco Systems, Inc. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* a) Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* b) Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* c) Neither the name of Cisco Systems, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
* THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#ifndef __sctp_sysctl_h__
|
||||
#define __sctp_sysctl_h__
|
||||
|
||||
#include <netinet/sctp_os.h>
|
||||
#include <netinet/sctp_constants.h>
|
||||
|
||||
/*
|
||||
* limits for the sysctl variables
|
||||
*/
|
||||
/* maxdgram: Maximum outgoing SCTP buffer size */
|
||||
#define SCTPCTL_MAXDGRAM 1
|
||||
#define SCTPCTL_MAXDGRAM_DESC "Maximum outgoing SCTP buffer size"
|
||||
#define SCTPCTL_MAXDGRAM_MIN 0
|
||||
#define SCTPCTL_MAXDGRAM_MAX 0xFFFFFFFF
|
||||
#define SCTPCTL_MAXDGRAM_DEFAULT 262144 /* 256k */
|
||||
|
||||
/* recvspace: Maximum incoming SCTP buffer size */
|
||||
#define SCTPCTL_RECVSPACE 2
|
||||
#define SCTPCTL_RECVSPACE_DESC "Maximum incoming SCTP buffer size"
|
||||
#define SCTPCTL_RECVSPACE_MIN 0
|
||||
#define SCTPCTL_RECVSPACE_MAX 0xFFFFFFFF
|
||||
#define SCTPCTL_RECVSPACE_DEFAULT 262144 /* 256k */
|
||||
|
||||
/* autoasconf: Enable SCTP Auto-ASCONF */
|
||||
#define SCTPCTL_AUTOASCONF 3
|
||||
#define SCTPCTL_AUTOASCONF_DESC "Enable SCTP Auto-ASCONF"
|
||||
#define SCTPCTL_AUTOASCONF_MIN 0
|
||||
#define SCTPCTL_AUTOASCONF_MAX 1
|
||||
#define SCTPCTL_AUTOASCONF_DEFAULT SCTP_DEFAULT_AUTO_ASCONF
|
||||
|
||||
/* ecn_enable: Enable SCTP ECN */
|
||||
#define SCTPCTL_ECN_ENABLE 4
|
||||
#define SCTPCTL_ECN_ENABLE_DESC "Enable SCTP ECN"
|
||||
#define SCTPCTL_ECN_ENABLE_MIN 0
|
||||
#define SCTPCTL_ECN_ENABLE_MAX 1
|
||||
#define SCTPCTL_ECN_ENABLE_DEFAULT 1
|
||||
|
||||
/* ecn_nonce: Enable SCTP ECN Nonce */
|
||||
#define SCTPCTL_ECN_NONCE 5
|
||||
#define SCTPCTL_ECN_NONCE_DESC "Enable SCTP ECN Nonce"
|
||||
#define SCTPCTL_ECN_NONCE_MIN 0
|
||||
#define SCTPCTL_ECN_NONCE_MAX 1
|
||||
#define SCTPCTL_ECN_NONCE_DEFAULT 0
|
||||
|
||||
/* strict_sacks: Enable SCTP Strict SACK checking */
|
||||
#define SCTPCTL_STRICT_SACKS 6
|
||||
#define SCTPCTL_STRICT_SACKS_DESC "Enable SCTP Strict SACK checking"
|
||||
#define SCTPCTL_STRICT_SACKS_MIN 0
|
||||
#define SCTPCTL_STRICT_SACKS_MAX 1
|
||||
#define SCTPCTL_STRICT_SACKS_DEFAULT 0
|
||||
|
||||
/* loopback_nocsum: Enable NO Csum on packets sent on loopback */
|
||||
#define SCTPCTL_LOOPBACK_NOCSUM 7
|
||||
#define SCTPCTL_LOOPBACK_NOCSUM_DESC "Enable NO Csum on packets sent on loopback"
|
||||
#define SCTPCTL_LOOPBACK_NOCSUM_MIN 0
|
||||
#define SCTPCTL_LOOPBACK_NOCSUM_MAX 1
|
||||
#define SCTPCTL_LOOPBACK_NOCSUM_DEFAULT 1
|
||||
|
||||
/* strict_init: Enable strict INIT/INIT-ACK singleton enforcement */
|
||||
#define SCTPCTL_STRICT_INIT 8
|
||||
#define SCTPCTL_STRICT_INIT_DESC "Enable strict INIT/INIT-ACK singleton enforcement"
|
||||
#define SCTPCTL_STRICT_INIT_MIN 0
|
||||
#define SCTPCTL_STRICT_INIT_MAX 1
|
||||
#define SCTPCTL_STRICT_INIT_DEFAULT 1
|
||||
|
||||
/* peer_chkoh: Amount to debit peers rwnd per chunk sent */
|
||||
#define SCTPCTL_PEER_CHKOH 9
|
||||
#define SCTPCTL_PEER_CHKOH_DESC "Amount to debit peers rwnd per chunk sent"
|
||||
#define SCTPCTL_PEER_CHKOH_MIN 0
|
||||
#define SCTPCTL_PEER_CHKOH_MAX 0xFFFFFFFF
|
||||
#define SCTPCTL_PEER_CHKOH_DEFAULT 0 /* sizeof struct mbuf */
|
||||
|
||||
/* maxburst: Default max burst for sctp endpoints */
|
||||
#define SCTPCTL_MAXBURST 10
|
||||
#define SCTPCTL_MAXBURST_DESC "Default max burst for sctp endpoints"
|
||||
#define SCTPCTL_MAXBURST_MIN 1
|
||||
#define SCTPCTL_MAXBURST_MAX 0xFFFFFFFF
|
||||
#define SCTPCTL_MAXBURST_DEFAULT SCTP_DEF_MAX_BURST
|
||||
|
||||
/* maxchunks: Default max chunks on queue per asoc */
|
||||
#define SCTPCTL_MAXCHUNKS 11
|
||||
#define SCTPCTL_MAXCHUNKS_DESC "Default max chunks on queue per asoc"
|
||||
#define SCTPCTL_MAXCHUNKS_MIN 0
|
||||
#define SCTPCTL_MAXCHUNKS_MAX 0xFFFFFFFF
|
||||
#define SCTPCTL_MAXCHUNKS_DEFAULT SCTP_ASOC_MAX_CHUNKS_ON_QUEUE
|
||||
|
||||
/* tcbhashsize: Tuneable for Hash table sizes */
|
||||
#define SCTPCTL_TCBHASHSIZE 12
|
||||
#define SCTPCTL_TCBHASHSIZE_DESC "Tunable for TCB hash table sizes"
|
||||
#define SCTPCTL_TCBHASHSIZE_MIN 1
|
||||
#define SCTPCTL_TCBHASHSIZE_MAX 0xFFFFFFFF
|
||||
#define SCTPCTL_TCBHASHSIZE_DEFAULT SCTP_TCBHASHSIZE
|
||||
|
||||
/* pcbhashsize: Tuneable for PCB Hash table sizes */
|
||||
#define SCTPCTL_PCBHASHSIZE 13
|
||||
#define SCTPCTL_PCBHASHSIZE_DESC "Tunable for PCB hash table sizes"
|
||||
#define SCTPCTL_PCBHASHSIZE_MIN 1
|
||||
#define SCTPCTL_PCBHASHSIZE_MAX 0xFFFFFFFF
|
||||
#define SCTPCTL_PCBHASHSIZE_DEFAULT SCTP_PCBHASHSIZE
|
||||
|
||||
/* min_split_point: Minimum size when splitting a chunk */
|
||||
#define SCTPCTL_MIN_SPLIT_POINT 14
|
||||
#define SCTPCTL_MIN_SPLIT_POINT_DESC "Minimum size when splitting a chunk"
|
||||
#define SCTPCTL_MIN_SPLIT_POINT_MIN 0
|
||||
#define SCTPCTL_MIN_SPLIT_POINT_MAX 0xFFFFFFFF
|
||||
#define SCTPCTL_MIN_SPLIT_POINT_DEFAULT SCTP_DEFAULT_SPLIT_POINT_MIN
|
||||
|
||||
/* chunkscale: Tuneable for Scaling of number of chunks and messages */
|
||||
#define SCTPCTL_CHUNKSCALE 15
|
||||
#define SCTPCTL_CHUNKSCALE_DESC "Tuneable for Scaling of number of chunks and messages"
|
||||
#define SCTPCTL_CHUNKSCALE_MIN 1
|
||||
#define SCTPCTL_CHUNKSCALE_MAX 0xFFFFFFFF
|
||||
#define SCTPCTL_CHUNKSCALE_DEFAULT SCTP_CHUNKQUEUE_SCALE
|
||||
|
||||
/* delayed_sack_time: Default delayed SACK timer in msec */
|
||||
#define SCTPCTL_DELAYED_SACK_TIME 16
|
||||
#define SCTPCTL_DELAYED_SACK_TIME_DESC "Default delayed SACK timer in msec"
|
||||
#define SCTPCTL_DELAYED_SACK_TIME_MIN 0
|
||||
#define SCTPCTL_DELAYED_SACK_TIME_MAX 0xFFFFFFFF
|
||||
#define SCTPCTL_DELAYED_SACK_TIME_DEFAULT SCTP_RECV_MSEC
|
||||
|
||||
/* sack_freq: Default SACK frequency */
|
||||
#define SCTPCTL_SACK_FREQ 17
|
||||
#define SCTPCTL_SACK_FREQ_DESC "Default SACK frequency"
|
||||
#define SCTPCTL_SACK_FREQ_MIN 0
|
||||
#define SCTPCTL_SACK_FREQ_MAX 0xFFFFFFFF
|
||||
#define SCTPCTL_SACK_FREQ_DEFAULT SCTP_DEFAULT_SACK_FREQ
|
||||
|
||||
/* sys_resource: Max number of cached resources in the system */
|
||||
#define SCTPCTL_SYS_RESOURCE 18
|
||||
#define SCTPCTL_SYS_RESOURCE_DESC "Max number of cached resources in the system"
|
||||
#define SCTPCTL_SYS_RESOURCE_MIN 0
|
||||
#define SCTPCTL_SYS_RESOURCE_MAX 0xFFFFFFFF
|
||||
#define SCTPCTL_SYS_RESOURCE_DEFAULT SCTP_DEF_SYSTEM_RESC_LIMIT
|
||||
|
||||
/* asoc_resource: Max number of cached resources in an asoc */
|
||||
#define SCTPCTL_ASOC_RESOURCE 19
|
||||
#define SCTPCTL_ASOC_RESOURCE_DESC "Max number of cached resources in an asoc"
|
||||
#define SCTPCTL_ASOC_RESOURCE_MIN 0
|
||||
#define SCTPCTL_ASOC_RESOURCE_MAX 0xFFFFFFFF
|
||||
#define SCTPCTL_ASOC_RESOURCE_DEFAULT SCTP_DEF_ASOC_RESC_LIMIT
|
||||
|
||||
/* heartbeat_interval: Default heartbeat interval in msec */
|
||||
#define SCTPCTL_HEARTBEAT_INTERVAL 20
|
||||
#define SCTPCTL_HEARTBEAT_INTERVAL_DESC "Default heartbeat interval in msec"
|
||||
#define SCTPCTL_HEARTBEAT_INTERVAL_MIN 0
|
||||
#define SCTPCTL_HEARTBEAT_INTERVAL_MAX 0xFFFFFFFF
|
||||
#define SCTPCTL_HEARTBEAT_INTERVAL_DEFAULT SCTP_HB_DEFAULT_MSEC
|
||||
|
||||
/* pmtu_raise_time: Default PMTU raise timer in sec */
|
||||
#define SCTPCTL_PMTU_RAISE_TIME 21
|
||||
#define SCTPCTL_PMTU_RAISE_TIME_DESC "Default PMTU raise timer in sec"
|
||||
#define SCTPCTL_PMTU_RAISE_TIME_MIN 0
|
||||
#define SCTPCTL_PMTU_RAISE_TIME_MAX 0xFFFFFFFF
|
||||
#define SCTPCTL_PMTU_RAISE_TIME_DEFAULT SCTP_DEF_PMTU_RAISE_SEC
|
||||
|
||||
/* shutdown_guard_time: Default shutdown guard timer in sec */
|
||||
#define SCTPCTL_SHUTDOWN_GUARD_TIME 22
|
||||
#define SCTPCTL_SHUTDOWN_GUARD_TIME_DESC "Default shutdown guard timer in sec"
|
||||
#define SCTPCTL_SHUTDOWN_GUARD_TIME_MIN 0
|
||||
#define SCTPCTL_SHUTDOWN_GUARD_TIME_MAX 0xFFFFFFFF
|
||||
#define SCTPCTL_SHUTDOWN_GUARD_TIME_DEFAULT SCTP_DEF_MAX_SHUTDOWN_SEC
|
||||
|
||||
/* secret_lifetime: Default secret lifetime in sec */
|
||||
#define SCTPCTL_SECRET_LIFETIME 23
|
||||
#define SCTPCTL_SECRET_LIFETIME_DESC "Default secret lifetime in sec"
|
||||
#define SCTPCTL_SECRET_LIFETIME_MIN 0
|
||||
#define SCTPCTL_SECRET_LIFETIME_MAX 0xFFFFFFFF
|
||||
#define SCTPCTL_SECRET_LIFETIME_DEFAULT SCTP_DEFAULT_SECRET_LIFE_SEC
|
||||
|
||||
/* rto_max: Default maximum retransmission timeout in msec */
|
||||
#define SCTPCTL_RTO_MAX 24
|
||||
#define SCTPCTL_RTO_MAX_DESC "Default maximum retransmission timeout in msec"
|
||||
#define SCTPCTL_RTO_MAX_MIN 0
|
||||
#define SCTPCTL_RTO_MAX_MAX 0xFFFFFFFF
|
||||
#define SCTPCTL_RTO_MAX_DEFAULT SCTP_RTO_UPPER_BOUND
|
||||
|
||||
/* rto_min: Default minimum retransmission timeout in msec */
|
||||
#define SCTPCTL_RTO_MIN 25
|
||||
#define SCTPCTL_RTO_MIN_DESC "Default minimum retransmission timeout in msec"
|
||||
#define SCTPCTL_RTO_MIN_MIN 0
|
||||
#define SCTPCTL_RTO_MIN_MAX 0xFFFFFFFF
|
||||
#define SCTPCTL_RTO_MIN_DEFAULT SCTP_RTO_LOWER_BOUND
|
||||
|
||||
/* rto_initial: Default initial retransmission timeout in msec */
|
||||
#define SCTPCTL_RTO_INITIAL 26
|
||||
#define SCTPCTL_RTO_INITIAL_DESC "Default initial retransmission timeout in msec"
|
||||
#define SCTPCTL_RTO_INITIAL_MIN 0
|
||||
#define SCTPCTL_RTO_INITIAL_MAX 0xFFFFFFFF
|
||||
#define SCTPCTL_RTO_INITIAL_DEFAULT SCTP_RTO_INITIAL
|
||||
|
||||
/* init_rto_max: Default maximum retransmission timeout during association setup in msec */
|
||||
#define SCTPCTL_INIT_RTO_MAX 27
|
||||
#define SCTPCTL_INIT_RTO_MAX_DESC "Default maximum retransmission timeout during association setup in msec"
|
||||
#define SCTPCTL_INIT_RTO_MAX_MIN 0
|
||||
#define SCTPCTL_INIT_RTO_MAX_MAX 0xFFFFFFFF
|
||||
#define SCTPCTL_INIT_RTO_MAX_DEFAULT SCTP_RTO_UPPER_BOUND
|
||||
|
||||
/* valid_cookie_life: Default cookie lifetime in sec */
|
||||
#define SCTPCTL_VALID_COOKIE_LIFE 28
|
||||
#define SCTPCTL_VALID_COOKIE_LIFE_DESC "Default cookie lifetime in sec"
|
||||
#define SCTPCTL_VALID_COOKIE_LIFE_MIN 0
|
||||
#define SCTPCTL_VALID_COOKIE_LIFE_MAX 0xFFFFFFFF
|
||||
#define SCTPCTL_VALID_COOKIE_LIFE_DEFAULT SCTP_DEFAULT_COOKIE_LIFE
|
||||
|
||||
/* init_rtx_max: Default maximum number of retransmission for INIT chunks */
|
||||
#define SCTPCTL_INIT_RTX_MAX 29
|
||||
#define SCTPCTL_INIT_RTX_MAX_DESC "Default maximum number of retransmission for INIT chunks"
|
||||
#define SCTPCTL_INIT_RTX_MAX_MIN 0
|
||||
#define SCTPCTL_INIT_RTX_MAX_MAX 0xFFFFFFFF
|
||||
#define SCTPCTL_INIT_RTX_MAX_DEFAULT SCTP_DEF_MAX_INIT
|
||||
|
||||
/* assoc_rtx_max: Default maximum number of retransmissions per association */
|
||||
#define SCTPCTL_ASSOC_RTX_MAX 30
|
||||
#define SCTPCTL_ASSOC_RTX_MAX_DESC "Default maximum number of retransmissions per association"
|
||||
#define SCTPCTL_ASSOC_RTX_MAX_MIN 0
|
||||
#define SCTPCTL_ASSOC_RTX_MAX_MAX 0xFFFFFFFF
|
||||
#define SCTPCTL_ASSOC_RTX_MAX_DEFAULT SCTP_DEF_MAX_SEND
|
||||
|
||||
/* path_rtx_max: Default maximum of retransmissions per path */
|
||||
#define SCTPCTL_PATH_RTX_MAX 31
|
||||
#define SCTPCTL_PATH_RTX_MAX_DESC "Default maximum of retransmissions per path"
|
||||
#define SCTPCTL_PATH_RTX_MAX_MIN 0
|
||||
#define SCTPCTL_PATH_RTX_MAX_MAX 0xFFFFFFFF
|
||||
#define SCTPCTL_PATH_RTX_MAX_DEFAULT SCTP_DEF_MAX_PATH_RTX
|
||||
|
||||
/* add_more_on_output: When space wise is it worthwhile to try to add more to a socket send buffer */
|
||||
#define SCTPCTL_ADD_MORE_ON_OUTPUT 32
|
||||
#define SCTPCTL_ADD_MORE_ON_OUTPUT_DESC "When space wise is it worthwhile to try to add more to a socket send buffer"
|
||||
#define SCTPCTL_ADD_MORE_ON_OUTPUT_MIN 0
|
||||
#define SCTPCTL_ADD_MORE_ON_OUTPUT_MAX 0xFFFFFFFF
|
||||
#define SCTPCTL_ADD_MORE_ON_OUTPUT_DEFAULT SCTP_DEFAULT_ADD_MORE
|
||||
|
||||
/* outgoing_streams: Default number of outgoing streams */
|
||||
#define SCTPCTL_OUTGOING_STREAMS 33
|
||||
#define SCTPCTL_OUTGOING_STREAMS_DESC "Default number of outgoing streams"
|
||||
#define SCTPCTL_OUTGOING_STREAMS_MIN 1
|
||||
#define SCTPCTL_OUTGOING_STREAMS_MAX 65535
|
||||
#define SCTPCTL_OUTGOING_STREAMS_DEFAULT SCTP_OSTREAM_INITIAL
|
||||
|
||||
/* cmt_on_off: CMT on/off flag */
|
||||
#define SCTPCTL_CMT_ON_OFF 34
|
||||
#define SCTPCTL_CMT_ON_OFF_DESC "CMT on/off flag"
|
||||
#define SCTPCTL_CMT_ON_OFF_MIN 0
|
||||
#define SCTPCTL_CMT_ON_OFF_MAX 1
|
||||
#define SCTPCTL_CMT_ON_OFF_DEFAULT 0
|
||||
|
||||
/* cwnd_maxburst: Use a CWND adjusting maxburst */
|
||||
#define SCTPCTL_CWND_MAXBURST 35
|
||||
#define SCTPCTL_CWND_MAXBURST_DESC "Use a CWND adjusting maxburst"
|
||||
#define SCTPCTL_CWND_MAXBURST_MIN 0
|
||||
#define SCTPCTL_CWND_MAXBURST_MAX 1
|
||||
#define SCTPCTL_CWND_MAXBURST_DEFAULT 1
|
||||
|
||||
/* early_fast_retran: Early Fast Retransmit with timer */
|
||||
#define SCTPCTL_EARLY_FAST_RETRAN 36
|
||||
#define SCTPCTL_EARLY_FAST_RETRAN_DESC "Early Fast Retransmit with timer"
|
||||
#define SCTPCTL_EARLY_FAST_RETRAN_MIN 0
|
||||
#define SCTPCTL_EARLY_FAST_RETRAN_MAX 0xFFFFFFFF
|
||||
#define SCTPCTL_EARLY_FAST_RETRAN_DEFAULT 0
|
||||
|
||||
/* use_rttvar_congctrl: Use Congestion Control via rtt variation */
|
||||
#define SCTPCTL_USE_RTTVAR_CONGCTRL 37
|
||||
#define SCTPCTL_USE_RTTVAR_CONGCTRL_DESC "Use Congestion Control via rtt variation"
|
||||
#define SCTPCTL_USE_RTTVAR_CONGCTRL_MIN 0
|
||||
#define SCTPCTL_USE_RTTVAR_CONGCTRL_MAX 1
|
||||
#define SCTPCTL_USE_RTTVAR_CONGCTRL_DEFAULT 0 /* UNUSED?? */
|
||||
|
||||
/* deadlock_detect: SMP Deadlock detection on/off */
|
||||
#define SCTPCTL_DEADLOCK_DETECT 38
|
||||
#define SCTPCTL_DEADLOCK_DETECT_DESC "SMP Deadlock detection on/off"
|
||||
#define SCTPCTL_DEADLOCK_DETECT_MIN 0
|
||||
#define SCTPCTL_DEADLOCK_DETECT_MAX 1
|
||||
#define SCTPCTL_DEADLOCK_DETECT_DEFAULT 0
|
||||
|
||||
/* early_fast_retran_msec: Early Fast Retransmit minimum timer value */
|
||||
#define SCTPCTL_EARLY_FAST_RETRAN_MSEC 39
|
||||
#define SCTPCTL_EARLY_FAST_RETRAN_MSEC_DESC "Early Fast Retransmit minimum timer value"
|
||||
#define SCTPCTL_EARLY_FAST_RETRAN_MSEC_MIN 0
|
||||
#define SCTPCTL_EARLY_FAST_RETRAN_MSEC_MAX 0xFFFFFFFF
|
||||
#define SCTPCTL_EARLY_FAST_RETRAN_MSEC_DEFAULT SCTP_MINFR_MSEC_TIMER
|
||||
|
||||
/* asconf_auth_nochk: Disable SCTP ASCONF AUTH requirement */
|
||||
#define SCTPCTL_ASCONF_AUTH_NOCHK 40
|
||||
#define SCTPCTL_ASCONF_AUTH_NOCHK_DESC "Disable SCTP ASCONF AUTH requirement"
|
||||
#define SCTPCTL_ASCONF_AUTH_NOCHK_MIN 0
|
||||
#define SCTPCTL_ASCONF_AUTH_NOCHK_MAX 1
|
||||
#define SCTPCTL_ASCONF_AUTH_NOCHK_DEFAULT 0
|
||||
|
||||
/* auth_disable: Disable SCTP AUTH function */
|
||||
#define SCTPCTL_AUTH_DISABLE 41
|
||||
#define SCTPCTL_AUTH_DISABLE_DESC "Disable SCTP AUTH function"
|
||||
#define SCTPCTL_AUTH_DISABLE_MIN 0
|
||||
#define SCTPCTL_AUTH_DISABLE_MAX 1
|
||||
#define SCTPCTL_AUTH_DISABLE_DEFAULT 0
|
||||
|
||||
/* nat_friendly: SCTP NAT friendly operation */
|
||||
#define SCTPCTL_NAT_FRIENDLY 42
|
||||
#define SCTPCTL_NAT_FRIENDLY_DESC "SCTP NAT friendly operation"
|
||||
#define SCTPCTL_NAT_FRIENDLY_MIN 0
|
||||
#define SCTPCTL_NAT_FRIENDLY_MAX 1
|
||||
#define SCTPCTL_NAT_FRIENDLY_DEFAULT 1
|
||||
|
||||
/* abc_l_var: SCTP ABC max increase per SACK (L) */
|
||||
#define SCTPCTL_ABC_L_VAR 43
|
||||
#define SCTPCTL_ABC_L_VAR_DESC "SCTP ABC max increase per SACK (L)"
|
||||
#define SCTPCTL_ABC_L_VAR_MIN 0
|
||||
#define SCTPCTL_ABC_L_VAR_MAX 0xFFFFFFFF
|
||||
#define SCTPCTL_ABC_L_VAR_DEFAULT 1
|
||||
|
||||
/* max_chained_mbufs: Default max number of small mbufs on a chain */
|
||||
#define SCTPCTL_MAX_CHAINED_MBUFS 44
|
||||
#define SCTPCTL_MAX_CHAINED_MBUFS_DESC "Default max number of small mbufs on a chain"
|
||||
#define SCTPCTL_MAX_CHAINED_MBUFS_MIN 0
|
||||
#define SCTPCTL_MAX_CHAINED_MBUFS_MAX 0xFFFFFFFF
|
||||
#define SCTPCTL_MAX_CHAINED_MBUFS_DEFAULT SCTP_DEFAULT_MBUFS_IN_CHAIN
|
||||
|
||||
/* cmt_use_dac: CMT DAC on/off flag */
|
||||
#define SCTPCTL_CMT_USE_DAC 45
|
||||
#define SCTPCTL_CMT_USE_DAC_DESC "CMT DAC on/off flag"
|
||||
#define SCTPCTL_CMT_USE_DAC_MIN 0
|
||||
#define SCTPCTL_CMT_USE_DAC_MAX 1
|
||||
#define SCTPCTL_CMT_USE_DAC_DEFAULT 0
|
||||
|
||||
/* do_sctp_drain: Should SCTP respond to the drain calls */
|
||||
#define SCTPCTL_DO_SCTP_DRAIN 46
|
||||
#define SCTPCTL_DO_SCTP_DRAIN_DESC "Should SCTP respond to the drain calls"
|
||||
#define SCTPCTL_DO_SCTP_DRAIN_MIN 0
|
||||
#define SCTPCTL_DO_SCTP_DRAIN_MAX 1
|
||||
#define SCTPCTL_DO_SCTP_DRAIN_DEFAULT 1
|
||||
|
||||
/* hb_max_burst: Confirmation Heartbeat max burst? */
|
||||
#define SCTPCTL_HB_MAX_BURST 47
|
||||
#define SCTPCTL_HB_MAX_BURST_DESC "Confirmation Heartbeat max burst?"
|
||||
#define SCTPCTL_HB_MAX_BURST_MIN 1
|
||||
#define SCTPCTL_HB_MAX_BURST_MAX 0xFFFFFFFF
|
||||
#define SCTPCTL_HB_MAX_BURST_DEFAULT SCTP_DEF_MAX_BURST
|
||||
|
||||
/* abort_at_limit: When one-2-one hits qlimit abort */
|
||||
#define SCTPCTL_ABORT_AT_LIMIT 48
|
||||
#define SCTPCTL_ABORT_AT_LIMIT_DESC "When one-2-one hits qlimit abort"
|
||||
#define SCTPCTL_ABORT_AT_LIMIT_MIN 0
|
||||
#define SCTPCTL_ABORT_AT_LIMIT_MAX 1
|
||||
#define SCTPCTL_ABORT_AT_LIMIT_DEFAULT 0
|
||||
|
||||
/* strict_data_order: Enforce strict data ordering, abort if control inside data */
|
||||
#define SCTPCTL_STRICT_DATA_ORDER 49
|
||||
#define SCTPCTL_STRICT_DATA_ORDER_DESC "Enforce strict data ordering, abort if control inside data"
|
||||
#define SCTPCTL_STRICT_DATA_ORDER_MIN 0
|
||||
#define SCTPCTL_STRICT_DATA_ORDER_MAX 1
|
||||
#define SCTPCTL_STRICT_DATA_ORDER_DEFAULT 0
|
||||
|
||||
/* debug: Configure debug output */
|
||||
#define SCTPCTL_DEBUG 50
|
||||
#define SCTPCTL_DEBUG_DESC "Configure debug output"
|
||||
#define SCTPCTL_DEBUG_MIN 0
|
||||
#define SCTPCTL_DEBUG_MAX 0xFFFFFFFF
|
||||
#define SCTPCTL_DEBUG_DEFAULT 0
|
||||
|
||||
#ifdef SCTP_DEBUG
|
||||
#define SCTPCTL_MAXID 50
|
||||
#else
|
||||
#define SCTPCTL_MAXID 49
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Names for SCTP sysctl objects variables.
|
||||
* Must match the OIDs above.
|
||||
*/
|
||||
#ifdef SCTP_DEBUG
|
||||
#define SCTPCTL_NAMES { \
|
||||
{ 0, 0 }, \
|
||||
{ "sendspace", CTLTYPE_INT }, \
|
||||
{ "recvspace", CTLTYPE_INT }, \
|
||||
{ "autoasconf", CTLTYPE_INT }, \
|
||||
{ "ecn_enable", CTLTYPE_INT }, \
|
||||
{ "ecn_nonce", CTLTYPE_INT }, \
|
||||
{ "strict_sack", CTLTYPE_INT }, \
|
||||
{ "looback_nocsum", CTLTYPE_INT }, \
|
||||
{ "strict_init", CTLTYPE_INT }, \
|
||||
{ "peer_chkoh", CTLTYPE_INT }, \
|
||||
{ "maxburst", CTLTYPE_INT }, \
|
||||
{ "maxchunks", CTLTYPE_INT }, \
|
||||
{ "delayed_sack_time", CTLTYPE_INT }, \
|
||||
{ "sack_freq", CTLTYPE_INT }, \
|
||||
{ "heartbeat_interval", CTLTYPE_INT }, \
|
||||
{ "pmtu_raise_time", CTLTYPE_INT }, \
|
||||
{ "shutdown_guard_time", CTLTYPE_INT }, \
|
||||
{ "secret_lifetime", CTLTYPE_INT }, \
|
||||
{ "rto_max", CTLTYPE_INT }, \
|
||||
{ "rto_min", CTLTYPE_INT }, \
|
||||
{ "rto_initial", CTLTYPE_INT }, \
|
||||
{ "init_rto_max", CTLTYPE_INT }, \
|
||||
{ "valid_cookie_life", CTLTYPE_INT }, \
|
||||
{ "init_rtx_max", CTLTYPE_INT }, \
|
||||
{ "assoc_rtx_max", CTLTYPE_INT }, \
|
||||
{ "path_rtx_max", CTLTYPE_INT }, \
|
||||
{ "outgoing_streams", CTLTYPE_INT }, \
|
||||
{ "cmt_on_off", CTLTYPE_INT }, \
|
||||
{ "cwnd_maxburst", CTLTYPE_INT }, \
|
||||
{ "early_fast_retran", CTLTYPE_INT }, \
|
||||
{ "use_rttvar_congctrl", CTLTYPE_INT }, \
|
||||
{ "deadlock_detect", CTLTYPE_INT }, \
|
||||
{ "early_fast_retran_msec", CTLTYPE_INT }, \
|
||||
{ "asconf_auth_nochk", CTLTYPE_INT }, \
|
||||
{ "auth_disable", CTLTYPE_INT }, \
|
||||
{ "nat_friendly", CTLTYPE_INT }, \
|
||||
{ "abc_l_var", CTLTYPE_INT }, \
|
||||
{ "max_mbuf_chain", CTLTYPE_INT }, \
|
||||
{ "cmt_use_dac", CTLTYPE_INT }, \
|
||||
{ "do_sctp_drain", CTLTYPE_INT }, \
|
||||
{ "warm_crc_table", CTLTYPE_INT }, \
|
||||
{ "abort_at_limit", CTLTYPE_INT }, \
|
||||
{ "strict_data_order", CTLTYPE_INT }, \
|
||||
{ "tcbhashsize", CTLTYPE_INT }, \
|
||||
{ "pcbhashsize", CTLTYPE_INT }, \
|
||||
{ "chunkscale", CTLTYPE_INT }, \
|
||||
{ "min_split_point", CTLTYPE_INT }, \
|
||||
{ "add_more_on_output", CTLTYPE_INT }, \
|
||||
{ "sys_resource", CTLTYPE_INT }, \
|
||||
{ "asoc_resource", CTLTYPE_INT }, \
|
||||
{ "debug", CTLTYPE_INT }, \
|
||||
}
|
||||
#else
|
||||
#define SCTPCTL_NAMES { \
|
||||
{ 0, 0 }, \
|
||||
{ "sendspace", CTLTYPE_INT }, \
|
||||
{ "recvspace", CTLTYPE_INT }, \
|
||||
{ "autoasconf", CTLTYPE_INT }, \
|
||||
{ "ecn_enable", CTLTYPE_INT }, \
|
||||
{ "ecn_nonce", CTLTYPE_INT }, \
|
||||
{ "strict_sack", CTLTYPE_INT }, \
|
||||
{ "looback_nocsum", CTLTYPE_INT }, \
|
||||
{ "strict_init", CTLTYPE_INT }, \
|
||||
{ "peer_chkoh", CTLTYPE_INT }, \
|
||||
{ "maxburst", CTLTYPE_INT }, \
|
||||
{ "maxchunks", CTLTYPE_INT }, \
|
||||
{ "delayed_sack_time", CTLTYPE_INT }, \
|
||||
{ "sack_freq", CTLTYPE_INT }, \
|
||||
{ "heartbeat_interval", CTLTYPE_INT }, \
|
||||
{ "pmtu_raise_time", CTLTYPE_INT }, \
|
||||
{ "shutdown_guard_time", CTLTYPE_INT }, \
|
||||
{ "secret_lifetime", CTLTYPE_INT }, \
|
||||
{ "rto_max", CTLTYPE_INT }, \
|
||||
{ "rto_min", CTLTYPE_INT }, \
|
||||
{ "rto_initial", CTLTYPE_INT }, \
|
||||
{ "init_rto_max", CTLTYPE_INT }, \
|
||||
{ "valid_cookie_life", CTLTYPE_INT }, \
|
||||
{ "init_rtx_max", CTLTYPE_INT }, \
|
||||
{ "assoc_rtx_max", CTLTYPE_INT }, \
|
||||
{ "path_rtx_max", CTLTYPE_INT }, \
|
||||
{ "outgoing_streams", CTLTYPE_INT }, \
|
||||
{ "cmt_on_off", CTLTYPE_INT }, \
|
||||
{ "cwnd_maxburst", CTLTYPE_INT }, \
|
||||
{ "early_fast_retran", CTLTYPE_INT }, \
|
||||
{ "use_rttvar_congctrl", CTLTYPE_INT }, \
|
||||
{ "deadlock_detect", CTLTYPE_INT }, \
|
||||
{ "early_fast_retran_msec", CTLTYPE_INT }, \
|
||||
{ "asconf_auth_nochk", CTLTYPE_INT }, \
|
||||
{ "auth_disable", CTLTYPE_INT }, \
|
||||
{ "nat_friendly", CTLTYPE_INT }, \
|
||||
{ "abc_l_var", CTLTYPE_INT }, \
|
||||
{ "max_mbuf_chain", CTLTYPE_INT }, \
|
||||
{ "cmt_use_dac", CTLTYPE_INT }, \
|
||||
{ "do_sctp_drain", CTLTYPE_INT }, \
|
||||
{ "warm_crc_table", CTLTYPE_INT }, \
|
||||
{ "abort_at_limit", CTLTYPE_INT }, \
|
||||
{ "strict_data_order", CTLTYPE_INT }, \
|
||||
{ "tcbhashsize", CTLTYPE_INT }, \
|
||||
{ "pcbhashsize", CTLTYPE_INT }, \
|
||||
{ "chunkscale", CTLTYPE_INT }, \
|
||||
{ "min_split_point", CTLTYPE_INT }, \
|
||||
{ "add_more_on_output", CTLTYPE_INT }, \
|
||||
{ "sys_resource", CTLTYPE_INT }, \
|
||||
{ "asoc_resource", CTLTYPE_INT }, \
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(_KERNEL)
|
||||
|
||||
/*
|
||||
* variable definitions
|
||||
*/
|
||||
extern uint32_t sctp_sendspace;
|
||||
extern uint32_t sctp_recvspace;
|
||||
extern uint32_t sctp_auto_asconf;
|
||||
extern uint32_t sctp_ecn_enable;
|
||||
extern uint32_t sctp_ecn_nonce;
|
||||
extern uint32_t sctp_strict_sacks;
|
||||
extern uint32_t sctp_no_csum_on_loopback;
|
||||
extern uint32_t sctp_strict_init;
|
||||
extern uint32_t sctp_peer_chunk_oh;
|
||||
extern uint32_t sctp_max_burst_default;
|
||||
extern uint32_t sctp_max_chunks_on_queue;
|
||||
extern uint32_t sctp_hashtblsize;
|
||||
extern uint32_t sctp_pcbtblsize;
|
||||
extern uint32_t sctp_min_split_point;
|
||||
extern uint32_t sctp_chunkscale;
|
||||
extern uint32_t sctp_delayed_sack_time_default;
|
||||
extern uint32_t sctp_sack_freq_default;
|
||||
extern uint32_t sctp_system_free_resc_limit;
|
||||
extern uint32_t sctp_asoc_free_resc_limit;
|
||||
extern uint32_t sctp_heartbeat_interval_default;
|
||||
extern uint32_t sctp_pmtu_raise_time_default;
|
||||
extern uint32_t sctp_shutdown_guard_time_default;
|
||||
extern uint32_t sctp_secret_lifetime_default;
|
||||
extern uint32_t sctp_rto_max_default;
|
||||
extern uint32_t sctp_rto_min_default;
|
||||
extern uint32_t sctp_rto_initial_default;
|
||||
extern uint32_t sctp_init_rto_max_default;
|
||||
extern uint32_t sctp_valid_cookie_life_default;
|
||||
extern uint32_t sctp_init_rtx_max_default;
|
||||
extern uint32_t sctp_assoc_rtx_max_default;
|
||||
extern uint32_t sctp_path_rtx_max_default;
|
||||
extern uint32_t sctp_add_more_threshold;
|
||||
extern uint32_t sctp_nr_outgoing_streams_default;
|
||||
extern uint32_t sctp_cmt_on_off;
|
||||
extern uint32_t sctp_use_cwnd_based_maxburst;
|
||||
extern uint32_t sctp_early_fr;
|
||||
extern uint32_t sctp_use_rttvar_cc;
|
||||
extern uint32_t sctp_says_check_for_deadlock;
|
||||
extern uint32_t sctp_early_fr_msec;
|
||||
extern uint32_t sctp_asconf_auth_nochk;
|
||||
extern uint32_t sctp_auth_disable;
|
||||
extern uint32_t sctp_nat_friendly;
|
||||
extern uint32_t sctp_L2_abc_variable;
|
||||
extern uint32_t sctp_mbuf_threshold_count;
|
||||
extern uint32_t sctp_cmt_use_dac;
|
||||
extern uint32_t sctp_do_drain;
|
||||
extern uint32_t sctp_hb_maxburst;
|
||||
extern uint32_t sctp_abort_if_one_2_one_hits_limit;
|
||||
extern uint32_t sctp_strict_data_order;
|
||||
|
||||
#if defined(SCTP_DEBUG)
|
||||
extern uint32_t sctp_debug_on;
|
||||
|
||||
#endif
|
||||
|
||||
extern struct sctpstat sctpstat;
|
||||
|
||||
|
||||
#ifdef SYSCTL_DECL
|
||||
SYSCTL_DECL(_net_inet_sctp);
|
||||
#endif
|
||||
|
||||
#endif /* _KERNEL */
|
||||
#endif /* __sctp_sysctl_h__ */
|
@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <netinet6/sctp6_var.h>
|
||||
#endif
|
||||
#include <netinet/sctp_var.h>
|
||||
#include <netinet/sctp_sysctl.h>
|
||||
#include <netinet/sctp_timer.h>
|
||||
#include <netinet/sctputil.h>
|
||||
#include <netinet/sctp_output.h>
|
||||
@ -51,13 +52,6 @@ __FBSDID("$FreeBSD$");
|
||||
#include <netinet/sctp_uio.h>
|
||||
|
||||
|
||||
#ifdef SCTP_DEBUG
|
||||
extern uint32_t sctp_debug_on;
|
||||
|
||||
#endif /* SCTP_DEBUG */
|
||||
|
||||
|
||||
extern unsigned int sctp_early_fr_msec;
|
||||
|
||||
void
|
||||
sctp_early_fr_timer(struct sctp_inpcb *inp,
|
||||
@ -224,6 +218,7 @@ sctp_threshold_management(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
|
||||
if (net->dest_state & SCTP_ADDR_REACHABLE) {
|
||||
net->dest_state &= ~SCTP_ADDR_REACHABLE;
|
||||
net->dest_state |= SCTP_ADDR_NOT_REACHABLE;
|
||||
net->dest_state &= ~SCTP_ADDR_REQ_PRIMARY;
|
||||
if (net == stcb->asoc.primary_destination) {
|
||||
net->dest_state |= SCTP_ADDR_WAS_PRIMARY;
|
||||
}
|
||||
@ -368,6 +363,10 @@ sctp_find_alternate_net(struct sctp_tcb *stcb,
|
||||
if (sin6->sin6_family == AF_INET6) {
|
||||
(void)sa6_recoverscope(sin6);
|
||||
}
|
||||
if (alt->ro._s_addr) {
|
||||
sctp_free_ifa(alt->ro._s_addr);
|
||||
alt->ro._s_addr = NULL;
|
||||
}
|
||||
alt->src_addr_selected = 0;
|
||||
}
|
||||
if (
|
||||
@ -441,8 +440,6 @@ sctp_backoff_on_timeout(struct sctp_tcb *stcb,
|
||||
}
|
||||
}
|
||||
|
||||
extern int sctp_peer_chunk_oh;
|
||||
|
||||
static int
|
||||
sctp_mark_all_for_resend(struct sctp_tcb *stcb,
|
||||
struct sctp_nets *net,
|
||||
@ -635,6 +632,11 @@ sctp_mark_all_for_resend(struct sctp_tcb *stcb,
|
||||
}
|
||||
if (stcb->asoc.total_flight_count > 0)
|
||||
stcb->asoc.total_flight_count--;
|
||||
if (chk->rec.data.chunk_was_revoked) {
|
||||
/* deflate the cwnd */
|
||||
chk->whoTo->cwnd -= chk->book_size;
|
||||
chk->rec.data.chunk_was_revoked = 0;
|
||||
}
|
||||
chk->sent = SCTP_DATAGRAM_RESEND;
|
||||
SCTP_STAT_INCR(sctps_markedretrans);
|
||||
net->marked_retrans++;
|
||||
@ -934,6 +936,10 @@ sctp_t3rxt_timer(struct sctp_inpcb *inp,
|
||||
(struct sockaddr *)NULL,
|
||||
alt) == 0) {
|
||||
net->dest_state |= SCTP_ADDR_WAS_PRIMARY;
|
||||
if (net->ro._s_addr) {
|
||||
sctp_free_ifa(net->ro._s_addr);
|
||||
net->ro._s_addr = NULL;
|
||||
}
|
||||
net->src_addr_selected = 0;
|
||||
}
|
||||
}
|
||||
@ -1387,6 +1393,15 @@ sctp_heartbeat_timer(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
|
||||
{
|
||||
if (net) {
|
||||
if (net->hb_responded == 0) {
|
||||
if (net->ro._s_addr) {
|
||||
/*
|
||||
* Invalidate the src address if we did not
|
||||
* get a response last time.
|
||||
*/
|
||||
sctp_free_ifa(net->ro._s_addr);
|
||||
net->ro._s_addr = NULL;
|
||||
net->src_addr_selected = 0;
|
||||
}
|
||||
sctp_backoff_on_timeout(stcb, net, 1, 0);
|
||||
}
|
||||
/* Zero PBA, if it needs it */
|
||||
@ -1415,10 +1430,18 @@ sctp_heartbeat_timer(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
|
||||
if ((net->dest_state & SCTP_ADDR_UNCONFIRMED) &&
|
||||
(net->dest_state & SCTP_ADDR_REACHABLE)) {
|
||||
cnt_sent++;
|
||||
if (net->hb_responded == 0) {
|
||||
/* Did we respond last time? */
|
||||
if (net->ro._s_addr) {
|
||||
sctp_free_ifa(net->ro._s_addr);
|
||||
net->ro._s_addr = NULL;
|
||||
net->src_addr_selected = 0;
|
||||
}
|
||||
}
|
||||
if (sctp_send_hb(stcb, 1, net) == 0) {
|
||||
break;
|
||||
}
|
||||
if (cnt_sent >= stcb->asoc.max_burst)
|
||||
if (cnt_sent >= sctp_hb_maxburst)
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1598,6 +1621,7 @@ void
|
||||
sctp_iterator_timer(struct sctp_iterator *it)
|
||||
{
|
||||
int iteration_count = 0;
|
||||
int inp_skip = 0;
|
||||
|
||||
/*
|
||||
* only one iterator can run at a time. This is the only way we can
|
||||
@ -1610,7 +1634,7 @@ sctp_iterator_timer(struct sctp_iterator *it)
|
||||
done_with_iterator:
|
||||
SCTP_ITERATOR_UNLOCK();
|
||||
SCTP_INP_INFO_WLOCK();
|
||||
LIST_REMOVE(it, sctp_nxt_itr);
|
||||
TAILQ_REMOVE(&sctppcbinfo.iteratorhead, it, sctp_nxt_itr);
|
||||
/* stopping the callout is not needed, in theory */
|
||||
SCTP_INP_INFO_WUNLOCK();
|
||||
SCTP_OS_TIMER_STOP(&it->tmr.timer);
|
||||
@ -1650,14 +1674,24 @@ sctp_iterator_timer(struct sctp_iterator *it)
|
||||
SCTP_INP_WUNLOCK(it->inp);
|
||||
SCTP_INP_RLOCK(it->inp);
|
||||
/* now go through each assoc which is in the desired state */
|
||||
if (it->done_current_ep == 0) {
|
||||
if (it->function_inp != NULL)
|
||||
inp_skip = (*it->function_inp) (it->inp, it->pointer, it->val);
|
||||
it->done_current_ep = 1;
|
||||
}
|
||||
if (it->stcb == NULL) {
|
||||
/* run the per instance function */
|
||||
if (it->function_inp != NULL)
|
||||
(*it->function_inp) (it->inp, it->pointer, it->val);
|
||||
|
||||
it->stcb = LIST_FIRST(&it->inp->sctp_asoc_list);
|
||||
}
|
||||
SCTP_INP_RUNLOCK(it->inp);
|
||||
if ((inp_skip) || it->stcb == NULL) {
|
||||
if (it->function_inp_end != NULL) {
|
||||
inp_skip = (*it->function_inp_end) (it->inp,
|
||||
it->pointer,
|
||||
it->val);
|
||||
}
|
||||
goto no_stcb;
|
||||
}
|
||||
if ((it->stcb) &&
|
||||
(it->stcb->asoc.stcb_starting_point_for_iterator == it)) {
|
||||
it->stcb->asoc.stcb_starting_point_for_iterator = NULL;
|
||||
@ -1695,8 +1729,17 @@ sctp_iterator_timer(struct sctp_iterator *it)
|
||||
SCTP_TCB_UNLOCK(it->stcb);
|
||||
next_assoc:
|
||||
it->stcb = LIST_NEXT(it->stcb, sctp_tcblist);
|
||||
if (it->stcb == NULL) {
|
||||
if (it->function_inp_end != NULL) {
|
||||
inp_skip = (*it->function_inp_end) (it->inp,
|
||||
it->pointer,
|
||||
it->val);
|
||||
}
|
||||
}
|
||||
}
|
||||
no_stcb:
|
||||
/* done with all assocs on this endpoint, move on to next endpoint */
|
||||
it->done_current_ep = 0;
|
||||
SCTP_INP_WLOCK(it->inp);
|
||||
it->inp->inp_starting_point_for_iterator = NULL;
|
||||
SCTP_INP_WUNLOCK(it->inp);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*-
|
||||
* Copyright (c) 2001-2006, Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2001-2007, Cisco Systems, Inc. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@ -36,8 +36,6 @@ __FBSDID("$FreeBSD$");
|
||||
#define __sctp_uio_h__
|
||||
|
||||
|
||||
|
||||
|
||||
#if ! defined(_KERNEL)
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
@ -409,7 +407,6 @@ struct sctp_paddrparams {
|
||||
uint32_t spp_hbinterval;
|
||||
uint16_t spp_pathmaxrxt;
|
||||
uint32_t spp_pathmtu;
|
||||
uint32_t spp_sackdelay;
|
||||
uint32_t spp_flags;
|
||||
uint32_t spp_ipv6_flowlabel;
|
||||
uint8_t spp_ipv4_tos;
|
||||
@ -451,6 +448,8 @@ struct sctp_assocparams {
|
||||
uint32_t sasoc_peer_rwnd;
|
||||
uint32_t sasoc_local_rwnd;
|
||||
uint32_t sasoc_cookie_life;
|
||||
uint32_t sasoc_sack_delay;
|
||||
uint32_t sasoc_sack_freq;
|
||||
};
|
||||
|
||||
struct sctp_setprim {
|
||||
@ -890,10 +889,10 @@ struct sctpstat {
|
||||
#define SCTP_STAT_DECR_GAUGE32(_x) SCTP_STAT_DECR(_x)
|
||||
|
||||
union sctp_sockstore {
|
||||
#ifdef AF_INET
|
||||
#if defined(INET) || !defined(_KERNEL)
|
||||
struct sockaddr_in sin;
|
||||
#endif
|
||||
#ifdef AF_INET6
|
||||
#if defined(INET6) || !defined(_KERNEL)
|
||||
struct sockaddr_in6 sin6;
|
||||
#endif
|
||||
struct sockaddr sa;
|
||||
@ -993,13 +992,12 @@ sctp_sorecvmsg(struct socket *so,
|
||||
/*
|
||||
* API system calls
|
||||
*/
|
||||
|
||||
#if !(defined(_KERNEL))
|
||||
|
||||
__BEGIN_DECLS
|
||||
int sctp_peeloff __P((int, sctp_assoc_t));
|
||||
int sctp_bindx __P((int, struct sockaddr *, int, int));
|
||||
int sctp_connectx __P((int, const struct sockaddr *, int));
|
||||
int sctp_connectx __P((int, const struct sockaddr *, int, sctp_assoc_t *));
|
||||
int sctp_getaddrlen __P((sa_family_t));
|
||||
int sctp_getpaddrs __P((int, sctp_assoc_t, struct sockaddr **));
|
||||
void sctp_freepaddrs __P((struct sockaddr *));
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -36,191 +36,10 @@ __FBSDID("$FreeBSD$");
|
||||
#ifndef _NETINET_SCTP_VAR_H_
|
||||
#define _NETINET_SCTP_VAR_H_
|
||||
|
||||
|
||||
#include <netinet/sctp_uio.h>
|
||||
|
||||
/* SCTP Kernel structures */
|
||||
|
||||
/*
|
||||
* Names for SCTP sysctl objects
|
||||
*/
|
||||
#define SCTPCTL_MAXDGRAM 1 /* max datagram size */
|
||||
#define SCTPCTL_RECVSPACE 2 /* default receive buffer space */
|
||||
#define SCTPCTL_AUTOASCONF 3 /* auto asconf enable/disable flag */
|
||||
#define SCTPCTL_ECN_ENABLE 4 /* Is ecn allowed */
|
||||
#define SCTPCTL_ECN_NONCE 5 /* Is ecn nonce allowed */
|
||||
#define SCTPCTL_STRICT_SACK 6 /* strictly require sack'd TSN's to be
|
||||
* smaller than sndnxt. */
|
||||
#define SCTPCTL_NOCSUM_LO 7 /* Require that the Loopback NOT have
|
||||
* the crc32 checksum on packets
|
||||
* routed over it. */
|
||||
#define SCTPCTL_STRICT_INIT 8
|
||||
#define SCTPCTL_PEER_CHK_OH 9
|
||||
#define SCTPCTL_MAXBURST 10
|
||||
#define SCTPCTL_MAXCHUNKONQ 11
|
||||
#define SCTPCTL_DELAYED_SACK 12
|
||||
#define SCTPCTL_HB_INTERVAL 13
|
||||
#define SCTPCTL_PMTU_RAISE 14
|
||||
#define SCTPCTL_SHUTDOWN_GUARD 15
|
||||
#define SCTPCTL_SECRET_LIFETIME 16
|
||||
#define SCTPCTL_RTO_MAX 17
|
||||
#define SCTPCTL_RTO_MIN 18
|
||||
#define SCTPCTL_RTO_INITIAL 19
|
||||
#define SCTPCTL_INIT_RTO_MAX 20
|
||||
#define SCTPCTL_COOKIE_LIFE 21
|
||||
#define SCTPCTL_INIT_RTX_MAX 22
|
||||
#define SCTPCTL_ASSOC_RTX_MAX 23
|
||||
#define SCTPCTL_PATH_RTX_MAX 24
|
||||
#define SCTPCTL_NR_OUTGOING_STREAMS 25
|
||||
#define SCTPCTL_CMT_ON_OFF 26
|
||||
#define SCTPCTL_CWND_MAXBURST 27
|
||||
#define SCTPCTL_EARLY_FR 28
|
||||
#define SCTPCTL_RTTVAR_CC 29
|
||||
#define SCTPCTL_DEADLOCK_DET 30
|
||||
#define SCTPCTL_EARLY_FR_MSEC 31
|
||||
#define SCTPCTL_ASCONF_AUTH_NOCHK 32
|
||||
#define SCTPCTL_AUTH_DISABLE 33
|
||||
#define SCTPCTL_AUTH_RANDOM_LEN 34
|
||||
#define SCTPCTL_AUTH_HMAC_ID 35
|
||||
#define SCTPCTL_ABC_L_VAR 36
|
||||
#define SCTPCTL_MAX_MBUF_CHAIN 37
|
||||
#define SCTPCTL_CMT_USE_DAC 38
|
||||
#define SCTPCTL_DO_DRAIN 39
|
||||
#define SCTPCTL_WARM_CRC32 40
|
||||
#define SCTPCTL_QLIMIT_ABORT 41
|
||||
#define SCTPCTL_STRICT_ORDER 42
|
||||
#define SCTPCTL_TCBHASHSIZE 43
|
||||
#define SCTPCTL_PCBHASHSIZE 44
|
||||
#define SCTPCTL_CHUNKSCALE 45
|
||||
#define SCTPCTL_MINSPLIT 46
|
||||
#define SCTPCTL_ADD_MORE 47
|
||||
#define SCTPCTL_SYS_RESC 48
|
||||
#define SCTPCTL_ASOC_RESC 49
|
||||
#define SCTPCTL_NAT_FRIENDLY 50
|
||||
#ifdef SCTP_DEBUG
|
||||
#define SCTPCTL_DEBUG 51
|
||||
#define SCTPCTL_MAXID 51
|
||||
#else
|
||||
#define SCTPCTL_MAXID 50
|
||||
#endif
|
||||
|
||||
#ifdef SCTP_DEBUG
|
||||
#define SCTPCTL_NAMES { \
|
||||
{ 0, 0 }, \
|
||||
{ "sendspace", CTLTYPE_INT }, \
|
||||
{ "recvspace", CTLTYPE_INT }, \
|
||||
{ "autoasconf", CTLTYPE_INT }, \
|
||||
{ "ecn_enable", CTLTYPE_INT }, \
|
||||
{ "ecn_nonce", CTLTYPE_INT }, \
|
||||
{ "strict_sack", CTLTYPE_INT }, \
|
||||
{ "looback_nocsum", CTLTYPE_INT }, \
|
||||
{ "strict_init", CTLTYPE_INT }, \
|
||||
{ "peer_chkoh", CTLTYPE_INT }, \
|
||||
{ "maxburst", CTLTYPE_INT }, \
|
||||
{ "maxchunks", CTLTYPE_INT }, \
|
||||
{ "delayed_sack_time", CTLTYPE_INT }, \
|
||||
{ "heartbeat_interval", CTLTYPE_INT }, \
|
||||
{ "pmtu_raise_time", CTLTYPE_INT }, \
|
||||
{ "shutdown_guard_time", CTLTYPE_INT }, \
|
||||
{ "secret_lifetime", CTLTYPE_INT }, \
|
||||
{ "rto_max", CTLTYPE_INT }, \
|
||||
{ "rto_min", CTLTYPE_INT }, \
|
||||
{ "rto_initial", CTLTYPE_INT }, \
|
||||
{ "init_rto_max", CTLTYPE_INT }, \
|
||||
{ "valid_cookie_life", CTLTYPE_INT }, \
|
||||
{ "init_rtx_max", CTLTYPE_INT }, \
|
||||
{ "assoc_rtx_max", CTLTYPE_INT }, \
|
||||
{ "path_rtx_max", CTLTYPE_INT }, \
|
||||
{ "nr_outgoing_streams", CTLTYPE_INT }, \
|
||||
{ "cmt_on_off", CTLTYPE_INT }, \
|
||||
{ "cwnd_maxburst", CTLTYPE_INT }, \
|
||||
{ "early_fast_retran", CTLTYPE_INT }, \
|
||||
{ "use_rttvar_congctrl", CTLTYPE_INT }, \
|
||||
{ "deadlock_detect", CTLTYPE_INT }, \
|
||||
{ "early_fast_retran_msec", CTLTYPE_INT }, \
|
||||
{ "asconf_auth_nochk", CTLTYPE_INT }, \
|
||||
{ "auth_disable", CTLTYPE_INT }, \
|
||||
{ "auth_random_len", CTLTYPE_INT }, \
|
||||
{ "auth_hmac_id", CTLTYPE_INT }, \
|
||||
{ "abc_l_var", CTLTYPE_INT }, \
|
||||
{ "max_mbuf_chain", CTLTYPE_INT }, \
|
||||
{ "cmt_use_dac", CTLTYPE_INT }, \
|
||||
{ "do_sctp_drain", CTLTYPE_INT }, \
|
||||
{ "warm_crc_table", CTLTYPE_INT }, \
|
||||
{ "abort_at_limit", CTLTYPE_INT }, \
|
||||
{ "strict_data_order", CTLTYPE_INT }, \
|
||||
{ "tcbhashsize", CTLTYPE_INT }, \
|
||||
{ "pcbhashsize", CTLTYPE_INT }, \
|
||||
{ "chunkscale", CTLTYPE_INT }, \
|
||||
{ "min_split_point", CTLTYPE_INT }, \
|
||||
{ "add_more_on_output", CTLTYPE_INT }, \
|
||||
{ "sys_resource", CTLTYPE_INT }, \
|
||||
{ "asoc_resource", CTLTYPE_INT }, \
|
||||
{ "nat_friendly", CTLTYPE_INT }, \
|
||||
{ "debug", CTLTYPE_INT }, \
|
||||
}
|
||||
#else
|
||||
#define SCTPCTL_NAMES { \
|
||||
{ 0, 0 }, \
|
||||
{ "sendspace", CTLTYPE_INT }, \
|
||||
{ "recvspace", CTLTYPE_INT }, \
|
||||
{ "autoasconf", CTLTYPE_INT }, \
|
||||
{ "ecn_enable", CTLTYPE_INT }, \
|
||||
{ "ecn_nonce", CTLTYPE_INT }, \
|
||||
{ "strict_sack", CTLTYPE_INT }, \
|
||||
{ "looback_nocsum", CTLTYPE_INT }, \
|
||||
{ "strict_init", CTLTYPE_INT }, \
|
||||
{ "peer_chkoh", CTLTYPE_INT }, \
|
||||
{ "maxburst", CTLTYPE_INT }, \
|
||||
{ "maxchunks", CTLTYPE_INT }, \
|
||||
{ "delayed_sack_time", CTLTYPE_INT }, \
|
||||
{ "heartbeat_interval", CTLTYPE_INT }, \
|
||||
{ "pmtu_raise_time", CTLTYPE_INT }, \
|
||||
{ "shutdown_guard_time", CTLTYPE_INT }, \
|
||||
{ "secret_lifetime", CTLTYPE_INT }, \
|
||||
{ "rto_max", CTLTYPE_INT }, \
|
||||
{ "rto_min", CTLTYPE_INT }, \
|
||||
{ "rto_initial", CTLTYPE_INT }, \
|
||||
{ "init_rto_max", CTLTYPE_INT }, \
|
||||
{ "valid_cookie_life", CTLTYPE_INT }, \
|
||||
{ "init_rtx_max", CTLTYPE_INT }, \
|
||||
{ "assoc_rtx_max", CTLTYPE_INT }, \
|
||||
{ "path_rtx_max", CTLTYPE_INT }, \
|
||||
{ "nr_outgoing_streams", CTLTYPE_INT }, \
|
||||
{ "cmt_on_off", CTLTYPE_INT }, \
|
||||
{ "cwnd_maxburst", CTLTYPE_INT }, \
|
||||
{ "early_fast_retran", CTLTYPE_INT }, \
|
||||
{ "use_rttvar_congctrl", CTLTYPE_INT }, \
|
||||
{ "deadlock_detect", CTLTYPE_INT }, \
|
||||
{ "early_fast_retran_msec", CTLTYPE_INT }, \
|
||||
{ "asconf_auth_nochk", CTLTYPE_INT }, \
|
||||
{ "auth_disable", CTLTYPE_INT }, \
|
||||
{ "auth_random_len", CTLTYPE_INT }, \
|
||||
{ "auth_hmac_id", CTLTYPE_INT }, \
|
||||
{ "abc_l_var", CTLTYPE_INT }, \
|
||||
{ "max_mbuf_chain", CTLTYPE_INT }, \
|
||||
{ "cmt_use_dac", CTLTYPE_INT }, \
|
||||
{ "do_sctp_drain", CTLTYPE_INT }, \
|
||||
{ "warm_crc_table", CTLTYPE_INT }, \
|
||||
{ "abort_at_limit", CTLTYPE_INT }, \
|
||||
{ "strict_data_order", CTLTYPE_INT }, \
|
||||
{ "tcbhashsize", CTLTYPE_INT }, \
|
||||
{ "pcbhashsize", CTLTYPE_INT }, \
|
||||
{ "chunkscale", CTLTYPE_INT }, \
|
||||
{ "min_split_point", CTLTYPE_INT }, \
|
||||
{ "add_more_on_output", CTLTYPE_INT }, \
|
||||
{ "sys_resource", CTLTYPE_INT }, \
|
||||
{ "asoc_resource", CTLTYPE_INT }, \
|
||||
{ "nat_friendly", CTLTYPE_INT }, \
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(_KERNEL)
|
||||
|
||||
#ifdef SYSCTL_DECL
|
||||
SYSCTL_DECL(_net_inet_sctp);
|
||||
#endif
|
||||
extern struct pr_usrreqs sctp_usrreqs;
|
||||
|
||||
|
||||
@ -235,18 +54,14 @@ extern struct pr_usrreqs sctp_usrreqs;
|
||||
|
||||
#define sctp_sbspace_sub(a,b) ((a > b) ? (a - b) : 0)
|
||||
|
||||
extern uint32_t sctp_asoc_free_resc_limit;
|
||||
extern uint32_t sctp_system_free_resc_limit;
|
||||
|
||||
/* I tried to cache the readq entries at one
|
||||
* point. But the reality is that it did not
|
||||
* add any performance since this meant
|
||||
* we had to lock the STCB on read. And at that point
|
||||
* once you have to do an extra lock, it really does
|
||||
* not matter if the lock is in the ZONE stuff or
|
||||
* in our code. Note that this same problem would
|
||||
* occur with an mbuf cache as well so it is
|
||||
* not really worth doing, at least right now :-D
|
||||
/*
|
||||
* I tried to cache the readq entries at one point. But the reality
|
||||
* is that it did not add any performance since this meant we had to
|
||||
* lock the STCB on read. And at that point once you have to do an
|
||||
* extra lock, it really does not matter if the lock is in the ZONE
|
||||
* stuff or in our code. Note that this same problem would occur with
|
||||
* an mbuf cache as well so it is not really worth doing, at least
|
||||
* right now :-D
|
||||
*/
|
||||
|
||||
#define sctp_free_a_readq(_stcb, _readq) { \
|
||||
@ -317,11 +132,20 @@ extern uint32_t sctp_system_free_resc_limit;
|
||||
|
||||
|
||||
#define sctp_free_remote_addr(__net) { \
|
||||
if ((__net)) { \
|
||||
if ((__net)) { \
|
||||
if (atomic_fetchadd_int(&(__net)->ref_count, -1) == 1) { \
|
||||
SCTP_OS_TIMER_STOP(&(__net)->rxt_timer.timer); \
|
||||
SCTP_OS_TIMER_STOP(&(__net)->pmtu_timer.timer); \
|
||||
SCTP_OS_TIMER_STOP(&(__net)->fr_timer.timer); \
|
||||
if ((__net)->ro.ro_rt) { \
|
||||
RTFREE((__net)->ro.ro_rt); \
|
||||
(__net)->ro.ro_rt = NULL; \
|
||||
} \
|
||||
if ((__net)->src_addr_selected) { \
|
||||
sctp_free_ifa((__net)->ro._s_addr); \
|
||||
(__net)->ro._s_addr = NULL; \
|
||||
} \
|
||||
(__net)->src_addr_selected = 0; \
|
||||
(__net)->dest_state = SCTP_ADDR_NOT_REACHABLE; \
|
||||
SCTP_ZONE_FREE(sctppcbinfo.ipi_zone_net, (__net)); \
|
||||
SCTP_DECR_RADDR_COUNT(); \
|
||||
@ -408,19 +232,6 @@ extern uint32_t sctp_system_free_resc_limit;
|
||||
} while (0)
|
||||
|
||||
|
||||
/*
|
||||
* some sysctls
|
||||
*/
|
||||
extern int sctp_sendspace;
|
||||
extern int sctp_recvspace;
|
||||
extern int sctp_ecn_enable;
|
||||
extern int sctp_ecn_nonce;
|
||||
extern int sctp_use_cwnd_based_maxburst;
|
||||
extern unsigned int sctp_cmt_on_off;
|
||||
extern unsigned int sctp_cmt_use_dac;
|
||||
extern unsigned int sctp_cmt_sockopt_on_off;
|
||||
extern uint32_t sctp_nat_friendly;
|
||||
|
||||
struct sctp_nets;
|
||||
struct sctp_inpcb;
|
||||
struct sctp_tcb;
|
||||
@ -429,7 +240,6 @@ struct sctphdr;
|
||||
void sctp_ctlinput __P((int, struct sockaddr *, void *));
|
||||
int sctp_ctloutput __P((struct socket *, struct sockopt *));
|
||||
void sctp_input __P((struct mbuf *, int));
|
||||
|
||||
void sctp_drain __P((void));
|
||||
void sctp_init __P((void));
|
||||
|
||||
@ -468,7 +278,6 @@ __P((struct sctp_inpcb *, int, struct sctphdr *,
|
||||
|
||||
int sctp_accept(struct socket *, struct sockaddr **);
|
||||
|
||||
|
||||
#endif /* _KERNEL */
|
||||
|
||||
#endif /* !_NETINET_SCTP_VAR_H_ */
|
||||
|
@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <netinet/sctp_pcb.h>
|
||||
#include <netinet/sctputil.h>
|
||||
#include <netinet/sctp_var.h>
|
||||
#include <netinet/sctp_sysctl.h>
|
||||
#ifdef INET6
|
||||
#include <netinet6/sctp6_var.h>
|
||||
#endif
|
||||
@ -48,16 +49,10 @@ __FBSDID("$FreeBSD$");
|
||||
#include <netinet/sctp_indata.h>/* for sctp_deliver_data() */
|
||||
#include <netinet/sctp_auth.h>
|
||||
#include <netinet/sctp_asconf.h>
|
||||
|
||||
extern int sctp_warm_the_crc32_table;
|
||||
#include <netinet/sctp_bsd_addr.h>
|
||||
|
||||
#define NUMBER_OF_MTU_SIZES 18
|
||||
|
||||
#ifdef SCTP_DEBUG
|
||||
extern uint32_t sctp_debug_on;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef SCTP_STAT_LOGGING
|
||||
int global_sctp_cwnd_log_at = 0;
|
||||
@ -489,22 +484,22 @@ sctp_log_block(uint8_t from, struct socket *so, struct sctp_association *asoc, i
|
||||
}
|
||||
|
||||
int
|
||||
sctp_fill_stat_log(struct mbuf *m)
|
||||
sctp_fill_stat_log(void *optval, size_t *optsize)
|
||||
{
|
||||
int sctp_cwnd_log_at;
|
||||
struct sctp_cwnd_log_req *req;
|
||||
size_t size_limit;
|
||||
int num, i, at, cnt_out = 0;
|
||||
|
||||
if (m == NULL)
|
||||
if (*optsize < sizeof(struct sctp_cwnd_log_req)) {
|
||||
return (EINVAL);
|
||||
|
||||
size_limit = (SCTP_BUF_LEN(m) - sizeof(struct sctp_cwnd_log_req));
|
||||
}
|
||||
size_limit = (*optsize - sizeof(struct sctp_cwnd_log_req));
|
||||
if (size_limit < sizeof(struct sctp_cwnd_log)) {
|
||||
return (EINVAL);
|
||||
}
|
||||
sctp_cwnd_log_at = global_sctp_cwnd_log_at;
|
||||
req = mtod(m, struct sctp_cwnd_log_req *);
|
||||
req = (struct sctp_cwnd_log_req *)optval;
|
||||
num = size_limit / sizeof(struct sctp_cwnd_log);
|
||||
if (global_sctp_cwnd_log_rolled) {
|
||||
req->num_in_log = SCTP_STAT_LOG_SIZE;
|
||||
@ -569,7 +564,7 @@ sctp_fill_stat_log(struct mbuf *m)
|
||||
if (at >= SCTP_STAT_LOG_SIZE)
|
||||
at = 0;
|
||||
}
|
||||
SCTP_BUF_LEN(m) = (cnt_out * sizeof(struct sctp_cwnd_log)) + sizeof(struct sctp_cwnd_log_req);
|
||||
*optsize = (cnt_out * sizeof(struct sctp_cwnd_log)) + sizeof(struct sctp_cwnd_log_req);
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -909,7 +904,7 @@ sctp_select_a_tag(struct sctp_inpcb *m)
|
||||
|
||||
int
|
||||
sctp_init_asoc(struct sctp_inpcb *m, struct sctp_association *asoc,
|
||||
int for_a_init, uint32_t override_tag)
|
||||
int for_a_init, uint32_t override_tag, uint32_t vrf_id)
|
||||
{
|
||||
/*
|
||||
* Anything set to zero is taken care of by the allocation routine's
|
||||
@ -930,13 +925,13 @@ sctp_init_asoc(struct sctp_inpcb *m, struct sctp_association *asoc,
|
||||
asoc->heart_beat_delay = TICKS_TO_MSEC(m->sctp_ep.sctp_timeoutticks[SCTP_TIMER_HEARTBEAT]);
|
||||
asoc->cookie_life = m->sctp_ep.def_cookie_life;
|
||||
asoc->sctp_cmt_on_off = (uint8_t) sctp_cmt_on_off;
|
||||
#ifdef AF_INET
|
||||
#ifdef INET
|
||||
asoc->default_tos = m->ip_inp.inp.inp_ip_tos;
|
||||
#else
|
||||
asoc->default_tos = 0;
|
||||
#endif
|
||||
|
||||
#ifdef AF_INET6
|
||||
#ifdef INET6
|
||||
asoc->default_flowlabel = ((struct in6pcb *)m)->in6p_flowinfo;
|
||||
#else
|
||||
asoc->default_flowlabel = 0;
|
||||
@ -957,6 +952,7 @@ sctp_init_asoc(struct sctp_inpcb *m, struct sctp_association *asoc,
|
||||
/* Get the nonce tags */
|
||||
asoc->my_vtag_nonce = sctp_select_a_tag(m);
|
||||
asoc->peer_vtag_nonce = sctp_select_a_tag(m);
|
||||
asoc->vrf_id = vrf_id;
|
||||
|
||||
if (sctp_is_feature_on(m, SCTP_PCB_FLAGS_DONOT_HEARTBEAT))
|
||||
asoc->hb_is_disabled = 1;
|
||||
@ -1005,6 +1001,7 @@ sctp_init_asoc(struct sctp_inpcb *m, struct sctp_association *asoc,
|
||||
asoc->nonce_wait_for_ecne = 0;
|
||||
asoc->nonce_wait_tsn = 0;
|
||||
asoc->delayed_ack = TICKS_TO_MSEC(m->sctp_ep.sctp_timeoutticks[SCTP_TIMER_RECV]);
|
||||
asoc->sack_freq = m->sctp_ep.sctp_sack_freq;
|
||||
asoc->pr_sctp_cnt = 0;
|
||||
asoc->total_output_queue_size = 0;
|
||||
|
||||
@ -1039,7 +1036,10 @@ sctp_init_asoc(struct sctp_inpcb *m, struct sctp_association *asoc,
|
||||
asoc->ecn_echo_cnt_onq = 0;
|
||||
asoc->stream_locked = 0;
|
||||
|
||||
LIST_INIT(&asoc->sctp_local_addr_list);
|
||||
asoc->send_sack = 1;
|
||||
|
||||
LIST_INIT(&asoc->sctp_restricted_addrs);
|
||||
|
||||
TAILQ_INIT(&asoc->nets);
|
||||
TAILQ_INIT(&asoc->pending_reply_queue);
|
||||
asoc->last_asconf_ack_sent = NULL;
|
||||
@ -1141,36 +1141,207 @@ sctp_expand_mapping_array(struct sctp_association *asoc)
|
||||
return (0);
|
||||
}
|
||||
|
||||
extern unsigned int sctp_early_fr_msec;
|
||||
#if defined(SCTP_USE_THREAD_BASED_ITERATOR)
|
||||
static void
|
||||
sctp_iterator_work(struct sctp_iterator *it)
|
||||
{
|
||||
int iteration_count = 0;
|
||||
int inp_skip = 0;
|
||||
|
||||
SCTP_ITERATOR_LOCK();
|
||||
if (it->inp)
|
||||
SCTP_INP_DECR_REF(it->inp);
|
||||
|
||||
if (it->inp == NULL) {
|
||||
/* iterator is complete */
|
||||
done_with_iterator:
|
||||
SCTP_ITERATOR_UNLOCK();
|
||||
if (it->function_atend != NULL) {
|
||||
(*it->function_atend) (it->pointer, it->val);
|
||||
}
|
||||
SCTP_FREE(it);
|
||||
return;
|
||||
}
|
||||
select_a_new_ep:
|
||||
SCTP_INP_WLOCK(it->inp);
|
||||
while (((it->pcb_flags) &&
|
||||
((it->inp->sctp_flags & it->pcb_flags) != it->pcb_flags)) ||
|
||||
((it->pcb_features) &&
|
||||
((it->inp->sctp_features & it->pcb_features) != it->pcb_features))) {
|
||||
/* endpoint flags or features don't match, so keep looking */
|
||||
if (it->iterator_flags & SCTP_ITERATOR_DO_SINGLE_INP) {
|
||||
SCTP_INP_WUNLOCK(it->inp);
|
||||
goto done_with_iterator;
|
||||
}
|
||||
SCTP_INP_WUNLOCK(it->inp);
|
||||
it->inp = LIST_NEXT(it->inp, sctp_list);
|
||||
if (it->inp == NULL) {
|
||||
goto done_with_iterator;
|
||||
}
|
||||
SCTP_INP_WLOCK(it->inp);
|
||||
}
|
||||
|
||||
/* mark the current iterator on the endpoint */
|
||||
it->inp->inp_starting_point_for_iterator = it;
|
||||
SCTP_INP_WUNLOCK(it->inp);
|
||||
SCTP_INP_RLOCK(it->inp);
|
||||
|
||||
/* now go through each assoc which is in the desired state */
|
||||
if (it->done_current_ep == 0) {
|
||||
if (it->function_inp != NULL)
|
||||
inp_skip = (*it->function_inp) (it->inp, it->pointer, it->val);
|
||||
it->done_current_ep = 1;
|
||||
}
|
||||
if (it->stcb == NULL) {
|
||||
/* run the per instance function */
|
||||
it->stcb = LIST_FIRST(&it->inp->sctp_asoc_list);
|
||||
}
|
||||
if ((inp_skip) || it->stcb == NULL) {
|
||||
if (it->function_inp_end != NULL) {
|
||||
inp_skip = (*it->function_inp_end) (it->inp,
|
||||
it->pointer,
|
||||
it->val);
|
||||
}
|
||||
SCTP_INP_RUNLOCK(it->inp);
|
||||
goto no_stcb;
|
||||
}
|
||||
if ((it->stcb) &&
|
||||
(it->stcb->asoc.stcb_starting_point_for_iterator == it)) {
|
||||
it->stcb->asoc.stcb_starting_point_for_iterator = NULL;
|
||||
}
|
||||
while (it->stcb) {
|
||||
SCTP_TCB_LOCK(it->stcb);
|
||||
if (it->asoc_state && ((it->stcb->asoc.state & it->asoc_state) != it->asoc_state)) {
|
||||
/* not in the right state... keep looking */
|
||||
SCTP_TCB_UNLOCK(it->stcb);
|
||||
goto next_assoc;
|
||||
}
|
||||
/* mark the current iterator on the assoc */
|
||||
it->stcb->asoc.stcb_starting_point_for_iterator = it;
|
||||
/* see if we have limited out the iterator loop */
|
||||
iteration_count++;
|
||||
if (iteration_count > SCTP_ITERATOR_MAX_AT_ONCE) {
|
||||
/* Pause to let others grab the lock */
|
||||
atomic_add_int(&it->stcb->asoc.refcnt, 1);
|
||||
SCTP_TCB_UNLOCK(it->stcb);
|
||||
SCTP_INP_RUNLOCK(it->inp);
|
||||
SCTP_ITERATOR_UNLOCK();
|
||||
SCTP_ITERATOR_LOCK();
|
||||
SCTP_INP_RLOCK(it->inp);
|
||||
SCTP_TCB_LOCK(it->stcb);
|
||||
atomic_add_int(&it->stcb->asoc.refcnt, -1);
|
||||
iteration_count = 0;
|
||||
}
|
||||
/* run function on this one */
|
||||
(*it->function_assoc) (it->inp, it->stcb, it->pointer, it->val);
|
||||
|
||||
/*
|
||||
* we lie here, it really needs to have its own type but
|
||||
* first I must verify that this won't effect things :-0
|
||||
*/
|
||||
if (it->no_chunk_output == 0)
|
||||
sctp_chunk_output(it->inp, it->stcb, SCTP_OUTPUT_FROM_T3);
|
||||
|
||||
SCTP_TCB_UNLOCK(it->stcb);
|
||||
next_assoc:
|
||||
it->stcb = LIST_NEXT(it->stcb, sctp_tcblist);
|
||||
if (it->stcb == NULL) {
|
||||
/* Run last function */
|
||||
if (it->function_inp_end != NULL) {
|
||||
inp_skip = (*it->function_inp_end) (it->inp,
|
||||
it->pointer,
|
||||
it->val);
|
||||
}
|
||||
}
|
||||
}
|
||||
SCTP_INP_RUNLOCK(it->inp);
|
||||
no_stcb:
|
||||
/* done with all assocs on this endpoint, move on to next endpoint */
|
||||
it->done_current_ep = 0;
|
||||
SCTP_INP_WLOCK(it->inp);
|
||||
it->inp->inp_starting_point_for_iterator = NULL;
|
||||
SCTP_INP_WUNLOCK(it->inp);
|
||||
if (it->iterator_flags & SCTP_ITERATOR_DO_SINGLE_INP) {
|
||||
it->inp = NULL;
|
||||
} else {
|
||||
SCTP_INP_INFO_RLOCK();
|
||||
it->inp = LIST_NEXT(it->inp, sctp_list);
|
||||
SCTP_INP_INFO_RUNLOCK();
|
||||
}
|
||||
if (it->inp == NULL) {
|
||||
goto done_with_iterator;
|
||||
}
|
||||
goto select_a_new_ep;
|
||||
}
|
||||
|
||||
void
|
||||
sctp_iterator_worker(void)
|
||||
{
|
||||
struct sctp_iterator *it = NULL;
|
||||
|
||||
/* This function is called with the WQ lock in place */
|
||||
|
||||
sctppcbinfo.iterator_running = 1;
|
||||
again:
|
||||
it = TAILQ_FIRST(&sctppcbinfo.iteratorhead);
|
||||
while (it) {
|
||||
/* now lets work on this one */
|
||||
TAILQ_REMOVE(&sctppcbinfo.iteratorhead, it, sctp_nxt_itr);
|
||||
SCTP_IPI_ITERATOR_WQ_UNLOCK();
|
||||
sctp_iterator_work(it);
|
||||
SCTP_IPI_ITERATOR_WQ_LOCK();
|
||||
it = TAILQ_FIRST(&sctppcbinfo.iteratorhead);
|
||||
}
|
||||
if (TAILQ_FIRST(&sctppcbinfo.iteratorhead)) {
|
||||
goto again;
|
||||
}
|
||||
sctppcbinfo.iterator_running = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
static void
|
||||
sctp_handle_addr_wq(void)
|
||||
{
|
||||
/* deal with the ADDR wq from the rtsock calls */
|
||||
struct sctp_laddr *wi;
|
||||
struct sctp_asconf_iterator *asc;
|
||||
|
||||
SCTP_IPI_ADDR_LOCK();
|
||||
wi = LIST_FIRST(&sctppcbinfo.addr_wq);
|
||||
if (wi == NULL) {
|
||||
SCTP_IPI_ADDR_UNLOCK();
|
||||
return;
|
||||
}
|
||||
LIST_REMOVE(wi, sctp_nxt_addr);
|
||||
if (!SCTP_LIST_EMPTY(&sctppcbinfo.addr_wq)) {
|
||||
SCTP_MALLOC(asc, struct sctp_asconf_iterator *,
|
||||
sizeof(struct sctp_asconf_iterator), "SCTP_ASCONF_ITERATOR");
|
||||
if (asc == NULL) {
|
||||
/* Try later, no memory */
|
||||
sctp_timer_start(SCTP_TIMER_TYPE_ADDR_WQ,
|
||||
(struct sctp_inpcb *)NULL,
|
||||
(struct sctp_tcb *)NULL,
|
||||
(struct sctp_nets *)NULL);
|
||||
return;
|
||||
}
|
||||
SCTP_IPI_ADDR_UNLOCK();
|
||||
if (wi->action == RTM_ADD) {
|
||||
sctp_add_ip_address(wi->ifa);
|
||||
} else if (wi->action == RTM_DELETE) {
|
||||
sctp_delete_ip_address(wi->ifa);
|
||||
LIST_INIT(&asc->list_of_work);
|
||||
asc->cnt = 0;
|
||||
SCTP_IPI_ITERATOR_WQ_LOCK();
|
||||
wi = LIST_FIRST(&sctppcbinfo.addr_wq);
|
||||
while (wi != NULL) {
|
||||
LIST_REMOVE(wi, sctp_nxt_addr);
|
||||
LIST_INSERT_HEAD(&asc->list_of_work, wi, sctp_nxt_addr);
|
||||
asc->cnt++;
|
||||
wi = LIST_FIRST(&sctppcbinfo.addr_wq);
|
||||
}
|
||||
IFAFREE(wi->ifa);
|
||||
SCTP_ZONE_FREE(sctppcbinfo.ipi_zone_laddr, wi);
|
||||
SCTP_DECR_LADDR_COUNT();
|
||||
SCTP_IPI_ITERATOR_WQ_UNLOCK();
|
||||
if (asc->cnt == 0) {
|
||||
SCTP_FREE(asc);
|
||||
} else {
|
||||
sctp_initiate_iterator(sctp_iterator_ep,
|
||||
sctp_iterator_stcb,
|
||||
NULL, /* No ep end for boundall */
|
||||
SCTP_PCB_FLAGS_BOUNDALL,
|
||||
SCTP_PCB_ANY_FEATURES,
|
||||
SCTP_ASOC_ANY_STATE, (void *)asc, 0,
|
||||
sctp_iterator_end, NULL, 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
@ -1564,7 +1735,7 @@ sctp_timer_start(int t_type, struct sctp_inpcb *inp, struct sctp_tcb *stcb,
|
||||
case SCTP_TIMER_TYPE_ADDR_WQ:
|
||||
/* Only 1 tick away :-) */
|
||||
tmr = &sctppcbinfo.addr_wq_timer;
|
||||
to_ticks = 1;
|
||||
to_ticks = SCTP_ADDRESS_TICK_DELAY;
|
||||
break;
|
||||
case SCTP_TIMER_TYPE_ITERATOR:
|
||||
{
|
||||
@ -1658,14 +1829,11 @@ sctp_timer_start(int t_type, struct sctp_inpcb *inp, struct sctp_tcb *stcb,
|
||||
rndval = sctp_select_initial_TSN(&inp->sctp_ep);
|
||||
memcpy(stcb->asoc.hb_random_values, &rndval,
|
||||
sizeof(stcb->asoc.hb_random_values));
|
||||
this_random = stcb->asoc.hb_random_values[0];
|
||||
stcb->asoc.hb_random_idx = 0;
|
||||
stcb->asoc.hb_ect_randombit = 0;
|
||||
} else {
|
||||
this_random = stcb->asoc.hb_random_values[stcb->asoc.hb_random_idx];
|
||||
stcb->asoc.hb_random_idx++;
|
||||
stcb->asoc.hb_ect_randombit = 0;
|
||||
}
|
||||
this_random = stcb->asoc.hb_random_values[stcb->asoc.hb_random_idx];
|
||||
stcb->asoc.hb_random_idx++;
|
||||
stcb->asoc.hb_ect_randombit = 0;
|
||||
/*
|
||||
* this_random will be 0 - 256 ms RTO is in ms.
|
||||
*/
|
||||
@ -2631,10 +2799,15 @@ sctp_notify_peer_addr_change(struct sctp_tcb *stcb, uint32_t state,
|
||||
|
||||
memcpy(&spc->spc_aaddr, sa, sizeof(struct sockaddr_in6));
|
||||
|
||||
/* recover scope_id for user */
|
||||
sin6 = (struct sockaddr_in6 *)&spc->spc_aaddr;
|
||||
if (IN6_IS_SCOPE_LINKLOCAL(&sin6->sin6_addr)) {
|
||||
(void)sa6_recoverscope(sin6);
|
||||
if (sin6->sin6_scope_id == 0) {
|
||||
/* recover scope_id for user */
|
||||
(void)sa6_recoverscope(sin6);
|
||||
} else {
|
||||
/* clear embedded scope_id for user */
|
||||
in6_clearscope(&sin6->sin6_addr);
|
||||
}
|
||||
}
|
||||
}
|
||||
spc->spc_state = state;
|
||||
@ -3719,8 +3892,12 @@ sctp_add_to_readq(struct sctp_inpcb *inp,
|
||||
return;
|
||||
}
|
||||
SCTP_INP_READ_LOCK(inp);
|
||||
atomic_add_int(&inp->total_recvs, 1);
|
||||
atomic_add_int(&stcb->total_recvs, 1);
|
||||
if (!(control->spec_flags & M_NOTIFICATION)) {
|
||||
atomic_add_int(&inp->total_recvs, 1);
|
||||
if (!control->do_not_ref_stcb) {
|
||||
atomic_add_int(&stcb->total_recvs, 1);
|
||||
}
|
||||
}
|
||||
m = control->data;
|
||||
control->held_length = 0;
|
||||
control->length = 0;
|
||||
@ -4019,57 +4196,105 @@ sctp_release_pr_sctp_chunk(struct sctp_tcb *stcb, struct sctp_tmit_chunk *tp1,
|
||||
* and doesn't handle multiple addresses with different zone/scope id's note:
|
||||
* ifa_ifwithaddr() compares the entire sockaddr struct
|
||||
*/
|
||||
struct ifaddr *
|
||||
sctp_find_ifa_by_addr(struct sockaddr *sa)
|
||||
struct sctp_ifa *
|
||||
sctp_find_ifa_in_ep(struct sctp_inpcb *inp, struct sockaddr *addr, int holds_lock)
|
||||
{
|
||||
struct ifnet *ifn;
|
||||
struct ifaddr *ifa;
|
||||
struct sctp_laddr *laddr;
|
||||
|
||||
/* go through all our known interfaces */
|
||||
TAILQ_FOREACH(ifn, &ifnet, if_list) {
|
||||
/* go through each interface addresses */
|
||||
TAILQ_FOREACH(ifa, &ifn->if_addrlist, ifa_list) {
|
||||
/* correct family? */
|
||||
if (ifa->ifa_addr->sa_family != sa->sa_family)
|
||||
continue;
|
||||
if (holds_lock == 0)
|
||||
SCTP_INP_RLOCK(inp);
|
||||
|
||||
#ifdef INET6
|
||||
if (ifa->ifa_addr->sa_family == AF_INET6) {
|
||||
/* IPv6 address */
|
||||
struct sockaddr_in6 *sin1, *sin2, sin6_tmp;
|
||||
|
||||
sin1 = (struct sockaddr_in6 *)ifa->ifa_addr;
|
||||
if (IN6_IS_SCOPE_LINKLOCAL(&sin1->sin6_addr)) {
|
||||
/* create a copy and clear scope */
|
||||
memcpy(&sin6_tmp, sin1,
|
||||
sizeof(struct sockaddr_in6));
|
||||
sin1 = &sin6_tmp;
|
||||
in6_clearscope(&sin1->sin6_addr);
|
||||
}
|
||||
sin2 = (struct sockaddr_in6 *)sa;
|
||||
if (memcmp(&sin1->sin6_addr, &sin2->sin6_addr,
|
||||
sizeof(struct in6_addr)) == 0) {
|
||||
/* found it */
|
||||
return (ifa);
|
||||
}
|
||||
} else
|
||||
#endif
|
||||
if (ifa->ifa_addr->sa_family == AF_INET) {
|
||||
/* IPv4 address */
|
||||
struct sockaddr_in *sin1, *sin2;
|
||||
|
||||
sin1 = (struct sockaddr_in *)ifa->ifa_addr;
|
||||
sin2 = (struct sockaddr_in *)sa;
|
||||
if (sin1->sin_addr.s_addr ==
|
||||
sin2->sin_addr.s_addr) {
|
||||
/* found it */
|
||||
return (ifa);
|
||||
}
|
||||
LIST_FOREACH(laddr, &inp->sctp_addr_list, sctp_nxt_addr) {
|
||||
if (laddr->ifa == NULL)
|
||||
continue;
|
||||
if (addr->sa_family != laddr->ifa->address.sa.sa_family)
|
||||
continue;
|
||||
if (addr->sa_family == AF_INET) {
|
||||
if (((struct sockaddr_in *)addr)->sin_addr.s_addr ==
|
||||
laddr->ifa->address.sin.sin_addr.s_addr) {
|
||||
/* found him. */
|
||||
if (holds_lock == 0)
|
||||
SCTP_INP_RUNLOCK(inp);
|
||||
return (laddr->ifa);
|
||||
break;
|
||||
}
|
||||
/* else, not AF_INET or AF_INET6, so skip */
|
||||
} /* end foreach ifa */
|
||||
} /* end foreach ifn */
|
||||
/* not found! */
|
||||
} else if (addr->sa_family == AF_INET6) {
|
||||
if (SCTP6_ARE_ADDR_EQUAL(&((struct sockaddr_in6 *)addr)->sin6_addr,
|
||||
&laddr->ifa->address.sin6.sin6_addr)) {
|
||||
/* found him. */
|
||||
if (holds_lock == 0)
|
||||
SCTP_INP_RUNLOCK(inp);
|
||||
return (laddr->ifa);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (holds_lock == 0)
|
||||
SCTP_INP_RUNLOCK(inp);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
struct sctp_ifa *
|
||||
sctp_find_ifa_in_ifn(struct sctp_ifn *sctp_ifnp, struct sockaddr *addr,
|
||||
int holds_lock)
|
||||
{
|
||||
struct sctp_ifa *sctp_ifap;
|
||||
|
||||
if (holds_lock == 0)
|
||||
SCTP_IPI_ADDR_LOCK();
|
||||
|
||||
LIST_FOREACH(sctp_ifap, &sctp_ifnp->ifalist, next_ifa) {
|
||||
if (addr->sa_family != sctp_ifap->address.sa.sa_family)
|
||||
continue;
|
||||
if (addr->sa_family == AF_INET) {
|
||||
if (((struct sockaddr_in *)addr)->sin_addr.s_addr ==
|
||||
sctp_ifap->address.sin.sin_addr.s_addr) {
|
||||
/* found him. */
|
||||
if (holds_lock == 0)
|
||||
SCTP_IPI_ADDR_UNLOCK();
|
||||
return (sctp_ifap);
|
||||
break;
|
||||
}
|
||||
} else if (addr->sa_family == AF_INET6) {
|
||||
if (SCTP6_ARE_ADDR_EQUAL(&((struct sockaddr_in6 *)addr)->sin6_addr,
|
||||
&sctp_ifap->address.sin6.sin6_addr)) {
|
||||
/* found him. */
|
||||
if (holds_lock == 0)
|
||||
SCTP_IPI_ADDR_UNLOCK();
|
||||
return (sctp_ifap);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (holds_lock == 0)
|
||||
SCTP_IPI_ADDR_UNLOCK();
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
struct sctp_ifa *
|
||||
sctp_find_ifa_by_addr(struct sockaddr *addr, uint32_t vrf_id, int holds_lock)
|
||||
{
|
||||
struct sctp_ifa *sctp_ifap;
|
||||
struct sctp_ifn *sctp_ifnp = NULL;
|
||||
struct sctp_vrf *vrf;
|
||||
|
||||
vrf = sctp_find_vrf(vrf_id);
|
||||
if (vrf == NULL)
|
||||
return (NULL);
|
||||
|
||||
if (holds_lock == 0)
|
||||
SCTP_IPI_ADDR_LOCK();
|
||||
|
||||
LIST_FOREACH(sctp_ifnp, &vrf->ifnlist, next_ifn) {
|
||||
sctp_ifap = sctp_find_ifa_in_ifn(sctp_ifnp, addr, 1);
|
||||
if (sctp_ifap) {
|
||||
if (holds_lock == 0)
|
||||
SCTP_IPI_ADDR_UNLOCK();
|
||||
return (sctp_ifap);
|
||||
}
|
||||
}
|
||||
if (holds_lock == 0)
|
||||
SCTP_IPI_ADDR_UNLOCK();
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
@ -4208,7 +4433,8 @@ sctp_sorecvmsg(struct socket *so,
|
||||
uint32_t rwnd_req = 0;
|
||||
int hold_sblock = 0;
|
||||
int hold_rlock = 0;
|
||||
int alen = 0, slen = 0;
|
||||
int alen = 0;
|
||||
int slen = 0;
|
||||
int held_length = 0;
|
||||
|
||||
if (msg_flags) {
|
||||
@ -4228,7 +4454,7 @@ sctp_sorecvmsg(struct socket *so,
|
||||
if ((in_flags & (MSG_DONTWAIT
|
||||
| MSG_NBIO
|
||||
)) ||
|
||||
(so->so_state & SS_NBIO)) {
|
||||
SCTP_SO_IS_NBIO(so)) {
|
||||
block_allowed = 0;
|
||||
}
|
||||
/* setup the endpoint */
|
||||
@ -4573,7 +4799,7 @@ sctp_sorecvmsg(struct socket *so,
|
||||
if (fromlen && from) {
|
||||
struct sockaddr *to;
|
||||
|
||||
#ifdef AF_INET
|
||||
#ifdef INET
|
||||
cp_len = min(fromlen, control->whoFrom->ro._l_addr.sin.sin_len);
|
||||
memcpy(from, &control->whoFrom->ro._l_addr, cp_len);
|
||||
((struct sockaddr_in *)from)->sin_port = control->port_from;
|
||||
@ -4585,7 +4811,7 @@ sctp_sorecvmsg(struct socket *so,
|
||||
#endif
|
||||
|
||||
to = from;
|
||||
#if defined(AF_INET) && defined(AF_INET6)
|
||||
#if defined(INET) && defined(INET6)
|
||||
if ((inp->sctp_flags & SCTP_PCB_FLAGS_NEEDS_MAPPED_V4) &&
|
||||
(to->sa_family == AF_INET) &&
|
||||
((size_t)fromlen >= sizeof(struct sockaddr_in6))) {
|
||||
@ -4604,7 +4830,7 @@ sctp_sorecvmsg(struct socket *so,
|
||||
memcpy(from, (caddr_t)&sin6, sizeof(sin6));
|
||||
}
|
||||
#endif
|
||||
#if defined(AF_INET6)
|
||||
#if defined(INET6)
|
||||
{
|
||||
struct sockaddr_in6 lsa6, *to6;
|
||||
|
||||
@ -5253,6 +5479,52 @@ sctp_m_freem(struct mbuf *mb)
|
||||
|
||||
#endif
|
||||
|
||||
int
|
||||
sctp_dynamic_set_primary(struct sockaddr *sa, uint32_t vrf_id)
|
||||
{
|
||||
/*
|
||||
* Given a local address. For all associations that holds the
|
||||
* address, request a peer-set-primary.
|
||||
*/
|
||||
struct sctp_ifa *ifa;
|
||||
struct sctp_laddr *wi;
|
||||
|
||||
ifa = sctp_find_ifa_by_addr(sa, vrf_id, 0);
|
||||
if (ifa == NULL) {
|
||||
return (EADDRNOTAVAIL);
|
||||
}
|
||||
/*
|
||||
* Now that we have the ifa we must awaken the iterator with this
|
||||
* message.
|
||||
*/
|
||||
wi = SCTP_ZONE_GET(sctppcbinfo.ipi_zone_laddr, struct sctp_laddr);
|
||||
if (wi == NULL) {
|
||||
return (ENOMEM);
|
||||
}
|
||||
/* Now incr the count and int wi structure */
|
||||
SCTP_INCR_LADDR_COUNT();
|
||||
bzero(wi, sizeof(*wi));
|
||||
wi->ifa = ifa;
|
||||
wi->action = SCTP_SET_PRIM_ADDR;
|
||||
atomic_add_int(&ifa->refcount, 1);
|
||||
|
||||
/* Now add it to the work queue */
|
||||
SCTP_IPI_ITERATOR_WQ_LOCK();
|
||||
/*
|
||||
* Should this really be a tailq? As it is we will process the
|
||||
* newest first :-0
|
||||
*/
|
||||
LIST_INSERT_HEAD(&sctppcbinfo.addr_wq, wi, sctp_nxt_addr);
|
||||
sctp_timer_start(SCTP_TIMER_TYPE_ADDR_WQ,
|
||||
(struct sctp_inpcb *)NULL,
|
||||
(struct sctp_tcb *)NULL,
|
||||
(struct sctp_nets *)NULL);
|
||||
SCTP_IPI_ITERATOR_WQ_UNLOCK();
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int
|
||||
sctp_soreceive(so, psa, uio, mp0, controlp, flagsp)
|
||||
|
@ -56,13 +56,20 @@ void sctp_m_freem(struct mbuf *m);
|
||||
/*
|
||||
* Function prototypes
|
||||
*/
|
||||
struct ifaddr *sctp_find_ifa_by_addr(struct sockaddr *sa);
|
||||
struct sctp_ifa *
|
||||
sctp_find_ifa_in_ep(struct sctp_inpcb *inp, struct sockaddr *addr, int hold_lock);
|
||||
struct sctp_ifa *
|
||||
sctp_find_ifa_in_ifn(struct sctp_ifn *sctp_ifnp, struct sockaddr *addr,
|
||||
int holds_lock);
|
||||
|
||||
struct sctp_ifa *
|
||||
sctp_find_ifa_by_addr(struct sockaddr *addr, uint32_t vrf_id, int holds_lock);
|
||||
|
||||
uint32_t sctp_select_initial_TSN(struct sctp_pcb *);
|
||||
|
||||
uint32_t sctp_select_a_tag(struct sctp_inpcb *);
|
||||
|
||||
int sctp_init_asoc(struct sctp_inpcb *, struct sctp_association *, int, uint32_t);
|
||||
int sctp_init_asoc(struct sctp_inpcb *, struct sctp_association *, int, uint32_t, uint32_t);
|
||||
|
||||
void sctp_fill_random_store(struct sctp_pcb *);
|
||||
|
||||
@ -74,6 +81,9 @@ int
|
||||
sctp_timer_stop(int, struct sctp_inpcb *, struct sctp_tcb *,
|
||||
struct sctp_nets *, uint32_t);
|
||||
|
||||
int
|
||||
sctp_dynamic_set_primary(struct sockaddr *sa, uint32_t vrf_id);
|
||||
|
||||
uint32_t sctp_calculate_sum(struct mbuf *, int32_t *, uint32_t);
|
||||
|
||||
void
|
||||
@ -96,6 +106,8 @@ sctp_append_to_readq(struct sctp_inpcb *inp,
|
||||
struct sockbuf *sb);
|
||||
|
||||
|
||||
void sctp_iterator_worker(void);
|
||||
|
||||
int find_next_best_mtu(int);
|
||||
|
||||
void
|
||||
@ -288,7 +300,7 @@ void sctp_log_block(uint8_t, struct socket *, struct sctp_association *, int);
|
||||
void sctp_log_rwnd(uint8_t, uint32_t, uint32_t, uint32_t);
|
||||
void sctp_log_mbcnt(uint8_t, uint32_t, uint32_t, uint32_t, uint32_t);
|
||||
void sctp_log_rwnd_set(uint8_t, uint32_t, uint32_t, uint32_t, uint32_t);
|
||||
int sctp_fill_stat_log(struct mbuf *);
|
||||
int sctp_fill_stat_log(void *, size_t *);
|
||||
void sctp_log_fr(uint32_t, uint32_t, uint32_t, int);
|
||||
void sctp_log_sack(uint32_t, uint32_t, uint32_t, uint16_t, uint16_t, int);
|
||||
void sctp_log_map(uint32_t, uint32_t, uint32_t, int);
|
||||
|
@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <netinet/sctp_pcb.h>
|
||||
#include <netinet/sctp_header.h>
|
||||
#include <netinet/sctp_var.h>
|
||||
#include <netinet/sctp_sysctl.h>
|
||||
#include <netinet/sctp_output.h>
|
||||
#include <netinet/sctp_input.h>
|
||||
#include <netinet/sctp_bsd_addr.h>
|
||||
@ -50,17 +51,10 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
|
||||
|
||||
#ifdef SCTP_DEBUG
|
||||
extern uint32_t sctp_debug_on;
|
||||
|
||||
#endif /* SCTP_DEBUG */
|
||||
|
||||
extern struct protosw inetsw[];
|
||||
|
||||
|
||||
|
||||
extern int sctp_no_csum_on_loopback;
|
||||
|
||||
int
|
||||
sctp6_input(mp, offp, proto)
|
||||
struct mbuf **mp;
|
||||
@ -339,8 +333,11 @@ sctp6_ctlinput(cmd, pktdst, d)
|
||||
{
|
||||
struct sctphdr sh;
|
||||
struct ip6ctlparam *ip6cp = NULL;
|
||||
uint32_t vrf_id;
|
||||
int cm;
|
||||
|
||||
vrf_id = SCTP_DEFAULT_VRFID;
|
||||
|
||||
if (pktdst->sa_family != AF_INET6 ||
|
||||
pktdst->sa_len != sizeof(struct sockaddr_in6))
|
||||
return;
|
||||
@ -386,7 +383,7 @@ sctp6_ctlinput(cmd, pktdst, d)
|
||||
final.sin6_port = sh.dest_port;
|
||||
stcb = sctp_findassociation_addr_sa((struct sockaddr *)ip6cp->ip6c_src,
|
||||
(struct sockaddr *)&final,
|
||||
&inp, &net, 1);
|
||||
&inp, &net, 1, vrf_id);
|
||||
/* inp's ref-count increased && stcb locked */
|
||||
if (stcb != NULL && inp && (inp->sctp_socket != NULL)) {
|
||||
if (cmd == PRC_MSGSIZE) {
|
||||
@ -437,6 +434,9 @@ sctp6_getcred(SYSCTL_HANDLER_ARGS)
|
||||
struct sctp_nets *net;
|
||||
struct sctp_tcb *stcb;
|
||||
int error;
|
||||
uint32_t vrf_id;
|
||||
|
||||
vrf_id = SCTP_DEFAULT_VRFID;
|
||||
|
||||
/*
|
||||
* XXXRW: Other instances of getcred use SUSER_ALLOWJAIL, as socket
|
||||
@ -458,7 +458,7 @@ sctp6_getcred(SYSCTL_HANDLER_ARGS)
|
||||
|
||||
stcb = sctp_findassociation_addr_sa(sin6tosa(&addrs[0]),
|
||||
sin6tosa(&addrs[1]),
|
||||
&inp, &net, 1);
|
||||
&inp, &net, 1, vrf_id);
|
||||
if (stcb == NULL || inp == NULL || inp->sctp_socket == NULL) {
|
||||
if ((inp != NULL) && (stcb == NULL)) {
|
||||
/* reduce ref-count */
|
||||
@ -703,6 +703,7 @@ sctp6_close(struct socket *so)
|
||||
|
||||
}
|
||||
|
||||
/* This could be made common with sctp_detach() since they are identical */
|
||||
|
||||
static int
|
||||
sctp6_disconnect(struct socket *so)
|
||||
@ -942,6 +943,7 @@ sctp6_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *addr,
|
||||
static int
|
||||
sctp6_connect(struct socket *so, struct sockaddr *addr, struct thread *p)
|
||||
{
|
||||
uint32_t vrf_id;
|
||||
int error = 0;
|
||||
struct sctp_inpcb *inp;
|
||||
struct in6pcb *inp6;
|
||||
@ -959,6 +961,7 @@ sctp6_connect(struct socket *so, struct sockaddr *addr, struct thread *p)
|
||||
return (ECONNRESET); /* I made the same as TCP since we are
|
||||
* not setup? */
|
||||
}
|
||||
vrf_id = SCTP_DEFAULT_VRFID;
|
||||
SCTP_ASOC_CREATE_LOCK(inp);
|
||||
SCTP_INP_RLOCK(inp);
|
||||
if ((inp->sctp_flags & SCTP_PCB_FLAGS_UNBOUND) ==
|
||||
@ -1039,7 +1042,7 @@ sctp6_connect(struct socket *so, struct sockaddr *addr, struct thread *p)
|
||||
return (EALREADY);
|
||||
}
|
||||
/* We are GOOD to go */
|
||||
stcb = sctp_aloc_assoc(inp, addr, 1, &error, 0);
|
||||
stcb = sctp_aloc_assoc(inp, addr, 1, &error, 0, vrf_id);
|
||||
SCTP_ASOC_CREATE_UNLOCK(inp);
|
||||
if (stcb == NULL) {
|
||||
/* Gak! no memory */
|
||||
@ -1065,12 +1068,12 @@ static int
|
||||
sctp6_getaddr(struct socket *so, struct sockaddr **addr)
|
||||
{
|
||||
struct sockaddr_in6 *sin6;
|
||||
|
||||
struct sctp_inpcb *inp;
|
||||
uint32_t vrf_id;
|
||||
struct sctp_ifa *sctp_ifa;
|
||||
|
||||
int error;
|
||||
|
||||
|
||||
/*
|
||||
* Do the malloc first in case it blocks.
|
||||
*/
|
||||
@ -1114,9 +1117,12 @@ sctp6_getaddr(struct socket *so, struct sockaddr **addr)
|
||||
/* punt */
|
||||
goto notConn6;
|
||||
}
|
||||
sin6->sin6_addr = sctp_ipv6_source_address_selection(
|
||||
inp, stcb, (struct route *)&net->ro, net, 0);
|
||||
vrf_id = SCTP_DEFAULT_VRFID;
|
||||
|
||||
sctp_ifa = sctp_source_address_selection(inp, stcb, (struct route *)&net->ro, net, 0, vrf_id);
|
||||
if (sctp_ifa) {
|
||||
sin6->sin6_addr = sctp_ifa->address.sin6.sin6_addr;
|
||||
}
|
||||
} else {
|
||||
/* For the bound all case you get back 0 */
|
||||
notConn6:
|
||||
@ -1128,10 +1134,10 @@ sctp6_getaddr(struct socket *so, struct sockaddr **addr)
|
||||
int fnd = 0;
|
||||
|
||||
LIST_FOREACH(laddr, &inp->sctp_addr_list, sctp_nxt_addr) {
|
||||
if (laddr->ifa->ifa_addr->sa_family == AF_INET6) {
|
||||
if (laddr->ifa->address.sa.sa_family == AF_INET6) {
|
||||
struct sockaddr_in6 *sin_a;
|
||||
|
||||
sin_a = (struct sockaddr_in6 *)laddr->ifa->ifa_addr;
|
||||
sin_a = (struct sockaddr_in6 *)&laddr->ifa->address.sin6;
|
||||
sin6->sin6_addr = sin_a->sin6_addr;
|
||||
fnd = 1;
|
||||
break;
|
||||
@ -1157,7 +1163,6 @@ static int
|
||||
sctp6_peeraddr(struct socket *so, struct sockaddr **addr)
|
||||
{
|
||||
struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)*addr;
|
||||
|
||||
int fnd;
|
||||
struct sockaddr_in6 *sin_a6;
|
||||
struct sctp_inpcb *inp;
|
||||
@ -1166,7 +1171,6 @@ sctp6_peeraddr(struct socket *so, struct sockaddr **addr)
|
||||
|
||||
int error;
|
||||
|
||||
|
||||
/*
|
||||
* Do the malloc first in case it blocks.
|
||||
*/
|
||||
@ -1220,7 +1224,6 @@ static int
|
||||
sctp6_in6getaddr(struct socket *so, struct sockaddr **nam)
|
||||
{
|
||||
struct sockaddr *addr;
|
||||
|
||||
struct in6pcb *inp6 = sotoin6pcb(so);
|
||||
int error;
|
||||
|
||||
@ -1252,7 +1255,6 @@ static int
|
||||
sctp6_getpeeraddr(struct socket *so, struct sockaddr **nam)
|
||||
{
|
||||
struct sockaddr *addr = *nam;
|
||||
|
||||
struct in6pcb *inp6 = sotoin6pcb(so);
|
||||
int error;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user