+ if (sosendallatonce(so))
+ siz = NFS_MAXPACKET;
+ else
+ siz = NFS_MAXPACKET + sizeof(u_long);
+ if (error = soreserve(so, siz, siz))
+ goto bad;
+ if (error = sockargs(&nam, uap->mskval, uap->msklen, MT_SONAME))
+ goto bad;
+ bcopy((caddr_t)nam, (caddr_t)&msk, sizeof (struct mbuf));
+ msk.m_data = msk.m_dat;
+ m_freem(nam);
+ if (error = sockargs(&nam, uap->mtchval, uap->mtchlen, MT_SONAME))
+ goto bad;
+ bcopy((caddr_t)nam, (caddr_t)&mtch, sizeof (struct mbuf));
+ mtch.m_data = mtch.m_dat;
+ m_freem(nam);
+
+ /* Copy the cred so others don't see changes */
+ cr = p->p_ucred = crcopy(p->p_ucred);
+
+ /*
+ * Set protocol specific options { for now TCP only } and
+ * reserve some space. For datagram sockets, this can get called
+ * repeatedly for the same socket, but that isn't harmful.
+ */
+ if (so->so_proto->pr_flags & PR_CONNREQUIRED) {
+ MGET(m, M_WAIT, MT_SOOPTS);
+ *mtod(m, int *) = 1;
+ m->m_len = sizeof(int);
+ sosetopt(so, SOL_SOCKET, SO_KEEPALIVE, m);
+ }
+ if (so->so_proto->pr_domain->dom_family == AF_INET &&
+ so->so_proto->pr_protocol == IPPROTO_TCP &&
+ nfs_tcpnodelay) {
+ MGET(m, M_WAIT, MT_SOOPTS);
+ *mtod(m, int *) = 1;
+ m->m_len = sizeof(int);
+ sosetopt(so, IPPROTO_TCP, TCP_NODELAY, m);
+ }
+ so->so_rcv.sb_flags &= ~SB_NOINTR;
+ so->so_rcv.sb_timeo = 0;
+ so->so_snd.sb_flags &= ~SB_NOINTR;
+ so->so_snd.sb_timeo = 0;
+