summaryrefslogtreecommitdiffstats
path: root/sys/netinet/sctputil.c
diff options
context:
space:
mode:
authorrrs <rrs@FreeBSD.org>2008-07-09 16:45:30 +0000
committerrrs <rrs@FreeBSD.org>2008-07-09 16:45:30 +0000
commita51aa927fad5ab9ebbb294340935d462f68ee19b (patch)
tree4a87f4aa4fe465871cb0aabaa4a65bf4595791b3 /sys/netinet/sctputil.c
parentc0ef832fd278f80304905d075e4657c1a92b196b (diff)
downloadFreeBSD-src-a51aa927fad5ab9ebbb294340935d462f68ee19b.zip
FreeBSD-src-a51aa927fad5ab9ebbb294340935d462f68ee19b.tar.gz
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!
Diffstat (limited to 'sys/netinet/sctputil.c')
-rw-r--r--sys/netinet/sctputil.c36
1 files changed, 25 insertions, 11 deletions
diff --git a/sys/netinet/sctputil.c b/sys/netinet/sctputil.c
index 42903b1..0b33c49 100644
--- a/sys/netinet/sctputil.c
+++ b/sys/netinet/sctputil.c
@@ -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;
OpenPOWER on IntegriCloud