1) Adds the rest of the VIMAGE change macros
2) Adds some __UserSpace__ on some of the common defines that the user space code needs 3) Fixes a bug when we send up data to a user that failed. We need to a) trim off the data chunk headers, if present, and b) make sure the frag bit is communicated properly for the msgs coming off the stream queues... i.e. we see if some of the msg has been taken. Obtained from: jeli contributed the VIMAGE changes on this pass Thanks Julain!
This commit is contained in:
parent
c0ef832fd2
commit
a51aa927fa
@ -877,7 +877,9 @@ send_reply:
|
||||
*/
|
||||
/* we probably don't need these operations */
|
||||
(void)sa6_recoverscope(from6);
|
||||
sa6_embedscope(from6, ip6_use_defzone);
|
||||
sa6_embedscope(from6,
|
||||
MODULE_GLOBAL(MOD_INET6, ip6_use_defzone));
|
||||
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
@ -36,7 +36,7 @@ __FBSDID("$FreeBSD$");
|
||||
#ifndef _NETINET_SCTP_ASCONF_H_
|
||||
#define _NETINET_SCTP_ASCONF_H_
|
||||
|
||||
#if defined(_KERNEL)
|
||||
#if defined(_KERNEL) || defined(__Userspace__)
|
||||
|
||||
/*
|
||||
* function prototypes
|
||||
|
@ -79,7 +79,6 @@ MALLOC_DEFINE(SCTP_M_MVRF, "sctp_mvrf", "sctp mvrf pcb list");
|
||||
MALLOC_DEFINE(SCTP_M_ITER, "sctp_iter", "sctp iterator control");
|
||||
MALLOC_DEFINE(SCTP_M_SOCKOPT, "sctp_socko", "sctp socket option");
|
||||
|
||||
|
||||
#if defined(SCTP_USE_THREAD_BASED_ITERATOR)
|
||||
void
|
||||
sctp_wakeup_iterator(void)
|
||||
@ -116,6 +115,7 @@ sctp_startup_iterator(void)
|
||||
#endif
|
||||
|
||||
#ifdef INET6
|
||||
|
||||
void
|
||||
sctp_gather_internal_ifa_flags(struct sctp_ifa *ifa)
|
||||
{
|
||||
@ -123,7 +123,7 @@ sctp_gather_internal_ifa_flags(struct sctp_ifa *ifa)
|
||||
|
||||
ifa6 = (struct in6_ifaddr *)ifa->ifa;
|
||||
ifa->flags = ifa6->ia6_flags;
|
||||
if (!ip6_use_deprecated) {
|
||||
if (!MODULE_GLOBAL(MOD_INET6, ip6_use_deprecated)) {
|
||||
if (ifa->flags &
|
||||
IN6_IFF_DEPRECATED) {
|
||||
ifa->localifa_flags |= SCTP_ADDR_IFA_UNUSEABLE;
|
||||
@ -143,7 +143,7 @@ sctp_gather_internal_ifa_flags(struct sctp_ifa *ifa)
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif /* INET6 */
|
||||
|
||||
|
||||
static uint32_t
|
||||
@ -189,6 +189,8 @@ sctp_is_desired_interface_type(struct ifaddr *ifa)
|
||||
static void
|
||||
sctp_init_ifns_for_vrf(int vrfid)
|
||||
{
|
||||
|
||||
|
||||
/*
|
||||
* Here we must apply ANY locks needed by the IFN we access and also
|
||||
* make sure we lock any IFA that exists as we float through the
|
||||
@ -200,8 +202,9 @@ sctp_init_ifns_for_vrf(int vrfid)
|
||||
struct sctp_ifa *sctp_ifa;
|
||||
uint32_t ifa_flags;
|
||||
|
||||
TAILQ_FOREACH(ifn, &ifnet, if_list) {
|
||||
TAILQ_FOREACH(ifn, &MODULE_GLOBAL(MOD_NET, ifnet), if_list) {
|
||||
TAILQ_FOREACH(ifa, &ifn->if_addrlist, ifa_list) {
|
||||
|
||||
if (ifa->ifa_addr == NULL) {
|
||||
continue;
|
||||
}
|
||||
@ -329,7 +332,7 @@ void
|
||||
struct ifnet *ifn;
|
||||
struct ifaddr *ifa;
|
||||
|
||||
TAILQ_FOREACH(ifn, &ifnet, if_list) {
|
||||
TAILQ_FOREACH(ifn, &MODULE_GLOBAL(MOD_NET, ifnet), if_list) {
|
||||
if (!(*pred) (ifn)) {
|
||||
continue;
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ __FBSDID("$FreeBSD$");
|
||||
#define __sctp_bsd_addr_h__
|
||||
#include <netinet/sctp_pcb.h>
|
||||
|
||||
#if defined(_KERNEL)
|
||||
#if defined(_KERNEL) || defined(__Userspace__)
|
||||
|
||||
#if defined(SCTP_USE_THREAD_BASED_ITERATOR)
|
||||
void sctp_wakeup_iterator(void);
|
||||
|
@ -33,7 +33,7 @@ __FBSDID("$FreeBSD$");
|
||||
#ifndef __sctp_cc_functions_h__
|
||||
#define __sctp_cc_functions_h__
|
||||
|
||||
#if defined(_KERNEL)
|
||||
#if defined(_KERNEL) || defined(__Userspace__)
|
||||
|
||||
void
|
||||
sctp_set_initial_cc_param(struct sctp_tcb *stcb,
|
||||
|
@ -1070,6 +1070,7 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
#define SCTP_GETTIME_TIMEVAL(x) (getmicrouptime(x))
|
||||
#define SCTP_GETPTIME_TIMEVAL(x) (microuptime(x))
|
||||
#endif
|
||||
/*#if defined(__FreeBSD__) || defined(__APPLE__)*/
|
||||
/*#define SCTP_GETTIME_TIMEVAL(x) { \*/
|
||||
/* (x)->tv_sec = ticks / 1000; \*/
|
||||
@ -1080,6 +1081,7 @@ __FBSDID("$FreeBSD$");
|
||||
/*#define SCTP_GETTIME_TIMEVAL(x) (microtime(x))*/
|
||||
/*#endif __FreeBSD__ */
|
||||
|
||||
#if defined(_KERNEL) || defined(__Userspace__)
|
||||
#define sctp_sowwakeup(inp, so) \
|
||||
do { \
|
||||
if (inp->sctp_flags & SCTP_PCB_FLAGS_DONT_WAKE) { \
|
||||
@ -1118,5 +1120,5 @@ do { \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#endif /* _KERNEL */
|
||||
#endif /* _KERNEL || __Userspace__ */
|
||||
#endif
|
||||
|
@ -38,7 +38,7 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
#ifndef SCTP_USE_ADLER32
|
||||
|
||||
#if defined(_KERNEL)
|
||||
#if defined(_KERNEL) || defined(__Userspace__)
|
||||
uint32_t update_crc32(uint32_t, unsigned char *, unsigned int);
|
||||
|
||||
uint32_t old_update_crc32(uint32_t, unsigned char *, unsigned int);
|
||||
|
@ -3184,6 +3184,10 @@ sctp_strike_gap_ack_chunks(struct sctp_tcb *stcb, struct sctp_association *asoc,
|
||||
if ((PR_SCTP_TTL_ENABLED(tp1->flags)) && tp1->sent < SCTP_DATAGRAM_ACKED) {
|
||||
/* Is it expired? */
|
||||
if (
|
||||
/*
|
||||
* TODO sctp_constants.h needs alternative
|
||||
* time macros when _KERNEL is undefined.
|
||||
*/
|
||||
(timevalcmp(&now, &tp1->rec.data.timetodrop, >))
|
||||
) {
|
||||
/* Yes so drop it */
|
||||
|
@ -36,7 +36,7 @@ __FBSDID("$FreeBSD$");
|
||||
#ifndef __sctp_indata_h__
|
||||
#define __sctp_indata_h__
|
||||
|
||||
#if defined(_KERNEL)
|
||||
#if defined(_KERNEL) || defined(__Userspace__)
|
||||
|
||||
struct sctp_queued_to_read *
|
||||
sctp_build_readq_entry(struct sctp_tcb *stcb,
|
||||
|
@ -2299,6 +2299,10 @@ sctp_handle_cookie_echo(struct mbuf *m, int iphlen, int offset,
|
||||
/* Expire time is in Ticks, so we convert to seconds */
|
||||
time_expires.tv_sec = cookie->time_entered.tv_sec + TICKS_TO_SEC(cookie->cookie_life);
|
||||
time_expires.tv_usec = cookie->time_entered.tv_usec;
|
||||
/*
|
||||
* TODO sctp_constants.h needs alternative time macros when _KERNEL
|
||||
* is undefined.
|
||||
*/
|
||||
if (timevalcmp(&now, &time_expires, >)) {
|
||||
/* cookie is stale! */
|
||||
struct mbuf *op_err;
|
||||
@ -5371,7 +5375,7 @@ sctp_skip_csum_4:
|
||||
goto bad;
|
||||
}
|
||||
/* validate mbuf chain length with IP payload length */
|
||||
if (mlen < (ip->ip_len - iphlen)) {
|
||||
if (mlen < (SCTP_GET_IPV4_LENGTH(ip) - iphlen)) {
|
||||
SCTP_STAT_INCR(sctps_hdrops);
|
||||
goto bad;
|
||||
}
|
||||
@ -5434,7 +5438,7 @@ sctp_skip_csum_4:
|
||||
* idea, so I will leave it in place.
|
||||
*/
|
||||
if (inp && ipsec4_in_reject(m, &inp->ip_inp.inp)) {
|
||||
ipsec4stat.in_polvio++;
|
||||
MODULE_GLOBAL(MOD_IPSEC, ipsec4stat).in_polvio++;
|
||||
SCTP_STAT_INCR(sctps_hdrops);
|
||||
goto bad;
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ __FBSDID("$FreeBSD$");
|
||||
#ifndef __sctp_input_h__
|
||||
#define __sctp_input_h__
|
||||
|
||||
#if defined(_KERNEL)
|
||||
#if defined(_KERNEL) || defined(__Userspace__)
|
||||
void
|
||||
sctp_common_input_processing(struct mbuf **, int, int, int,
|
||||
struct sctphdr *, struct sctp_chunkhdr *, struct sctp_inpcb *,
|
||||
|
@ -60,6 +60,9 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/random.h>
|
||||
#include <sys/limits.h>
|
||||
#include <sys/queue.h>
|
||||
#if defined(__FreeBSD__) && __FreeBSD_version > 800000 && defined(VIMAGE)
|
||||
#include <sys/vimage.h>
|
||||
#endif
|
||||
#include <machine/cpu.h>
|
||||
|
||||
#include <net/if.h>
|
||||
@ -138,6 +141,26 @@ MALLOC_DECLARE(SCTP_M_SOCKOPT);
|
||||
#define SCTP_BASE_SYSCTL(__m) system_base_info.sctpsysctl.__m
|
||||
#define SCTP_BASE_VAR(__m) system_base_info.__m
|
||||
|
||||
/*
|
||||
* Macros to expand out globals defined by various modules
|
||||
* to either a real global or a virtualized instance of one,
|
||||
* depending on whether VIMAGE is defined in opt_vimage.h
|
||||
* XXX opt_vimage.h not yet present, more framework to come.
|
||||
* XXX so will always evaluate to the global for now (VIMAGE not defined)
|
||||
*/
|
||||
/* first define modules that supply us information */
|
||||
#define MOD_NET net
|
||||
#define MOD_INET inet
|
||||
#define MOD_INET6 inet6
|
||||
#define MOD_IPSEC ipsec
|
||||
|
||||
/* then define the macro(s) that hook into the vimage macros */
|
||||
#if defined(__FreeBSD__) && __FreeBSD_version > 800000 && defined(VIMAGE)
|
||||
#define VSYMNAME(__MODULE) vnet_ ## __MODULE
|
||||
#define MODULE_GLOBAL(__MODULE, __SYMBOL) VSYM(VSYMNAME(__MODULE), __SYMBOL)
|
||||
#else
|
||||
#define MODULE_GLOBAL(__MODULE, __SYMBOL) (__SYMBOL)
|
||||
#endif
|
||||
/*
|
||||
*
|
||||
*/
|
||||
|
@ -3510,7 +3510,7 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp,
|
||||
tos_value = inp->ip_inp.inp.inp_ip_tos;
|
||||
}
|
||||
if ((nofragment_flag) && (port == 0)) {
|
||||
#if defined(WITH_CONVERT_IP_OFF) || defined(__FreeBSD__) || defined(__APPLE__)
|
||||
#if defined(WITH_CONVERT_IP_OFF) || defined(__FreeBSD__) || defined(__APPLE__) || defined(__Userspace__)
|
||||
ip->ip_off = IP_DF;
|
||||
#else
|
||||
ip->ip_off = htons(IP_DF);
|
||||
@ -3826,7 +3826,7 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp,
|
||||
sin6 = &tmp;
|
||||
|
||||
/* KAME hack: embed scopeid */
|
||||
if (sa6_embedscope(sin6, ip6_use_defzone) != 0) {
|
||||
if (sa6_embedscope(sin6, MODULE_GLOBAL(MOD_INET6, ip6_use_defzone)) != 0) {
|
||||
SCTP_LTRACE_ERR_RET_PKT(m, inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EINVAL);
|
||||
return (EINVAL);
|
||||
}
|
||||
@ -3880,7 +3880,7 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp,
|
||||
if (net->src_addr_selected == 0) {
|
||||
sin6 = (struct sockaddr_in6 *)&net->ro._l_addr;
|
||||
/* KAME hack: embed scopeid */
|
||||
if (sa6_embedscope(sin6, ip6_use_defzone) != 0) {
|
||||
if (sa6_embedscope(sin6, MODULE_GLOBAL(MOD_INET6, ip6_use_defzone)) != 0) {
|
||||
SCTP_LTRACE_ERR_RET_PKT(m, inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EINVAL);
|
||||
return (EINVAL);
|
||||
}
|
||||
@ -3903,7 +3903,7 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp,
|
||||
} else {
|
||||
sin6 = (struct sockaddr_in6 *)&ro->ro_dst;
|
||||
/* KAME hack: embed scopeid */
|
||||
if (sa6_embedscope(sin6, ip6_use_defzone) != 0) {
|
||||
if (sa6_embedscope(sin6, MODULE_GLOBAL(MOD_INET6, ip6_use_defzone)) != 0) {
|
||||
SCTP_LTRACE_ERR_RET_PKT(m, inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EINVAL);
|
||||
return (EINVAL);
|
||||
}
|
||||
@ -5096,7 +5096,7 @@ do_a_abort:
|
||||
*/
|
||||
(void)sa6_recoverscope(sin6);
|
||||
stc.scope_id = sin6->sin6_scope_id;
|
||||
sa6_embedscope(sin6, ip6_use_defzone);
|
||||
sa6_embedscope(sin6, MODULE_GLOBAL(MOD_INET6, ip6_use_defzone));
|
||||
stc.loopback_scope = 1;
|
||||
stc.local_scope = 0;
|
||||
stc.site_scope = 1;
|
||||
@ -5132,7 +5132,7 @@ do_a_abort:
|
||||
*/
|
||||
(void)sa6_recoverscope(sin6);
|
||||
stc.scope_id = sin6->sin6_scope_id;
|
||||
sa6_embedscope(sin6, ip6_use_defzone);
|
||||
sa6_embedscope(sin6, MODULE_GLOBAL(MOD_INET6, ip6_use_defzone));
|
||||
} else if (IN6_IS_ADDR_SITELOCAL(&sin6->sin6_addr)) {
|
||||
/*
|
||||
* If the new destination is
|
||||
@ -5761,6 +5761,10 @@ sctp_set_prsctp_policy(struct sctp_tcb *stcb,
|
||||
(void)SCTP_GETTIME_TIMEVAL(&sp->ts);
|
||||
tv.tv_sec = sp->timetolive / 1000;
|
||||
tv.tv_usec = (sp->timetolive * 1000) % 1000000;
|
||||
/*
|
||||
* TODO sctp_constants.h needs alternative
|
||||
* time macros when _KERNEL is undefined.
|
||||
*/
|
||||
timevaladd(&sp->ts, &tv);
|
||||
}
|
||||
break;
|
||||
@ -10260,7 +10264,7 @@ sctp_send_shutdown_complete2(struct mbuf *m, int iphlen, struct sctphdr *sh,
|
||||
|
||||
/* Fill in the IPv6 header for the ABORT */
|
||||
ip6_out->ip6_flow = ip6->ip6_flow;
|
||||
ip6_out->ip6_hlim = ip6_defhlim;
|
||||
ip6_out->ip6_hlim = MODULE_GLOBAL(MOD_INET6, ip6_defhlim);
|
||||
if (port) {
|
||||
ip6_out->ip6_nxt = IPPROTO_UDP;
|
||||
} else {
|
||||
@ -10277,7 +10281,7 @@ sctp_send_shutdown_complete2(struct mbuf *m, int iphlen, struct sctphdr *sh,
|
||||
comp_cp = (struct sctp_shutdown_complete_msg *)(
|
||||
(caddr_t)ip6_out + offset_out);
|
||||
break;
|
||||
#endif
|
||||
#endif /* INET6 */
|
||||
default:
|
||||
/* Currently not supported. */
|
||||
return;
|
||||
@ -11225,7 +11229,7 @@ sctp_send_abort(struct mbuf *m, int iphlen, struct sctphdr *sh, uint32_t vtag,
|
||||
|
||||
/* Fill in the IP6 header for the ABORT */
|
||||
ip6_out->ip6_flow = ip6->ip6_flow;
|
||||
ip6_out->ip6_hlim = ip6_defhlim;
|
||||
ip6_out->ip6_hlim = MODULE_GLOBAL(MOD_INET6, ip6_defhlim);
|
||||
if (port) {
|
||||
ip6_out->ip6_nxt = IPPROTO_UDP;
|
||||
} else {
|
||||
@ -11237,7 +11241,7 @@ sctp_send_abort(struct mbuf *m, int iphlen, struct sctphdr *sh, uint32_t vtag,
|
||||
iphlen_out = sizeof(*ip6_out);
|
||||
abm = (struct sctp_abort_msg *)((caddr_t)ip6_out + iphlen_out);
|
||||
break;
|
||||
#endif
|
||||
#endif /* INET6 */
|
||||
default:
|
||||
/* Currently not supported */
|
||||
if (err_cause)
|
||||
@ -11517,7 +11521,7 @@ sctp_send_operr_to(struct mbuf *m, int iphlen, struct mbuf *scm, uint32_t vtag,
|
||||
in6 = mtod(m, struct ip6_hdr *);
|
||||
out6 = mtod(mout, struct ip6_hdr *);
|
||||
out6->ip6_flow = in6->ip6_flow;
|
||||
out6->ip6_hlim = ip6_defhlim;
|
||||
out6->ip6_hlim = MODULE_GLOBAL(MOD_INET6, ip6_defhlim);
|
||||
if (port) {
|
||||
out6->ip6_nxt = IPPROTO_UDP;
|
||||
} else {
|
||||
@ -11568,7 +11572,7 @@ sctp_send_operr_to(struct mbuf *m, int iphlen, struct mbuf *scm, uint32_t vtag,
|
||||
RTFREE(ro.ro_rt);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
#endif /* INET6 */
|
||||
default:
|
||||
/* TSNH */
|
||||
break;
|
||||
@ -13162,7 +13166,7 @@ sctp_v6src_match_nexthop(struct sockaddr_in6 *src6, sctp_route_t * ro)
|
||||
return (0);
|
||||
|
||||
/* get prefix entry of address */
|
||||
LIST_FOREACH(pfx, &nd_prefix, ndpr_entry) {
|
||||
LIST_FOREACH(pfx, &MODULE_GLOBAL(MOD_INET6, nd_prefix), ndpr_entry) {
|
||||
if (pfx->ndpr_stateflags & NDPRF_DETACHED)
|
||||
continue;
|
||||
if (IN6_ARE_MASKED_ADDR_EQUAL(&pfx->ndpr_prefix.sin6_addr,
|
||||
|
@ -38,7 +38,7 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
#include <netinet/sctp_header.h>
|
||||
|
||||
#if defined(_KERNEL)
|
||||
#if defined(_KERNEL) || defined(__Userspace__)
|
||||
|
||||
|
||||
struct mbuf *
|
||||
@ -201,6 +201,9 @@ sctp_send_abort(struct mbuf *, int, struct sctphdr *, uint32_t,
|
||||
|
||||
void sctp_send_operr_to(struct mbuf *, int, struct mbuf *, uint32_t, uint32_t, uint16_t);
|
||||
|
||||
#endif /* _KERNEL || __Userspace__ */
|
||||
|
||||
#if defined(_KERNEL) || defined (__Userspace__)
|
||||
int
|
||||
sctp_sosend(struct socket *so,
|
||||
struct sockaddr *addr,
|
||||
|
@ -59,11 +59,11 @@ SCTP6_ARE_ADDR_EQUAL(struct sockaddr_in6 *a, struct sockaddr_in6 *b)
|
||||
struct sockaddr_in6 tmp_a, tmp_b;
|
||||
|
||||
memcpy(&tmp_a, a, sizeof(struct sockaddr_in6));
|
||||
if (sa6_embedscope(&tmp_a, ip6_use_defzone) != 0) {
|
||||
if (sa6_embedscope(&tmp_a, MODULE_GLOBAL(MOD_INET6, MODULE_GLOBAL(MOD_INET6, ip6_use_defzone))) != 0) {
|
||||
return 0;
|
||||
}
|
||||
memcpy(&tmp_b, b, sizeof(struct sockaddr_in6));
|
||||
if (sa6_embedscope(&tmp_b, ip6_use_defzone) != 0) {
|
||||
if (sa6_embedscope(&tmp_b, MODULE_GLOBAL(MOD_INET6, MODULE_GLOBAL(MOD_INET6, ip6_use_defzone))) != 0) {
|
||||
return 0;
|
||||
}
|
||||
return (IN6_ARE_ADDR_EQUAL(&tmp_a.sin6_addr, &tmp_b.sin6_addr));
|
||||
@ -1894,7 +1894,7 @@ sctp_findassociation_addr(struct mbuf *m, int iphlen, int offset,
|
||||
/* Get the scopes in properly to the sin6 addr's */
|
||||
/* we probably don't need these operations */
|
||||
(void)sa6_recoverscope(from6);
|
||||
sa6_embedscope(from6, ip6_use_defzone);
|
||||
sa6_embedscope(from6, MODULE_GLOBAL(MOD_INET6, MODULE_GLOBAL(MOD_INET6, ip6_use_defzone)));
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
@ -1941,7 +1941,7 @@ sctp_findassociation_addr(struct mbuf *m, int iphlen, int offset,
|
||||
/* Get the scopes in properly to the sin6 addr's */
|
||||
/* we probably don't need these operations */
|
||||
(void)sa6_recoverscope(to6);
|
||||
sa6_embedscope(to6, ip6_use_defzone);
|
||||
sa6_embedscope(to6, MODULE_GLOBAL(MOD_INET6, MODULE_GLOBAL(MOD_INET6, ip6_use_defzone)));
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
@ -2193,7 +2193,7 @@ sctp_inpcb_alloc(struct socket *so, uint32_t vrf_id)
|
||||
}
|
||||
#endif /* IPSEC */
|
||||
SCTP_INCR_EP_COUNT();
|
||||
inp->ip_inp.inp.inp_ip_ttl = ip_defttl;
|
||||
inp->ip_inp.inp.inp_ip_ttl = MODULE_GLOBAL(MOD_INET, ip_defttl);
|
||||
SCTP_INP_INFO_WUNLOCK();
|
||||
|
||||
so->so_pcb = (caddr_t)inp;
|
||||
@ -2606,7 +2606,7 @@ sctp_inpcb_bind(struct socket *so, struct sockaddr *addr,
|
||||
if (!IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr)) {
|
||||
bindall = 0;
|
||||
/* KAME hack: embed scopeid */
|
||||
if (sa6_embedscope(sin6, ip6_use_defzone) != 0) {
|
||||
if (sa6_embedscope(sin6, MODULE_GLOBAL(MOD_INET6, ip6_use_defzone)) != 0) {
|
||||
SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PCB, EINVAL);
|
||||
return (EINVAL);
|
||||
}
|
||||
@ -2706,8 +2706,8 @@ sctp_inpcb_bind(struct socket *so, struct sockaddr *addr,
|
||||
int done;
|
||||
|
||||
if (ip_inp->inp_flags & INP_HIGHPORT) {
|
||||
first = ipport_hifirstauto;
|
||||
last = ipport_hilastauto;
|
||||
first = MODULE_GLOBAL(MOD_INET, ipport_hifirstauto);
|
||||
last = MODULE_GLOBAL(MOD_INET, ipport_hilastauto);
|
||||
} else if (ip_inp->inp_flags & INP_LOWPORT) {
|
||||
if (p && (error =
|
||||
priv_check(p, PRIV_NETINET_RESERVEDPORT)
|
||||
@ -2718,8 +2718,8 @@ sctp_inpcb_bind(struct socket *so, struct sockaddr *addr,
|
||||
SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PCB, error);
|
||||
return (error);
|
||||
}
|
||||
first = ipport_lowfirstauto;
|
||||
last = ipport_lowlastauto;
|
||||
first = MODULE_GLOBAL(MOD_INET, ipport_lowfirstauto);
|
||||
last = MODULE_GLOBAL(MOD_INET, ipport_lowlastauto);
|
||||
} else {
|
||||
first = ipport_firstauto;
|
||||
last = ipport_lastauto;
|
||||
@ -3635,7 +3635,7 @@ sctp_add_remote_addr(struct sctp_tcb *stcb, struct sockaddr *newaddr,
|
||||
struct sockaddr_in6 *sin6;
|
||||
|
||||
sin6 = (struct sockaddr_in6 *)&net->ro._l_addr;
|
||||
(void)sa6_embedscope(sin6, ip6_use_defzone);
|
||||
(void)sa6_embedscope(sin6, MODULE_GLOBAL(MOD_INET6, ip6_use_defzone));
|
||||
sin6->sin6_scope_id = 0;
|
||||
}
|
||||
#endif
|
||||
@ -5357,12 +5357,6 @@ sctp_pcb_finish(void)
|
||||
struct sctp_tagblock *twait_block, *prev_twait_block;
|
||||
int i;
|
||||
|
||||
/* FIXME MT */
|
||||
SCTP_BASE_INFO(threads_must_exit) = 1;
|
||||
#if defined(SCTP_USE_THREAD_BASED_ITERATOR)
|
||||
/* Wake the thread up so it will exit now */
|
||||
sctp_wakeup_iterator();
|
||||
#endif
|
||||
/*
|
||||
* free the vrf/ifn/ifa lists and hashes (be sure address monitor is
|
||||
* destroyed first).
|
||||
|
@ -450,7 +450,8 @@ struct sctp_tcb {
|
||||
#include <netinet/sctp_lock_bsd.h>
|
||||
|
||||
|
||||
#if defined(_KERNEL)
|
||||
/* TODO where to put non-_KERNEL things for __Userspace__? */
|
||||
#if defined(_KERNEL) || defined(__Userspace__)
|
||||
|
||||
/* Attention Julian, this is the extern that
|
||||
* goes with the base info. sctp_pcb.c has
|
||||
|
@ -483,7 +483,7 @@ struct sctp_sysctl {
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(_KERNEL)
|
||||
#if defined(_KERNEL) || defined(__Userspace__)
|
||||
#if defined(SYSCTL_DECL)
|
||||
SYSCTL_DECL(_net_inet_sctp);
|
||||
#endif
|
||||
|
@ -37,7 +37,6 @@ __FBSDID("$FreeBSD$");
|
||||
#include <netinet/sctp_os.h>
|
||||
#include <netinet/sctp_pcb.h>
|
||||
#ifdef INET6
|
||||
#include <netinet6/sctp6_var.h>
|
||||
#endif
|
||||
#include <netinet/sctp_var.h>
|
||||
#include <netinet/sctp_sysctl.h>
|
||||
@ -402,8 +401,7 @@ sctp_find_alternate_net(struct sctp_tcb *stcb,
|
||||
}
|
||||
if (this_random % 2 == 1) {
|
||||
max_cwnd_net = mnet;
|
||||
max_cwnd = mnet->cwnd;
|
||||
//Useless ?
|
||||
max_cwnd = mnet->cwnd; /* Useless? */
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1711,7 +1709,7 @@ sctp_pathmtu_timer(struct sctp_inpcb *inp,
|
||||
struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)&net->ro._l_addr;
|
||||
|
||||
/* KAME hack: embed scopeid */
|
||||
(void)sa6_embedscope(sin6, ip6_use_defzone);
|
||||
(void)sa6_embedscope(sin6, MODULE_GLOBAL(MOD_INET6, ip6_use_defzone));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -35,7 +35,7 @@ __FBSDID("$FreeBSD$");
|
||||
#ifndef __sctp_timer_h__
|
||||
#define __sctp_timer_h__
|
||||
|
||||
#if defined(_KERNEL)
|
||||
#if defined(_KERNEL) || defined(__Userspace__)
|
||||
|
||||
#define SCTP_RTT_SHIFT 3
|
||||
#define SCTP_RTT_VAR_SHIFT 2
|
||||
|
@ -1037,7 +1037,7 @@ struct sctp_log {
|
||||
/*
|
||||
* Kernel defined for sctp_send
|
||||
*/
|
||||
#if defined(_KERNEL)
|
||||
#if defined(_KERNEL) || defined(__Userspace__)
|
||||
int
|
||||
sctp_lower_sosend(struct socket *so,
|
||||
struct sockaddr *addr,
|
||||
@ -1065,7 +1065,7 @@ sctp_sorecvmsg(struct socket *so,
|
||||
/*
|
||||
* API system calls
|
||||
*/
|
||||
#if !(defined(_KERNEL))
|
||||
#if !(defined(_KERNEL)) && !(defined(__Userspace__))
|
||||
|
||||
__BEGIN_DECLS
|
||||
int sctp_peeloff __P((int, sctp_assoc_t));
|
||||
|
@ -38,7 +38,6 @@ __FBSDID("$FreeBSD$");
|
||||
#include <netinet/sctp_header.h>
|
||||
#include <netinet/sctp_var.h>
|
||||
#if defined(INET6)
|
||||
#include <netinet6/sctp6_var.h>
|
||||
#endif
|
||||
#include <netinet/sctp_sysctl.h>
|
||||
#include <netinet/sctp_output.h>
|
||||
@ -63,7 +62,6 @@ sctp_init(void)
|
||||
|
||||
/* Initialize and modify the sysctled variables */
|
||||
sctp_init_sysctls();
|
||||
|
||||
if ((nmbclusters / 8) > SCTP_ASOC_MAX_CHUNKS_ON_QUEUE)
|
||||
SCTP_BASE_SYSCTL(sctp_max_chunks_on_queue) = (nmbclusters / 8);
|
||||
/*
|
||||
@ -532,7 +530,7 @@ sctp_attach(struct socket *so, int proto, struct thread *p)
|
||||
inp->sctp_flags &= ~SCTP_PCB_FLAGS_BOUND_V6; /* I'm not v6! */
|
||||
ip_inp = &inp->ip_inp.inp;
|
||||
ip_inp->inp_vflag |= INP_IPV4;
|
||||
ip_inp->inp_ip_ttl = ip_defttl;
|
||||
ip_inp->inp_ip_ttl = MODULE_GLOBAL(MOD_INET, ip_defttl);
|
||||
#ifdef IPSEC
|
||||
error = ipsec_init_policy(so, &ip_inp->inp_sp);
|
||||
#ifdef SCTP_LOG_CLOSING
|
||||
@ -3986,7 +3984,6 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
|
||||
return (error);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
sctp_ctloutput(struct socket *so, struct sockopt *sopt)
|
||||
{
|
||||
|
@ -38,7 +38,7 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
#include <netinet/sctp_uio.h>
|
||||
|
||||
#if defined(_KERNEL)
|
||||
#if defined(_KERNEL) || defined(__Userspace__)
|
||||
|
||||
extern struct pr_usrreqs sctp_usrreqs;
|
||||
|
||||
|
@ -39,7 +39,6 @@ __FBSDID("$FreeBSD$");
|
||||
#include <netinet/sctp_var.h>
|
||||
#include <netinet/sctp_sysctl.h>
|
||||
#ifdef INET6
|
||||
#include <netinet6/sctp6_var.h>
|
||||
#endif
|
||||
#include <netinet/sctp_header.h>
|
||||
#include <netinet/sctp_output.h>
|
||||
@ -3098,7 +3097,7 @@ sctp_notify_send_failed(struct sctp_tcb *stcb, uint32_t error,
|
||||
#endif
|
||||
)
|
||||
{
|
||||
struct mbuf *m_notify;
|
||||
struct mbuf *m_notify, *tt;
|
||||
struct sctp_send_failed *ssf;
|
||||
struct sctp_queued_to_read *control;
|
||||
int length;
|
||||
@ -3107,11 +3106,12 @@ sctp_notify_send_failed(struct sctp_tcb *stcb, uint32_t error,
|
||||
/* event not enabled */
|
||||
return;
|
||||
|
||||
length = sizeof(struct sctp_send_failed) + chk->send_size;
|
||||
m_notify = sctp_get_mbuf_for_msg(sizeof(struct sctp_send_failed), 0, M_DONTWAIT, 1, MT_DATA);
|
||||
if (m_notify == NULL)
|
||||
/* no space left */
|
||||
return;
|
||||
length = sizeof(struct sctp_send_failed) + chk->send_size;
|
||||
length -= sizeof(struct sctp_data_chunk);
|
||||
SCTP_BUF_LEN(m_notify) = 0;
|
||||
ssf = mtod(m_notify, struct sctp_send_failed *);
|
||||
ssf->ssf_type = SCTP_SEND_FAILED;
|
||||
@ -3130,6 +3130,18 @@ sctp_notify_send_failed(struct sctp_tcb *stcb, uint32_t error,
|
||||
ssf->ssf_info.sinfo_context = chk->rec.data.context;
|
||||
ssf->ssf_info.sinfo_assoc_id = sctp_get_associd(stcb);
|
||||
ssf->ssf_assoc_id = sctp_get_associd(stcb);
|
||||
|
||||
/* Take off the chunk header */
|
||||
m_adj(chk->data, sizeof(struct sctp_data_chunk));
|
||||
|
||||
/* trim out any 0 len mbufs */
|
||||
while (SCTP_BUF_LEN(chk->data) == 0) {
|
||||
tt = chk->data;
|
||||
chk->data = SCTP_BUF_NEXT(tt);
|
||||
SCTP_BUF_NEXT(tt) = NULL;
|
||||
sctp_m_freem(tt);
|
||||
}
|
||||
|
||||
SCTP_BUF_NEXT(m_notify) = chk->data;
|
||||
SCTP_BUF_LEN(m_notify) = sizeof(struct sctp_send_failed);
|
||||
|
||||
@ -3195,7 +3207,11 @@ sctp_notify_send_failed2(struct sctp_tcb *stcb, uint32_t error,
|
||||
bzero(&ssf->ssf_info, sizeof(ssf->ssf_info));
|
||||
ssf->ssf_info.sinfo_stream = sp->stream;
|
||||
ssf->ssf_info.sinfo_ssn = sp->strseq;
|
||||
ssf->ssf_info.sinfo_flags = sp->sinfo_flags;
|
||||
if (sp->some_taken) {
|
||||
ssf->ssf_info.sinfo_flags = SCTP_DATA_LAST_FRAG;
|
||||
} else {
|
||||
ssf->ssf_info.sinfo_flags = SCTP_DATA_NOT_FRAG;
|
||||
}
|
||||
ssf->ssf_info.sinfo_ppid = sp->ppid;
|
||||
ssf->ssf_info.sinfo_context = sp->context;
|
||||
ssf->ssf_info.sinfo_assoc_id = sctp_get_associd(stcb);
|
||||
@ -5467,10 +5483,10 @@ found_one:
|
||||
bzero(&sin6, sizeof(sin6));
|
||||
sin6.sin6_family = AF_INET6;
|
||||
sin6.sin6_len = sizeof(struct sockaddr_in6);
|
||||
sin6.sin6_addr.s6_addr32[2] = ntohl(0x0000ffff);
|
||||
sin6.sin6_addr.s6_addr16[2] = 0xffff;
|
||||
bcopy(&sin->sin_addr,
|
||||
&sin6.sin6_addr.s6_addr32[3],
|
||||
sizeof(sin6.sin6_addr.s6_addr32[3]));
|
||||
&sin6.sin6_addr.s6_addr16[3],
|
||||
sizeof(sin6.sin6_addr.s6_addr16[3]));
|
||||
sin6.sin6_port = sin->sin_port;
|
||||
memcpy(from, (caddr_t)&sin6, sizeof(sin6));
|
||||
}
|
||||
@ -6000,8 +6016,6 @@ sctp_dynamic_set_primary(struct sockaddr *sa, uint32_t vrf_id)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int
|
||||
sctp_soreceive(struct socket *so,
|
||||
struct sockaddr **psa,
|
||||
@ -6256,7 +6270,7 @@ sctp_bindx_add_address(struct socket *so, struct sctp_inpcb *inp,
|
||||
return;
|
||||
}
|
||||
addr_touse = sa;
|
||||
#if defined(INET6)
|
||||
#if defined(INET6) && !defined(__Userspace__) /* TODO port in6_sin6_2_sin */
|
||||
if (sa->sa_family == AF_INET6) {
|
||||
struct sockaddr_in6 *sin6;
|
||||
|
||||
@ -6382,7 +6396,7 @@ sctp_bindx_delete_address(struct socket *so, struct sctp_inpcb *inp,
|
||||
return;
|
||||
}
|
||||
addr_touse = sa;
|
||||
#if defined(INET6)
|
||||
#if defined(INET6) && !defined(__Userspace__) /* TODO port in6_sin6_2_sin */
|
||||
if (sa->sa_family == AF_INET6) {
|
||||
struct sockaddr_in6 *sin6;
|
||||
|
||||
|
@ -37,7 +37,7 @@ __FBSDID("$FreeBSD$");
|
||||
#define __sctputil_h__
|
||||
|
||||
|
||||
#if defined(_KERNEL)
|
||||
#if defined(_KERNEL) || defined(__Userspace__)
|
||||
|
||||
|
||||
#ifdef SCTP_ASOCLOG_OF_TSNS
|
||||
|
@ -210,7 +210,7 @@ sctp_skip_csum:
|
||||
*/
|
||||
if (in6p_ip && (ipsec6_in_reject(m, in6p_ip))) {
|
||||
/* XXX */
|
||||
ipsec6stat.in_polvio++;
|
||||
MODULE_GLOBAL(MOD_IPSEC, ipsec6stat).in_polvio++;
|
||||
goto bad;
|
||||
}
|
||||
#endif /* IPSEC */
|
||||
@ -679,7 +679,7 @@ sctp6_attach(struct socket *so, int proto, struct thread *p)
|
||||
* socket as well, because the socket may be bound to an IPv6
|
||||
* wildcard address, which may match an IPv4-mapped IPv6 address.
|
||||
*/
|
||||
inp6->inp_ip_ttl = ip_defttl;
|
||||
inp6->inp_ip_ttl = MODULE_GLOBAL(MOD_INET, ip_defttl);
|
||||
#endif
|
||||
/*
|
||||
* Hmm what about the IPSEC stuff that is missing here but in
|
||||
@ -843,7 +843,7 @@ sctp6_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *addr,
|
||||
}
|
||||
}
|
||||
if (IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr)) {
|
||||
if (!ip6_v6only) {
|
||||
if (!MODULE_GLOBAL(MOD_INET6, ip6_v6only)) {
|
||||
struct sockaddr_in sin;
|
||||
|
||||
/* convert v4-mapped into v4 addr and send */
|
||||
@ -974,7 +974,7 @@ sctp6_connect(struct socket *so, struct sockaddr *addr, struct thread *p)
|
||||
}
|
||||
}
|
||||
if (IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr)) {
|
||||
if (!ip6_v6only) {
|
||||
if (!MODULE_GLOBAL(MOD_INET6, ip6_v6only)) {
|
||||
/* convert v4-mapped into v4 addr */
|
||||
in6_sin6_2_sin((struct sockaddr_in *)&ss, sin6);
|
||||
addr = (struct sockaddr *)&ss;
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
/* TODO __Userspace__ IPv6 stuff... */
|
||||
#if defined(_KERNEL)
|
||||
|
||||
SYSCTL_DECL(_net_inet6_sctp6);
|
||||
|
Loading…
x
Reference in New Issue
Block a user