+ if (asa != NULL) {
+ MGET(m, M_DONTWAIT, MT_SONAME);
+ if (m == 0) {
+ if (n) {
+ /* unchain control and data if necessary */
+ n->m_next = NULL;
+ }
+ return NULL;
+ }
+ m->m_len = asa->sa_len;
+ bcopy((caddr_t)asa, mtod(m, caddr_t), asa->sa_len);
+
+ m->m_next = control;
+ } else {
+ m = control;
+ }
+
+ return m;
+}
+
+/*
+ * Queue mbuf chain to the receive queue of a socket.
+ * Parameter space is the total len of the mbuf chain.
+ * If passed in, sockbuf space will be checked.
+ *
+ * Returns: 0 Invalid mbuf chain
+ * 1 Success
+ */
+int
+sbappendchain(struct sockbuf *sb, struct mbuf *m, int space)
+{
+ struct mbuf *n, *nlast;
+
+ if (m == NULL) {
+ return 0;
+ }
+
+ if (space != 0 && space > sbspace(sb)) {
+ return 0;
+ }