aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/fs/cd9660/cd9660_vfsops.c6
-rw-r--r--sys/fs/fdescfs/fdesc_vfsops.c4
-rw-r--r--sys/fs/fifofs/fifo_vnops.c7
-rw-r--r--sys/fs/msdosfs/msdosfs_vfsops.c6
-rw-r--r--sys/fs/nullfs/null_vfsops.c9
-rw-r--r--sys/fs/portalfs/portal_vfsops.c4
-rw-r--r--sys/fs/portalfs/portal_vnops.c13
-rw-r--r--sys/fs/procfs/procfs_vfsops.c4
-rw-r--r--sys/fs/umapfs/umap_vfsops.c6
-rw-r--r--sys/fs/unionfs/union_vfsops.c4
-rw-r--r--sys/gnu/ext2fs/ext2_vfsops.c4
-rw-r--r--sys/gnu/fs/ext2fs/ext2_vfsops.c4
-rw-r--r--sys/i386/i386/in_cksum.c177
-rw-r--r--sys/i386/include/in_cksum.h11
-rw-r--r--sys/isofs/cd9660/cd9660_vfsops.c6
-rw-r--r--sys/kern/sys_socket.c5
-rw-r--r--sys/kern/uipc_sockbuf.c165
-rw-r--r--sys/kern/uipc_socket.c38
-rw-r--r--sys/kern/uipc_socket2.c165
-rw-r--r--sys/kern/uipc_syscalls.c158
-rw-r--r--sys/kern/uipc_usrreq.c112
-rw-r--r--sys/kern/vfs_export.c6
-rw-r--r--sys/kern/vfs_subr.c6
-rw-r--r--sys/miscfs/devfs/devfs_vfsops.c4
-rw-r--r--sys/miscfs/fdesc/fdesc_vfsops.c4
-rw-r--r--sys/miscfs/fifofs/fifo_vnops.c7
-rw-r--r--sys/miscfs/kernfs/kernfs.h4
-rw-r--r--sys/miscfs/nullfs/null_vfsops.c9
-rw-r--r--sys/miscfs/portal/portal_vfsops.c4
-rw-r--r--sys/miscfs/portal/portal_vnops.c13
-rw-r--r--sys/miscfs/procfs/procfs_vfsops.c4
-rw-r--r--sys/miscfs/umapfs/umap_vfsops.c6
-rw-r--r--sys/miscfs/union/union_vfsops.c4
-rw-r--r--sys/msdosfs/msdosfs_vfsops.c6
-rw-r--r--sys/net/raw_usrreq.c22
-rw-r--r--sys/net/rtsock.c12
-rw-r--r--sys/netatalk/ddp_pcb.c94
-rw-r--r--sys/netatalk/ddp_usrreq.c94
-rw-r--r--sys/netinet/in_pcb.c41
-rw-r--r--sys/netinet/in_pcb.h13
-rw-r--r--sys/netinet/raw_ip.c18
-rw-r--r--sys/netinet/tcp_fsm.h4
-rw-r--r--sys/netinet/tcp_input.c15
-rw-r--r--sys/netinet/tcp_reass.c15
-rw-r--r--sys/netinet/tcp_usrreq.c31
-rw-r--r--sys/netinet/udp_usrreq.c15
-rw-r--r--sys/netinet/udp_var.h13
-rw-r--r--sys/netipx/ipx_pcb.c41
-rw-r--r--sys/netipx/ipx_pcb.h10
-rw-r--r--sys/netipx/ipx_usrreq.c24
-rw-r--r--sys/netipx/ipx_var.h6
-rw-r--r--sys/netipx/spx_usrreq.c58
-rw-r--r--sys/netnatm/natm.c37
-rw-r--r--sys/nfs/bootp_subr.c36
-rw-r--r--sys/nfs/krpc.h4
-rw-r--r--sys/nfs/krpc_subr.c34
-rw-r--r--sys/nfs/nfs.h133
-rw-r--r--sys/nfs/nfs_common.c14
-rw-r--r--sys/nfs/nfs_nqlease.c51
-rw-r--r--sys/nfs/nfs_serv.c44
-rw-r--r--sys/nfs/nfs_socket.c62
-rw-r--r--sys/nfs/nfs_srvcache.c9
-rw-r--r--sys/nfs/nfs_subs.c14
-rw-r--r--sys/nfs/nfs_syscalls.c57
-rw-r--r--sys/nfs/nfs_vfsops.c31
-rw-r--r--sys/nfs/nfsmount.h4
-rw-r--r--sys/nfs/nqnfs.h7
-rw-r--r--sys/nfsclient/bootp_subr.c36
-rw-r--r--sys/nfsclient/krpc.h4
-rw-r--r--sys/nfsclient/krpc_subr.c34
-rw-r--r--sys/nfsclient/nfs.h133
-rw-r--r--sys/nfsclient/nfs_nfsiod.c57
-rw-r--r--sys/nfsclient/nfs_socket.c62
-rw-r--r--sys/nfsclient/nfs_subs.c14
-rw-r--r--sys/nfsclient/nfs_vfsops.c31
-rw-r--r--sys/nfsclient/nfsargs.h133
-rw-r--r--sys/nfsclient/nfsmount.h4
-rw-r--r--sys/nfsclient/nfsstats.h133
-rw-r--r--sys/nfsserver/nfs.h133
-rw-r--r--sys/nfsserver/nfs_serv.c44
-rw-r--r--sys/nfsserver/nfs_srvcache.c9
-rw-r--r--sys/nfsserver/nfs_srvsock.c62
-rw-r--r--sys/nfsserver/nfs_srvsubs.c14
-rw-r--r--sys/nfsserver/nfs_syscalls.c57
-rw-r--r--sys/nfsserver/nfsrvstats.h133
-rw-r--r--sys/sys/malloc.h6
-rw-r--r--sys/sys/mbuf.h29
-rw-r--r--sys/sys/mount.h6
-rw-r--r--sys/sys/protosw.h31
-rw-r--r--sys/sys/socket.h3
-rw-r--r--sys/sys/socketvar.h20
-rw-r--r--sys/sys/un.h3
-rw-r--r--sys/sys/unpcb.h4
-rw-r--r--sys/ufs/ffs/ffs_extern.h7
-rw-r--r--sys/ufs/ffs/ffs_vfsops.c4
-rw-r--r--sys/ufs/lfs/lfs_vfsops.c8
-rw-r--r--sys/ufs/ufs/ufs_extern.h9
-rw-r--r--sys/ufs/ufs/ufs_vfsops.c4
98 files changed, 1694 insertions, 1581 deletions
diff --git a/sys/fs/cd9660/cd9660_vfsops.c b/sys/fs/cd9660/cd9660_vfsops.c
index cf09054be4e7..a0cea9db8e04 100644
--- a/sys/fs/cd9660/cd9660_vfsops.c
+++ b/sys/fs/cd9660/cd9660_vfsops.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)cd9660_vfsops.c 8.18 (Berkeley) 5/22/95
- * $Id: cd9660_vfsops.c,v 1.25 1997/05/04 15:24:21 joerg Exp $
+ * $Id: cd9660_vfsops.c,v 1.26 1997/08/02 14:31:20 bde Exp $
*/
#include <sys/param.h>
@@ -71,7 +71,7 @@ static int cd9660_statfs __P((struct mount *, struct statfs *, struct proc *));
static int cd9660_sync __P((struct mount *, int, struct ucred *,
struct proc *));
static int cd9660_vget __P((struct mount *, ino_t, struct vnode **));
-static int cd9660_fhtovp __P((struct mount *, struct fid *, struct mbuf *,
+static int cd9660_fhtovp __P((struct mount *, struct fid *, struct sockaddr *,
struct vnode **, int *, struct ucred **));
static int cd9660_vptofh __P((struct vnode *, struct fid *));
@@ -590,7 +590,7 @@ int
cd9660_fhtovp(mp, fhp, nam, vpp, exflagsp, credanonp)
register struct mount *mp;
struct fid *fhp;
- struct mbuf *nam;
+ struct sockaddr *nam;
struct vnode **vpp;
int *exflagsp;
struct ucred **credanonp;
diff --git a/sys/fs/fdescfs/fdesc_vfsops.c b/sys/fs/fdescfs/fdesc_vfsops.c
index ea668c9915f3..e80c69d90626 100644
--- a/sys/fs/fdescfs/fdesc_vfsops.c
+++ b/sys/fs/fdescfs/fdesc_vfsops.c
@@ -35,7 +35,7 @@
*
* @(#)fdesc_vfsops.c 8.4 (Berkeley) 1/21/94
*
- * $Id: fdesc_vfsops.c,v 1.10 1997/02/22 09:40:15 peter Exp $
+ * $Id: fdesc_vfsops.c,v 1.11 1997/08/02 14:31:59 bde Exp $
*/
/*
@@ -244,7 +244,7 @@ fdesc_sync(mp, waitfor, cred, p)
}
#define fdesc_fhtovp ((int (*) __P((struct mount *, struct fid *, \
- struct mbuf *, struct vnode **, int *, struct ucred **)))eopnotsupp)
+ struct sockaddr *, struct vnode **, int *, struct ucred **)))eopnotsupp)
#define fdesc_quotactl ((int (*) __P((struct mount *, int, uid_t, caddr_t, \
struct proc *)))eopnotsupp)
#define fdesc_sysctl ((int (*) __P((int *, u_int, void *, size_t *, void *, \
diff --git a/sys/fs/fifofs/fifo_vnops.c b/sys/fs/fifofs/fifo_vnops.c
index 1cdc3d789701..ce23c6e51925 100644
--- a/sys/fs/fifofs/fifo_vnops.c
+++ b/sys/fs/fifofs/fifo_vnops.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)fifo_vnops.c 8.10 (Berkeley) 5/27/95
- * $Id: fifo_vnops.c,v 1.23 1997/03/23 03:36:49 bde Exp $
+ * $Id: fifo_vnops.c,v 1.24 1997/03/24 11:37:53 bde Exp $
*/
#include <sys/param.h>
@@ -264,7 +264,7 @@ fifo_read(ap)
rso->so_state |= SS_NBIO;
startresid = uio->uio_resid;
VOP_UNLOCK(ap->a_vp, 0, p);
- error = soreceive(rso, (struct mbuf **)0, uio, (struct mbuf **)0,
+ error = soreceive(rso, (struct sockaddr **)0, uio, (struct mbuf **)0,
(struct mbuf **)0, (int *)0);
vn_lock(ap->a_vp, LK_EXCLUSIVE | LK_RETRY, p);
/*
@@ -301,7 +301,8 @@ fifo_write(ap)
if (ap->a_ioflag & IO_NDELAY)
wso->so_state |= SS_NBIO;
VOP_UNLOCK(ap->a_vp, 0, p);
- error = sosend(wso, (struct mbuf *)0, ap->a_uio, 0, (struct mbuf *)0, 0);
+ error = sosend(wso, (struct sockaddr *)0, ap->a_uio, 0,
+ (struct mbuf *)0, 0, p);
vn_lock(ap->a_vp, LK_EXCLUSIVE | LK_RETRY, p);
if (ap->a_ioflag & IO_NDELAY)
wso->so_state &= ~SS_NBIO;
diff --git a/sys/fs/msdosfs/msdosfs_vfsops.c b/sys/fs/msdosfs/msdosfs_vfsops.c
index 896c4f03e2a5..755c0b12329e 100644
--- a/sys/fs/msdosfs/msdosfs_vfsops.c
+++ b/sys/fs/msdosfs/msdosfs_vfsops.c
@@ -1,4 +1,4 @@
-/* $Id: msdosfs_vfsops.c,v 1.18 1997/03/18 19:50:10 peter Exp $ */
+/* $Id: msdosfs_vfsops.c,v 1.19 1997/03/23 03:37:06 bde Exp $ */
/* $NetBSD: msdosfs_vfsops.c,v 1.19 1994/08/21 18:44:10 ws Exp $ */
/*-
@@ -70,7 +70,7 @@
static int mountmsdosfs __P((struct vnode *devvp, struct mount *mp,
struct proc *p));
static int msdosfs_fhtovp __P((struct mount *, struct fid *,
- struct mbuf *, struct vnode **, int *,
+ struct sockaddr *, struct vnode **, int *,
struct ucred **));
static int msdosfs_mount __P((struct mount *, char *, caddr_t,
struct nameidata *, struct proc *));
@@ -732,7 +732,7 @@ static int
msdosfs_fhtovp(mp, fhp, nam, vpp, exflagsp, credanonp)
struct mount *mp;
struct fid *fhp;
- struct mbuf *nam;
+ struct sockaddr *nam;
struct vnode **vpp;
int *exflagsp;
struct ucred **credanonp;
diff --git a/sys/fs/nullfs/null_vfsops.c b/sys/fs/nullfs/null_vfsops.c
index 40e2a19ce9c6..ea5711f7351f 100644
--- a/sys/fs/nullfs/null_vfsops.c
+++ b/sys/fs/nullfs/null_vfsops.c
@@ -36,7 +36,7 @@
* @(#)null_vfsops.c 8.2 (Berkeley) 1/21/94
*
* @(#)lofs_vfsops.c 1.2 (Berkeley) 6/18/92
- * $Id: null_vfsops.c,v 1.17 1997/04/19 06:03:30 kato Exp $
+ * $Id: null_vfsops.c,v 1.18 1997/08/02 14:32:05 bde Exp $
*/
/*
@@ -55,7 +55,7 @@
#include <miscfs/nullfs/null.h>
static int nullfs_fhtovp __P((struct mount *mp, struct fid *fidp,
- struct mbuf *nam, struct vnode **vpp,
+ struct sockaddr *nam, struct vnode **vpp,
int *exflagsp, struct ucred **credanonp));
static int nullfs_mount __P((struct mount *mp, char *path, caddr_t data,
struct nameidata *ndp, struct proc *p));
@@ -387,13 +387,14 @@ static int
nullfs_fhtovp(mp, fidp, nam, vpp, exflagsp, credanonp)
struct mount *mp;
struct fid *fidp;
- struct mbuf *nam;
+ struct sockaddr *nam;
struct vnode **vpp;
int *exflagsp;
struct ucred**credanonp;
{
- return VFS_FHTOVP(MOUNTTONULLMOUNT(mp)->nullm_vfs, fidp, nam, vpp, exflagsp,credanonp);
+ return VFS_FHTOVP(MOUNTTONULLMOUNT(mp)->nullm_vfs, fidp, nam,
+ vpp, exflagsp, credanonp);
}
static int
diff --git a/sys/fs/portalfs/portal_vfsops.c b/sys/fs/portalfs/portal_vfsops.c
index 7ab3be6c39b6..c70e73e0a581 100644
--- a/sys/fs/portalfs/portal_vfsops.c
+++ b/sys/fs/portalfs/portal_vfsops.c
@@ -35,7 +35,7 @@
*
* @(#)portal_vfsops.c 8.11 (Berkeley) 5/14/95
*
- * $Id: portal_vfsops.c,v 1.15 1997/02/22 09:40:24 peter Exp $
+ * $Id: portal_vfsops.c,v 1.16 1997/08/02 14:32:07 bde Exp $
*/
/*
@@ -261,7 +261,7 @@ portal_statfs(mp, sbp, p)
}
#define portal_fhtovp ((int (*) __P((struct mount *, struct fid *, \
- struct mbuf *, struct vnode **, int *, struct ucred **)))eopnotsupp)
+ struct sockaddr *, struct vnode **, int *, struct ucred **)))eopnotsupp)
#define portal_quotactl ((int (*) __P((struct mount *, int, uid_t, caddr_t, \
struct proc *)))eopnotsupp)
#define portal_sync ((int (*) __P((struct mount *, int, struct ucred *, \
diff --git a/sys/fs/portalfs/portal_vnops.c b/sys/fs/portalfs/portal_vnops.c
index edd42174db0b..281d5632f88d 100644
--- a/sys/fs/portalfs/portal_vnops.c
+++ b/sys/fs/portalfs/portal_vnops.c
@@ -35,7 +35,7 @@
*
* @(#)portal_vnops.c 8.14 (Berkeley) 5/21/95
*
- * $Id: portal_vnops.c,v 1.18 1997/03/23 03:36:54 bde Exp $
+ * $Id: portal_vnops.c,v 1.19 1997/08/02 14:32:08 bde Exp $
*/
/*
@@ -197,11 +197,10 @@ portal_connect(so, so2)
unp2 = sotounpcb(so2);
unp3 = sotounpcb(so3);
if (unp2->unp_addr)
- unp3->unp_addr = m_copy(unp2->unp_addr, 0, (int)M_COPYALL);
-
+ unp3->unp_addr = (struct sockaddr_un *)
+ dup_sockaddr((struct sockaddr *)unp2->unp_addr, 0);
so2 = so3;
-
return (unp_connect2(so, so2));
}
@@ -326,8 +325,8 @@ portal_open(ap)
auio.uio_offset = 0;
auio.uio_resid = aiov[0].iov_len + aiov[1].iov_len;
- error = sosend(so, (struct mbuf *) 0, &auio,
- (struct mbuf *) 0, (struct mbuf *) 0, 0);
+ error = sosend(so, (struct sockaddr *) 0, &auio,
+ (struct mbuf *) 0, (struct mbuf *) 0, 0, p);
if (error)
goto bad;
@@ -335,7 +334,7 @@ portal_open(ap)
do {
struct mbuf *m = 0;
int flags = MSG_WAITALL;
- error = soreceive(so, (struct mbuf **) 0, &auio,
+ error = soreceive(so, (struct sockaddr **) 0, &auio,
&m, &cm, &flags);
if (error)
goto bad;
diff --git a/sys/fs/procfs/procfs_vfsops.c b/sys/fs/procfs/procfs_vfsops.c
index a6ebbaec02c5..3afd9e96b617 100644
--- a/sys/fs/procfs/procfs_vfsops.c
+++ b/sys/fs/procfs/procfs_vfsops.c
@@ -36,7 +36,7 @@
*
* @(#)procfs_vfsops.c 8.7 (Berkeley) 5/10/95
*
- * $Id: procfs_vfsops.c,v 1.15 1997/02/22 09:40:31 peter Exp $
+ * $Id: procfs_vfsops.c,v 1.16 1997/08/02 14:32:19 bde Exp $
*/
/*
@@ -177,7 +177,7 @@ procfs_init(vfsp)
}
#define procfs_fhtovp ((int (*) __P((struct mount *, struct fid *, \
- struct mbuf *, struct vnode **, int *, struct ucred **)))einval)
+ struct sockaddr *, struct vnode **, int *, struct ucred **)))einval)
#define procfs_quotactl ((int (*) __P((struct mount *, int, uid_t, caddr_t, \
struct proc *)))eopnotsupp)
#define procfs_sync ((int (*) __P((struct mount *, int, struct ucred *, \
diff --git a/sys/fs/umapfs/umap_vfsops.c b/sys/fs/umapfs/umap_vfsops.c
index 3a73bd69aa4c..20c0c4c8f126 100644
--- a/sys/fs/umapfs/umap_vfsops.c
+++ b/sys/fs/umapfs/umap_vfsops.c
@@ -35,7 +35,7 @@
*
* @(#)umap_vfsops.c 8.8 (Berkeley) 5/14/95
*
- * $Id: umap_vfsops.c,v 1.14 1997/02/22 09:40:38 peter Exp $
+ * $Id: umap_vfsops.c,v 1.15 1997/08/02 14:32:25 bde Exp $
*/
/*
@@ -54,7 +54,7 @@
#include <miscfs/umapfs/umap.h>
static int umapfs_fhtovp __P((struct mount *mp, struct fid *fidp,
- struct mbuf *nam, struct vnode **vpp,
+ struct sockaddr *nam, struct vnode **vpp,
int *exflagsp, struct ucred **credanonp));
static int umapfs_mount __P((struct mount *mp, char *path, caddr_t data,
struct nameidata *ndp, struct proc *p));
@@ -391,7 +391,7 @@ static int
umapfs_fhtovp(mp, fidp, nam, vpp, exflagsp, credanonp)
struct mount *mp;
struct fid *fidp;
- struct mbuf *nam;
+ struct sockaddr *nam;
struct vnode **vpp;
int *exflagsp;
struct ucred**credanonp;
diff --git a/sys/fs/unionfs/union_vfsops.c b/sys/fs/unionfs/union_vfsops.c
index 82edf917218d..e7954beee643 100644
--- a/sys/fs/unionfs/union_vfsops.c
+++ b/sys/fs/unionfs/union_vfsops.c
@@ -35,7 +35,7 @@
* SUCH DAMAGE.
*
* @(#)union_vfsops.c 8.20 (Berkeley) 5/20/95
- * $Id: union_vfsops.c,v 1.17 1997/05/07 14:37:31 kato Exp $
+ * $Id: union_vfsops.c,v 1.18 1997/08/02 14:32:29 bde Exp $
*/
/*
@@ -531,7 +531,7 @@ union_statfs(mp, sbp, p)
struct proc *)))nullop)
#define union_fhtovp ((int (*) __P((struct mount *, struct fid *, \
- struct mbuf *, struct vnode **, int *, struct ucred **)))eopnotsupp)
+ struct sockaddr *, struct vnode **, int *, struct ucred **)))eopnotsupp)
#define union_quotactl ((int (*) __P((struct mount *, int, uid_t, caddr_t, \
struct proc *)))eopnotsupp)
#define union_sysctl ((int (*) __P((int *, u_int, void *, size_t *, void *, \
diff --git a/sys/gnu/ext2fs/ext2_vfsops.c b/sys/gnu/ext2fs/ext2_vfsops.c
index 253d0e54dde4..55b55087c0ec 100644
--- a/sys/gnu/ext2fs/ext2_vfsops.c
+++ b/sys/gnu/ext2fs/ext2_vfsops.c
@@ -70,7 +70,7 @@
#include <gnu/ext2fs/ext2_fs.h>
#include <gnu/ext2fs/ext2_fs_sb.h>
-static int ext2_fhtovp __P((struct mount *, struct fid *, struct mbuf *,
+static int ext2_fhtovp __P((struct mount *, struct fid *, struct sockaddr *,
struct vnode **, int *, struct ucred **));
static int ext2_flushfiles __P((struct mount *mp, int flags, struct proc *p));
static int ext2_mount __P((struct mount *,
@@ -1053,7 +1053,7 @@ static int
ext2_fhtovp(mp, fhp, nam, vpp, exflagsp, credanonp)
register struct mount *mp;
struct fid *fhp;
- struct mbuf *nam;
+ struct sockaddr *nam;
struct vnode **vpp;
int *exflagsp;
struct ucred **credanonp;
diff --git a/sys/gnu/fs/ext2fs/ext2_vfsops.c b/sys/gnu/fs/ext2fs/ext2_vfsops.c
index 253d0e54dde4..55b55087c0ec 100644
--- a/sys/gnu/fs/ext2fs/ext2_vfsops.c
+++ b/sys/gnu/fs/ext2fs/ext2_vfsops.c
@@ -70,7 +70,7 @@
#include <gnu/ext2fs/ext2_fs.h>
#include <gnu/ext2fs/ext2_fs_sb.h>
-static int ext2_fhtovp __P((struct mount *, struct fid *, struct mbuf *,
+static int ext2_fhtovp __P((struct mount *, struct fid *, struct sockaddr *,
struct vnode **, int *, struct ucred **));
static int ext2_flushfiles __P((struct mount *mp, int flags, struct proc *p));
static int ext2_mount __P((struct mount *,
@@ -1053,7 +1053,7 @@ static int
ext2_fhtovp(mp, fhp, nam, vpp, exflagsp, credanonp)
register struct mount *mp;
struct fid *fhp;
- struct mbuf *nam;
+ struct sockaddr *nam;
struct vnode **vpp;
int *exflagsp;
struct ucred **credanonp;
diff --git a/sys/i386/i386/in_cksum.c b/sys/i386/i386/in_cksum.c
index 42737b382c52..203051123d4b 100644
--- a/sys/i386/i386/in_cksum.c
+++ b/sys/i386/i386/in_cksum.c
@@ -32,14 +32,19 @@
*
* from tahoe: in_cksum.c 1.2 86/01/05
* from: @(#)in_cksum.c 1.3 (Berkeley) 1/19/91
- * $Id$
+ * $Id: in_cksum.c,v 1.10 1997/02/22 09:32:20 peter Exp $
*/
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/mbuf.h>
+#include <sys/socket.h>
-extern int in_cksum __P((struct mbuf *m, int len));
+#include <netinet/in.h>
+#include <netinet/in_systm.h>
+#include <netinet/ip.h>
+
+#include <machine/in_cksum.h>
/*
* Checksum routine for Internet Protocol family headers.
@@ -237,3 +242,171 @@ in_cksum(m, len)
REDUCE;
return (~sum & 0xffff);
}
+
+/*
+ * This is the exact same algorithm as above with a few exceptions:
+ * (1) it is designed to operate on buffers, not mbufs
+ * (2) it returns an intermediate form of the sum which has to be
+ * explicitly finalized (but this can be delayed)
+ * (3) it accepts an intermediate sum
+ *
+ * This is particularly useful when building packets quickly,
+ * since one can compute the checksum of the pseudoheader ahead of
+ * time and then use this function to complete the work. That way,
+ * the pseudoheader never actually has to exist in the packet buffer,
+ * which avoids needless duplication of work.
+ */
+in_psum_t
+in_cksum_partial(psum, w, len)
+ in_psum_t psum;
+ const u_short *w;
+ int len;
+{
+ register in_psum_t sum = psum;
+ int byte_swapped = 0;
+ union { char c[2]; u_short s; } su;
+
+ /*
+ * Force to long boundary so we do longword aligned
+ * memory operations
+ */
+ if (3 & (int) w) {
+ REDUCE;
+ if ((1 & (int) w) && (len > 0)) {
+ sum <<= 8;
+ su.c[0] = *(char *)w;
+ w = (u_short *)((char *)w + 1);
+ len--;
+ byte_swapped = 1;
+ }
+ if ((2 & (int) w) && (len >= 2)) {
+ sum += *w++;
+ len -= 2;
+ }
+ }
+ /*
+ * Advance to a 486 cache line boundary.
+ */
+ if (4 & (int) w && len >= 4) {
+ ADD(0);
+ MOP;
+ w += 2;
+ len -= 4;
+ }
+ if (8 & (int) w && len >= 8) {
+ ADD(0);
+ ADDC(4);
+ MOP;
+ w += 4;
+ len -= 8;
+ }
+ /*
+ * Do as much of the checksum as possible 32 bits at at time.
+ * In fact, this loop is unrolled to make overhead from
+ * branches &c small.
+ */
+ len -= 1;
+ while ((len -= 32) >= 0) {
+ u_char junk;
+ /*
+ * Add with carry 16 words and fold in the last
+ * carry by adding a 0 with carry.
+ *
+ * The early ADD(16) and the LOAD(32) are to load
+ * the next 2 cache lines in advance on 486's. The
+ * 486 has a penalty of 2 clock cycles for loading
+ * a cache line, plus whatever time the external
+ * memory takes to load the first word(s) addressed.
+ * These penalties are unavoidable. Subsequent
+ * accesses to a cache line being loaded (and to
+ * other external memory?) are delayed until the
+ * whole load finishes. These penalties are mostly
+ * avoided by not accessing external memory for
+ * 8 cycles after the ADD(16) and 12 cycles after
+ * the LOAD(32). The loop terminates when len
+ * is initially 33 (not 32) to guaranteed that
+ * the LOAD(32) is within bounds.
+ */
+ ADD(16);
+ ADDC(0);
+ ADDC(4);
+ ADDC(8);
+ ADDC(12);
+ LOAD(32);
+ ADDC(20);
+ ADDC(24);
+ ADDC(28);
+ MOP;
+ w += 16;
+ }
+ len += 32 + 1;
+ if (len >= 32) {
+ ADD(16);
+ ADDC(0);
+ ADDC(4);
+ ADDC(8);
+ ADDC(12);
+ ADDC(20);
+ ADDC(24);
+ ADDC(28);
+ MOP;
+ w += 16;
+ len -= 32;
+ }
+ if (len >= 16) {
+ ADD(0);
+ ADDC(4);
+ ADDC(8);
+ ADDC(12);
+ MOP;
+ w += 8;
+ len -= 16;
+ }
+ if (len >= 8) {
+ ADD(0);
+ ADDC(4);
+ MOP;
+ w += 4;
+ len -= 8;
+ }
+ if (len == 0 && byte_swapped == 0)
+ goto out;
+ REDUCE;
+ while ((len -= 2) >= 0) {
+ sum += *w++;
+ }
+ if (byte_swapped) {
+ sum <<= 8;
+ byte_swapped = 0;
+ if (len == -1) {
+ su.c[1] = *(char *)w;
+ sum += su.s;
+ len = 0;
+ } else
+ len = -1;
+ } else if (len == -1) {
+ /*
+ * This buffer has odd number of bytes.
+ * There could be a word split betwen
+ * this buffer and the next.
+ */
+ su.c[0] = *(char *)w;
+ }
+out:
+ if (len == -1) {
+ /* The last buffer has odd # of bytes. Follow the
+ standard (the odd byte is shifted left by 8 bits) */
+ su.c[1] = 0;
+ sum += su.s;
+ }
+ return sum;
+}
+
+int
+in_cksum_finalize(psum)
+ in_psum_t psum;
+{
+ in_psum_t sum = psum;
+ REDUCE;
+ return (sum & 0xffff);
+}
diff --git a/sys/i386/include/in_cksum.h b/sys/i386/include/in_cksum.h
index 49932f5ff89a..acfa10de0f04 100644
--- a/sys/i386/include/in_cksum.h
+++ b/sys/i386/include/in_cksum.h
@@ -33,7 +33,7 @@
* from tahoe: in_cksum.c 1.2 86/01/05
* from: @(#)in_cksum.c 1.3 (Berkeley) 1/19/91
* from: Id: in_cksum.c,v 1.8 1995/12/03 18:35:19 bde Exp
- * $Id$
+ * $Id: in_cksum.h,v 1.4 1997/02/22 09:34:42 peter Exp $
*/
#ifndef _MACHINE_IN_CKSUM_H_
@@ -63,6 +63,9 @@ in_cksum_hdr(const struct ip *ip)
ADDC(12);
ADDC(16);
MOP;
+#undef ADD
+#undef ADDC
+#undef MOP
sum = (sum & 0xffff) + (sum >> 16);
if (sum > 0xffff)
sum -= 0xffff;
@@ -89,4 +92,10 @@ u_int in_cksum_hdr __P((const struct ip *));
#endif
+typedef unsigned in_psum_t;
+#ifdef KERNEL
+in_psum_t in_cksum_partial(in_psum_t psum, const u_short *w, int len);
+int in_cksum_finalize(in_psum_t psum);
+#endif /* KERNEL */
+
#endif /* _MACHINE_IN_CKSUM_H_ */
diff --git a/sys/isofs/cd9660/cd9660_vfsops.c b/sys/isofs/cd9660/cd9660_vfsops.c
index cf09054be4e7..a0cea9db8e04 100644
--- a/sys/isofs/cd9660/cd9660_vfsops.c
+++ b/sys/isofs/cd9660/cd9660_vfsops.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)cd9660_vfsops.c 8.18 (Berkeley) 5/22/95
- * $Id: cd9660_vfsops.c,v 1.25 1997/05/04 15:24:21 joerg Exp $
+ * $Id: cd9660_vfsops.c,v 1.26 1997/08/02 14:31:20 bde Exp $
*/
#include <sys/param.h>
@@ -71,7 +71,7 @@ static int cd9660_statfs __P((struct mount *, struct statfs *, struct proc *));
static int cd9660_sync __P((struct mount *, int, struct ucred *,
struct proc *));
static int cd9660_vget __P((struct mount *, ino_t, struct vnode **));
-static int cd9660_fhtovp __P((struct mount *, struct fid *, struct mbuf *,
+static int cd9660_fhtovp __P((struct mount *, struct fid *, struct sockaddr *,
struct vnode **, int *, struct ucred **));
static int cd9660_vptofh __P((struct vnode *, struct fid *));
@@ -590,7 +590,7 @@ int
cd9660_fhtovp(mp, fhp, nam, vpp, exflagsp, credanonp)
register struct mount *mp;
struct fid *fhp;
- struct mbuf *nam;
+ struct sockaddr *nam;
struct vnode **vpp;
int *exflagsp;
struct ucred **credanonp;
diff --git a/sys/kern/sys_socket.c b/sys/kern/sys_socket.c
index 8e9e90e983b1..e0394b726b22 100644
--- a/sys/kern/sys_socket.c
+++ b/sys/kern/sys_socket.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)sys_socket.c 8.1 (Berkeley) 6/10/93
- * $Id: sys_socket.c,v 1.13 1997/04/27 20:00:42 wollman Exp $
+ * $Id: sys_socket.c,v 1.14 1997/08/02 14:31:36 bde Exp $
*/
#include <sys/param.h>
@@ -75,7 +75,8 @@ soo_write(fp, uio, cred)
struct ucred *cred;
{
struct socket *so = (struct socket *)fp->f_data;
- return so->so_proto->pr_usrreqs->pru_sosend(so, 0, uio, 0, 0, 0);
+ return so->so_proto->pr_usrreqs->pru_sosend(so, 0, uio, 0, 0, 0,
+ uio->uio_procp);
}
int
diff --git a/sys/kern/uipc_sockbuf.c b/sys/kern/uipc_sockbuf.c
index 978b46a16bbe..b20b9ee88598 100644
--- a/sys/kern/uipc_sockbuf.c
+++ b/sys/kern/uipc_sockbuf.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)uipc_socket2.c 8.1 (Berkeley) 6/10/93
- * $Id: uipc_socket2.c,v 1.25 1997/05/24 17:23:10 peter Exp $
+ * $Id: uipc_socket2.c,v 1.26 1997/07/19 20:15:35 fenner Exp $
*/
#include <sys/param.h>
@@ -814,159 +814,18 @@ sbcreatecontrol(p, size, type, level)
return (m);
}
-#ifdef PRU_OLDSTYLE
-/*
- * The following routines mediate between the old-style `pr_usrreq'
- * protocol implementations and the new-style `struct pr_usrreqs'
- * calling convention.
- */
-
-/* syntactic sugar */
-#define nomb (struct mbuf *)0
-
-static int
-old_abort(struct socket *so)
-{
- return so->so_proto->pr_ousrreq(so, PRU_ABORT, nomb, nomb, nomb);
-}
-
-static int
-old_accept(struct socket *so, struct mbuf *nam)
-{
- return so->so_proto->pr_ousrreq(so, PRU_ACCEPT, nomb, nam, nomb);
-}
-
-static int
-old_attach(struct socket *so, int proto)
-{
- return so->so_proto->pr_ousrreq(so, PRU_ATTACH, nomb,
- (struct mbuf *)proto, /* XXX */
- nomb);
-}
-
-static int
-old_bind(struct socket *so, struct mbuf *nam)
-{
- return so->so_proto->pr_ousrreq(so, PRU_BIND, nomb, nam, nomb);
-}
-
-static int
-old_connect(struct socket *so, struct mbuf *nam)
-{
- return so->so_proto->pr_ousrreq(so, PRU_CONNECT, nomb, nam, nomb);
-}
-
-static int
-old_connect2(struct socket *so1, struct socket *so2)
-{
- return so1->so_proto->pr_ousrreq(so1, PRU_CONNECT2, nomb,
- (struct mbuf *)so2, nomb);
-}
-
-static int
-old_control(struct socket *so, int cmd, caddr_t data, struct ifnet *ifp)
-{
- return so->so_proto->pr_ousrreq(so, PRU_CONTROL, (struct mbuf *)cmd,
- (struct mbuf *)data,
- (struct mbuf *)ifp);
-}
-
-static int
-old_detach(struct socket *so)
-{
- return so->so_proto->pr_ousrreq(so, PRU_DETACH, nomb, nomb, nomb);
-}
-
-static int
-old_disconnect(struct socket *so)
-{
- return so->so_proto->pr_ousrreq(so, PRU_DISCONNECT, nomb, nomb, nomb);
-}
-
-static int
-old_listen(struct socket *so)
-{
- return so->so_proto->pr_ousrreq(so, PRU_LISTEN, nomb, nomb, nomb);
-}
-
-static int
-old_peeraddr(struct socket *so, struct mbuf *nam)
-{
- return so->so_proto->pr_ousrreq(so, PRU_PEERADDR, nomb, nam, nomb);
-}
-
-static int
-old_rcvd(struct socket *so, int flags)
-{
- return so->so_proto->pr_ousrreq(so, PRU_RCVD, nomb,
- (struct mbuf *)flags, /* XXX */
- nomb);
-}
-
-static int
-old_rcvoob(struct socket *so, struct mbuf *m, int flags)
-{
- return so->so_proto->pr_ousrreq(so, PRU_RCVOOB, m,
- (struct mbuf *)flags, /* XXX */
- nomb);
-}
-
-static int
-old_send(struct socket *so, int flags, struct mbuf *m, struct mbuf *addr,
- struct mbuf *control)
-{
- int req;
-
- if (flags & PRUS_OOB) {
- req = PRU_SENDOOB;
- } else if(flags & PRUS_EOF) {
- req = PRU_SEND_EOF;
- } else {
- req = PRU_SEND;
- }
- return so->so_proto->pr_ousrreq(so, req, m, addr, control);
-}
-
-static int
-old_sense(struct socket *so, struct stat *sb)
-{
- return so->so_proto->pr_ousrreq(so, PRU_SENSE, (struct mbuf *)sb,
- nomb, nomb);
-}
-
-static int
-old_shutdown(struct socket *so)
-{
- return so->so_proto->pr_ousrreq(so, PRU_SHUTDOWN, nomb, nomb, nomb);
-}
-
-static int
-old_sockaddr(struct socket *so, struct mbuf *nam)
-{
- return so->so_proto->pr_ousrreq(so, PRU_SOCKADDR, nomb, nam, nomb);
-}
-
-struct pr_usrreqs pru_oldstyle = {
- old_abort, old_accept, old_attach, old_bind, old_connect,
- old_connect2, old_control, old_detach, old_disconnect,
- old_listen, old_peeraddr, old_rcvd, old_rcvoob, old_send,
- old_sense, old_shutdown, old_sockaddr
-};
-
-#endif /* PRU_OLDSTYLE */
-
/*
* Some routines that return EOPNOTSUPP for entry points that are not
* supported by a protocol. Fill in as needed.
*/
int
-pru_accept_notsupp(struct socket *so, struct mbuf *nam)
+pru_accept_notsupp(struct socket *so, struct sockaddr **nam)
{
return EOPNOTSUPP;
}
int
-pru_connect_notsupp(struct socket *so, struct mbuf *nam, struct proc *p)
+pru_connect_notsupp(struct socket *so, struct sockaddr *nam, struct proc *p)
{
return EOPNOTSUPP;
}
@@ -1014,6 +873,23 @@ pru_sense_null(struct socket *so, struct stat *sb)
}
/*
+ * Make a copy of a sockaddr in a malloced buffer of type M_SONAME.
+ */
+struct sockaddr *
+dup_sockaddr(sa, canwait)
+ struct sockaddr *sa;
+ int canwait;
+{
+ struct sockaddr *sa2;
+
+ MALLOC(sa2, struct sockaddr *, sa->sa_len, M_SONAME,
+ canwait ? M_WAITOK : M_NOWAIT);
+ if (sa2)
+ bcopy(sa, sa2, sa->sa_len);
+ return sa2;
+}
+
+/*
* Here is the definition of some of the basic objects in the kern.ipc
* branch of the MIB.
*/
@@ -1026,3 +902,4 @@ SYSCTL_INT(_kern, KERN_DUMMY, dummy, CTLFLAG_RW, &dummy, 0, "");
SYSCTL_INT(_kern_ipc, KIPC_MAXSOCKBUF, maxsockbuf, CTLFLAG_RW, &sb_max, 0, "")
SYSCTL_INT(_kern_ipc, KIPC_SOCKBUF_WASTE, sockbuf_waste_factor, CTLFLAG_RW,
&sb_efficiency, 0, "");
+
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c
index 8c1319a74570..8a554d0089d2 100644
--- a/sys/kern/uipc_socket.c
+++ b/sys/kern/uipc_socket.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)uipc_socket.c 8.3 (Berkeley) 4/15/94
- * $Id: uipc_socket.c,v 1.26 1997/04/27 20:00:44 wollman Exp $
+ * $Id: uipc_socket.c,v 1.27 1997/06/27 15:28:54 peter Exp $
*/
#include <sys/param.h>
@@ -101,7 +101,7 @@ socreate(dom, aso, type, proto, p)
int
sobind(so, nam, p)
struct socket *so;
- struct mbuf *nam;
+ struct sockaddr *nam;
struct proc *p;
{
int s = splnet();
@@ -233,7 +233,7 @@ soabort(so)
int
soaccept(so, nam)
register struct socket *so;
- struct mbuf *nam;
+ struct sockaddr **nam;
{
int s = splnet();
int error;
@@ -249,7 +249,7 @@ soaccept(so, nam)
int
soconnect(so, nam, p)
register struct socket *so;
- struct mbuf *nam;
+ struct sockaddr *nam;
struct proc *p;
{
int s;
@@ -327,15 +327,15 @@ bad:
* Data and control buffers are freed on return.
*/
int
-sosend(so, addr, uio, top, control, flags)
+sosend(so, addr, uio, top, control, flags, p)
register struct socket *so;
- struct mbuf *addr;
+ struct sockaddr *addr;
struct uio *uio;
struct mbuf *top;
struct mbuf *control;
int flags;
+ struct proc *p;
{
- struct proc *p = curproc; /* XXX */
struct mbuf **mp;
register struct mbuf *m;
register long space, len, resid;
@@ -512,9 +512,9 @@ out:
* only for the count in uio_resid.
*/
int
-soreceive(so, paddr, uio, mp0, controlp, flagsp)
+soreceive(so, psa, uio, mp0, controlp, flagsp)
register struct socket *so;
- struct mbuf **paddr;
+ struct sockaddr **psa;
struct uio *uio;
struct mbuf **mp0;
struct mbuf **controlp;
@@ -528,8 +528,8 @@ soreceive(so, paddr, uio, mp0, controlp, flagsp)
int orig_resid = uio->uio_resid;
mp = mp0;
- if (paddr)
- *paddr = 0;
+ if (psa)
+ *psa = 0;
if (controlp)
*controlp = 0;
if (flagsp)
@@ -630,21 +630,15 @@ dontblock:
panic("receive 1a");
#endif
orig_resid = 0;
+ if (psa)
+ *psa = dup_sockaddr(mtod(m, struct sockaddr *),
+ mp0 == 0);
if (flags & MSG_PEEK) {
- if (paddr)
- *paddr = m_copy(m, 0, m->m_len);
m = m->m_next;
} else {
sbfree(&so->so_rcv, m);
- if (paddr) {
- *paddr = m;
- so->so_rcv.sb_mb = m->m_next;
- m->m_next = 0;
- m = so->so_rcv.sb_mb;
- } else {
- MFREE(m, so->so_rcv.sb_mb);
- m = so->so_rcv.sb_mb;
- }
+ MFREE(m, so->so_rcv.sb_mb);
+ m = so->so_rcv.sb_mb;
}
}
while (m && m->m_type == MT_CONTROL && error == 0) {
diff --git a/sys/kern/uipc_socket2.c b/sys/kern/uipc_socket2.c
index 978b46a16bbe..b20b9ee88598 100644
--- a/sys/kern/uipc_socket2.c
+++ b/sys/kern/uipc_socket2.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)uipc_socket2.c 8.1 (Berkeley) 6/10/93
- * $Id: uipc_socket2.c,v 1.25 1997/05/24 17:23:10 peter Exp $
+ * $Id: uipc_socket2.c,v 1.26 1997/07/19 20:15:35 fenner Exp $
*/
#include <sys/param.h>
@@ -814,159 +814,18 @@ sbcreatecontrol(p, size, type, level)
return (m);
}
-#ifdef PRU_OLDSTYLE
-/*
- * The following routines mediate between the old-style `pr_usrreq'
- * protocol implementations and the new-style `struct pr_usrreqs'
- * calling convention.
- */
-
-/* syntactic sugar */
-#define nomb (struct mbuf *)0
-
-static int
-old_abort(struct socket *so)
-{
- return so->so_proto->pr_ousrreq(so, PRU_ABORT, nomb, nomb, nomb);
-}
-
-static int
-old_accept(struct socket *so, struct mbuf *nam)
-{
- return so->so_proto->pr_ousrreq(so, PRU_ACCEPT, nomb, nam, nomb);
-}
-
-static int
-old_attach(struct socket *so, int proto)
-{
- return so->so_proto->pr_ousrreq(so, PRU_ATTACH, nomb,
- (struct mbuf *)proto, /* XXX */
- nomb);
-}
-
-static int
-old_bind(struct socket *so, struct mbuf *nam)
-{
- return so->so_proto->pr_ousrreq(so, PRU_BIND, nomb, nam, nomb);
-}
-
-static int
-old_connect(struct socket *so, struct mbuf *nam)
-{
- return so->so_proto->pr_ousrreq(so, PRU_CONNECT, nomb, nam, nomb);
-}
-
-static int
-old_connect2(struct socket *so1, struct socket *so2)
-{
- return so1->so_proto->pr_ousrreq(so1, PRU_CONNECT2, nomb,
- (struct mbuf *)so2, nomb);
-}
-
-static int
-old_control(struct socket *so, int cmd, caddr_t data, struct ifnet *ifp)
-{
- return so->so_proto->pr_ousrreq(so, PRU_CONTROL, (struct mbuf *)cmd,
- (struct mbuf *)data,
- (struct mbuf *)ifp);
-}
-
-static int
-old_detach(struct socket *so)
-{
- return so->so_proto->pr_ousrreq(so, PRU_DETACH, nomb, nomb, nomb);
-}
-
-static int
-old_disconnect(struct socket *so)
-{
- return so->so_proto->pr_ousrreq(so, PRU_DISCONNECT, nomb, nomb, nomb);
-}
-
-static int
-old_listen(struct socket *so)
-{
- return so->so_proto->pr_ousrreq(so, PRU_LISTEN, nomb, nomb, nomb);
-}
-
-static int
-old_peeraddr(struct socket *so, struct mbuf *nam)
-{
- return so->so_proto->pr_ousrreq(so, PRU_PEERADDR, nomb, nam, nomb);
-}
-
-static int
-old_rcvd(struct socket *so, int flags)
-{
- return so->so_proto->pr_ousrreq(so, PRU_RCVD, nomb,
- (struct mbuf *)flags, /* XXX */
- nomb);
-}
-
-static int
-old_rcvoob(struct socket *so, struct mbuf *m, int flags)
-{
- return so->so_proto->pr_ousrreq(so, PRU_RCVOOB, m,
- (struct mbuf *)flags, /* XXX */
- nomb);
-}
-
-static int
-old_send(struct socket *so, int flags, struct mbuf *m, struct mbuf *addr,
- struct mbuf *control)
-{
- int req;
-
- if (flags & PRUS_OOB) {
- req = PRU_SENDOOB;
- } else if(flags & PRUS_EOF) {
- req = PRU_SEND_EOF;
- } else {
- req = PRU_SEND;
- }
- return so->so_proto->pr_ousrreq(so, req, m, addr, control);
-}
-
-static int
-old_sense(struct socket *so, struct stat *sb)
-{
- return so->so_proto->pr_ousrreq(so, PRU_SENSE, (struct mbuf *)sb,
- nomb, nomb);
-}
-
-static int
-old_shutdown(struct socket *so)
-{
- return so->so_proto->pr_ousrreq(so, PRU_SHUTDOWN, nomb, nomb, nomb);
-}
-
-static int
-old_sockaddr(struct socket *so, struct mbuf *nam)
-{
- return so->so_proto->pr_ousrreq(so, PRU_SOCKADDR, nomb, nam, nomb);
-}
-
-struct pr_usrreqs pru_oldstyle = {
- old_abort, old_accept, old_attach, old_bind, old_connect,
- old_connect2, old_control, old_detach, old_disconnect,
- old_listen, old_peeraddr, old_rcvd, old_rcvoob, old_send,
- old_sense, old_shutdown, old_sockaddr
-};
-
-#endif /* PRU_OLDSTYLE */
-
/*
* Some routines that return EOPNOTSUPP for entry points that are not
* supported by a protocol. Fill in as needed.
*/
int
-pru_accept_notsupp(struct socket *so, struct mbuf *nam)
+pru_accept_notsupp(struct socket *so, struct sockaddr **nam)
{
return EOPNOTSUPP;
}
int
-pru_connect_notsupp(struct socket *so, struct mbuf *nam, struct proc *p)
+pru_connect_notsupp(struct socket *so, struct sockaddr *nam, struct proc *p)
{
return EOPNOTSUPP;
}
@@ -1014,6 +873,23 @@ pru_sense_null(struct socket *so, struct stat *sb)
}
/*
+ * Make a copy of a sockaddr in a malloced buffer of type M_SONAME.
+ */
+struct sockaddr *
+dup_sockaddr(sa, canwait)
+ struct sockaddr *sa;
+ int canwait;
+{
+ struct sockaddr *sa2;
+
+ MALLOC(sa2, struct sockaddr *, sa->sa_len, M_SONAME,
+ canwait ? M_WAITOK : M_NOWAIT);
+ if (sa2)
+ bcopy(sa, sa2, sa->sa_len);
+ return sa2;
+}
+
+/*
* Here is the definition of some of the basic objects in the kern.ipc
* branch of the MIB.
*/
@@ -1026,3 +902,4 @@ SYSCTL_INT(_kern, KERN_DUMMY, dummy, CTLFLAG_RW, &dummy, 0, "");
SYSCTL_INT(_kern_ipc, KIPC_MAXSOCKBUF, maxsockbuf, CTLFLAG_RW, &sb_max, 0, "")
SYSCTL_INT(_kern_ipc, KIPC_SOCKBUF_WASTE, sockbuf_waste_factor, CTLFLAG_RW,
&sb_efficiency, 0, "");
+
diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c
index fb8f428d5ae5..409f68f8f922 100644
--- a/sys/kern/uipc_syscalls.c
+++ b/sys/kern/uipc_syscalls.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)uipc_syscalls.c 8.4 (Berkeley) 2/21/94
- * $Id: uipc_syscalls.c,v 1.25 1997/04/09 16:53:40 bde Exp $
+ * $Id: uipc_syscalls.c,v 1.26 1997/04/27 20:00:45 wollman Exp $
*/
#include "opt_ktrace.h"
@@ -121,17 +121,17 @@ bind(p, uap, retval)
int *retval;
{
struct file *fp;
- struct mbuf *nam;
+ struct sockaddr *sa;
int error;
error = getsock(p->p_fd, uap->s, &fp);
if (error)
return (error);
- error = sockargs(&nam, uap->name, uap->namelen, MT_SONAME);
+ error = getsockaddr(&sa, uap->name, uap->namelen);
if (error)
return (error);
- error = sobind((struct socket *)fp->f_data, nam, p);
- m_freem(nam);
+ error = sobind((struct socket *)fp->f_data, sa, p);
+ FREE(sa, M_SONAME);
return (error);
}
@@ -166,7 +166,7 @@ accept1(p, uap, retval, compat)
int compat;
{
struct file *fp;
- struct mbuf *nam;
+ struct sockaddr *sa;
int namelen, error, s;
struct socket *head, *so;
short fflag; /* type must match fp->f_flag */
@@ -243,24 +243,32 @@ accept1(p, uap, retval, compat)
fp->f_flag = fflag;
fp->f_ops = &socketops;
fp->f_data = (caddr_t)so;
- nam = m_get(M_WAIT, MT_SONAME);
- (void) soaccept(so, nam);
+ sa = 0;
+ (void) soaccept(so, &sa);
+ if (sa == 0) {
+ namelen = 0;
+ if (uap->name)
+ goto gotnoname;
+ return 0;
+ }
+ if ((u_long)sa < 0xf0000000) {
+ panic("accept1 bad sa");
+ }
if (uap->name) {
#ifdef COMPAT_OLDSOCK
if (compat)
- mtod(nam, struct osockaddr *)->sa_family =
- mtod(nam, struct sockaddr *)->sa_family;
+ ((struct osockaddr *)sa)->sa_family =
+ sa->sa_family;
#endif
- if (namelen > nam->m_len)
- namelen = nam->m_len;
- /* SHOULD COPY OUT A CHAIN HERE */
- error = copyout(mtod(nam, caddr_t), (caddr_t)uap->name,
- (u_int)namelen);
+ if (namelen > sa->sa_len)
+ namelen = sa->sa_len;
+ error = copyout(sa, (caddr_t)uap->name, (u_int)namelen);
if (!error)
+gotnoname:
error = copyout((caddr_t)&namelen,
(caddr_t)uap->anamelen, sizeof (*uap->anamelen));
}
- m_freem(nam);
+ FREE(sa, M_SONAME);
splx(s);
return (error);
}
@@ -300,7 +308,7 @@ connect(p, uap, retval)
{
struct file *fp;
register struct socket *so;
- struct mbuf *nam;
+ struct sockaddr *sa;
int error, s;
error = getsock(p->p_fd, uap->s, &fp);
@@ -309,14 +317,14 @@ connect(p, uap, retval)
so = (struct socket *)fp->f_data;
if ((so->so_state & SS_NBIO) && (so->so_state & SS_ISCONNECTING))
return (EALREADY);
- error = sockargs(&nam, uap->name, uap->namelen, MT_SONAME);
+ error = getsockaddr(&sa, uap->name, uap->namelen);
if (error)
return (error);
- error = soconnect(so, nam, p);
+ error = soconnect(so, sa, p);
if (error)
goto bad;
if ((so->so_state & SS_NBIO) && (so->so_state & SS_ISCONNECTING)) {
- m_freem(nam);
+ FREE(sa, M_SONAME);
return (EINPROGRESS);
}
s = splnet();
@@ -333,7 +341,7 @@ connect(p, uap, retval)
splx(s);
bad:
so->so_state &= ~SS_ISCONNECTING;
- m_freem(nam);
+ FREE(sa, M_SONAME);
if (error == ERESTART)
error = EINTR;
return (error);
@@ -418,7 +426,8 @@ sendit(p, s, mp, flags, retsize)
struct uio auio;
register struct iovec *iov;
register int i;
- struct mbuf *to, *control;
+ struct mbuf *control;
+ struct sockaddr *to;
int len, error;
struct socket *so;
#ifdef KTRACE
@@ -441,7 +450,7 @@ sendit(p, s, mp, flags, retsize)
return (EINVAL);
}
if (mp->msg_name) {
- error = sockargs(&to, mp->msg_name, mp->msg_namelen, MT_SONAME);
+ error = getsockaddr(&to, mp->msg_name, mp->msg_namelen);
if (error)
return (error);
} else
@@ -488,7 +497,7 @@ sendit(p, s, mp, flags, retsize)
len = auio.uio_resid;
so = (struct socket *)fp->f_data;
error = so->so_proto->pr_usrreqs->pru_sosend(so, to, &auio, 0, control,
- flags);
+ flags, p);
if (error) {
if (auio.uio_resid != len && (error == ERESTART ||
error == EINTR || error == EWOULDBLOCK))
@@ -508,7 +517,7 @@ sendit(p, s, mp, flags, retsize)
#endif
bad:
if (to)
- m_freem(to);
+ FREE(to, M_SONAME);
return (error);
}
@@ -659,9 +668,10 @@ recvit(p, s, mp, namelenp, retsize)
register struct iovec *iov;
register int i;
int len, error;
- struct mbuf *m, *from = 0, *control = 0;
+ struct mbuf *m, *control = 0;
caddr_t ctlbuf;
struct socket *so;
+ struct sockaddr *fromsa = 0;
#ifdef KTRACE
struct iovec *ktriov = NULL;
#endif
@@ -691,7 +701,7 @@ recvit(p, s, mp, namelenp, retsize)
#endif
len = auio.uio_resid;
so = (struct socket *)fp->f_data;
- error = so->so_proto->pr_usrreqs->pru_soreceive(so, &from, &auio,
+ error = so->so_proto->pr_usrreqs->pru_soreceive(so, &fromsa, &auio,
(struct mbuf **)0, mp->msg_control ? &control : (struct mbuf **)0,
&mp->msg_flags);
if (error) {
@@ -712,18 +722,19 @@ recvit(p, s, mp, namelenp, retsize)
*retsize = len - auio.uio_resid;
if (mp->msg_name) {
len = mp->msg_namelen;
- if (len <= 0 || from == 0)
+ if (len <= 0 || fromsa == 0)
len = 0;
else {
#ifdef COMPAT_OLDSOCK
if (mp->msg_flags & MSG_COMPAT)
- mtod(from, struct osockaddr *)->sa_family =
- mtod(from, struct sockaddr *)->sa_family;
+ ((struct osockaddr *)fromsa)->sa_family =
+ fromsa->sa_family;
+#endif
+#ifndef MIN
+#define MIN(a,b) ((a)>(b)?(b):(a))
#endif
- if (len > from->m_len)
- len = from->m_len;
- /* else if len < from->m_len ??? */
- error = copyout(mtod(from, caddr_t),
+ len = MIN(len, fromsa->sa_len);
+ error = copyout(fromsa,
(caddr_t)mp->msg_name, (unsigned)len);
if (error)
goto out;
@@ -786,8 +797,8 @@ recvit(p, s, mp, namelenp, retsize)
mp->msg_controllen = ctlbuf - mp->msg_control;
}
out:
- if (from)
- m_freem(from);
+ if (fromsa)
+ FREE(fromsa, M_SONAME);
if (control)
m_freem(control);
return (error);
@@ -1084,7 +1095,7 @@ getsockname1(p, uap, retval, compat)
{
struct file *fp;
register struct socket *so;
- struct mbuf *m;
+ struct sockaddr *sa;
int len, error;
error = getsock(p->p_fd, uap->fdes, &fp);
@@ -1094,25 +1105,28 @@ getsockname1(p, uap, retval, compat)
if (error)
return (error);
so = (struct socket *)fp->f_data;
- m = m_getclr(M_WAIT, MT_SONAME);
- if (m == NULL)
- return (ENOBUFS);
- error = (*so->so_proto->pr_usrreqs->pru_sockaddr)(so, m);
+ sa = 0;
+ error = (*so->so_proto->pr_usrreqs->pru_sockaddr)(so, &sa);
if (error)
goto bad;
- if (len > m->m_len)
- len = m->m_len;
+ if (sa == 0) {
+ len = 0;
+ goto gotnothing;
+ }
+
+ len = MIN(len, sa->sa_len);
#ifdef COMPAT_OLDSOCK
if (compat)
- mtod(m, struct osockaddr *)->sa_family =
- mtod(m, struct sockaddr *)->sa_family;
+ ((struct osockaddr *)sa)->sa_family = sa->sa_family;
#endif
- error = copyout(mtod(m, caddr_t), (caddr_t)uap->asa, (u_int)len);
+ error = copyout(sa, (caddr_t)uap->asa, (u_int)len);
if (error == 0)
+gotnothing:
error = copyout((caddr_t)&len, (caddr_t)uap->alen,
sizeof (len));
bad:
- m_freem(m);
+ if (sa)
+ FREE(sa, M_SONAME);
return (error);
}
@@ -1155,7 +1169,7 @@ getpeername1(p, uap, retval, compat)
{
struct file *fp;
register struct socket *so;
- struct mbuf *m;
+ struct sockaddr *sa;
int len, error;
error = getsock(p->p_fd, uap->fdes, &fp);
@@ -1167,25 +1181,27 @@ getpeername1(p, uap, retval, compat)
error = copyin((caddr_t)uap->alen, (caddr_t)&len, sizeof (len));
if (error)
return (error);
- m = m_getclr(M_WAIT, MT_SONAME);
- if (m == NULL)
- return (ENOBUFS);
- error = (*so->so_proto->pr_usrreqs->pru_peeraddr)(so, m);
+ sa = 0;
+ error = (*so->so_proto->pr_usrreqs->pru_peeraddr)(so, &sa);
if (error)
goto bad;
- if (len > m->m_len)
- len = m->m_len;
+ if (sa == 0) {
+ len = 0;
+ goto gotnothing;
+ }
+ len = MIN(len, sa->sa_len);
#ifdef COMPAT_OLDSOCK
if (compat)
- mtod(m, struct osockaddr *)->sa_family =
- mtod(m, struct sockaddr *)->sa_family;
+ ((struct osockaddr *)sa)->sa_family =
+ sa->sa_family;
#endif
- error = copyout(mtod(m, caddr_t), (caddr_t)uap->asa, (u_int)len);
+ error = copyout(sa, (caddr_t)uap->asa, (u_int)len);
if (error)
goto bad;
+gotnothing:
error = copyout((caddr_t)&len, (caddr_t)uap->alen, sizeof (len));
bad:
- m_freem(m);
+ if (sa) FREE(sa, M_SONAME);
return (error);
}
@@ -1253,6 +1269,32 @@ sockargs(mp, buf, buflen, type)
}
int
+getsockaddr(namp, uaddr, len)
+ struct sockaddr **namp;
+ caddr_t uaddr;
+ size_t len;
+{
+ struct sockaddr *sa;
+ int error;
+
+ if (len > SOCK_MAXADDRLEN)
+ return ENAMETOOLONG;
+ MALLOC(sa, struct sockaddr *, len, M_SONAME, M_WAITOK);
+ error = copyin(uaddr, sa, len);
+ if (error) {
+ FREE(sa, M_SONAME);
+ } else {
+#if defined(COMPAT_OLDSOCK) && BYTE_ORDER != BIG_ENDIAN
+ if (sa->sa_family == 0 && sa->sa_len < AF_MAX)
+ sa->sa_family = sa->sa_len;
+#endif
+ sa->sa_len = len;
+ *namp = sa;
+ }
+ return error;
+}
+
+int
getsock(fdp, fdes, fpp)
struct filedesc *fdp;
int fdes;
diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c
index 2734778d1159..a908e19c7368 100644
--- a/sys/kern/uipc_usrreq.c
+++ b/sys/kern/uipc_usrreq.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* From: @(#)uipc_usrreq.c 8.3 (Berkeley) 1/4/94
- * $Id: uipc_usrreq.c,v 1.22 1997/03/23 03:36:33 bde Exp $
+ * $Id: uipc_usrreq.c,v 1.23 1997/04/27 20:00:46 wollman Exp $
*/
#include <sys/param.h>
@@ -67,8 +67,9 @@ static ino_t unp_ino; /* prototype for fake inode numbers */
static int unp_attach __P((struct socket *));
static void unp_detach __P((struct unpcb *));
-static int unp_bind __P((struct unpcb *,struct mbuf *, struct proc *));
-static int unp_connect __P((struct socket *,struct mbuf *, struct proc *));
+static int unp_bind __P((struct unpcb *,struct sockaddr *, struct proc *));
+static int unp_connect __P((struct socket *,struct sockaddr *,
+ struct proc *));
static void unp_disconnect __P((struct unpcb *));
static void unp_shutdown __P((struct unpcb *));
static void unp_drop __P((struct unpcb *, int));
@@ -90,7 +91,7 @@ uipc_abort(struct socket *so)
}
static int
-uipc_accept(struct socket *so, struct mbuf *nam)
+uipc_accept(struct socket *so, struct sockaddr **nam)
{
struct unpcb *unp = sotounpcb(so);
@@ -103,12 +104,10 @@ uipc_accept(struct socket *so, struct mbuf *nam)
* (our peer may have closed already!).
*/
if (unp->unp_conn && unp->unp_conn->unp_addr) {
- nam->m_len = unp->unp_conn->unp_addr->m_len;
- bcopy(mtod(unp->unp_conn->unp_addr, caddr_t),
- mtod(nam, caddr_t), (unsigned)nam->m_len);
+ *nam = dup_sockaddr((struct sockaddr *)unp->unp_conn->unp_addr,
+ 1);
} else {
- nam->m_len = sizeof(sun_noname);
- *(mtod(nam, struct sockaddr *)) = sun_noname;
+ *nam = dup_sockaddr((struct sockaddr *)&sun_noname, 1);
}
return 0;
}
@@ -124,7 +123,7 @@ uipc_attach(struct socket *so, int proto, struct proc *p)
}
static int
-uipc_bind(struct socket *so, struct mbuf *nam, struct proc *p)
+uipc_bind(struct socket *so, struct sockaddr *nam, struct proc *p)
{
struct unpcb *unp = sotounpcb(so);
@@ -135,7 +134,7 @@ uipc_bind(struct socket *so, struct mbuf *nam, struct proc *p)
}
static int
-uipc_connect(struct socket *so, struct mbuf *nam, struct proc *p)
+uipc_connect(struct socket *so, struct sockaddr *nam, struct proc *p)
{
struct unpcb *unp = sotounpcb(so);
@@ -191,18 +190,15 @@ uipc_listen(struct socket *so, struct proc *p)
}
static int
-uipc_peeraddr(struct socket *so, struct mbuf *nam)
+uipc_peeraddr(struct socket *so, struct sockaddr **nam)
{
struct unpcb *unp = sotounpcb(so);
if (unp == 0)
return EINVAL;
- if (unp->unp_conn && unp->unp_conn->unp_addr) {
- nam->m_len = unp->unp_conn->unp_addr->m_len;
- bcopy(mtod(unp->unp_conn->unp_addr, caddr_t),
- mtod(nam, caddr_t), (unsigned)nam->m_len);
- } else
- nam->m_len = 0;
+ if (unp->unp_conn && unp->unp_conn->unp_addr)
+ *nam = dup_sockaddr((struct sockaddr *)unp->unp_conn->unp_addr,
+ 1);
return 0;
}
@@ -247,7 +243,7 @@ uipc_rcvd(struct socket *so, int flags)
/* pru_rcvoob is EOPNOTSUPP */
static int
-uipc_send(struct socket *so, int flags, struct mbuf *m, struct mbuf *nam,
+uipc_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *nam,
struct mbuf *control, struct proc *p)
{
int error = 0;
@@ -287,7 +283,7 @@ uipc_send(struct socket *so, int flags, struct mbuf *m, struct mbuf *nam,
}
so2 = unp->unp_conn->unp_socket;
if (unp->unp_addr)
- from = mtod(unp->unp_addr, struct sockaddr *);
+ from = (struct sockaddr *)unp->unp_addr;
else
from = &sun_noname;
if (sbappendaddr(&so2->so_rcv, from, m, control)) {
@@ -402,18 +398,14 @@ uipc_shutdown(struct socket *so)
}
static int
-uipc_sockaddr(struct socket *so, struct mbuf *nam)
+uipc_sockaddr(struct socket *so, struct sockaddr **nam)
{
struct unpcb *unp = sotounpcb(so);
if (unp == 0)
return EINVAL;
- if (unp->unp_addr) {
- nam->m_len = unp->unp_addr->m_len;
- bcopy(mtod(unp->unp_addr, caddr_t),
- mtod(nam, caddr_t), (unsigned)nam->m_len);
- } else
- nam->m_len = 0;
+ if (unp->unp_addr)
+ *nam = dup_sockaddr((struct sockaddr *)unp->unp_addr, 1);
return 0;
}
@@ -478,10 +470,10 @@ unp_attach(so)
if (error)
return (error);
}
- m = m_getclr(M_DONTWAIT, MT_PCB);
- if (m == NULL)
+ MALLOC(unp, struct unpcb *, sizeof *unp, M_PCB, M_NOWAIT);
+ if (unp == NULL)
return (ENOBUFS);
- unp = mtod(m, struct unpcb *);
+ bzero(unp, sizeof *unp);
so->so_pcb = (caddr_t)unp;
unp->unp_socket = so;
return (0);
@@ -491,7 +483,6 @@ static void
unp_detach(unp)
register struct unpcb *unp;
{
-
if (unp->unp_vnode) {
unp->unp_vnode->v_socket = 0;
vrele(unp->unp_vnode);
@@ -514,31 +505,34 @@ unp_detach(unp)
sorflush(unp->unp_socket);
unp_gc();
}
- m_freem(unp->unp_addr);
- (void) m_free(dtom(unp));
+ if (unp->unp_addr)
+ FREE(unp->unp_addr, M_SONAME);
+ FREE(unp, M_PCB);
}
static int
unp_bind(unp, nam, p)
struct unpcb *unp;
- struct mbuf *nam;
+ struct sockaddr *nam;
struct proc *p;
{
- struct sockaddr_un *soun = mtod(nam, struct sockaddr_un *);
+ struct sockaddr_un *soun = (struct sockaddr_un *)nam;
register struct vnode *vp;
struct vattr vattr;
- int error;
+ int error, namelen;
struct nameidata nd;
+ char buf[SOCK_MAXADDRLEN];
- NDINIT(&nd, CREATE, FOLLOW | LOCKPARENT, UIO_SYSSPACE,
- soun->sun_path, p);
if (unp->unp_vnode != NULL)
return (EINVAL);
- if (nam->m_len == MLEN) {
- if (*(mtod(nam, caddr_t) + nam->m_len - 1) != 0)
- return (EINVAL);
- } else
- *(mtod(nam, caddr_t) + nam->m_len) = 0;
+#define offsetof(s, e) ((char *)&((s *)0)->e - (char *)((s *)0))
+ namelen = soun->sun_len - offsetof(struct sockaddr_un, sun_path);
+ if (namelen <= 0)
+ return EINVAL;
+ strncpy(buf, soun->sun_path, namelen);
+ buf[namelen] = 0; /* null-terminate the string */
+ NDINIT(&nd, CREATE, FOLLOW | LOCKPARENT, UIO_SYSSPACE,
+ buf, p);
/* SHOULD BE ABLE TO ADOPT EXISTING AND wakeup() ALA FIFO's */
error = namei(&nd);
if (error)
@@ -562,7 +556,7 @@ unp_bind(unp, nam, p)
vp = nd.ni_vp;
vp->v_socket = unp->unp_socket;
unp->unp_vnode = vp;
- unp->unp_addr = m_copy(nam, 0, (int)M_COPYALL);
+ unp->unp_addr = (struct sockaddr_un *)dup_sockaddr(nam, 1);
VOP_UNLOCK(vp, 0, p);
return (0);
}
@@ -570,22 +564,24 @@ unp_bind(unp, nam, p)
static int
unp_connect(so, nam, p)
struct socket *so;
- struct mbuf *nam;
+ struct sockaddr *nam;
struct proc *p;
{
- register struct sockaddr_un *soun = mtod(nam, struct sockaddr_un *);
+ register struct sockaddr_un *soun = (struct sockaddr_un *)nam;
register struct vnode *vp;
register struct socket *so2, *so3;
struct unpcb *unp2, *unp3;
- int error;
+ int error, len;
struct nameidata nd;
+ char buf[SOCK_MAXADDRLEN];
- NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE, soun->sun_path, p);
- if (nam->m_data + nam->m_len == &nam->m_dat[MLEN]) { /* XXX */
- if (*(mtod(nam, caddr_t) + nam->m_len - 1) != 0)
- return (EMSGSIZE);
- } else
- *(mtod(nam, caddr_t) + nam->m_len) = 0;
+ len = nam->sa_len - offsetof(struct sockaddr_un, sun_path);
+ if (len <= 0)
+ return EINVAL;
+ strncpy(buf, soun->sun_path, len);
+ buf[len] = 0;
+
+ NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE, buf, p);
error = namei(&nd);
if (error)
return (error);
@@ -615,8 +611,9 @@ unp_connect(so, nam, p)
unp2 = sotounpcb(so2);
unp3 = sotounpcb(so3);
if (unp2->unp_addr)
- unp3->unp_addr =
- m_copy(unp2->unp_addr, 0, (int)M_COPYALL);
+ unp3->unp_addr = (struct sockaddr_un *)
+ dup_sockaddr((struct sockaddr *)
+ unp2->unp_addr, 1);
so2 = so3;
}
error = unp_connect2(so, so2);
@@ -726,8 +723,9 @@ unp_drop(unp, errno)
unp_disconnect(unp);
if (so->so_head) {
so->so_pcb = (caddr_t) 0;
- m_freem(unp->unp_addr);
- (void) m_free(dtom(unp));
+ if (unp->unp_addr)
+ FREE(unp->unp_addr, M_SONAME);
+ FREE(unp, M_PCB);
sofree(so);
}
}
diff --git a/sys/kern/vfs_export.c b/sys/kern/vfs_export.c
index 3a8c88c979be..6b55c8525414 100644
--- a/sys/kern/vfs_export.c
+++ b/sys/kern/vfs_export.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)vfs_subr.c 8.31 (Berkeley) 5/26/95
- * $Id: vfs_subr.c,v 1.89 1997/07/17 07:17:31 dfr Exp $
+ * $Id: vfs_subr.c,v 1.90 1997/08/04 07:43:28 dyson Exp $
*/
/*
@@ -2145,7 +2145,7 @@ struct netcred *
vfs_export_lookup(mp, nep, nam)
register struct mount *mp;
struct netexport *nep;
- struct mbuf *nam;
+ struct sockaddr *nam;
{
register struct netcred *np;
register struct radix_node_head *rnh;
@@ -2157,7 +2157,7 @@ vfs_export_lookup(mp, nep, nam)
* Lookup in the export list first.
*/
if (nam != NULL) {
- saddr = mtod(nam, struct sockaddr *);
+ saddr = nam;
rnh = nep->ne_rtable[saddr->sa_family];
if (rnh != NULL) {
np = (struct netcred *)
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index 3a8c88c979be..6b55c8525414 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)vfs_subr.c 8.31 (Berkeley) 5/26/95
- * $Id: vfs_subr.c,v 1.89 1997/07/17 07:17:31 dfr Exp $
+ * $Id: vfs_subr.c,v 1.90 1997/08/04 07:43:28 dyson Exp $
*/
/*
@@ -2145,7 +2145,7 @@ struct netcred *
vfs_export_lookup(mp, nep, nam)
register struct mount *mp;
struct netexport *nep;
- struct mbuf *nam;
+ struct sockaddr *nam;
{
register struct netcred *np;
register struct radix_node_head *rnh;
@@ -2157,7 +2157,7 @@ vfs_export_lookup(mp, nep, nam)
* Lookup in the export list first.
*/
if (nam != NULL) {
- saddr = mtod(nam, struct sockaddr *);
+ saddr = nam;
rnh = nep->ne_rtable[saddr->sa_family];
if (rnh != NULL) {
np = (struct netcred *)
diff --git a/sys/miscfs/devfs/devfs_vfsops.c b/sys/miscfs/devfs/devfs_vfsops.c
index 06e0501ef485..163cf8552b5b 100644
--- a/sys/miscfs/devfs/devfs_vfsops.c
+++ b/sys/miscfs/devfs/devfs_vfsops.c
@@ -1,7 +1,7 @@
/*
* Written by Julian Elischer (julian@DIALix.oz.au)
*
- * $Header: /home/ncvs/src/sys/miscfs/devfs/devfs_vfsops.c,v 1.18 1997/07/14 04:30:22 julian Exp $
+ * $Header: /home/ncvs/src/sys/miscfs/devfs/devfs_vfsops.c,v 1.19 1997/08/02 14:31:55 bde Exp $
*
*
*/
@@ -284,7 +284,7 @@ DBPRINT(("vget "));
*/
static int
-devfs_fhtovp (struct mount *mp, struct fid *fhp, struct mbuf *nam,
+devfs_fhtovp (struct mount *mp, struct fid *fhp, struct sockaddr *nam,
struct vnode **vpp, int *exflagsp, struct ucred **credanonp)
{
DBPRINT(("fhtovp "));
diff --git a/sys/miscfs/fdesc/fdesc_vfsops.c b/sys/miscfs/fdesc/fdesc_vfsops.c
index ea668c9915f3..e80c69d90626 100644
--- a/sys/miscfs/fdesc/fdesc_vfsops.c
+++ b/sys/miscfs/fdesc/fdesc_vfsops.c
@@ -35,7 +35,7 @@
*
* @(#)fdesc_vfsops.c 8.4 (Berkeley) 1/21/94
*
- * $Id: fdesc_vfsops.c,v 1.10 1997/02/22 09:40:15 peter Exp $
+ * $Id: fdesc_vfsops.c,v 1.11 1997/08/02 14:31:59 bde Exp $
*/
/*
@@ -244,7 +244,7 @@ fdesc_sync(mp, waitfor, cred, p)
}
#define fdesc_fhtovp ((int (*) __P((struct mount *, struct fid *, \
- struct mbuf *, struct vnode **, int *, struct ucred **)))eopnotsupp)
+ struct sockaddr *, struct vnode **, int *, struct ucred **)))eopnotsupp)
#define fdesc_quotactl ((int (*) __P((struct mount *, int, uid_t, caddr_t, \
struct proc *)))eopnotsupp)
#define fdesc_sysctl ((int (*) __P((int *, u_int, void *, size_t *, void *, \
diff --git a/sys/miscfs/fifofs/fifo_vnops.c b/sys/miscfs/fifofs/fifo_vnops.c
index 1cdc3d789701..ce23c6e51925 100644
--- a/sys/miscfs/fifofs/fifo_vnops.c
+++ b/sys/miscfs/fifofs/fifo_vnops.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)fifo_vnops.c 8.10 (Berkeley) 5/27/95
- * $Id: fifo_vnops.c,v 1.23 1997/03/23 03:36:49 bde Exp $
+ * $Id: fifo_vnops.c,v 1.24 1997/03/24 11:37:53 bde Exp $
*/
#include <sys/param.h>
@@ -264,7 +264,7 @@ fifo_read(ap)
rso->so_state |= SS_NBIO;
startresid = uio->uio_resid;
VOP_UNLOCK(ap->a_vp, 0, p);
- error = soreceive(rso, (struct mbuf **)0, uio, (struct mbuf **)0,
+ error = soreceive(rso, (struct sockaddr **)0, uio, (struct mbuf **)0,
(struct mbuf **)0, (int *)0);
vn_lock(ap->a_vp, LK_EXCLUSIVE | LK_RETRY, p);
/*
@@ -301,7 +301,8 @@ fifo_write(ap)
if (ap->a_ioflag & IO_NDELAY)
wso->so_state |= SS_NBIO;
VOP_UNLOCK(ap->a_vp, 0, p);
- error = sosend(wso, (struct mbuf *)0, ap->a_uio, 0, (struct mbuf *)0, 0);
+ error = sosend(wso, (struct sockaddr *)0, ap->a_uio, 0,
+ (struct mbuf *)0, 0, p);
vn_lock(ap->a_vp, LK_EXCLUSIVE | LK_RETRY, p);
if (ap->a_ioflag & IO_NDELAY)
wso->so_state &= ~SS_NBIO;
diff --git a/sys/miscfs/kernfs/kernfs.h b/sys/miscfs/kernfs/kernfs.h
index 94d46af8c892..aa9805010ca9 100644
--- a/sys/miscfs/kernfs/kernfs.h
+++ b/sys/miscfs/kernfs/kernfs.h
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)kernfs.h 8.6 (Berkeley) 3/29/95
- * $Id$
+ * $Id: kernfs.h,v 1.6 1997/02/22 09:40:18 peter Exp $
*/
#define _PATH_KERNFS "/kern" /* Default mountpoint */
@@ -52,7 +52,7 @@ struct kernfs_node {
#define VTOKERN(vp) ((struct kernfs_node *)(vp)->v_data)
#define kernfs_fhtovp ((int (*) __P((struct mount *, struct fid *, \
- struct mbuf *, struct vnode **, int *, struct ucred **)))eopnotsupp)
+ struct sockaddr *, struct vnode **, int *, struct ucred **)))eopnotsupp)
#define kernfs_quotactl ((int (*) __P((struct mount *, int, uid_t, caddr_t, \
struct proc *)))eopnotsupp)
#define kernfs_sync ((int (*) __P((struct mount *, int, struct ucred *, \
diff --git a/sys/miscfs/nullfs/null_vfsops.c b/sys/miscfs/nullfs/null_vfsops.c
index 40e2a19ce9c6..ea5711f7351f 100644
--- a/sys/miscfs/nullfs/null_vfsops.c
+++ b/sys/miscfs/nullfs/null_vfsops.c
@@ -36,7 +36,7 @@
* @(#)null_vfsops.c 8.2 (Berkeley) 1/21/94
*
* @(#)lofs_vfsops.c 1.2 (Berkeley) 6/18/92
- * $Id: null_vfsops.c,v 1.17 1997/04/19 06:03:30 kato Exp $
+ * $Id: null_vfsops.c,v 1.18 1997/08/02 14:32:05 bde Exp $
*/
/*
@@ -55,7 +55,7 @@
#include <miscfs/nullfs/null.h>
static int nullfs_fhtovp __P((struct mount *mp, struct fid *fidp,
- struct mbuf *nam, struct vnode **vpp,
+ struct sockaddr *nam, struct vnode **vpp,
int *exflagsp, struct ucred **credanonp));
static int nullfs_mount __P((struct mount *mp, char *path, caddr_t data,
struct nameidata *ndp, struct proc *p));
@@ -387,13 +387,14 @@ static int
nullfs_fhtovp(mp, fidp, nam, vpp, exflagsp, credanonp)
struct mount *mp;
struct fid *fidp;
- struct mbuf *nam;
+ struct sockaddr *nam;
struct vnode **vpp;
int *exflagsp;
struct ucred**credanonp;
{
- return VFS_FHTOVP(MOUNTTONULLMOUNT(mp)->nullm_vfs, fidp, nam, vpp, exflagsp,credanonp);
+ return VFS_FHTOVP(MOUNTTONULLMOUNT(mp)->nullm_vfs, fidp, nam,
+ vpp, exflagsp, credanonp);
}
static int
diff --git a/sys/miscfs/portal/portal_vfsops.c b/sys/miscfs/portal/portal_vfsops.c
index 7ab3be6c39b6..c70e73e0a581 100644
--- a/sys/miscfs/portal/portal_vfsops.c
+++ b/sys/miscfs/portal/portal_vfsops.c
@@ -35,7 +35,7 @@
*
* @(#)portal_vfsops.c 8.11 (Berkeley) 5/14/95
*
- * $Id: portal_vfsops.c,v 1.15 1997/02/22 09:40:24 peter Exp $
+ * $Id: portal_vfsops.c,v 1.16 1997/08/02 14:32:07 bde Exp $
*/
/*
@@ -261,7 +261,7 @@ portal_statfs(mp, sbp, p)
}
#define portal_fhtovp ((int (*) __P((struct mount *, struct fid *, \
- struct mbuf *, struct vnode **, int *, struct ucred **)))eopnotsupp)
+ struct sockaddr *, struct vnode **, int *, struct ucred **)))eopnotsupp)
#define portal_quotactl ((int (*) __P((struct mount *, int, uid_t, caddr_t, \
struct proc *)))eopnotsupp)
#define portal_sync ((int (*) __P((struct mount *, int, struct ucred *, \
diff --git a/sys/miscfs/portal/portal_vnops.c b/sys/miscfs/portal/portal_vnops.c
index edd42174db0b..281d5632f88d 100644
--- a/sys/miscfs/portal/portal_vnops.c
+++ b/sys/miscfs/portal/portal_vnops.c
@@ -35,7 +35,7 @@
*
* @(#)portal_vnops.c 8.14 (Berkeley) 5/21/95
*
- * $Id: portal_vnops.c,v 1.18 1997/03/23 03:36:54 bde Exp $
+ * $Id: portal_vnops.c,v 1.19 1997/08/02 14:32:08 bde Exp $
*/
/*
@@ -197,11 +197,10 @@ portal_connect(so, so2)
unp2 = sotounpcb(so2);
unp3 = sotounpcb(so3);
if (unp2->unp_addr)
- unp3->unp_addr = m_copy(unp2->unp_addr, 0, (int)M_COPYALL);
-
+ unp3->unp_addr = (struct sockaddr_un *)
+ dup_sockaddr((struct sockaddr *)unp2->unp_addr, 0);
so2 = so3;
-
return (unp_connect2(so, so2));
}
@@ -326,8 +325,8 @@ portal_open(ap)
auio.uio_offset = 0;
auio.uio_resid = aiov[0].iov_len + aiov[1].iov_len;
- error = sosend(so, (struct mbuf *) 0, &auio,
- (struct mbuf *) 0, (struct mbuf *) 0, 0);
+ error = sosend(so, (struct sockaddr *) 0, &auio,
+ (struct mbuf *) 0, (struct mbuf *) 0, 0, p);
if (error)
goto bad;
@@ -335,7 +334,7 @@ portal_open(ap)
do {
struct mbuf *m = 0;
int flags = MSG_WAITALL;
- error = soreceive(so, (struct mbuf **) 0, &auio,
+ error = soreceive(so, (struct sockaddr **) 0, &auio,
&m, &cm, &flags);
if (error)
goto bad;
diff --git a/sys/miscfs/procfs/procfs_vfsops.c b/sys/miscfs/procfs/procfs_vfsops.c
index a6ebbaec02c5..3afd9e96b617 100644
--- a/sys/miscfs/procfs/procfs_vfsops.c
+++ b/sys/miscfs/procfs/procfs_vfsops.c
@@ -36,7 +36,7 @@
*
* @(#)procfs_vfsops.c 8.7 (Berkeley) 5/10/95
*
- * $Id: procfs_vfsops.c,v 1.15 1997/02/22 09:40:31 peter Exp $
+ * $Id: procfs_vfsops.c,v 1.16 1997/08/02 14:32:19 bde Exp $
*/
/*
@@ -177,7 +177,7 @@ procfs_init(vfsp)
}
#define procfs_fhtovp ((int (*) __P((struct mount *, struct fid *, \
- struct mbuf *, struct vnode **, int *, struct ucred **)))einval)
+ struct sockaddr *, struct vnode **, int *, struct ucred **)))einval)
#define procfs_quotactl ((int (*) __P((struct mount *, int, uid_t, caddr_t, \
struct proc *)))eopnotsupp)
#define procfs_sync ((int (*) __P((struct mount *, int, struct ucred *, \
diff --git a/sys/miscfs/umapfs/umap_vfsops.c b/sys/miscfs/umapfs/umap_vfsops.c
index 3a73bd69aa4c..20c0c4c8f126 100644
--- a/sys/miscfs/umapfs/umap_vfsops.c
+++ b/sys/miscfs/umapfs/umap_vfsops.c
@@ -35,7 +35,7 @@
*
* @(#)umap_vfsops.c 8.8 (Berkeley) 5/14/95
*
- * $Id: umap_vfsops.c,v 1.14 1997/02/22 09:40:38 peter Exp $
+ * $Id: umap_vfsops.c,v 1.15 1997/08/02 14:32:25 bde Exp $
*/
/*
@@ -54,7 +54,7 @@
#include <miscfs/umapfs/umap.h>
static int umapfs_fhtovp __P((struct mount *mp, struct fid *fidp,
- struct mbuf *nam, struct vnode **vpp,
+ struct sockaddr *nam, struct vnode **vpp,
int *exflagsp, struct ucred **credanonp));
static int umapfs_mount __P((struct mount *mp, char *path, caddr_t data,
struct nameidata *ndp, struct proc *p));
@@ -391,7 +391,7 @@ static int
umapfs_fhtovp(mp, fidp, nam, vpp, exflagsp, credanonp)
struct mount *mp;
struct fid *fidp;
- struct mbuf *nam;
+ struct sockaddr *nam;
struct vnode **vpp;
int *exflagsp;
struct ucred**credanonp;
diff --git a/sys/miscfs/union/union_vfsops.c b/sys/miscfs/union/union_vfsops.c
index 82edf917218d..e7954beee643 100644
--- a/sys/miscfs/union/union_vfsops.c
+++ b/sys/miscfs/union/union_vfsops.c
@@ -35,7 +35,7 @@
* SUCH DAMAGE.
*
* @(#)union_vfsops.c 8.20 (Berkeley) 5/20/95
- * $Id: union_vfsops.c,v 1.17 1997/05/07 14:37:31 kato Exp $
+ * $Id: union_vfsops.c,v 1.18 1997/08/02 14:32:29 bde Exp $
*/
/*
@@ -531,7 +531,7 @@ union_statfs(mp, sbp, p)
struct proc *)))nullop)
#define union_fhtovp ((int (*) __P((struct mount *, struct fid *, \
- struct mbuf *, struct vnode **, int *, struct ucred **)))eopnotsupp)
+ struct sockaddr *, struct vnode **, int *, struct ucred **)))eopnotsupp)
#define union_quotactl ((int (*) __P((struct mount *, int, uid_t, caddr_t, \
struct proc *)))eopnotsupp)
#define union_sysctl ((int (*) __P((int *, u_int, void *, size_t *, void *, \
diff --git a/sys/msdosfs/msdosfs_vfsops.c b/sys/msdosfs/msdosfs_vfsops.c
index 896c4f03e2a5..755c0b12329e 100644
--- a/sys/msdosfs/msdosfs_vfsops.c
+++ b/sys/msdosfs/msdosfs_vfsops.c
@@ -1,4 +1,4 @@
-/* $Id: msdosfs_vfsops.c,v 1.18 1997/03/18 19:50:10 peter Exp $ */
+/* $Id: msdosfs_vfsops.c,v 1.19 1997/03/23 03:37:06 bde Exp $ */
/* $NetBSD: msdosfs_vfsops.c,v 1.19 1994/08/21 18:44:10 ws Exp $ */
/*-
@@ -70,7 +70,7 @@
static int mountmsdosfs __P((struct vnode *devvp, struct mount *mp,
struct proc *p));
static int msdosfs_fhtovp __P((struct mount *, struct fid *,
- struct mbuf *, struct vnode **, int *,
+ struct sockaddr *, struct vnode **, int *,
struct ucred **));
static int msdosfs_mount __P((struct mount *, char *, caddr_t,
struct nameidata *, struct proc *));
@@ -732,7 +732,7 @@ static int
msdosfs_fhtovp(mp, fhp, nam, vpp, exflagsp, credanonp)
struct mount *mp;
struct fid *fhp;
- struct mbuf *nam;
+ struct sockaddr *nam;
struct vnode **vpp;
int *exflagsp;
struct ucred **credanonp;
diff --git a/sys/net/raw_usrreq.c b/sys/net/raw_usrreq.c
index ec847ed59518..08d02d590f55 100644
--- a/sys/net/raw_usrreq.c
+++ b/sys/net/raw_usrreq.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)raw_usrreq.c 8.1 (Berkeley) 6/10/93
- * $Id: raw_usrreq.c,v 1.12 1997/04/27 20:00:59 wollman Exp $
+ * $Id: raw_usrreq.c,v 1.13 1997/08/02 14:32:40 bde Exp $
*/
#include <sys/param.h>
@@ -164,13 +164,13 @@ raw_uattach(struct socket *so, int proto, struct proc *p)
}
static int
-raw_ubind(struct socket *so, struct mbuf *nam, struct proc *p)
+raw_ubind(struct socket *so, struct sockaddr *nam, struct proc *p)
{
return EINVAL;
}
static int
-raw_uconnect(struct socket *so, struct mbuf *nam, struct proc *p)
+raw_uconnect(struct socket *so, struct sockaddr *nam, struct proc *p)
{
return EINVAL;
}
@@ -208,7 +208,7 @@ raw_udisconnect(struct socket *so)
/* pru_listen is EOPNOTSUPP */
static int
-raw_upeeraddr(struct socket *so, struct mbuf *nam)
+raw_upeeraddr(struct socket *so, struct sockaddr **nam)
{
struct rawcb *rp = sotorawcb(so);
unsigned len;
@@ -218,9 +218,7 @@ raw_upeeraddr(struct socket *so, struct mbuf *nam)
if (rp->rcb_faddr == 0) {
return ENOTCONN;
}
- len = rp->rcb_faddr->sa_len;
- bcopy((caddr_t)rp->rcb_faddr, mtod(nam, caddr_t), len);
- nam->m_len = len;
+ *nam = dup_sockaddr(rp->rcb_faddr, 1);
return 0;
}
@@ -229,7 +227,7 @@ raw_upeeraddr(struct socket *so, struct mbuf *nam)
static int
raw_usend(struct socket *so, int flags, struct mbuf *m,
- struct mbuf *nam, struct mbuf *control, struct proc *p)
+ struct sockaddr *nam, struct mbuf *control, struct proc *p)
{
int error;
struct rawcb *rp = sotorawcb(so);
@@ -253,7 +251,7 @@ raw_usend(struct socket *so, int flags, struct mbuf *m,
error = EISCONN;
goto release;
}
- rp->rcb_faddr = mtod(nam, struct sockaddr *);
+ rp->rcb_faddr = nam;
} else if (rp->rcb_faddr == 0) {
error = ENOTCONN;
goto release;
@@ -282,7 +280,7 @@ raw_ushutdown(struct socket *so)
}
static int
-raw_usockaddr(struct socket *so, struct mbuf *nam)
+raw_usockaddr(struct socket *so, struct sockaddr **nam)
{
struct rawcb *rp = sotorawcb(so);
unsigned len;
@@ -291,9 +289,7 @@ raw_usockaddr(struct socket *so, struct mbuf *nam)
return EINVAL;
if (rp->rcb_laddr == 0)
return EINVAL;
- len = rp->rcb_laddr->sa_len;
- bcopy((caddr_t)rp->rcb_laddr, mtod(nam, caddr_t), len);
- nam->m_len = len;
+ *nam = dup_sockaddr(rp->rcb_laddr, 1);
return 0;
}
diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c
index a73baa041a78..48c7996f7cc1 100644
--- a/sys/net/rtsock.c
+++ b/sys/net/rtsock.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)rtsock.c 8.5 (Berkeley) 11/2/94
- * $Id: rtsock.c,v 1.30 1997/07/17 09:21:34 msmith Exp $
+ * $Id: rtsock.c,v 1.31 1997/07/18 11:44:24 julian Exp $
*/
@@ -150,7 +150,7 @@ rts_attach(struct socket *so, int proto, struct proc *p)
}
static int
-rts_bind(struct socket *so, struct mbuf *nam, struct proc *p)
+rts_bind(struct socket *so, struct sockaddr *nam, struct proc *p)
{
int s, error;
s = splnet();
@@ -160,7 +160,7 @@ rts_bind(struct socket *so, struct mbuf *nam, struct proc *p)
}
static int
-rts_connect(struct socket *so, struct mbuf *nam, struct proc *p)
+rts_connect(struct socket *so, struct sockaddr *nam, struct proc *p)
{
int s, error;
s = splnet();
@@ -214,7 +214,7 @@ rts_disconnect(struct socket *so)
/* pru_listen is EOPNOTSUPP */
static int
-rts_peeraddr(struct socket *so, struct mbuf *nam)
+rts_peeraddr(struct socket *so, struct sockaddr **nam)
{
int s, error;
s = splnet();
@@ -227,7 +227,7 @@ rts_peeraddr(struct socket *so, struct mbuf *nam)
/* pru_rcvoob is EOPNOTSUPP */
static int
-rts_send(struct socket *so, int flags, struct mbuf *m, struct mbuf *nam,
+rts_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *nam,
struct mbuf *control, struct proc *p)
{
int s, error;
@@ -250,7 +250,7 @@ rts_shutdown(struct socket *so)
}
static int
-rts_sockaddr(struct socket *so, struct mbuf *nam)
+rts_sockaddr(struct socket *so, struct sockaddr **nam)
{
int s, error;
s = splnet();
diff --git a/sys/netatalk/ddp_pcb.c b/sys/netatalk/ddp_pcb.c
index 110bda7d1fde..6d9da4b25fa4 100644
--- a/sys/netatalk/ddp_pcb.c
+++ b/sys/netatalk/ddp_pcb.c
@@ -19,11 +19,13 @@
#include <netatalk/at_extern.h>
static void at_pcbdisconnect( struct ddpcb *ddp );
-static void at_sockaddr( struct ddpcb *ddp, struct mbuf *addr );
-static int at_pcbsetaddr( struct ddpcb *ddp, struct mbuf *addr, struct proc *p);
-static int at_pcbconnect( struct ddpcb *ddp, struct mbuf *addr, struct proc *p);
-static void at_pcbdetach( struct socket *so, struct ddpcb *ddp);
-static int at_pcballoc( struct socket *so );
+static void at_sockaddr(struct ddpcb *ddp, struct sockaddr **addr);
+static int at_pcbsetaddr(struct ddpcb *ddp, struct sockaddr *addr,
+ struct proc *p);
+static int at_pcbconnect(struct ddpcb *ddp, struct sockaddr *addr,
+ struct proc *p);
+static void at_pcbdetach(struct socket *so, struct ddpcb *ddp);
+static int at_pcballoc(struct socket *so);
struct ddpcb *ddp_ports[ ATPORT_LAST ];
struct ddpcb *ddpcb = NULL;
@@ -71,7 +73,7 @@ ddp_detach(struct socket *so)
}
static int
-ddp_bind(struct socket *so, struct mbuf *nam, struct proc *p)
+ddp_bind(struct socket *so, struct sockaddr *nam, struct proc *p)
{
struct ddpcb *ddp;
int error = 0;
@@ -82,13 +84,13 @@ ddp_bind(struct socket *so, struct mbuf *nam, struct proc *p)
return( EINVAL);
}
s = splnet();
- error = at_pcbsetaddr( ddp, nam, p );
+ error = at_pcbsetaddr(ddp, nam, p);
splx(s);
return (error);
}
static int
-ddp_connect(struct socket *so, struct mbuf *nam, struct proc *p)
+ddp_connect(struct socket *so, struct sockaddr *nam, struct proc *p)
{
struct ddpcb *ddp;
int error = 0;
@@ -151,7 +153,7 @@ ddp_shutdown(struct socket *so)
}
static int
-ddp_send(struct socket *so, int flags, struct mbuf *m, struct mbuf *addr,
+ddp_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *addr,
struct mbuf *control, struct proc *p)
{
struct ddpcb *ddp;
@@ -173,7 +175,7 @@ ddp_send(struct socket *so, int flags, struct mbuf *m, struct mbuf *addr,
}
s = splnet();
- error = at_pcbconnect( ddp, addr, p );
+ error = at_pcbconnect(ddp, addr, p);
splx( s );
if ( error ) {
return(error);
@@ -212,17 +214,16 @@ ddp_abort(struct socket *so)
static void
-at_sockaddr( struct ddpcb *ddp, struct mbuf *addr)
+at_sockaddr(struct ddpcb *ddp, struct sockaddr **addr)
{
struct sockaddr_at *sat;
- addr->m_len = sizeof( struct sockaddr_at );
- sat = mtod( addr, struct sockaddr_at *);
*sat = ddp->ddp_lsat;
+ *addr = dup_sockaddr((struct sockaddr *)&ddp->ddp_lsat, 0);
}
static int
-at_pcbsetaddr( struct ddpcb *ddp, struct mbuf *addr, struct proc *p )
+at_pcbsetaddr(struct ddpcb *ddp, struct sockaddr *addr, struct proc *p)
{
struct sockaddr_at lsat, *sat;
struct at_ifaddr *aa;
@@ -232,13 +233,10 @@ at_pcbsetaddr( struct ddpcb *ddp, struct mbuf *addr, struct proc *p )
return( EINVAL );
}
- if ( addr != 0 ) { /* validate passed address */
- sat = mtod( addr, struct sockaddr_at *);
- if ( addr->m_len != sizeof( *sat )) {
- return( EINVAL );
- }
- if ( sat->sat_family != AF_APPLETALK ) {
- return( EAFNOSUPPORT );
+ if (addr != 0) { /* validate passed address */
+ sat = (struct sockaddr_at *)addr;
+ if (sat->sat_family != AF_APPLETALK) {
+ return(EAFNOSUPPORT);
}
if ( sat->sat_addr.s_node != ATADDR_ANYNODE ||
@@ -319,18 +317,16 @@ at_pcbsetaddr( struct ddpcb *ddp, struct mbuf *addr, struct proc *p )
}
static int
-at_pcbconnect( struct ddpcb *ddp, struct mbuf *addr, struct proc *p)
+at_pcbconnect(struct ddpcb *ddp, struct sockaddr *addr, struct proc *p)
{
- struct sockaddr_at *sat = mtod( addr, struct sockaddr_at *);
+ struct sockaddr_at *sat = (struct sockaddr_at *)addr;
struct route *ro;
struct at_ifaddr *aa = 0;
struct ifnet *ifp;
u_short hintnet = 0, net;
- if ( addr->m_len != sizeof( *sat ))
- return( EINVAL );
- if ( sat->sat_family != AF_APPLETALK ) {
- return( EAFNOSUPPORT );
+ if (sat->sat_family != AF_APPLETALK) {
+ return(EAFNOSUPPORT);
}
/*
@@ -410,7 +406,7 @@ at_pcbconnect( struct ddpcb *ddp, struct mbuf *addr, struct proc *p)
ddp->ddp_fsat = *sat;
if ( ddp->ddp_lsat.sat_port == ATADDR_ANYPORT ) {
- return( at_pcbsetaddr( ddp, (struct mbuf *)0, p ));
+ return(at_pcbsetaddr(ddp, (struct sockaddr *)0, p));
}
return( 0 );
}
@@ -426,25 +422,24 @@ at_pcbdisconnect( struct ddpcb *ddp )
static int
at_pcballoc( struct socket *so )
{
- struct ddpcb *ddp;
- struct mbuf *m;
-
- m = m_getclr( M_WAIT, MT_PCB );
- ddp = mtod( m, struct ddpcb * );
- ddp->ddp_lsat.sat_port = ATADDR_ANYPORT;
-
- ddp->ddp_next = ddpcb;
- ddp->ddp_prev = NULL;
- ddp->ddp_pprev = NULL;
- ddp->ddp_pnext = NULL;
- if ( ddpcb ) {
- ddpcb->ddp_prev = ddp;
- }
- ddpcb = ddp;
+ struct ddpcb *ddp;
- ddp->ddp_socket = so;
- so->so_pcb = (caddr_t)ddp;
- return( 0 );
+ MALLOC(ddp, struct ddpcb *, sizeof *ddp, M_PCB, M_WAITOK);
+ bzero(ddp, sizeof *ddp);
+ ddp->ddp_lsat.sat_port = ATADDR_ANYPORT;
+
+ ddp->ddp_next = ddpcb;
+ ddp->ddp_prev = NULL;
+ ddp->ddp_pprev = NULL;
+ ddp->ddp_pnext = NULL;
+ if (ddpcb) {
+ ddpcb->ddp_prev = ddp;
+ }
+ ddpcb = ddp;
+
+ ddp->ddp_socket = so;
+ so->so_pcb = (caddr_t)ddp;
+ return(0);
}
static void
@@ -479,8 +474,7 @@ at_pcbdetach( struct socket *so, struct ddpcb *ddp)
if ( ddp->ddp_next ) {
ddp->ddp_next->ddp_prev = ddp->ddp_prev;
}
-
- (void) m_free( dtom( ddp ));
+ FREE(ddp, M_PCB);
}
/*
@@ -535,13 +529,13 @@ ddp_search( struct sockaddr_at *from, struct sockaddr_at *to,
return( ddp );
}
static int
-at_setpeeraddr(struct socket *so, struct mbuf *nam)
+at_setpeeraddr(struct socket *so, struct sockaddr **nam)
{
return(EOPNOTSUPP);
}
static int
-at_setsockaddr(struct socket *so, struct mbuf *nam)
+at_setsockaddr(struct socket *so, struct sockaddr **nam)
{
struct ddpcb *ddp;
int error = 0;
diff --git a/sys/netatalk/ddp_usrreq.c b/sys/netatalk/ddp_usrreq.c
index 110bda7d1fde..6d9da4b25fa4 100644
--- a/sys/netatalk/ddp_usrreq.c
+++ b/sys/netatalk/ddp_usrreq.c
@@ -19,11 +19,13 @@
#include <netatalk/at_extern.h>
static void at_pcbdisconnect( struct ddpcb *ddp );
-static void at_sockaddr( struct ddpcb *ddp, struct mbuf *addr );
-static int at_pcbsetaddr( struct ddpcb *ddp, struct mbuf *addr, struct proc *p);
-static int at_pcbconnect( struct ddpcb *ddp, struct mbuf *addr, struct proc *p);
-static void at_pcbdetach( struct socket *so, struct ddpcb *ddp);
-static int at_pcballoc( struct socket *so );
+static void at_sockaddr(struct ddpcb *ddp, struct sockaddr **addr);
+static int at_pcbsetaddr(struct ddpcb *ddp, struct sockaddr *addr,
+ struct proc *p);
+static int at_pcbconnect(struct ddpcb *ddp, struct sockaddr *addr,
+ struct proc *p);
+static void at_pcbdetach(struct socket *so, struct ddpcb *ddp);
+static int at_pcballoc(struct socket *so);
struct ddpcb *ddp_ports[ ATPORT_LAST ];
struct ddpcb *ddpcb = NULL;
@@ -71,7 +73,7 @@ ddp_detach(struct socket *so)
}
static int
-ddp_bind(struct socket *so, struct mbuf *nam, struct proc *p)
+ddp_bind(struct socket *so, struct sockaddr *nam, struct proc *p)
{
struct ddpcb *ddp;
int error = 0;
@@ -82,13 +84,13 @@ ddp_bind(struct socket *so, struct mbuf *nam, struct proc *p)
return( EINVAL);
}
s = splnet();
- error = at_pcbsetaddr( ddp, nam, p );
+ error = at_pcbsetaddr(ddp, nam, p);
splx(s);
return (error);
}
static int
-ddp_connect(struct socket *so, struct mbuf *nam, struct proc *p)
+ddp_connect(struct socket *so, struct sockaddr *nam, struct proc *p)
{
struct ddpcb *ddp;
int error = 0;
@@ -151,7 +153,7 @@ ddp_shutdown(struct socket *so)
}
static int
-ddp_send(struct socket *so, int flags, struct mbuf *m, struct mbuf *addr,
+ddp_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *addr,
struct mbuf *control, struct proc *p)
{
struct ddpcb *ddp;
@@ -173,7 +175,7 @@ ddp_send(struct socket *so, int flags, struct mbuf *m, struct mbuf *addr,
}
s = splnet();
- error = at_pcbconnect( ddp, addr, p );
+ error = at_pcbconnect(ddp, addr, p);
splx( s );
if ( error ) {
return(error);
@@ -212,17 +214,16 @@ ddp_abort(struct socket *so)
static void
-at_sockaddr( struct ddpcb *ddp, struct mbuf *addr)
+at_sockaddr(struct ddpcb *ddp, struct sockaddr **addr)
{
struct sockaddr_at *sat;
- addr->m_len = sizeof( struct sockaddr_at );
- sat = mtod( addr, struct sockaddr_at *);
*sat = ddp->ddp_lsat;
+ *addr = dup_sockaddr((struct sockaddr *)&ddp->ddp_lsat, 0);
}
static int
-at_pcbsetaddr( struct ddpcb *ddp, struct mbuf *addr, struct proc *p )
+at_pcbsetaddr(struct ddpcb *ddp, struct sockaddr *addr, struct proc *p)
{
struct sockaddr_at lsat, *sat;
struct at_ifaddr *aa;
@@ -232,13 +233,10 @@ at_pcbsetaddr( struct ddpcb *ddp, struct mbuf *addr, struct proc *p )
return( EINVAL );
}
- if ( addr != 0 ) { /* validate passed address */
- sat = mtod( addr, struct sockaddr_at *);
- if ( addr->m_len != sizeof( *sat )) {
- return( EINVAL );
- }
- if ( sat->sat_family != AF_APPLETALK ) {
- return( EAFNOSUPPORT );
+ if (addr != 0) { /* validate passed address */
+ sat = (struct sockaddr_at *)addr;
+ if (sat->sat_family != AF_APPLETALK) {
+ return(EAFNOSUPPORT);
}
if ( sat->sat_addr.s_node != ATADDR_ANYNODE ||
@@ -319,18 +317,16 @@ at_pcbsetaddr( struct ddpcb *ddp, struct mbuf *addr, struct proc *p )
}
static int
-at_pcbconnect( struct ddpcb *ddp, struct mbuf *addr, struct proc *p)
+at_pcbconnect(struct ddpcb *ddp, struct sockaddr *addr, struct proc *p)
{
- struct sockaddr_at *sat = mtod( addr, struct sockaddr_at *);
+ struct sockaddr_at *sat = (struct sockaddr_at *)addr;
struct route *ro;
struct at_ifaddr *aa = 0;
struct ifnet *ifp;
u_short hintnet = 0, net;
- if ( addr->m_len != sizeof( *sat ))
- return( EINVAL );
- if ( sat->sat_family != AF_APPLETALK ) {
- return( EAFNOSUPPORT );
+ if (sat->sat_family != AF_APPLETALK) {
+ return(EAFNOSUPPORT);
}
/*
@@ -410,7 +406,7 @@ at_pcbconnect( struct ddpcb *ddp, struct mbuf *addr, struct proc *p)
ddp->ddp_fsat = *sat;
if ( ddp->ddp_lsat.sat_port == ATADDR_ANYPORT ) {
- return( at_pcbsetaddr( ddp, (struct mbuf *)0, p ));
+ return(at_pcbsetaddr(ddp, (struct sockaddr *)0, p));
}
return( 0 );
}
@@ -426,25 +422,24 @@ at_pcbdisconnect( struct ddpcb *ddp )
static int
at_pcballoc( struct socket *so )
{
- struct ddpcb *ddp;
- struct mbuf *m;
-
- m = m_getclr( M_WAIT, MT_PCB );
- ddp = mtod( m, struct ddpcb * );
- ddp->ddp_lsat.sat_port = ATADDR_ANYPORT;
-
- ddp->ddp_next = ddpcb;
- ddp->ddp_prev = NULL;
- ddp->ddp_pprev = NULL;
- ddp->ddp_pnext = NULL;
- if ( ddpcb ) {
- ddpcb->ddp_prev = ddp;
- }
- ddpcb = ddp;
+ struct ddpcb *ddp;
- ddp->ddp_socket = so;
- so->so_pcb = (caddr_t)ddp;
- return( 0 );
+ MALLOC(ddp, struct ddpcb *, sizeof *ddp, M_PCB, M_WAITOK);
+ bzero(ddp, sizeof *ddp);
+ ddp->ddp_lsat.sat_port = ATADDR_ANYPORT;
+
+ ddp->ddp_next = ddpcb;
+ ddp->ddp_prev = NULL;
+ ddp->ddp_pprev = NULL;
+ ddp->ddp_pnext = NULL;
+ if (ddpcb) {
+ ddpcb->ddp_prev = ddp;
+ }
+ ddpcb = ddp;
+
+ ddp->ddp_socket = so;
+ so->so_pcb = (caddr_t)ddp;
+ return(0);
}
static void
@@ -479,8 +474,7 @@ at_pcbdetach( struct socket *so, struct ddpcb *ddp)
if ( ddp->ddp_next ) {
ddp->ddp_next->ddp_prev = ddp->ddp_prev;
}
-
- (void) m_free( dtom( ddp ));
+ FREE(ddp, M_PCB);
}
/*
@@ -535,13 +529,13 @@ ddp_search( struct sockaddr_at *from, struct sockaddr_at *to,
return( ddp );
}
static int
-at_setpeeraddr(struct socket *so, struct mbuf *nam)
+at_setpeeraddr(struct socket *so, struct sockaddr **nam)
{
return(EOPNOTSUPP);
}
static int
-at_setsockaddr(struct socket *so, struct mbuf *nam)
+at_setsockaddr(struct socket *so, struct sockaddr **nam)
{
struct ddpcb *ddp;
int error = 0;
diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c
index 95409fc639dc..77ff62d6ce3f 100644
--- a/sys/netinet/in_pcb.c
+++ b/sys/netinet/in_pcb.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)in_pcb.c 8.4 (Berkeley) 5/24/95
- * $Id: in_pcb.c,v 1.32 1997/05/19 00:18:30 tegge Exp $
+ * $Id: in_pcb.c,v 1.33 1997/05/19 01:28:39 tegge Exp $
*/
#include <sys/param.h>
@@ -138,7 +138,7 @@ in_pcballoc(so, pcbinfo, p)
int
in_pcbbind(inp, nam, p)
register struct inpcb *inp;
- struct mbuf *nam;
+ struct sockaddr *nam;
struct proc *p;
{
register struct socket *so = inp->inp_socket;
@@ -157,8 +157,8 @@ in_pcbbind(inp, nam, p)
(so->so_options & SO_ACCEPTCONN) == 0))
wild = 1;
if (nam) {
- sin = mtod(nam, struct sockaddr_in *);
- if (nam->m_len != sizeof (*sin))
+ sin = (struct sockaddr_in *)nam;
+ if (nam->sa_len != sizeof (*sin))
return (EINVAL);
#ifdef notdef
/*
@@ -188,7 +188,7 @@ in_pcbbind(inp, nam, p)
struct inpcb *t;
/* GROSS */
- if (ntohs(lport) < IPPORT_RESERVED &&
+ if (ntohs(lport) < IPPORT_RESERVED && p &&
(error = suser(p->p_ucred, &p->p_acflag)))
return (EACCES);
t = in_pcblookup(inp->inp_pcbinfo, zeroin_addr, 0,
@@ -209,7 +209,7 @@ in_pcbbind(inp, nam, p)
last = ipport_hilastauto;
lastport = &inp->inp_pcbinfo->lasthi;
} else if (inp->inp_flags & INP_LOWPORT) {
- if (error = suser(p->p_ucred, &p->p_acflag))
+ if (p && (error = suser(p->p_ucred, &p->p_acflag)))
return error;
first = ipport_lowfirstauto; /* 1023 */
last = ipport_lowlastauto; /* 600 */
@@ -278,13 +278,13 @@ in_pcbbind(inp, nam, p)
int
in_pcbladdr(inp, nam, plocal_sin)
register struct inpcb *inp;
- struct mbuf *nam;
+ struct sockaddr *nam;
struct sockaddr_in **plocal_sin;
{
struct in_ifaddr *ia;
- register struct sockaddr_in *sin = mtod(nam, struct sockaddr_in *);
+ register struct sockaddr_in *sin = (struct sockaddr_in *)nam;
- if (nam->m_len != sizeof (*sin))
+ if (nam->sa_len != sizeof (*sin))
return (EINVAL);
if (sin->sin_family != AF_INET)
return (EAFNOSUPPORT);
@@ -395,11 +395,11 @@ in_pcbladdr(inp, nam, plocal_sin)
int
in_pcbconnect(inp, nam, p)
register struct inpcb *inp;
- struct mbuf *nam;
+ struct sockaddr *nam;
struct proc *p;
{
struct sockaddr_in *ifaddr;
- register struct sockaddr_in *sin = mtod(nam, struct sockaddr_in *);
+ register struct sockaddr_in *sin = (struct sockaddr_in *)nam;
int error;
/*
@@ -414,7 +414,7 @@ in_pcbconnect(inp, nam, p)
return (EADDRINUSE);
if (inp->inp_laddr.s_addr == INADDR_ANY) {
if (inp->inp_lport == 0)
- (void)in_pcbbind(inp, (struct mbuf *)0, p);
+ (void)in_pcbbind(inp, (struct sockaddr *)0, p);
inp->inp_laddr = ifaddr->sin_addr;
}
inp->inp_faddr = sin->sin_addr;
@@ -463,12 +463,13 @@ in_pcbdetach(inp)
* without the need for a wrapper function. The socket must have a valid
* (i.e., non-nil) PCB, but it should be impossible to get an invalid one
* except through a kernel programming error, so it is acceptable to panic
- * (or in this case trap) if the PCB is invalid.
+ * (or in this case trap) if the PCB is invalid. (Actually, we don't trap
+ * because there actually /is/ a programming error somewhere... XXX)
*/
int
in_setsockaddr(so, nam)
struct socket *so;
- struct mbuf *nam;
+ struct sockaddr **nam;
{
int s;
register struct inpcb *inp;
@@ -480,9 +481,9 @@ in_setsockaddr(so, nam)
splx(s);
return EINVAL;
}
- nam->m_len = sizeof (*sin);
- sin = mtod(nam, struct sockaddr_in *);
- bzero((caddr_t)sin, sizeof (*sin));
+ MALLOC(sin, struct sockaddr_in *, sizeof *sin, M_SONAME, M_WAITOK);
+ *nam = (struct sockaddr *)sin;
+ bzero(sin, sizeof *sin);
sin->sin_family = AF_INET;
sin->sin_len = sizeof(*sin);
sin->sin_port = inp->inp_lport;
@@ -494,7 +495,7 @@ in_setsockaddr(so, nam)
int
in_setpeeraddr(so, nam)
struct socket *so;
- struct mbuf *nam;
+ struct sockaddr **nam;
{
int s;
struct inpcb *inp;
@@ -506,8 +507,8 @@ in_setpeeraddr(so, nam)
splx(s);
return EINVAL;
}
- nam->m_len = sizeof (*sin);
- sin = mtod(nam, struct sockaddr_in *);
+ MALLOC(sin, struct sockaddr_in *, sizeof *sin, M_SONAME, M_WAITOK);
+ *nam = (struct sockaddr *)sin;
bzero((caddr_t)sin, sizeof (*sin));
sin->sin_family = AF_INET;
sin->sin_len = sizeof(*sin);
diff --git a/sys/netinet/in_pcb.h b/sys/netinet/in_pcb.h
index 6d6cdc63918d..18e40e9a259e 100644
--- a/sys/netinet/in_pcb.h
+++ b/sys/netinet/in_pcb.h
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)in_pcb.h 8.1 (Berkeley) 6/10/93
- * $Id: in_pcb.h,v 1.20 1997/04/03 05:14:41 davidg Exp $
+ * $Id: in_pcb.h,v 1.21 1997/04/27 20:01:04 wollman Exp $
*/
#ifndef _NETINET_IN_PCB_H_
@@ -92,6 +92,7 @@ struct inpcbinfo {
#define INP_LOWPORT 0x20 /* user wants "low" port binding */
#define INP_ANONPORT 0x40 /* port chosen for user */
#define INP_RECVIF 0x80 /* receive incoming interface */
+#define INP_MTUDISC 0x100 /* user can do MTU discovery */
#define INP_CONTROLOPTS (INP_RECVOPTS|INP_RECVRETOPTS|INP_RECVDSTADDR|\
INP_RECVIF)
@@ -102,11 +103,11 @@ struct inpcbinfo {
#ifdef KERNEL
void in_losing __P((struct inpcb *));
int in_pcballoc __P((struct socket *, struct inpcbinfo *, struct proc *));
-int in_pcbbind __P((struct inpcb *, struct mbuf *, struct proc *));
-int in_pcbconnect __P((struct inpcb *, struct mbuf *, struct proc *));
+int in_pcbbind __P((struct inpcb *, struct sockaddr *, struct proc *));
+int in_pcbconnect __P((struct inpcb *, struct sockaddr *, struct proc *));
void in_pcbdetach __P((struct inpcb *));
void in_pcbdisconnect __P((struct inpcb *));
-int in_pcbladdr __P((struct inpcb *, struct mbuf *,
+int in_pcbladdr __P((struct inpcb *, struct sockaddr *,
struct sockaddr_in **));
struct inpcb *
in_pcblookup __P((struct inpcbinfo *,
@@ -117,8 +118,8 @@ struct inpcb *
void in_pcbnotify __P((struct inpcbhead *, struct sockaddr *,
u_int, struct in_addr, u_int, int, void (*)(struct inpcb *, int)));
void in_pcbrehash __P((struct inpcb *));
-int in_setpeeraddr __P((struct socket *so, struct mbuf *nam));
-int in_setsockaddr __P((struct socket *so, struct mbuf *nam));
+int in_setpeeraddr __P((struct socket *so, struct sockaddr **nam));
+int in_setsockaddr __P((struct socket *so, struct sockaddr **nam));
#endif
#endif
diff --git a/sys/netinet/raw_ip.c b/sys/netinet/raw_ip.c
index b5b3c7daecb4..0afd76402244 100644
--- a/sys/netinet/raw_ip.c
+++ b/sys/netinet/raw_ip.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)raw_ip.c 8.7 (Berkeley) 5/15/95
- * $Id: raw_ip.c,v 1.46 1997/05/22 20:52:56 fenner Exp $
+ * $Id: raw_ip.c,v 1.47 1997/08/02 14:32:54 bde Exp $
*/
#include <sys/param.h>
@@ -440,12 +440,12 @@ rip_disconnect(struct socket *so)
}
static int
-rip_bind(struct socket *so, struct mbuf *nam, struct proc *p)
+rip_bind(struct socket *so, struct sockaddr *nam, struct proc *p)
{
struct inpcb *inp = sotoinpcb(so);
- struct sockaddr_in *addr = mtod(nam, struct sockaddr_in *);
+ struct sockaddr_in *addr = (struct sockaddr_in *)nam;
- if (nam->m_len != sizeof(*addr))
+ if (nam->sa_len != sizeof(*addr))
return EINVAL;
if (TAILQ_EMPTY(&ifnet) || ((addr->sin_family != AF_INET) &&
@@ -458,12 +458,12 @@ rip_bind(struct socket *so, struct mbuf *nam, struct proc *p)
}
static int
-rip_connect(struct socket *so, struct mbuf *nam, struct proc *p)
+rip_connect(struct socket *so, struct sockaddr *nam, struct proc *p)
{
struct inpcb *inp = sotoinpcb(so);
- struct sockaddr_in *addr = mtod(nam, struct sockaddr_in *);
+ struct sockaddr_in *addr = (struct sockaddr_in *)nam;
- if (nam->m_len != sizeof(*addr))
+ if (nam->sa_len != sizeof(*addr))
return EINVAL;
if (TAILQ_EMPTY(&ifnet))
return EADDRNOTAVAIL;
@@ -483,7 +483,7 @@ rip_shutdown(struct socket *so)
}
static int
-rip_send(struct socket *so, int flags, struct mbuf *m, struct mbuf *nam,
+rip_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *nam,
struct mbuf *control, struct proc *p)
{
struct inpcb *inp = sotoinpcb(so);
@@ -500,7 +500,7 @@ rip_send(struct socket *so, int flags, struct mbuf *m, struct mbuf *nam,
m_freem(m);
return ENOTCONN;
}
- dst = mtod(nam, struct sockaddr_in *)->sin_addr.s_addr;
+ dst = ((struct sockaddr_in *)nam)->sin_addr.s_addr;
}
return rip_output(m, so, dst);
}
diff --git a/sys/netinet/tcp_fsm.h b/sys/netinet/tcp_fsm.h
index 3f2c12f54fe2..804a55e1a6d8 100644
--- a/sys/netinet/tcp_fsm.h
+++ b/sys/netinet/tcp_fsm.h
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)tcp_fsm.h 8.1 (Berkeley) 6/10/93
- * $Id$
+ * $Id: tcp_fsm.h,v 1.9 1997/02/22 09:41:39 peter Exp $
*/
#ifndef _NETINET_TCP_FSM_H_
@@ -73,7 +73,7 @@
static u_char tcp_outflags[TCP_NSTATES] = {
TH_RST|TH_ACK, 0, TH_SYN, TH_SYN|TH_ACK,
TH_ACK, TH_ACK,
- TH_FIN|TH_ACK, TH_FIN|TH_ACK, TH_FIN|TH_ACK, TH_ACK, TH_ACK,
+ TH_FIN|TH_ACK, TH_ACK, TH_FIN|TH_ACK, TH_ACK, TH_ACK,
};
#endif
diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c
index 33e9b60a44e9..14f0754fadd2 100644
--- a/sys/netinet/tcp_input.c
+++ b/sys/netinet/tcp_input.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)tcp_input.c 8.12 (Berkeley) 5/24/95
- * $Id: tcp_input.c,v 1.58 1997/04/27 20:01:13 wollman Exp $
+ * $Id: tcp_input.c,v 1.59 1997/07/01 05:42:16 jdp Exp $
*/
#ifndef TUBA_INCLUDE
@@ -640,11 +640,10 @@ findpcb:
if (m->m_flags & (M_BCAST|M_MCAST) ||
IN_MULTICAST(ntohl(ti->ti_dst.s_addr)))
goto drop;
- am = m_get(M_DONTWAIT, MT_SONAME); /* XXX */
- if (am == NULL)
+ MALLOC(sin, struct sockaddr_in *, sizeof *sin, M_SONAME,
+ M_NOWAIT);
+ if (sin == NULL)
goto drop;
- am->m_len = sizeof (struct sockaddr_in);
- sin = mtod(am, struct sockaddr_in *);
sin->sin_family = AF_INET;
sin->sin_len = sizeof(*sin);
sin->sin_addr = ti->ti_src;
@@ -653,12 +652,12 @@ findpcb:
laddr = inp->inp_laddr;
if (inp->inp_laddr.s_addr == INADDR_ANY)
inp->inp_laddr = ti->ti_dst;
- if (in_pcbconnect(inp, am, &proc0)) { /* XXX creds */
+ if (in_pcbconnect(inp, (struct sockaddr *)sin, &proc0)) {
inp->inp_laddr = laddr;
- (void) m_free(am);
+ FREE(sin, M_SONAME);
goto drop;
}
- (void) m_free(am);
+ FREE(sin, M_SONAME);
tp->t_template = tcp_template(tp);
if (tp->t_template == 0) {
tp = tcp_drop(tp, ENOBUFS);
diff --git a/sys/netinet/tcp_reass.c b/sys/netinet/tcp_reass.c
index 33e9b60a44e9..14f0754fadd2 100644
--- a/sys/netinet/tcp_reass.c
+++ b/sys/netinet/tcp_reass.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)tcp_input.c 8.12 (Berkeley) 5/24/95
- * $Id: tcp_input.c,v 1.58 1997/04/27 20:01:13 wollman Exp $
+ * $Id: tcp_input.c,v 1.59 1997/07/01 05:42:16 jdp Exp $
*/
#ifndef TUBA_INCLUDE
@@ -640,11 +640,10 @@ findpcb:
if (m->m_flags & (M_BCAST|M_MCAST) ||
IN_MULTICAST(ntohl(ti->ti_dst.s_addr)))
goto drop;
- am = m_get(M_DONTWAIT, MT_SONAME); /* XXX */
- if (am == NULL)
+ MALLOC(sin, struct sockaddr_in *, sizeof *sin, M_SONAME,
+ M_NOWAIT);
+ if (sin == NULL)
goto drop;
- am->m_len = sizeof (struct sockaddr_in);
- sin = mtod(am, struct sockaddr_in *);
sin->sin_family = AF_INET;
sin->sin_len = sizeof(*sin);
sin->sin_addr = ti->ti_src;
@@ -653,12 +652,12 @@ findpcb:
laddr = inp->inp_laddr;
if (inp->inp_laddr.s_addr == INADDR_ANY)
inp->inp_laddr = ti->ti_dst;
- if (in_pcbconnect(inp, am, &proc0)) { /* XXX creds */
+ if (in_pcbconnect(inp, (struct sockaddr *)sin, &proc0)) {
inp->inp_laddr = laddr;
- (void) m_free(am);
+ FREE(sin, M_SONAME);
goto drop;
}
- (void) m_free(am);
+ FREE(sin, M_SONAME);
tp->t_template = tcp_template(tp);
if (tp->t_template == 0) {
tp = tcp_drop(tp, ENOBUFS);
diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c
index 36256fd87af6..ab2f3b680822 100644
--- a/sys/netinet/tcp_usrreq.c
+++ b/sys/netinet/tcp_usrreq.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* From: @(#)tcp_usrreq.c 8.2 (Berkeley) 1/3/94
- * $Id: tcp_usrreq.c,v 1.31 1997/04/27 20:01:14 wollman Exp $
+ * $Id: tcp_usrreq.c,v 1.32 1997/08/02 14:32:58 bde Exp $
*/
#include <sys/param.h>
@@ -67,7 +67,7 @@
extern char *tcpstates[]; /* XXX ??? */
static int tcp_attach __P((struct socket *, struct proc *));
-static int tcp_connect __P((struct tcpcb *, struct mbuf *,
+static int tcp_connect __P((struct tcpcb *, struct sockaddr *,
struct proc *));
static struct tcpcb *
tcp_disconnect __P((struct tcpcb *));
@@ -139,10 +139,7 @@ tcp_usr_detach(struct socket *so)
}
tp = intotcpcb(inp);
TCPDEBUG1();
- if (tp->t_state > TCPS_LISTEN)
- tp = tcp_disconnect(tp);
- else
- tp = tcp_close(tp);
+ tp = tcp_disconnect(tp);
TCPDEBUG2(PRU_DETACH);
splx(s);
@@ -166,7 +163,7 @@ tcp_usr_detach(struct socket *so)
* Give the socket an address.
*/
static int
-tcp_usr_bind(struct socket *so, struct mbuf *nam, struct proc *p)
+tcp_usr_bind(struct socket *so, struct sockaddr *nam, struct proc *p)
{
int s = splnet();
int error = 0;
@@ -180,7 +177,7 @@ tcp_usr_bind(struct socket *so, struct mbuf *nam, struct proc *p)
* Must check for multicast addresses and disallow binding
* to them.
*/
- sinp = mtod(nam, struct sockaddr_in *);
+ sinp = (struct sockaddr_in *)nam;
if (sinp->sin_family == AF_INET &&
IN_MULTICAST(ntohl(sinp->sin_addr.s_addr))) {
error = EAFNOSUPPORT;
@@ -206,7 +203,7 @@ tcp_usr_listen(struct socket *so, struct proc *p)
COMMON_START();
if (inp->inp_lport == 0)
- error = in_pcbbind(inp, (struct mbuf *)0, p);
+ error = in_pcbbind(inp, (struct sockaddr *)0, p);
if (error == 0)
tp->t_state = TCPS_LISTEN;
COMMON_END(PRU_LISTEN);
@@ -220,7 +217,7 @@ tcp_usr_listen(struct socket *so, struct proc *p)
* Send initial segment on connection.
*/
static int
-tcp_usr_connect(struct socket *so, struct mbuf *nam, struct proc *p)
+tcp_usr_connect(struct socket *so, struct sockaddr *nam, struct proc *p)
{
int s = splnet();
int error = 0;
@@ -233,7 +230,7 @@ tcp_usr_connect(struct socket *so, struct mbuf *nam, struct proc *p)
/*
* Must disallow TCP ``connections'' to multicast addresses.
*/
- sinp = mtod(nam, struct sockaddr_in *);
+ sinp = (struct sockaddr_in *)nam;
if (sinp->sin_family == AF_INET
&& IN_MULTICAST(ntohl(sinp->sin_addr.s_addr))) {
error = EAFNOSUPPORT;
@@ -276,7 +273,7 @@ tcp_usr_disconnect(struct socket *so)
* of the peer, storing through addr.
*/
static int
-tcp_usr_accept(struct socket *so, struct mbuf *nam)
+tcp_usr_accept(struct socket *so, struct sockaddr **nam)
{
int s = splnet();
int error = 0;
@@ -328,8 +325,8 @@ tcp_usr_rcvd(struct socket *so, int flags)
* marker if URG set. Possibly send more data.
*/
static int
-tcp_usr_send(struct socket *so, int flags, struct mbuf *m, struct mbuf *nam,
- struct mbuf *control, struct proc *p)
+tcp_usr_send(struct socket *so, int flags, struct mbuf *m,
+ struct sockaddr *nam, struct mbuf *control, struct proc *p)
{
int s = splnet();
int error = 0;
@@ -475,20 +472,20 @@ struct pr_usrreqs tcp_usrreqs = {
static int
tcp_connect(tp, nam, p)
register struct tcpcb *tp;
- struct mbuf *nam;
+ struct sockaddr *nam;
struct proc *p;
{
struct inpcb *inp = tp->t_inpcb, *oinp;
struct socket *so = inp->inp_socket;
struct tcpcb *otp;
- struct sockaddr_in *sin = mtod(nam, struct sockaddr_in *);
+ struct sockaddr_in *sin = (struct sockaddr_in *)nam;
struct sockaddr_in *ifaddr;
int error;
struct rmxp_tao *taop;
struct rmxp_tao tao_noncached;
if (inp->inp_lport == 0) {
- error = in_pcbbind(inp, (struct mbuf *)0, p);
+ error = in_pcbbind(inp, (struct sockaddr *)0, p);
if (error)
return error;
}
diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c
index 108bea5025d1..22b24501b2a3 100644
--- a/sys/netinet/udp_usrreq.c
+++ b/sys/netinet/udp_usrreq.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)udp_usrreq.c 8.6 (Berkeley) 5/23/95
- * $Id: udp_usrreq.c,v 1.37 1997/04/03 05:14:45 davidg Exp $
+ * $Id: udp_usrreq.c,v 1.38 1997/04/27 20:01:16 wollman Exp $
*/
#include <sys/param.h>
@@ -90,7 +90,7 @@ SYSCTL_STRUCT(_net_inet_udp, UDPCTL_STATS, stats, CTLFLAG_RD,
static struct sockaddr_in udp_in = { sizeof(udp_in), AF_INET };
-static int udp_output __P((struct inpcb *, struct mbuf *, struct mbuf *,
+static int udp_output __P((struct inpcb *, struct mbuf *, struct sockaddr *,
struct mbuf *, struct proc *));
static void udp_notify __P((struct inpcb *, int));
@@ -363,7 +363,8 @@ static int
udp_output(inp, m, addr, control, p)
register struct inpcb *inp;
register struct mbuf *m;
- struct mbuf *addr, *control;
+ struct sockaddr *addr;
+ struct mbuf *control;
struct proc *p;
{
register struct udpiphdr *ui;
@@ -445,7 +446,7 @@ udp_output(inp, m, addr, control, p)
if (addr) {
in_pcbdisconnect(inp);
- inp->inp_laddr = laddr;
+ inp->inp_laddr = laddr; /* XXX rehash? */
splx(s);
}
return (error);
@@ -503,7 +504,7 @@ udp_attach(struct socket *so, int proto, struct proc *p)
}
static int
-udp_bind(struct socket *so, struct mbuf *nam, struct proc *p)
+udp_bind(struct socket *so, struct sockaddr *nam, struct proc *p)
{
struct inpcb *inp;
int s, error;
@@ -518,7 +519,7 @@ udp_bind(struct socket *so, struct mbuf *nam, struct proc *p)
}
static int
-udp_connect(struct socket *so, struct mbuf *nam, struct proc *p)
+udp_connect(struct socket *so, struct sockaddr *nam, struct proc *p)
{
struct inpcb *inp;
int s, error;
@@ -572,7 +573,7 @@ udp_disconnect(struct socket *so)
}
static int
-udp_send(struct socket *so, int flags, struct mbuf *m, struct mbuf *addr,
+udp_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *addr,
struct mbuf *control, struct proc *p)
{
struct inpcb *inp;
diff --git a/sys/netinet/udp_var.h b/sys/netinet/udp_var.h
index c9f22f5a4255..4227219c4ade 100644
--- a/sys/netinet/udp_var.h
+++ b/sys/netinet/udp_var.h
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)udp_var.h 8.1 (Berkeley) 6/10/93
- * $Id$
+ * $Id: udp_var.h,v 1.12 1997/02/22 09:41:44 peter Exp $
*/
#ifndef _NETINET_UDP_VAR_H_
@@ -56,6 +56,16 @@ struct udpiphdr {
#define ui_ulen ui_u.uh_ulen
#define ui_sum ui_u.uh_sum
+struct udpcb {
+ /* XXX - these should be by reference so we can do options quickly */
+ struct ip udb_ip;
+ struct udphdr udb_uh;
+ struct sockaddr_in udb_conn;
+ struct in_hostcache *udb_hc;
+ struct mbuf *udb_queue;
+};
+#define inptoudpcb(inp) ((struct udpdb *)(inp)->inp_ppcb)
+
struct udpstat {
/* input statistics: */
u_long udps_ipackets; /* total input packets */
@@ -69,6 +79,7 @@ struct udpstat {
u_long udpps_pcbhashmiss; /* input packets not for hashed pcb */
/* output statistics: */
u_long udps_opackets; /* total output packets */
+ u_long udps_fastout; /* output packets on fast path */
};
/*
diff --git a/sys/netipx/ipx_pcb.c b/sys/netipx/ipx_pcb.c
index e0a66f7362cd..483bab3b2edb 100644
--- a/sys/netipx/ipx_pcb.c
+++ b/sys/netipx/ipx_pcb.c
@@ -33,7 +33,7 @@
*
* @(#)ipx_pcb.c
*
- * $Id: ipx_pcb.c,v 1.9 1997/05/10 09:58:54 jhay Exp $
+ * $Id: ipx_pcb.c,v 1.10 1997/06/26 19:35:53 jhay Exp $
*/
#include <sys/param.h>
@@ -59,13 +59,12 @@ ipx_pcballoc(so, head, p)
struct ipxpcb *head;
struct proc *p;
{
- struct mbuf *m;
register struct ipxpcb *ipxp;
- m = m_getclr(M_DONTWAIT, MT_PCB);
- if (m == NULL)
+ MALLOC(ipxp, struct ipxpcb *, sizeof *ipxp, M_PCB, M_NOWAIT);
+ if (ipxp == NULL)
return (ENOBUFS);
- ipxp = mtod(m, struct ipxpcb *);
+ bzero(ipxp, sizeof *ipxp);
ipxp->ipxp_socket = so;
insque(ipxp, head);
so->so_pcb = (caddr_t)ipxp;
@@ -75,7 +74,7 @@ ipx_pcballoc(so, head, p)
int
ipx_pcbbind(ipxp, nam, p)
register struct ipxpcb *ipxp;
- struct mbuf *nam;
+ struct sockaddr *nam;
struct proc *p;
{
register struct sockaddr_ipx *sipx;
@@ -85,9 +84,7 @@ ipx_pcbbind(ipxp, nam, p)
return (EINVAL);
if (nam == NULL)
goto noname;
- sipx = mtod(nam, struct sockaddr_ipx *);
- if (nam->m_len != sizeof(*sipx))
- return (EINVAL);
+ sipx = (struct sockaddr_ipx *)nam;
if (!ipx_nullhost(sipx->sipx_addr)) {
int tport = sipx->sipx_port;
@@ -130,19 +127,17 @@ noname:
int
ipx_pcbconnect(ipxp, nam, p)
struct ipxpcb *ipxp;
- struct mbuf *nam;
+ struct sockaddr *nam;
struct proc *p;
{
struct ipx_ifaddr *ia;
- register struct sockaddr_ipx *sipx = mtod(nam, struct sockaddr_ipx *);
+ register struct sockaddr_ipx *sipx = (struct sockaddr_ipx *)nam;
register struct ipx_addr *dst;
register struct route *ro;
struct ifnet *ifp;
ia = NULL;
- if (nam->m_len != sizeof(*sipx))
- return (EINVAL);
if (sipx->sipx_family != AF_IPX)
return (EAFNOSUPPORT);
if (sipx->sipx_port == 0 || ipx_nullhost(sipx->sipx_addr))
@@ -248,7 +243,7 @@ ipx_pcbconnect(ipxp, nam, p)
if (ipx_pcblookup(&sipx->sipx_addr, ipxp->ipxp_lport, 0))
return (EADDRINUSE);
if (ipxp->ipxp_lport == 0)
- ipx_pcbbind(ipxp, (struct mbuf *)NULL, p);
+ ipx_pcbbind(ipxp, (struct sockaddr *)NULL, p);
/* XXX just leave it zero if we can't find a route */
@@ -278,37 +273,37 @@ ipx_pcbdetach(ipxp)
if (ipxp->ipxp_route.ro_rt != NULL)
rtfree(ipxp->ipxp_route.ro_rt);
remque(ipxp);
- m_free(dtom(ipxp));
+ FREE(ipxp, M_PCB);
}
void
ipx_setsockaddr(ipxp, nam)
register struct ipxpcb *ipxp;
- struct mbuf *nam;
+ struct sockaddr **nam;
{
- register struct sockaddr_ipx *sipx = mtod(nam, struct sockaddr_ipx *);
+ struct sockaddr_ipx *sipx, ssipx;
- nam->m_len = sizeof(*sipx);
- sipx = mtod(nam, struct sockaddr_ipx *);
+ sipx = &ssipx;
bzero((caddr_t)sipx, sizeof(*sipx));
sipx->sipx_len = sizeof(*sipx);
sipx->sipx_family = AF_IPX;
sipx->sipx_addr = ipxp->ipxp_laddr;
+ *nam = dup_sockaddr((struct sockaddr *)sipx, 0);
}
void
ipx_setpeeraddr(ipxp, nam)
register struct ipxpcb *ipxp;
- struct mbuf *nam;
+ struct sockaddr **nam;
{
- register struct sockaddr_ipx *sipx = mtod(nam, struct sockaddr_ipx *);
+ struct sockaddr_ipx *sipx, ssipx;
- nam->m_len = sizeof(*sipx);
- sipx = mtod(nam, struct sockaddr_ipx *);
+ sipx = &ssipx;
bzero((caddr_t)sipx, sizeof(*sipx));
sipx->sipx_len = sizeof(*sipx);
sipx->sipx_family = AF_IPX;
sipx->sipx_addr = ipxp->ipxp_faddr;
+ *nam = dup_sockaddr((struct sockaddr *)sipx, 0);
}
/*
diff --git a/sys/netipx/ipx_pcb.h b/sys/netipx/ipx_pcb.h
index be13c1a3551c..3f03602dcfc8 100644
--- a/sys/netipx/ipx_pcb.h
+++ b/sys/netipx/ipx_pcb.h
@@ -33,7 +33,7 @@
*
* @(#)ipx_pcb.h
*
- * $Id: ipx_pcb.h,v 1.10 1997/05/10 09:58:54 jhay Exp $
+ * $Id: ipx_pcb.h,v 1.11 1997/06/26 19:35:54 jhay Exp $
*/
#ifndef _NETIPX_IPX_PCB_H_
@@ -83,9 +83,9 @@ extern struct ipxpcb ipxpcb; /* head of list */
int ipx_pcballoc __P((struct socket *so, struct ipxpcb *head,
struct proc *p));
-int ipx_pcbbind __P((struct ipxpcb *ipxp, struct mbuf *nam,
+int ipx_pcbbind __P((struct ipxpcb *ipxp, struct sockaddr *nam,
struct proc *p));
-int ipx_pcbconnect __P((struct ipxpcb *ipxp, struct mbuf *nam,
+int ipx_pcbconnect __P((struct ipxpcb *ipxp, struct sockaddr *nam,
struct proc *p));
void ipx_pcbdetach __P((struct ipxpcb *ipxp));
void ipx_pcbdisconnect __P((struct ipxpcb *ipxp));
@@ -93,8 +93,8 @@ struct ipxpcb *
ipx_pcblookup __P((struct ipx_addr *faddr, int lport, int wildp));
void ipx_pcbnotify __P((struct ipx_addr *dst, int errno,
void (*notify)(struct ipxpcb *), long param));
-void ipx_setpeeraddr __P((struct ipxpcb *ipxp, struct mbuf *nam));
-void ipx_setsockaddr __P((struct ipxpcb *ipxp, struct mbuf *nam));
+void ipx_setpeeraddr __P((struct ipxpcb *ipxp, struct sockaddr **nam));
+void ipx_setsockaddr __P((struct ipxpcb *ipxp, struct sockaddr **nam));
#endif /* KERNEL */
#endif /* !_NETIPX_IPX_PCB_H_ */
diff --git a/sys/netipx/ipx_usrreq.c b/sys/netipx/ipx_usrreq.c
index d266310299b5..afc42106ae19 100644
--- a/sys/netipx/ipx_usrreq.c
+++ b/sys/netipx/ipx_usrreq.c
@@ -33,7 +33,7 @@
*
* @(#)ipx_usrreq.c
*
- * $Id: ipx_usrreq.c,v 1.14 1997/05/10 09:58:55 jhay Exp $
+ * $Id: ipx_usrreq.c,v 1.15 1997/06/26 19:35:58 jhay Exp $
*/
#include <sys/param.h>
@@ -70,12 +70,14 @@ SYSCTL_INT(_net_ipx_ipx, OID_AUTO, ipxrecvspace, CTLFLAG_RW,
static int ipx_usr_abort(struct socket *so);
static int ipx_attach(struct socket *so, int proto, struct proc *p);
-static int ipx_bind(struct socket *so, struct mbuf *nam, struct proc *p);
-static int ipx_connect(struct socket *so, struct mbuf *nam, struct proc *p);
+static int ipx_bind(struct socket *so, struct sockaddr *nam, struct proc *p);
+static int ipx_connect(struct socket *so, struct sockaddr *nam,
+ struct proc *p);
static int ipx_detach(struct socket *so);
static int ipx_disconnect(struct socket *so);
static int ipx_send(struct socket *so, int flags, struct mbuf *m,
- struct mbuf *addr, struct mbuf *control, struct proc *p);
+ struct sockaddr *addr, struct mbuf *control,
+ struct proc *p);
static int ipx_shutdown(struct socket *so);
static int ripx_attach(struct socket *so, int proto, struct proc *p);
static int ipx_output(struct ipxpcb *ipxp, struct mbuf *m0);
@@ -458,7 +460,7 @@ ipx_attach(so, proto, p)
static int
ipx_bind(so, nam, p)
struct socket *so;
- struct mbuf *nam;
+ struct sockaddr *nam;
struct proc *p;
{
struct ipxpcb *ipxp = sotoipxpcb(so);
@@ -469,7 +471,7 @@ ipx_bind(so, nam, p)
static int
ipx_connect(so, nam, p)
struct socket *so;
- struct mbuf *nam;
+ struct sockaddr *nam;
struct proc *p;
{
int error;
@@ -520,11 +522,11 @@ ipx_disconnect(so)
int
ipx_peeraddr(so, nam)
struct socket *so;
- struct mbuf *nam;
+ struct sockaddr **nam;
{
struct ipxpcb *ipxp = sotoipxpcb(so);
- ipx_setpeeraddr(ipxp, nam);
+ ipx_setpeeraddr(ipxp, nam); /* XXX what if alloc fails? */
return (0);
}
@@ -533,7 +535,7 @@ ipx_send(so, flags, m, nam, control, p)
struct socket *so;
int flags;
struct mbuf *m;
- struct mbuf *nam;
+ struct sockaddr *nam;
struct mbuf *control;
struct proc *p;
{
@@ -589,11 +591,11 @@ ipx_shutdown(so)
int
ipx_sockaddr(so, nam)
struct socket *so;
- struct mbuf *nam;
+ struct sockaddr **nam;
{
struct ipxpcb *ipxp = sotoipxpcb(so);
- ipx_setsockaddr(ipxp, nam);
+ ipx_setsockaddr(ipxp, nam); /* XXX what if alloc fails? */
return (0);
}
diff --git a/sys/netipx/ipx_var.h b/sys/netipx/ipx_var.h
index 6ee157985973..7e6731f18d7a 100644
--- a/sys/netipx/ipx_var.h
+++ b/sys/netipx/ipx_var.h
@@ -33,7 +33,7 @@
*
* @(#)ipx_var.h
*
- * $Id: ipx_var.h,v 1.6 1997/05/10 09:58:55 jhay Exp $
+ * $Id: ipx_var.h,v 1.7 1997/06/26 19:35:59 jhay Exp $
*/
#ifndef _NETIPX_IPX_VAR_H_
@@ -92,9 +92,9 @@ void ipx_input __P((struct mbuf *m, struct ipxpcb *ipxp));
void ipxintr __P((void));
int ipx_outputfl __P((struct mbuf *m0, struct route *ro, int flags));
int ipx_output_type20 __P((struct mbuf *));
-int ipx_peeraddr __P((struct socket *so, struct mbuf *nam));
+int ipx_peeraddr __P((struct socket *so, struct sockaddr **nam));
void ipx_printhost __P((struct ipx_addr *addr));
-int ipx_sockaddr __P((struct socket *so, struct mbuf *nam));
+int ipx_sockaddr __P((struct socket *so, struct sockaddr **nam));
void ipx_watch_output __P((struct mbuf *m, struct ifnet *ifp));
#endif /* KERNEL */
diff --git a/sys/netipx/spx_usrreq.c b/sys/netipx/spx_usrreq.c
index 9c3cfc459d30..216cfd435f2b 100644
--- a/sys/netipx/spx_usrreq.c
+++ b/sys/netipx/spx_usrreq.c
@@ -33,7 +33,7 @@
*
* @(#)spx_usrreq.h
*
- * $Id: spx_usrreq.c,v 1.13 1997/05/10 09:58:58 jhay Exp $
+ * $Id: spx_usrreq.c,v 1.14 1997/06/26 19:36:02 jhay Exp $
*/
#include <sys/param.h>
@@ -87,17 +87,19 @@ static struct spxpcb *spx_timers(struct spxpcb *cb, int timer);
static struct spxpcb *spx_usrclosed(struct spxpcb *cb);
static int spx_usr_abort(struct socket *so);
-static int spx_accept(struct socket *so, struct mbuf *nam);
+static int spx_accept(struct socket *so, struct sockaddr **nam);
static int spx_attach(struct socket *so, int proto, struct proc *p);
-static int spx_bind(struct socket *so, struct mbuf *nam, struct proc *p);
-static int spx_connect(struct socket *so, struct mbuf *nam, struct proc *p);
+static int spx_bind(struct socket *so, struct sockaddr *nam, struct proc *p);
+static int spx_connect(struct socket *so, struct sockaddr *nam,
+ struct proc *p);
static int spx_detach(struct socket *so);
static int spx_usr_disconnect(struct socket *so);
static int spx_listen(struct socket *so, struct proc *p);
static int spx_rcvd(struct socket *so, int flags);
static int spx_rcvoob(struct socket *so, struct mbuf *m, int flags);
static int spx_send(struct socket *so, int flags, struct mbuf *m,
- struct mbuf *addr, struct mbuf *control, struct proc *p);
+ struct sockaddr *addr, struct mbuf *control,
+ struct proc *p);
static int spx_shutdown(struct socket *so);
static int spx_sp_attach(struct socket *so, int proto, struct proc *p);
@@ -200,8 +202,7 @@ spx_input(m, ipxp)
switch (cb->s_state) {
case TCPS_LISTEN:{
- struct mbuf *am;
- register struct sockaddr_ipx *sipx;
+ struct sockaddr_ipx *sipx, ssipx;
struct ipx_addr laddr;
/*
@@ -213,24 +214,19 @@ spx_input(m, ipxp)
spx_istat.gonawy++;
goto dropwithreset;
}
- am = m_get(M_DONTWAIT, MT_SONAME);
- if (am == NULL)
- goto drop;
- am->m_len = sizeof(struct sockaddr_ipx);
- sipx = mtod(am, struct sockaddr_ipx *);
+ sipx = &ssipx;
+ bzero(sipx, sizeof *sipx);
sipx->sipx_len = sizeof(*sipx);
sipx->sipx_family = AF_IPX;
sipx->sipx_addr = si->si_sna;
laddr = ipxp->ipxp_laddr;
if (ipx_nullhost(laddr))
ipxp->ipxp_laddr = si->si_dna;
- if (ipx_pcbconnect(ipxp, am, &proc0)) {
+ if (ipx_pcbconnect(ipxp, (struct sockaddr *)sipx, &proc0)) {
ipxp->ipxp_laddr = laddr;
- m_free(am);
spx_istat.noconn++;
goto drop;
}
- m_free(am);
spx_template(cb);
dropsocket = 0; /* committed to socket */
cb->s_did = si->si_sid;
@@ -1307,17 +1303,18 @@ spx_usr_abort(so)
static int
spx_accept(so, nam)
struct socket *so;
- struct mbuf *nam;
+ struct sockaddr **nam;
{
struct ipxpcb *ipxp;
- struct sockaddr_ipx *sipx;
+ struct sockaddr_ipx *sipx, ssipx;
ipxp = sotoipxpcb(so);
- sipx = mtod(nam, struct sockaddr_ipx *);
-
- nam->m_len = sizeof(struct sockaddr_ipx);
+ sipx = &ssipx;
+ bzero(sipx, sizeof *sipx);
+ sipx->sipx_len = sizeof *sipx;
sipx->sipx_family = AF_IPX;
sipx->sipx_addr = ipxp->ipxp_faddr;
+ *nam = dup_sockaddr((struct sockaddr *)sipx, 0);
return (0);
}
@@ -1350,17 +1347,18 @@ spx_attach(so, proto, p)
}
ipxp = sotoipxpcb(so);
- mm = m_getclr(M_DONTWAIT, MT_PCB);
+ MALLOC(cb, struct spxpcb *, sizeof *cb, M_PCB, M_NOWAIT);
+ bzero(cb, sizeof *cb);
sb = &so->so_snd;
- if (mm == NULL) {
+ if (cb == NULL) {
error = ENOBUFS;
goto spx_attach_end;
}
- cb = mtod(mm, struct spxpcb *);
+
mm = m_getclr(M_DONTWAIT, MT_HEADER);
if (mm == NULL) {
- m_freem(dtom(cb));
+ FREE(cb, M_PCB);
error = ENOBUFS;
goto spx_attach_end;
}
@@ -1390,7 +1388,7 @@ spx_attach_end:
static int
spx_bind(so, nam, p)
struct socket *so;
- struct mbuf *nam;
+ struct sockaddr *nam;
struct proc *p;
{
struct ipxpcb *ipxp;
@@ -1409,7 +1407,7 @@ spx_bind(so, nam, p)
static int
spx_connect(so, nam, p)
struct socket *so;
- struct mbuf *nam;
+ struct sockaddr *nam;
struct proc *p;
{
int error;
@@ -1422,7 +1420,7 @@ spx_connect(so, nam, p)
s = splnet();
if (ipxp->ipxp_lport == 0) {
- error = ipx_pcbbind(ipxp, (struct mbuf *)NULL, p);
+ error = ipx_pcbbind(ipxp, (struct sockaddr *)NULL, p);
if (error)
goto spx_connect_end;
}
@@ -1509,7 +1507,7 @@ spx_listen(so, p)
cb = ipxtospxpcb(ipxp);
if (ipxp->ipxp_lport == 0)
- error = ipx_pcbbind(ipxp, (struct mbuf *)NULL, p);
+ error = ipx_pcbbind(ipxp, (struct sockaddr *)NULL, p);
if (error == 0)
cb->s_state = TCPS_LISTEN;
return (error);
@@ -1565,7 +1563,7 @@ spx_send(so, flags, m, addr, controlp, p)
struct socket *so;
int flags;
struct mbuf *m;
- struct mbuf *addr;
+ struct sockaddr *addr;
struct mbuf *controlp;
struct proc *p;
{
@@ -1698,7 +1696,7 @@ spx_close(cb)
m_freem(m);
}
m_free(dtom(cb->s_ipx));
- m_free(dtom(cb));
+ FREE(cb, M_PCB);
ipxp->ipxp_pcb = 0;
soisdisconnected(so);
ipx_pcbdetach(ipxp);
diff --git a/sys/netnatm/natm.c b/sys/netnatm/natm.c
index f78c3cbb7a11..302de5208f51 100644
--- a/sys/netnatm/natm.c
+++ b/sys/netnatm/natm.c
@@ -76,18 +76,20 @@ u_long natm0_recvspace = 16*1024;
*/
static int natm_usr_attach __P((struct socket *, int, struct proc *));
static int natm_usr_detach __P((struct socket *));
-static int natm_usr_connect __P((struct socket *, struct mbuf *,
+static int natm_usr_connect __P((struct socket *, struct sockaddr *,
struct proc *));
static int natm_usr_disconnect __P((struct socket *));
static int natm_usr_shutdown __P((struct socket *));
static int natm_usr_send __P((struct socket *, int, struct mbuf *,
- struct mbuf *, struct mbuf *, struct proc *));
-static int natm_usr_peeraddr __P((struct socket *, struct mbuf *));
+ struct sockaddr *, struct mbuf *,
+ struct proc *));
+static int natm_usr_peeraddr __P((struct socket *, struct sockaddr **));
static int natm_usr_control __P((struct socket *, int, caddr_t,
struct ifnet *, struct proc *));
static int natm_usr_abort __P((struct socket *));
-static int natm_usr_bind __P((struct socket *, struct mbuf *, struct proc *));
-static int natm_usr_sockaddr __P((struct socket *, struct mbuf *));
+static int natm_usr_bind __P((struct socket *, struct sockaddr *,
+ struct proc *));
+static int natm_usr_sockaddr __P((struct socket *, struct sockaddr **));
static int
natm_usr_attach(struct socket *so, int proto, struct proc *p)
@@ -144,7 +146,7 @@ natm_usr_detach(struct socket *so)
}
static int
-natm_usr_connect(struct socket *so, struct mbuf *nam, struct proc *p)
+natm_usr_connect(struct socket *so, struct sockaddr *nam, struct proc *p)
{
struct natmpcb *npcb;
struct sockaddr_natm *snatm;
@@ -165,11 +167,7 @@ natm_usr_connect(struct socket *so, struct mbuf *nam, struct proc *p)
* validate nam and npcb
*/
- if (nam->m_len != sizeof(*snatm)) {
- error = EINVAL;
- goto out;
- }
- snatm = mtod(nam, struct sockaddr_natm *);
+ snatm = (struct sockaddr_natm *)nam;
if (snatm->snatm_len != sizeof(*snatm) ||
(npcb->npcb_flags & NPCB_FREE) == 0) {
error = EINVAL;
@@ -285,8 +283,8 @@ natm_usr_shutdown(struct socket *so)
}
static int
-natm_usr_send(struct socket *so, int flags, struct mbuf *m, struct mbuf *nam,
- struct mbuf *control, struct proc *p)
+natm_usr_send(struct socket *so, int flags, struct mbuf *m,
+ struct sockaddr *nam, struct mbuf *control, struct proc *p)
{
struct natmpcb *npcb;
struct atm_pseudohdr *aph;
@@ -329,10 +327,10 @@ natm_usr_send(struct socket *so, int flags, struct mbuf *m, struct mbuf *nam,
}
static int
-natm_usr_peeraddr(struct socket *so, struct mbuf *nam)
+natm_usr_peeraddr(struct socket *so, struct sockaddr **nam)
{
struct natmpcb *npcb;
- struct sockaddr_natm *snatm;
+ struct sockaddr_natm *snatm, ssnatm;
int error = 0;
int s = SPLSOFTNET();
@@ -342,14 +340,15 @@ natm_usr_peeraddr(struct socket *so, struct mbuf *nam)
goto out;
}
- snatm = mtod(nam, struct sockaddr_natm *);
+ snatm = &ssnatm;
bzero(snatm, sizeof(*snatm));
- nam->m_len = snatm->snatm_len = sizeof(*snatm);
+ snatm->snatm_len = sizeof(*snatm);
snatm->snatm_family = AF_NATM;
sprintf(snatm->snatm_if, "%s%d", npcb->npcb_ifp->if_name,
npcb->npcb_ifp->if_unit);
snatm->snatm_vci = npcb->npcb_vci;
snatm->snatm_vpi = npcb->npcb_vpi;
+ *nam = dup_sockaddr((struct sockaddr *)snatm, 0);
out:
splx(s);
@@ -406,13 +405,13 @@ natm_usr_abort(struct socket *so)
}
static int
-natm_usr_bind(struct socket *so, struct mbuf *nam, struct proc *p)
+natm_usr_bind(struct socket *so, struct sockaddr *nam, struct proc *p)
{
return EOPNOTSUPP;
}
static int
-natm_usr_sockaddr(struct socket *so, struct mbuf *nam)
+natm_usr_sockaddr(struct socket *so, struct sockaddr **nam)
{
return EOPNOTSUPP;
}
diff --git a/sys/nfs/bootp_subr.c b/sys/nfs/bootp_subr.c
index 3d0f5870b137..b1fd7161dc6b 100644
--- a/sys/nfs/bootp_subr.c
+++ b/sys/nfs/bootp_subr.c
@@ -1,4 +1,4 @@
-/* $Id: bootp_subr.c,v 1.3 1997/05/14 01:31:54 tegge Exp $ */
+/* $Id: bootp_subr.c,v 1.4 1997/06/12 14:08:20 tegge Exp $ */
/*
* Copyright (c) 1995 Gordon Ross, Adam Glass
@@ -260,16 +260,13 @@ bootpc_call(call,reply,procp)
struct proc *procp;
{
struct socket *so;
- struct sockaddr_in *sin,sa;
- struct mbuf *m, *nam;
+ struct sockaddr_in *sin, sa;
+ struct mbuf *m;
struct uio auio;
struct iovec aio;
int error, rcvflg, timo, secs, len;
u_int tport;
- /* Free at end if not null. */
- nam = NULL;
-
/*
* Create socket and set its recieve timeout.
*/
@@ -310,14 +307,13 @@ bootpc_call(call,reply,procp)
/*
* Bind the local endpoint to a bootp client port.
*/
- m = m_getclr(M_WAIT, MT_SONAME);
- sin = mtod(m, struct sockaddr_in *);
- sin->sin_len = m->m_len = sizeof(*sin);
+ sin = &sa;
+ bzero(sin, sizeof *sin);
+ sin->sin_len = sizeof(*sin);
sin->sin_family = AF_INET;
sin->sin_addr.s_addr = INADDR_ANY;
sin->sin_port = htons(IPPORT_BOOTPC);
- error = sobind(so, m, procp);
- m_freem(m);
+ error = sobind(so, (struct sockaddr *)sin, procp);
if (error) {
printf("bind failed\n");
goto out;
@@ -326,19 +322,13 @@ bootpc_call(call,reply,procp)
/*
* Setup socket address for the server.
*/
- nam = m_get(M_WAIT, MT_SONAME);
- if (nam == NULL) {
- error = ENOBUFS;
- goto out;
- }
- sin = mtod(nam, struct sockaddr_in *);
- sin-> sin_len = sizeof(*sin);
- sin-> sin_family = AF_INET;
+ sin = &sa;
+ bzero(sin, sizeof *sin);
+ sin->sin_len = sizeof(*sin);
+ sin->sin_family = AF_INET;
sin->sin_addr.s_addr = INADDR_BROADCAST;
sin->sin_port = htons(IPPORT_BOOTPS);
- nam->m_len = sizeof(*sin);
-
/*
* Send it, repeatedly, until a reply is received,
* but delay each re-send by an increasing amount.
@@ -359,7 +349,8 @@ bootpc_call(call,reply,procp)
auio.uio_resid = sizeof(*call);
auio.uio_procp = procp;
- error = sosend(so, nam, &auio, NULL, NULL, 0);
+ error = sosend(so, (struct sockaddr *)sin, &auio, NULL,
+ NULL, 0, procp);
if (error) {
printf("bootpc_call: sosend: %d\n", error);
goto out;
@@ -427,7 +418,6 @@ bootpc_call(call,reply,procp)
gotreply:
out:
- if (nam) m_freem(nam);
soclose(so);
return error;
}
diff --git a/sys/nfs/krpc.h b/sys/nfs/krpc.h
index 88687ae169f5..d84768330c9f 100644
--- a/sys/nfs/krpc.h
+++ b/sys/nfs/krpc.h
@@ -1,11 +1,11 @@
/* $NetBSD: krpc.h,v 1.4 1995/12/19 23:07:11 cgd Exp $ */
-/* $Id: krpc.h,v 1.2 1997/05/11 18:05:39 tegge Exp $ */
+/* $Id: krpc.h,v 1.3 1997/06/12 14:03:16 tegge Exp $ */
#include <sys/cdefs.h>
int krpc_call __P((struct sockaddr_in *sin,
u_int prog, u_int vers, u_int func,
- struct mbuf **data, struct mbuf **from, struct proc *procp));
+ struct mbuf **data, struct sockaddr **from, struct proc *procp));
int krpc_portmap __P((struct sockaddr_in *sin,
u_int prog, u_int vers, u_int16_t *portp,struct proc *procp));
diff --git a/sys/nfs/krpc_subr.c b/sys/nfs/krpc_subr.c
index e3eadb6616fc..2d8ca1d4c0c1 100644
--- a/sys/nfs/krpc_subr.c
+++ b/sys/nfs/krpc_subr.c
@@ -1,5 +1,5 @@
/* $NetBSD: krpc_subr.c,v 1.12.4.1 1996/06/07 00:52:26 cgd Exp $ */
-/* $Id: krpc_subr.c,v 1.2 1997/05/11 18:05:39 tegge Exp $ */
+/* $Id: krpc_subr.c,v 1.3 1997/06/12 14:03:16 tegge Exp $ */
/*
* Copyright (c) 1995 Gordon Ross, Adam Glass
@@ -192,12 +192,13 @@ krpc_call(sa, prog, vers, func, data, from_p, procp)
struct sockaddr_in *sa;
u_int prog, vers, func;
struct mbuf **data; /* input/output */
- struct mbuf **from_p; /* output */
+ struct sockaddr **from_p; /* output */
struct proc *procp;
{
struct socket *so;
- struct sockaddr_in *sin;
- struct mbuf *m, *nam, *mhead, *from;
+ struct sockaddr_in *sin, ssin;
+ struct sockaddr *from;
+ struct mbuf *m, *nam, *mhead;
struct rpc_call *call;
struct rpc_reply *reply;
struct uio auio;
@@ -258,19 +259,18 @@ krpc_call(sa, prog, vers, func, data, from_p, procp)
* because some NFS servers refuse requests from
* non-reserved (non-privileged) ports.
*/
- m = m_getclr(M_WAIT, MT_SONAME);
- sin = mtod(m, struct sockaddr_in *);
- sin->sin_len = m->m_len = sizeof(*sin);
+ sin = &ssin;
+ bzero(sin, sizeof *sin);
+ sin->sin_len = sizeof(*sin);
sin->sin_family = AF_INET;
sin->sin_addr.s_addr = INADDR_ANY;
tport = IPPORT_RESERVED;
do {
tport--;
sin->sin_port = htons(tport);
- error = sobind(so, m, procp);
+ error = sobind(so, (struct sockaddr *)sin, procp);
} while (error == EADDRINUSE &&
tport > IPPORT_RESERVED / 2);
- m_freem(m);
if (error) {
printf("bind failed\n");
goto out;
@@ -279,14 +279,6 @@ krpc_call(sa, prog, vers, func, data, from_p, procp)
/*
* Setup socket address for the server.
*/
- nam = m_get(M_WAIT, MT_SONAME);
- if (nam == NULL) {
- error = ENOBUFS;
- goto out;
- }
- sin = mtod(nam, struct sockaddr_in *);
- bcopy((caddr_t)sa, (caddr_t)sin,
- (nam->m_len = sa->sin_len));
/*
* Prepend RPC message header.
@@ -336,7 +328,8 @@ krpc_call(sa, prog, vers, func, data, from_p, procp)
error = ENOBUFS;
goto out;
}
- error = sosend(so, nam, NULL, m, NULL, 0);
+ error = sosend(so, (struct sockaddr *)sa, NULL, m,
+ NULL, 0, 0);
if (error) {
printf("krpc_call: sosend: %d\n", error);
goto out;
@@ -357,7 +350,7 @@ krpc_call(sa, prog, vers, func, data, from_p, procp)
secs = timo;
while (secs > 0) {
if (from) {
- m_freem(from);
+ FREE(from, M_SONAME);
from = NULL;
}
if (m) {
@@ -445,9 +438,8 @@ krpc_call(sa, prog, vers, func, data, from_p, procp)
}
out:
- if (nam) m_freem(nam);
if (mhead) m_freem(mhead);
- if (from) m_freem(from);
+ if (from) free(from, M_SONAME);
soclose(so);
return error;
}
diff --git a/sys/nfs/nfs.h b/sys/nfs/nfs.h
index 528a366c1e67..e1a47551689b 100644
--- a/sys/nfs/nfs.h
+++ b/sys/nfs/nfs.h
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs.h 8.4 (Berkeley) 5/1/95
- * $Id: nfs.h,v 1.28 1997/06/03 17:22:45 dfr Exp $
+ * $Id: nfs.h,v 1.29 1997/07/16 09:06:27 dfr Exp $
*/
#ifndef _NFS_NFS_H_
@@ -382,7 +382,7 @@ extern TAILQ_HEAD(nfs_reqq, nfsreq) nfs_reqq;
*/
union nethostaddr {
u_long had_inetaddr;
- struct mbuf *had_nam;
+ struct sockaddr *had_nam;
};
struct nfsuid {
@@ -406,7 +406,7 @@ struct nfsuid {
struct nfsrv_rec {
STAILQ_ENTRY(nfsrv_rec) nr_link;
- struct mbuf *nr_address;
+ struct sockaddr *nr_address;
struct mbuf *nr_packet;
};
@@ -415,7 +415,7 @@ struct nfssvc_sock {
TAILQ_HEAD(, nfsuid) ns_uidlruhead;
struct file *ns_fp;
struct socket *ns_so;
- struct mbuf *ns_nam;
+ struct sockaddr *ns_nam;
struct mbuf *ns_raw;
struct mbuf *ns_rawend;
STAILQ_HEAD(, nfsrv_rec) ns_rec;
@@ -480,8 +480,8 @@ struct nfsrv_descript {
struct mbuf *nd_mrep; /* Request mbuf list */
struct mbuf *nd_md; /* Current dissect mbuf */
struct mbuf *nd_mreq; /* Reply mbuf list */
- struct mbuf *nd_nam; /* and socket addr */
- struct mbuf *nd_nam2; /* return socket addr */
+ struct sockaddr *nd_nam; /* and socket addr */
+ struct sockaddr *nd_nam2; /* return socket addr */
caddr_t nd_dpos; /* Current dissect pos */
u_int32_t nd_procnum; /* RPC # */
int nd_stable; /* storage type */
@@ -567,70 +567,91 @@ extern int nfs_debug;
int nfs_init __P((struct vfsconf *vfsp));
int nfs_reply __P((struct nfsreq *));
int nfs_getreq __P((struct nfsrv_descript *,struct nfsd *,int));
-int nfs_send __P((struct socket *,struct mbuf *,struct mbuf *,struct nfsreq *));
-int nfs_rephead __P((int,struct nfsrv_descript *,struct nfssvc_sock *,int,int,u_quad_t *,struct mbuf **,struct mbuf **,caddr_t *));
-int nfs_sndlock __P((int *,struct nfsreq *));
+int nfs_send __P((struct socket *, struct sockaddr *, struct mbuf *,
+ struct nfsreq *));
+int nfs_rephead __P((int, struct nfsrv_descript *, struct nfssvc_sock *,
+ int, int, u_quad_t *, struct mbuf **, struct mbuf **,
+ caddr_t *));
+int nfs_sndlock __P((int *, struct nfsreq *));
void nfs_sndunlock __P((int *flagp));
-int nfs_disct __P((struct mbuf **,caddr_t *,int,int,caddr_t *));
-int nfs_vinvalbuf __P((struct vnode *,int,struct ucred *,struct proc *,int));
-int nfs_readrpc __P((struct vnode *,struct uio *,struct ucred *));
-int nfs_writerpc __P((struct vnode *,struct uio *,struct ucred *,int *,int *));
-int nfs_readdirrpc __P((register struct vnode *,struct uio *,struct ucred *));
-int nfs_asyncio __P((struct buf *,struct ucred *));
-int nfs_doio __P((struct buf *,struct ucred *,struct proc *));
-int nfs_readlinkrpc __P((struct vnode *,struct uio *,struct ucred *));
-int nfs_sigintr __P((struct nfsmount *,struct nfsreq *r,struct proc *));
-int nfs_readdirplusrpc __P((struct vnode *,register struct uio *,struct ucred *));
-int nfsm_disct __P((struct mbuf **,caddr_t *,int,int,caddr_t *));
-void nfsm_srvfattr __P((struct nfsrv_descript *,struct vattr *,struct nfs_fattr *));
-void nfsm_srvwcc __P((struct nfsrv_descript *,int,struct vattr *,int,struct vattr *,struct mbuf **,char **));
-void nfsm_srvpostopattr __P((struct nfsrv_descript *,int,struct vattr *,struct mbuf **,char **));
-int netaddr_match __P((int,union nethostaddr *,struct mbuf *));
-int nfs_request __P((struct vnode *,struct mbuf *,int,struct proc *,struct ucred *,struct mbuf **,struct mbuf **,caddr_t *));
-int nfs_loadattrcache __P((struct vnode **,struct mbuf **,caddr_t *,struct vattr *));
-int nfs_namei __P((struct nameidata *,fhandle_t *,int,struct nfssvc_sock *,struct mbuf *,struct mbuf **,caddr_t *,struct vnode **,struct proc *,int,int));
-void nfsm_adj __P((struct mbuf *,int,int));
-int nfsm_mbuftouio __P((struct mbuf **,struct uio *,int,caddr_t *));
+int nfs_disct __P((struct mbuf **, caddr_t *, int, int, caddr_t *));
+int nfs_vinvalbuf __P((struct vnode *, int, struct ucred *, struct proc *,
+ int));
+int nfs_readrpc __P((struct vnode *, struct uio *, struct ucred *));
+int nfs_writerpc __P((struct vnode *, struct uio *, struct ucred *, int *,
+ int *));
+int nfs_readdirrpc __P((struct vnode *, struct uio *, struct ucred *));
+int nfs_asyncio __P((struct buf *, struct ucred *));
+int nfs_doio __P((struct buf *, struct ucred *, struct proc *));
+int nfs_readlinkrpc __P((struct vnode *, struct uio *, struct ucred *));
+int nfs_sigintr __P((struct nfsmount *, struct nfsreq *, struct proc *));
+int nfs_readdirplusrpc __P((struct vnode *, struct uio *, struct ucred *));
+int nfsm_disct __P((struct mbuf **, caddr_t *, int, int, caddr_t *));
+void nfsm_srvfattr __P((struct nfsrv_descript *, struct vattr *,
+ struct nfs_fattr *));
+void nfsm_srvwcc __P((struct nfsrv_descript *, int, struct vattr *, int,
+ struct vattr *, struct mbuf **, char **));
+void nfsm_srvpostopattr __P((struct nfsrv_descript *, int, struct vattr *,
+ struct mbuf **, char **));
+int netaddr_match __P((int, union nethostaddr *, struct sockaddr *));
+int nfs_request __P((struct vnode *, struct mbuf *, int, struct proc *,
+ struct ucred *, struct mbuf **, struct mbuf **,
+ caddr_t *));
+int nfs_loadattrcache __P((struct vnode **, struct mbuf **, caddr_t *,
+ struct vattr *));
+int nfs_namei __P((struct nameidata *, fhandle_t *, int,
+ struct nfssvc_sock *, struct sockaddr *, struct mbuf **,
+ caddr_t *, struct vnode **, struct proc *, int, int));
+void nfsm_adj __P((struct mbuf *, int, int));
+int nfsm_mbuftouio __P((struct mbuf **, struct uio *, int, caddr_t *));
void nfsrv_initcache __P((void));
-int nfs_getauth __P((struct nfsmount *,struct nfsreq *,struct ucred *,char **,int *,char *,int *,NFSKERBKEY_T));
-int nfs_getnickauth __P((struct nfsmount *,struct ucred *,char **,int *,char *,int));
-int nfs_savenickauth __P((struct nfsmount *,struct ucred *,int,NFSKERBKEY_T,struct mbuf **,char **,struct mbuf *));
-int nfs_adv __P((struct mbuf **,caddr_t *,int,int));
+int nfs_getauth __P((struct nfsmount *, struct nfsreq *, struct ucred *,
+ char **, int *, char *, int *, NFSKERBKEY_T));
+int nfs_getnickauth __P((struct nfsmount *, struct ucred *, char **,
+ int *, char *, int));
+int nfs_savenickauth __P((struct nfsmount *, struct ucred *, int,
+ NFSKERBKEY_T, struct mbuf **, char **,
+ struct mbuf *));
+int nfs_adv __P((struct mbuf **, caddr_t *, int, int));
void nfs_nhinit __P((void));
void nfs_timer __P((void*));
-u_long nfs_hash __P((nfsfh_t *,int));
-int nfsrv_dorec __P((struct nfssvc_sock *,struct nfsd *,struct nfsrv_descript **));
-int nfsrv_getcache __P((struct nfsrv_descript *,struct nfssvc_sock *,struct mbuf **));
-void nfsrv_updatecache __P((struct nfsrv_descript *,int,struct mbuf *));
+u_long nfs_hash __P((nfsfh_t *, int));
+int nfsrv_dorec __P((struct nfssvc_sock *, struct nfsd *,
+ struct nfsrv_descript **));
+int nfsrv_getcache __P((struct nfsrv_descript *, struct nfssvc_sock *,
+ struct mbuf **));
+void nfsrv_updatecache __P((struct nfsrv_descript *, int, struct mbuf *));
void nfsrv_cleancache __P((void));
-int nfs_connect __P((struct nfsmount *,struct nfsreq *));
+int nfs_connect __P((struct nfsmount *, struct nfsreq *));
void nfs_disconnect __P((struct nfsmount *));
-int nfs_getattrcache __P((struct vnode *,struct vattr *));
-int nfsm_strtmbuf __P((struct mbuf **,char **,char *,long));
-int nfs_bioread __P((struct vnode *,struct uio *,int,struct ucred *, int getpages));
-int nfsm_uiotombuf __P((struct uio *,struct mbuf **,int,caddr_t *));
+int nfs_getattrcache __P((struct vnode *, struct vattr *));
+int nfsm_strtmbuf __P((struct mbuf **, char **, char *, long));
+int nfs_bioread __P((struct vnode *, struct uio *, int, struct ucred *,
+ int));
+int nfsm_uiotombuf __P((struct uio *, struct mbuf **, int, caddr_t *));
void nfsrv_init __P((int));
void nfs_clearcommit __P((struct mount *));
int nfsrv_errmap __P((struct nfsrv_descript *, int));
-void nfsrvw_sort __P((gid_t [],int));
-void nfsrv_setcred __P((struct ucred *,struct ucred *));
-int nfs_writebp __P((struct buf *,int));
-int nfsrv_object_create __P(( struct vnode * ));
+void nfsrvw_sort __P((gid_t *, int));
+void nfsrv_setcred __P((struct ucred *, struct ucred *));
+int nfs_writebp __P((struct buf *, int));
+int nfsrv_object_create __P((struct vnode *));
void nfsrv_wakenfsd __P((struct nfssvc_sock *slp));
int nfsrv_writegather __P((struct nfsrv_descript **, struct nfssvc_sock *,
struct proc *, struct mbuf **));
int nfs_fsinfo __P((struct nfsmount *, struct vnode *, struct ucred *,
struct proc *p));
-int nfsrv3_access __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
+int nfsrv3_access __P((struct nfsrv_descript *nfsd,
+ struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
int nfsrv_commit __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
int nfsrv_create __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
-int nfsrv_fhtovp __P((fhandle_t *,int,struct vnode **,
- struct ucred *,struct nfssvc_sock *,struct mbuf *,
- int *,int,int));
+int nfsrv_fhtovp __P((fhandle_t *, int, struct vnode **, struct ucred *,
+ struct nfssvc_sock *, struct sockaddr *, int *,
+ int, int));
int nfsrv_setpublicfs __P((struct mount *, struct netexport *,
struct export_args *));
int nfs_ispublicfh __P((fhandle_t *));
@@ -655,7 +676,8 @@ int nfsrv_pathconf __P((struct nfsrv_descript *nfsd,
struct mbuf **mrq));
int nfsrv_read __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
-int nfsrv_readdir __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
+int nfsrv_readdir __P((struct nfsrv_descript *nfsd,
+ struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
int nfsrv_readdirplus __P((struct nfsrv_descript *nfsd,
struct nfssvc_sock *slp, struct proc *procp,
@@ -669,11 +691,14 @@ int nfsrv_rename __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
int nfsrv_rmdir __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
-int nfsrv_setattr __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
+int nfsrv_setattr __P((struct nfsrv_descript *nfsd,
+ struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
-int nfsrv_statfs __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
+int nfsrv_statfs __P((struct nfsrv_descript *nfsd,
+ struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
-int nfsrv_symlink __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
+int nfsrv_symlink __P((struct nfsrv_descript *nfsd,
+ struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
int nfsrv_write __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
diff --git a/sys/nfs/nfs_common.c b/sys/nfs/nfs_common.c
index 4c102c865edd..69baccb1d64b 100644
--- a/sys/nfs/nfs_common.c
+++ b/sys/nfs/nfs_common.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_subs.c 8.3 (Berkeley) 1/4/94
- * $Id: nfs_subs.c,v 1.39 1997/07/16 09:06:29 dfr Exp $
+ * $Id: nfs_subs.c,v 1.40 1997/07/22 15:35:57 dfr Exp $
*/
/*
@@ -1429,7 +1429,7 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag, pubflag)
fhandle_t *fhp;
int len;
struct nfssvc_sock *slp;
- struct mbuf *nam;
+ struct sockaddr *nam;
struct mbuf **mdp;
caddr_t *dposp;
struct vnode **retdirp;
@@ -1840,7 +1840,7 @@ nfsrv_fhtovp(fhp, lockflag, vpp, cred, slp, nam, rdonlyp, kerbflag, pubflag)
struct vnode **vpp;
struct ucred *cred;
struct nfssvc_sock *slp;
- struct mbuf *nam;
+ struct sockaddr *nam;
int *rdonlyp;
int kerbflag;
int pubflag;
@@ -1925,13 +1925,13 @@ int
netaddr_match(family, haddr, nam)
int family;
union nethostaddr *haddr;
- struct mbuf *nam;
+ struct sockaddr *nam;
{
register struct sockaddr_in *inetaddr;
switch (family) {
case AF_INET:
- inetaddr = mtod(nam, struct sockaddr_in *);
+ inetaddr = (struct sockaddr_in *)nam;
if (inetaddr->sin_family == AF_INET &&
inetaddr->sin_addr.s_addr == haddr->had_inetaddr)
return (1);
@@ -1941,8 +1941,8 @@ netaddr_match(family, haddr, nam)
{
register struct sockaddr_iso *isoaddr1, *isoaddr2;
- isoaddr1 = mtod(nam, struct sockaddr_iso *);
- isoaddr2 = mtod(haddr->had_nam, struct sockaddr_iso *);
+ isoaddr1 = (struct sockaddr_iso *)nam;
+ isoaddr2 = (struct sockaddr_iso *)haddr->had_nam;
if (isoaddr1->siso_family == AF_ISO &&
isoaddr1->siso_nlen > 0 &&
isoaddr1->siso_nlen == isoaddr2->siso_nlen &&
diff --git a/sys/nfs/nfs_nqlease.c b/sys/nfs/nfs_nqlease.c
index 173ea6d49aca..d7a1bdf35ff9 100644
--- a/sys/nfs/nfs_nqlease.c
+++ b/sys/nfs/nfs_nqlease.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_nqlease.c 8.9 (Berkeley) 5/20/95
- * $Id: nfs_nqlease.c,v 1.25 1997/06/03 17:22:46 dfr Exp $
+ * $Id: nfs_nqlease.c,v 1.26 1997/07/16 09:06:27 dfr Exp $
*/
@@ -83,17 +83,18 @@ static int nqsrv_maxnumlease = NQ_MAXNUMLEASE;
struct vop_lease_args;
-static int nqsrv_cmpnam __P((struct nfssvc_sock *,struct mbuf *,
+static int nqsrv_cmpnam __P((struct nfssvc_sock *, struct sockaddr *,
struct nqhost *));
extern void nqnfs_lease_updatetime __P((int deltat));
static int nqnfs_vacated __P((struct vnode *vp, struct ucred *cred));
static void nqsrv_addhost __P((struct nqhost *lph, struct nfssvc_sock *slp,
- struct mbuf *nam));
+ struct sockaddr *nam));
static void nqsrv_instimeq __P((struct nqlease *lp, u_long duration));
static void nqsrv_locklease __P((struct nqlease *lp));
static void nqsrv_send_eviction __P((struct vnode *vp, struct nqlease *lp,
struct nfssvc_sock *slp,
- struct mbuf *nam, struct ucred *cred));
+ struct sockaddr *nam,
+ struct ucred *cred));
static void nqsrv_unlocklease __P((struct nqlease *lp));
static void nqsrv_waitfor_expiry __P((struct nqlease *lp));
@@ -170,7 +171,7 @@ nqsrv_getlease(vp, duration, flags, slp, procp, nam, cachablep, frev, cred)
int flags;
struct nfssvc_sock *slp;
struct proc *procp;
- struct mbuf *nam;
+ struct sockaddr *nam;
int *cachablep;
u_quad_t *frev;
struct ucred *cred;
@@ -343,7 +344,7 @@ nqnfs_lease_check(vp, p, cred, flag)
u_quad_t frev;
(void) nqsrv_getlease(vp, &duration, ND_CHECK | flag, NQLOCALSLP,
- p, (struct mbuf *)0, &cache, &frev, cred);
+ p, (struct sockaddr *)0, &cache, &frev, cred);
}
int
@@ -360,7 +361,8 @@ nqnfs_vop_lease_check(ap)
u_quad_t frev;
(void) nqsrv_getlease(ap->a_vp, &duration, ND_CHECK | ap->a_flag,
- NQLOCALSLP, ap->a_p, (struct mbuf *)0, &cache, &frev, ap->a_cred);
+ NQLOCALSLP, ap->a_p, (struct sockaddr *)0,
+ &cache, &frev, ap->a_cred);
return (0);
}
@@ -373,19 +375,19 @@ static void
nqsrv_addhost(lph, slp, nam)
register struct nqhost *lph;
struct nfssvc_sock *slp;
- struct mbuf *nam;
+ struct sockaddr *nam;
{
register struct sockaddr_in *saddr;
if (slp == NQLOCALSLP)
lph->lph_flag |= (LC_VALID | LC_LOCAL);
else if (slp == nfs_udpsock) {
- saddr = mtod(nam, struct sockaddr_in *);
+ saddr = (struct sockaddr_in *)nam;
lph->lph_flag |= (LC_VALID | LC_UDP);
lph->lph_inetaddr = saddr->sin_addr.s_addr;
lph->lph_port = saddr->sin_port;
} else if (slp == nfs_cltpsock) {
- lph->lph_nam = m_copym(nam, 0, M_COPYALL, M_WAIT);
+ lph->lph_nam = dup_sockaddr(nam, 1);
lph->lph_flag |= (LC_VALID | LC_CLTP);
} else {
lph->lph_flag |= (LC_VALID | LC_SREF);
@@ -439,11 +441,11 @@ nqsrv_instimeq(lp, duration)
static int
nqsrv_cmpnam(slp, nam, lph)
register struct nfssvc_sock *slp;
- struct mbuf *nam;
+ struct sockaddr *nam;
register struct nqhost *lph;
{
register struct sockaddr_in *saddr;
- struct mbuf *addr;
+ struct sockaddr *addr;
union nethostaddr lhaddr;
int ret;
@@ -464,7 +466,7 @@ nqsrv_cmpnam(slp, nam, lph)
else {
if ((lph->lph_slp->ns_flag & SLP_VALID) == 0)
return (0);
- saddr = mtod(lph->lph_slp->ns_nam, struct sockaddr_in *);
+ saddr = (struct sockaddr_in *)lph->lph_slp->ns_nam;
if (saddr->sin_family == AF_INET)
lhaddr.had_inetaddr = saddr->sin_addr.s_addr;
else
@@ -482,15 +484,16 @@ nqsrv_send_eviction(vp, lp, slp, nam, cred)
struct vnode *vp;
register struct nqlease *lp;
struct nfssvc_sock *slp;
- struct mbuf *nam;
+ struct sockaddr *nam;
struct ucred *cred;
{
register struct nqhost *lph = &lp->lc_host;
register struct mbuf *m;
register int siz;
struct nqm *lphnext = lp->lc_morehosts;
- struct mbuf *mreq, *mb, *mb2, *nam2, *mheadend;
+ struct mbuf *mreq, *mb, *mb2, *mheadend;
struct socket *so;
+ struct sockaddr *nam2;
struct sockaddr_in *saddr;
nfsfh_t nfh;
fhandle_t *fhp;
@@ -504,10 +507,10 @@ nqsrv_send_eviction(vp, lp, slp, nam, cred)
lph->lph_flag |= LC_VACATED;
else if ((lph->lph_flag & (LC_LOCAL | LC_VACATED)) == 0) {
if (lph->lph_flag & LC_UDP) {
- MGET(nam2, M_WAIT, MT_SONAME);
- saddr = mtod(nam2, struct sockaddr_in *);
- nam2->m_len = saddr->sin_len =
- sizeof (struct sockaddr_in);
+ MALLOC(nam2, struct sockaddr *,
+ sizeof *nam2, M_SONAME, M_WAITOK);
+ saddr = (struct sockaddr_in *)nam2;
+ saddr->sin_len = sizeof *saddr;
saddr->sin_family = AF_INET;
saddr->sin_addr.s_addr = lph->lph_inetaddr;
saddr->sin_port = lph->lph_port;
@@ -516,7 +519,7 @@ nqsrv_send_eviction(vp, lp, slp, nam, cred)
nam2 = lph->lph_nam;
so = nfs_cltpsock->ns_so;
} else if (lph->lph_slp->ns_flag & SLP_VALID) {
- nam2 = (struct mbuf *)0;
+ nam2 = (struct sockaddr *)0;
so = lph->lph_slp->ns_so;
} else
goto nextone;
@@ -568,7 +571,7 @@ nqsrv_send_eviction(vp, lp, slp, nam, cred)
nfs_sndunlock(solockp);
}
if (lph->lph_flag & LC_UDP)
- MFREE(nam2, m);
+ FREE(nam2, M_SONAME);
}
nextone:
if (++i == len) {
@@ -686,7 +689,7 @@ nqnfs_serverd()
ok = 1;
while (ok && (lph->lph_flag & LC_VALID)) {
if (lph->lph_flag & LC_CLTP)
- MFREE(lph->lph_nam, n);
+ FREE(lph->lph_nam, M_SONAME);
if (lph->lph_flag & LC_SREF)
nfsrv_slpderef(lph->lph_slp);
if (++i == len) {
@@ -727,7 +730,7 @@ nqnfsrv_getlease(nfsd, slp, procp, mrq)
struct mbuf **mrq;
{
struct mbuf *mrep = nfsd->nd_mrep, *md = nfsd->nd_md;
- struct mbuf *nam = nfsd->nd_nam;
+ struct sockaddr *nam = nfsd->nd_nam;
caddr_t dpos = nfsd->nd_dpos;
struct ucred *cred = &nfsd->nd_cr;
register struct nfs_fattr *fp;
@@ -785,7 +788,7 @@ nqnfsrv_vacated(nfsd, slp, procp, mrq)
struct mbuf **mrq;
{
struct mbuf *mrep = nfsd->nd_mrep, *md = nfsd->nd_md;
- struct mbuf *nam = nfsd->nd_nam;
+ struct sockaddr *nam = nfsd->nd_nam;
caddr_t dpos = nfsd->nd_dpos;
register struct nqlease *lp;
register struct nqhost *lph;
diff --git a/sys/nfs/nfs_serv.c b/sys/nfs/nfs_serv.c
index 0ca0a9a8e475..ce2ed4359d02 100644
--- a/sys/nfs/nfs_serv.c
+++ b/sys/nfs/nfs_serv.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_serv.c 8.3 (Berkeley) 1/12/94
- * $Id: nfs_serv.c,v 1.45 1997/07/16 09:06:28 dfr Exp $
+ * $Id: nfs_serv.c,v 1.46 1997/07/22 15:35:15 dfr Exp $
*/
/*
@@ -117,7 +117,7 @@ nfsrv3_access(nfsd, slp, procp, mrq)
struct mbuf **mrq;
{
struct mbuf *mrep = nfsd->nd_mrep, *md = nfsd->nd_md;
- struct mbuf *nam = nfsd->nd_nam;
+ struct sockaddr *nam = nfsd->nd_nam;
caddr_t dpos = nfsd->nd_dpos;
struct ucred *cred = &nfsd->nd_cr;
struct vnode *vp;
@@ -184,7 +184,7 @@ nfsrv_getattr(nfsd, slp, procp, mrq)
struct mbuf **mrq;
{
struct mbuf *mrep = nfsd->nd_mrep, *md = nfsd->nd_md;
- struct mbuf *nam = nfsd->nd_nam;
+ struct sockaddr *nam = nfsd->nd_nam;
caddr_t dpos = nfsd->nd_dpos;
struct ucred *cred = &nfsd->nd_cr;
register struct nfs_fattr *fp;
@@ -230,7 +230,7 @@ nfsrv_setattr(nfsd, slp, procp, mrq)
struct mbuf **mrq;
{
struct mbuf *mrep = nfsd->nd_mrep, *md = nfsd->nd_md;
- struct mbuf *nam = nfsd->nd_nam;
+ struct sockaddr *nam = nfsd->nd_nam;
caddr_t dpos = nfsd->nd_dpos;
struct ucred *cred = &nfsd->nd_cr;
struct vattr va, preat;
@@ -361,7 +361,7 @@ nfsrv_lookup(nfsd, slp, procp, mrq)
struct mbuf **mrq;
{
struct mbuf *mrep = nfsd->nd_mrep, *md = nfsd->nd_md;
- struct mbuf *nam = nfsd->nd_nam;
+ struct sockaddr *nam = nfsd->nd_nam;
caddr_t dpos = nfsd->nd_dpos;
struct ucred *cred = &nfsd->nd_cr;
register struct nfs_fattr *fp;
@@ -482,7 +482,7 @@ nfsrv_readlink(nfsd, slp, procp, mrq)
struct mbuf **mrq;
{
struct mbuf *mrep = nfsd->nd_mrep, *md = nfsd->nd_md;
- struct mbuf *nam = nfsd->nd_nam;
+ struct sockaddr *nam = nfsd->nd_nam;
caddr_t dpos = nfsd->nd_dpos;
struct ucred *cred = &nfsd->nd_cr;
struct iovec iv[(NFS_MAXPATHLEN+MLEN-1)/MLEN];
@@ -585,7 +585,7 @@ nfsrv_read(nfsd, slp, procp, mrq)
struct mbuf **mrq;
{
struct mbuf *mrep = nfsd->nd_mrep, *md = nfsd->nd_md;
- struct mbuf *nam = nfsd->nd_nam;
+ struct sockaddr *nam = nfsd->nd_nam;
caddr_t dpos = nfsd->nd_dpos;
struct ucred *cred = &nfsd->nd_cr;
register struct iovec *iv;
@@ -750,7 +750,7 @@ nfsrv_write(nfsd, slp, procp, mrq)
struct mbuf **mrq;
{
struct mbuf *mrep = nfsd->nd_mrep, *md = nfsd->nd_md;
- struct mbuf *nam = nfsd->nd_nam;
+ struct sockaddr *nam = nfsd->nd_nam;
caddr_t dpos = nfsd->nd_dpos;
struct ucred *cred = &nfsd->nd_cr;
register struct iovec *ivp;
@@ -1355,7 +1355,7 @@ nfsrv_create(nfsd, slp, procp, mrq)
struct mbuf **mrq;
{
struct mbuf *mrep = nfsd->nd_mrep, *md = nfsd->nd_md;
- struct mbuf *nam = nfsd->nd_nam;
+ struct sockaddr *nam = nfsd->nd_nam;
caddr_t dpos = nfsd->nd_dpos;
struct ucred *cred = &nfsd->nd_cr;
register struct nfs_fattr *fp;
@@ -1593,7 +1593,7 @@ nfsrv_mknod(nfsd, slp, procp, mrq)
struct mbuf **mrq;
{
struct mbuf *mrep = nfsd->nd_mrep, *md = nfsd->nd_md;
- struct mbuf *nam = nfsd->nd_nam;
+ struct sockaddr *nam = nfsd->nd_nam;
caddr_t dpos = nfsd->nd_dpos;
struct ucred *cred = &nfsd->nd_cr;
struct vattr va, dirfor, diraft;
@@ -1742,7 +1742,7 @@ nfsrv_remove(nfsd, slp, procp, mrq)
struct mbuf **mrq;
{
struct mbuf *mrep = nfsd->nd_mrep, *md = nfsd->nd_md;
- struct mbuf *nam = nfsd->nd_nam;
+ struct sockaddr *nam = nfsd->nd_nam;
caddr_t dpos = nfsd->nd_dpos;
struct ucred *cred = &nfsd->nd_cr;
struct nameidata nd;
@@ -1830,7 +1830,7 @@ nfsrv_rename(nfsd, slp, procp, mrq)
struct mbuf **mrq;
{
struct mbuf *mrep = nfsd->nd_mrep, *md = nfsd->nd_md;
- struct mbuf *nam = nfsd->nd_nam;
+ struct sockaddr *nam = nfsd->nd_nam;
caddr_t dpos = nfsd->nd_dpos;
struct ucred *cred = &nfsd->nd_cr;
register u_long *tl;
@@ -2037,7 +2037,7 @@ nfsrv_link(nfsd, slp, procp, mrq)
struct mbuf **mrq;
{
struct mbuf *mrep = nfsd->nd_mrep, *md = nfsd->nd_md;
- struct mbuf *nam = nfsd->nd_nam;
+ struct sockaddr *nam = nfsd->nd_nam;
caddr_t dpos = nfsd->nd_dpos;
struct ucred *cred = &nfsd->nd_cr;
struct nameidata nd;
@@ -2140,7 +2140,7 @@ nfsrv_symlink(nfsd, slp, procp, mrq)
struct mbuf **mrq;
{
struct mbuf *mrep = nfsd->nd_mrep, *md = nfsd->nd_md;
- struct mbuf *nam = nfsd->nd_nam;
+ struct sockaddr *nam = nfsd->nd_nam;
caddr_t dpos = nfsd->nd_dpos;
struct ucred *cred = &nfsd->nd_cr;
struct vattr va, dirfor, diraft;
@@ -2283,7 +2283,7 @@ nfsrv_mkdir(nfsd, slp, procp, mrq)
struct mbuf **mrq;
{
struct mbuf *mrep = nfsd->nd_mrep, *md = nfsd->nd_md;
- struct mbuf *nam = nfsd->nd_nam;
+ struct sockaddr *nam = nfsd->nd_nam;
caddr_t dpos = nfsd->nd_dpos;
struct ucred *cred = &nfsd->nd_cr;
struct vattr va, dirfor, diraft;
@@ -2399,7 +2399,7 @@ nfsrv_rmdir(nfsd, slp, procp, mrq)
struct mbuf **mrq;
{
struct mbuf *mrep = nfsd->nd_mrep, *md = nfsd->nd_md;
- struct mbuf *nam = nfsd->nd_nam;
+ struct sockaddr *nam = nfsd->nd_nam;
caddr_t dpos = nfsd->nd_dpos;
struct ucred *cred = &nfsd->nd_cr;
register u_long *tl;
@@ -2528,7 +2528,7 @@ nfsrv_readdir(nfsd, slp, procp, mrq)
struct mbuf **mrq;
{
struct mbuf *mrep = nfsd->nd_mrep, *md = nfsd->nd_md;
- struct mbuf *nam = nfsd->nd_nam;
+ struct sockaddr *nam = nfsd->nd_nam;
caddr_t dpos = nfsd->nd_dpos;
struct ucred *cred = &nfsd->nd_cr;
register char *bp, *be;
@@ -2795,7 +2795,7 @@ nfsrv_readdirplus(nfsd, slp, procp, mrq)
struct mbuf **mrq;
{
struct mbuf *mrep = nfsd->nd_mrep, *md = nfsd->nd_md;
- struct mbuf *nam = nfsd->nd_nam;
+ struct sockaddr *nam = nfsd->nd_nam;
caddr_t dpos = nfsd->nd_dpos;
struct ucred *cred = &nfsd->nd_cr;
register char *bp, *be;
@@ -3111,7 +3111,7 @@ nfsrv_commit(nfsd, slp, procp, mrq)
struct mbuf **mrq;
{
struct mbuf *mrep = nfsd->nd_mrep, *md = nfsd->nd_md;
- struct mbuf *nam = nfsd->nd_nam;
+ struct sockaddr *nam = nfsd->nd_nam;
caddr_t dpos = nfsd->nd_dpos;
struct ucred *cred = &nfsd->nd_cr;
struct vattr bfor, aft;
@@ -3172,7 +3172,7 @@ nfsrv_statfs(nfsd, slp, procp, mrq)
struct mbuf **mrq;
{
struct mbuf *mrep = nfsd->nd_mrep, *md = nfsd->nd_md;
- struct mbuf *nam = nfsd->nd_nam;
+ struct sockaddr *nam = nfsd->nd_nam;
caddr_t dpos = nfsd->nd_dpos;
struct ucred *cred = &nfsd->nd_cr;
register struct statfs *sf;
@@ -3250,7 +3250,7 @@ nfsrv_fsinfo(nfsd, slp, procp, mrq)
struct mbuf **mrq;
{
struct mbuf *mrep = nfsd->nd_mrep, *md = nfsd->nd_md;
- struct mbuf *nam = nfsd->nd_nam;
+ struct sockaddr *nam = nfsd->nd_nam;
caddr_t dpos = nfsd->nd_dpos;
struct ucred *cred = &nfsd->nd_cr;
register u_long *tl;
@@ -3320,7 +3320,7 @@ nfsrv_pathconf(nfsd, slp, procp, mrq)
struct mbuf **mrq;
{
struct mbuf *mrep = nfsd->nd_mrep, *md = nfsd->nd_md;
- struct mbuf *nam = nfsd->nd_nam;
+ struct sockaddr *nam = nfsd->nd_nam;
caddr_t dpos = nfsd->nd_dpos;
struct ucred *cred = &nfsd->nd_cr;
register u_long *tl;
diff --git a/sys/nfs/nfs_socket.c b/sys/nfs/nfs_socket.c
index 0ea7f690f274..4b41e67f6a22 100644
--- a/sys/nfs/nfs_socket.c
+++ b/sys/nfs/nfs_socket.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_socket.c 8.5 (Berkeley) 3/30/95
- * $Id: nfs_socket.c,v 1.25 1997/05/13 17:25:44 dfr Exp $
+ * $Id: nfs_socket.c,v 1.26 1997/06/03 17:22:46 dfr Exp $
*/
/*
@@ -138,7 +138,7 @@ static int nfs_msg __P((struct proc *,char *,char *));
static int nfs_rcvlock __P((struct nfsreq *));
static void nfs_rcvunlock __P((int *flagp));
static void nfs_realign __P((struct mbuf *m, int hsiz));
-static int nfs_receive __P((struct nfsreq *rep, struct mbuf **aname,
+static int nfs_receive __P((struct nfsreq *rep, struct sockaddr **aname,
struct mbuf **mp));
static int nfs_reconnect __P((struct nfsreq *rep));
#ifndef NFS_NOSERVER
@@ -195,7 +195,7 @@ nfs_connect(nmp, rep)
struct proc *p = &proc0; /* only used for socreate and sobind */
nmp->nm_so = (struct socket *)0;
- saddr = mtod(nmp->nm_nam, struct sockaddr *);
+ saddr = nmp->nm_nam;
error = socreate(saddr->sa_family, &nmp->nm_so, nmp->nm_sotype,
nmp->nm_soproto, p);
if (error)
@@ -207,17 +207,18 @@ nfs_connect(nmp, rep)
* Some servers require that the client port be a reserved port number.
*/
if (saddr->sa_family == AF_INET && (nmp->nm_flag & NFSMNT_RESVPORT)) {
- MGET(m, M_WAIT, MT_SONAME);
- sin = mtod(m, struct sockaddr_in *);
- sin->sin_len = m->m_len = sizeof (struct sockaddr_in);
+ struct sockaddr_in ssin;
+ bzero(&ssin, sizeof ssin);
+ sin = &ssin;
+ sin->sin_len = sizeof (struct sockaddr_in);
sin->sin_family = AF_INET;
sin->sin_addr.s_addr = INADDR_ANY;
tport = IPPORT_RESERVED - 1;
sin->sin_port = htons(tport);
- while ((error = sobind(so, m, p)) == EADDRINUSE &&
+ while ((error = sobind(so, (struct sockaddr *)sin, p))
+ == EADDRINUSE &&
--tport > IPPORT_RESERVED / 2)
sin->sin_port = htons(tport);
- m_freem(m);
if (error)
goto bad;
}
@@ -232,6 +233,7 @@ nfs_connect(nmp, rep)
goto bad;
}
} else {
+ /* XXX should not use mbuf */
error = soconnect(so, nmp->nm_nam, p);
if (error)
goto bad;
@@ -383,11 +385,11 @@ nfs_disconnect(nmp)
int
nfs_send(so, nam, top, rep)
register struct socket *so;
- struct mbuf *nam;
+ struct sockaddr *nam;
register struct mbuf *top;
struct nfsreq *rep;
{
- struct mbuf *sendnam;
+ struct sockaddr *sendnam;
int error, soflags, flags;
if (rep) {
@@ -405,7 +407,7 @@ nfs_send(so, nam, top, rep)
} else
soflags = so->so_proto->pr_flags;
if ((soflags & PR_CONNREQUIRED) || (so->so_state & SS_ISCONNECTED))
- sendnam = (struct mbuf *)0;
+ sendnam = (struct sockaddr *)0;
else
sendnam = nam;
if (so->so_type == SOCK_SEQPACKET)
@@ -414,10 +416,11 @@ nfs_send(so, nam, top, rep)
flags = 0;
error = so->so_proto->pr_usrreqs->pru_sosend(so, sendnam, 0, top, 0,
- flags);
+ flags, curproc /*XXX*/);
if (error) {
if (rep) {
- log(LOG_INFO, "nfs send error %d for server %s\n",error,
+ log(LOG_INFO, "nfs send error %d for server %s\n",
+ error,
rep->r_nmp->nm_mountp->mnt_stat.f_mntfromname);
/*
* Deal with errors for the client side.
@@ -451,7 +454,7 @@ nfs_send(so, nam, top, rep)
static int
nfs_receive(rep, aname, mp)
register struct nfsreq *rep;
- struct mbuf **aname;
+ struct sockaddr **aname;
struct mbuf **mp;
{
register struct socket *so;
@@ -460,7 +463,7 @@ nfs_receive(rep, aname, mp)
register struct mbuf *m;
struct mbuf *control;
u_long len;
- struct mbuf **getnam;
+ struct sockaddr **getnam;
int error, sotype, rcvflg;
struct proc *p = curproc; /* XXX */
@@ -468,7 +471,7 @@ nfs_receive(rep, aname, mp)
* Set up arguments for soreceive()
*/
*mp = (struct mbuf *)0;
- *aname = (struct mbuf *)0;
+ *aname = (struct sockaddr *)0;
sotype = rep->r_nmp->nm_sotype;
/*
@@ -533,7 +536,7 @@ tryagain:
do {
rcvflg = MSG_WAITALL;
error = so->so_proto->pr_usrreqs->pru_soreceive
- (so, (struct mbuf **)0, &auio,
+ (so, (struct sockaddr **)0, &auio,
(struct mbuf **)0, (struct mbuf **)0,
&rcvflg);
if (error == EWOULDBLOCK && rep) {
@@ -568,7 +571,7 @@ tryagain:
do {
rcvflg = MSG_WAITALL;
error = so->so_proto->pr_usrreqs->pru_soreceive
- (so, (struct mbuf **)0,
+ (so, (struct sockaddr **)0,
&auio, mp, (struct mbuf **)0, &rcvflg);
} while (error == EWOULDBLOCK || error == EINTR ||
error == ERESTART);
@@ -593,7 +596,7 @@ tryagain:
do {
rcvflg = 0;
error = so->so_proto->pr_usrreqs->pru_soreceive
- (so, (struct mbuf **)0,
+ (so, (struct sockaddr **)0,
&auio, mp, &control, &rcvflg);
if (control)
m_freem(control);
@@ -628,7 +631,7 @@ errout:
if ((so = rep->r_nmp->nm_so) == NULL)
return (EACCES);
if (so->so_state & SS_ISCONNECTED)
- getnam = (struct mbuf **)0;
+ getnam = (struct sockaddr **)0;
else
getnam = aname;
auio.uio_resid = len = 1000000;
@@ -671,7 +674,8 @@ nfs_reply(myrep)
register struct nfsreq *rep;
register struct nfsmount *nmp = myrep->r_nmp;
register long t1;
- struct mbuf *mrep, *nam, *md;
+ struct mbuf *mrep, *md;
+ struct sockaddr *nam;
u_long rxid, *tl;
caddr_t dpos, cp2;
int error;
@@ -715,7 +719,7 @@ nfs_reply(myrep)
return (error);
}
if (nam)
- m_freem(nam);
+ FREE(nam, M_SONAME);
/*
* Get the xid and check that it is an rpc reply
@@ -1356,7 +1360,7 @@ nfs_timer(arg)
(m = m_copym(rep->r_mreq, 0, M_COPYALL, M_DONTWAIT))){
if ((nmp->nm_flag & NFSMNT_NOCONN) == 0)
error = (*so->so_proto->pr_usrreqs->pru_send)
- (so, 0, m, (struct mbuf *)0,
+ (so, 0, m, (struct sockaddr *)0,
(struct mbuf *)0, p);
else
error = (*so->so_proto->pr_usrreqs->pru_send)
@@ -1642,7 +1646,8 @@ nfsrv_rcv(so, arg, waitflag)
{
register struct nfssvc_sock *slp = (struct nfssvc_sock *)arg;
register struct mbuf *m;
- struct mbuf *mp, *nam;
+ struct mbuf *mp;
+ struct sockaddr *nam;
struct uio auio;
int flags, error;
@@ -1717,7 +1722,7 @@ nfsrv_rcv(so, arg, waitflag)
M_NFSRVDESC, waitflag);
if (!rec) {
if (nam)
- m_freem(nam);
+ FREE(nam, M_SONAME);
m_freem(mp);
continue;
}
@@ -1864,7 +1869,7 @@ nfsrv_getstream(slp, waitflag)
m_freem(slp->ns_frag);
} else {
nfs_realign(slp->ns_frag, 10 * NFSX_UNSIGNED);
- rec->nr_address = (struct mbuf*)0;
+ rec->nr_address = (struct sockaddr *)0;
rec->nr_packet = slp->ns_frag;
STAILQ_INSERT_TAIL(&slp->ns_rec, rec, nr_link);
}
@@ -1883,7 +1888,8 @@ nfsrv_dorec(slp, nfsd, ndp)
struct nfsrv_descript **ndp;
{
struct nfsrv_rec *rec;
- register struct mbuf *m, *nam;
+ register struct mbuf *m;
+ struct sockaddr *nam;
register struct nfsrv_descript *nd;
int error;
@@ -1902,7 +1908,7 @@ nfsrv_dorec(slp, nfsd, ndp)
nd->nd_dpos = mtod(m, caddr_t);
error = nfs_getreq(nd, nfsd, TRUE);
if (error) {
- m_freem(nam);
+ FREE(nam, M_SONAME);
free((caddr_t)nd, M_NFSRVDESC);
return (error);
}
diff --git a/sys/nfs/nfs_srvcache.c b/sys/nfs/nfs_srvcache.c
index c2623a30a471..6c6be6d08d83 100644
--- a/sys/nfs/nfs_srvcache.c
+++ b/sys/nfs/nfs_srvcache.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_srvcache.c 8.3 (Berkeley) 3/30/95
- * $Id: nfs_srvcache.c,v 1.12 1997/05/10 16:12:03 dfr Exp $
+ * $Id: nfs_srvcache.c,v 1.13 1997/08/02 14:33:07 bde Exp $
*/
#ifndef NFS_NOSERVER
@@ -49,6 +49,7 @@
#include <sys/mbuf.h>
#include <sys/malloc.h>
#include <sys/socket.h>
+#include <sys/socketvar.h> /* for dup_sockaddr */
#include <netinet/in.h>
#ifdef ISO
@@ -239,13 +240,13 @@ loop:
if (rp->rc_flag & RC_REPMBUF)
m_freem(rp->rc_reply);
if (rp->rc_flag & RC_NAM)
- MFREE(rp->rc_nam, mb);
+ FREE(rp->rc_nam, M_SONAME);
rp->rc_flag &= (RC_LOCKED | RC_WANTED);
}
TAILQ_INSERT_TAIL(&nfsrvlruhead, rp, rc_lru);
rp->rc_state = RC_INPROG;
rp->rc_xid = nd->nd_retxid;
- saddr = mtod(nd->nd_nam, struct sockaddr_in *);
+ saddr = (struct sockaddr_in *)nd->nd_nam;
switch (saddr->sin_family) {
case AF_INET:
rp->rc_flag |= RC_INETADDR;
@@ -254,7 +255,7 @@ loop:
case AF_ISO:
default:
rp->rc_flag |= RC_NAM;
- rp->rc_nam = m_copym(nd->nd_nam, 0, M_COPYALL, M_WAIT);
+ rp->rc_nam = dup_sockaddr(nd->nd_nam, 1);
break;
};
rp->rc_proc = nd->nd_procnum;
diff --git a/sys/nfs/nfs_subs.c b/sys/nfs/nfs_subs.c
index 4c102c865edd..69baccb1d64b 100644
--- a/sys/nfs/nfs_subs.c
+++ b/sys/nfs/nfs_subs.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_subs.c 8.3 (Berkeley) 1/4/94
- * $Id: nfs_subs.c,v 1.39 1997/07/16 09:06:29 dfr Exp $
+ * $Id: nfs_subs.c,v 1.40 1997/07/22 15:35:57 dfr Exp $
*/
/*
@@ -1429,7 +1429,7 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag, pubflag)
fhandle_t *fhp;
int len;
struct nfssvc_sock *slp;
- struct mbuf *nam;
+ struct sockaddr *nam;
struct mbuf **mdp;
caddr_t *dposp;
struct vnode **retdirp;
@@ -1840,7 +1840,7 @@ nfsrv_fhtovp(fhp, lockflag, vpp, cred, slp, nam, rdonlyp, kerbflag, pubflag)
struct vnode **vpp;
struct ucred *cred;
struct nfssvc_sock *slp;
- struct mbuf *nam;
+ struct sockaddr *nam;
int *rdonlyp;
int kerbflag;
int pubflag;
@@ -1925,13 +1925,13 @@ int
netaddr_match(family, haddr, nam)
int family;
union nethostaddr *haddr;
- struct mbuf *nam;
+ struct sockaddr *nam;
{
register struct sockaddr_in *inetaddr;
switch (family) {
case AF_INET:
- inetaddr = mtod(nam, struct sockaddr_in *);
+ inetaddr = (struct sockaddr_in *)nam;
if (inetaddr->sin_family == AF_INET &&
inetaddr->sin_addr.s_addr == haddr->had_inetaddr)
return (1);
@@ -1941,8 +1941,8 @@ netaddr_match(family, haddr, nam)
{
register struct sockaddr_iso *isoaddr1, *isoaddr2;
- isoaddr1 = mtod(nam, struct sockaddr_iso *);
- isoaddr2 = mtod(haddr->had_nam, struct sockaddr_iso *);
+ isoaddr1 = (struct sockaddr_iso *)nam;
+ isoaddr2 = (struct sockaddr_iso *)haddr->had_nam;
if (isoaddr1->siso_family == AF_ISO &&
isoaddr1->siso_nlen > 0 &&
isoaddr1->siso_nlen == isoaddr2->siso_nlen &&
diff --git a/sys/nfs/nfs_syscalls.c b/sys/nfs/nfs_syscalls.c
index 0c46e2817651..ad93ce67a708 100644
--- a/sys/nfs/nfs_syscalls.c
+++ b/sys/nfs/nfs_syscalls.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_syscalls.c 8.5 (Berkeley) 3/30/95
- * $Id: nfs_syscalls.c,v 1.25 1997/06/25 21:07:26 tegge Exp $
+ * $Id: nfs_syscalls.c,v 1.26 1997/07/16 09:06:29 dfr Exp $
*/
#include <sys/param.h>
@@ -106,7 +106,7 @@ static int notstarted = 1;
static int modify_flag = 0;
static void nfsd_rt __P((int sotype, struct nfsrv_descript *nd,
int cacherep));
-static int nfssvc_addsock __P((struct file *, struct mbuf *,
+static int nfssvc_addsock __P((struct file *, struct sockaddr *,
struct proc *));
static int nfssvc_nfsd __P((struct nfsd_srvargs *,caddr_t,struct proc *));
@@ -184,7 +184,7 @@ nfssvc(p, uap, retval)
#ifndef NFS_NOSERVER
struct nameidata nd;
struct file *fp;
- struct mbuf *nam;
+ struct sockaddr *nam;
struct nfsd_args nfsdarg;
struct nfsd_srvargs nfsd_srvargs, *nsd = &nfsd_srvargs;
struct nfsd_cargs ncd;
@@ -243,10 +243,10 @@ nfssvc(p, uap, retval)
* Get the client address for connected sockets.
*/
if (nfsdarg.name == NULL || nfsdarg.namelen == 0)
- nam = (struct mbuf *)0;
+ nam = (struct sockaddr *)0;
else {
- error = sockargs(&nam, nfsdarg.name, nfsdarg.namelen,
- MT_SONAME);
+ error = getsockaddr(&nam, nfsdarg.name,
+ nfsdarg.namelen);
if (error)
return (error);
}
@@ -295,7 +295,7 @@ nfssvc(p, uap, retval)
TAILQ_REMOVE(&slp->ns_uidlruhead, nuidp,
nu_lru);
if (nuidp->nu_flag & NU_NAM)
- m_freem(nuidp->nu_nam);
+ FREE(nuidp->nu_nam, M_SONAME);
}
nuidp->nu_flag = 0;
nuidp->nu_cr = nsd->nsd_cr;
@@ -312,8 +312,8 @@ nfssvc(p, uap, retval)
if (nfsd->nfsd_nd->nd_nam2) {
struct sockaddr_in *saddr;
- saddr = mtod(nfsd->nfsd_nd->nd_nam2,
- struct sockaddr_in *);
+ saddr = (struct sockaddr_in *)
+ nfsd->nfsd_nd->nd_nam2;
switch (saddr->sin_family) {
case AF_INET:
nuidp->nu_flag |= NU_INETADDR;
@@ -323,9 +323,9 @@ nfssvc(p, uap, retval)
case AF_ISO:
default:
nuidp->nu_flag |= NU_NAM;
- nuidp->nu_nam = m_copym(
- nfsd->nfsd_nd->nd_nam2, 0,
- M_COPYALL, M_WAIT);
+ nuidp->nu_nam =
+ dup_sockaddr(nfsd->nfsd_nd->
+ nd_nam2, 1);
break;
};
}
@@ -356,7 +356,7 @@ nfssvc(p, uap, retval)
static int
nfssvc_addsock(fp, mynam, p)
struct file *fp;
- struct mbuf *mynam;
+ struct sockaddr *mynam;
struct proc *p;
{
register struct mbuf *m;
@@ -374,14 +374,14 @@ nfssvc_addsock(fp, mynam, p)
if (so->so_proto->pr_protocol == IPPROTO_UDP) {
tslp = nfs_udpsock;
if (tslp->ns_flag & SLP_VALID) {
- m_freem(mynam);
+ FREE(mynam, M_SONAME);
return (EPERM);
}
#ifdef ISO
} else if (so->so_proto->pr_protocol == ISOPROTO_CLTP) {
tslp = nfs_cltpsock;
if (tslp->ns_flag & SLP_VALID) {
- m_freem(mynam);
+ FREE(mynam, M_SONAME);
return (EPERM);
}
#endif /* ISO */
@@ -392,7 +392,7 @@ nfssvc_addsock(fp, mynam, p)
siz = NFS_MAXPACKET;
error = soreserve(so, siz, siz);
if (error) {
- m_freem(mynam);
+ FREE(mynam, M_SONAME);
return (error);
}
@@ -564,8 +564,9 @@ nfssvc_nfsd(nsd, argp, p)
*/
if (nfsd->nfsd_flag & NFSD_NEEDAUTH) {
nfsd->nfsd_flag &= ~NFSD_NEEDAUTH;
- nsd->nsd_haddr = mtod(nd->nd_nam,
- struct sockaddr_in *)->sin_addr.s_addr;
+ nsd->nsd_haddr =
+ ((struct sockaddr_in *)
+ nd->nd_nam)->sin_addr.s_addr;
nsd->nsd_authlen = nfsd->nfsd_authlen;
nsd->nsd_verflen = nfsd->nfsd_verflen;
if (!copyout(nfsd->nfsd_authstr,nsd->nsd_authstr,
@@ -607,10 +608,10 @@ nfssvc_nfsd(nsd, argp, p)
/* Check if source port is privileged */
u_short port;
u_long addr;
- struct mbuf *nam = nd->nd_nam;
+ struct sockaddr *nam = nd->nd_nam;
struct sockaddr_in *sin;
- sin = mtod(nam, struct sockaddr_in *);
+ sin = (struct sockaddr_in *)nam;
port = ntohs(sin->sin_port);
if (port >= IPPORT_RESERVED &&
nd->nd_procnum != NFSPROC_NULL) {
@@ -649,7 +650,7 @@ nfssvc_nfsd(nsd, argp, p)
nfsstats.srv_errs++;
nfsrv_updatecache(nd, FALSE, mreq);
if (nd->nd_nam2)
- m_freem(nd->nd_nam2);
+ FREE(nd->nd_nam2, M_SONAME);
break;
}
nfsstats.srvrpccnt[nd->nd_procnum]++;
@@ -688,7 +689,7 @@ nfssvc_nfsd(nsd, argp, p)
if (nfsrtton)
nfsd_rt(sotype, nd, cacherep);
if (nd->nd_nam2)
- MFREE(nd->nd_nam2, m);
+ FREE(nd->nd_nam2, M_SONAME);
if (nd->nd_mrep)
m_freem(nd->nd_mrep);
if (error == EPIPE)
@@ -706,7 +707,7 @@ nfssvc_nfsd(nsd, argp, p)
if (nfsrtton)
nfsd_rt(sotype, nd, cacherep);
m_freem(nd->nd_mrep);
- m_freem(nd->nd_nam2);
+ FREE(nd->nd_nam2, M_SONAME);
break;
};
if (nd) {
@@ -857,12 +858,12 @@ nfsrv_zapsock(slp)
soshutdown(so, 2);
closef(fp, (struct proc *)0);
if (slp->ns_nam)
- MFREE(slp->ns_nam, m);
+ FREE(slp->ns_nam, M_SONAME);
m_freem(slp->ns_raw);
while (rec = STAILQ_FIRST(&slp->ns_rec)) {
STAILQ_REMOVE_HEAD(&slp->ns_rec, nr_link);
if (rec->nr_address)
- m_freem(rec->nr_address);
+ FREE(rec->nr_address, M_SONAME);
m_freem(rec->nr_packet);
free(rec, M_NFSRVDESC);
}
@@ -872,7 +873,7 @@ nfsrv_zapsock(slp)
LIST_REMOVE(nuidp, nu_hash);
TAILQ_REMOVE(&slp->ns_uidlruhead, nuidp, nu_lru);
if (nuidp->nu_flag & NU_NAM)
- m_freem(nuidp->nu_nam);
+ FREE(nuidp->nu_nam, M_SONAME);
free((caddr_t)nuidp, M_NFSUID);
}
s = splsoftclock();
@@ -1182,8 +1183,8 @@ nfsd_rt(sotype, nd, cacherep)
else if (nd->nd_flag & ND_NFSV3)
rt->flag |= DRT_NFSV3;
rt->proc = nd->nd_procnum;
- if (mtod(nd->nd_nam, struct sockaddr *)->sa_family == AF_INET)
- rt->ipadr = mtod(nd->nd_nam, struct sockaddr_in *)->sin_addr.s_addr;
+ if (nd->nd_nam->sa_family == AF_INET)
+ rt->ipadr = ((struct sockaddr_in *)nd->nd_nam)->sin_addr.s_addr;
else
rt->ipadr = INADDR_ANY;
rt->resptime = ((time.tv_sec - nd->nd_starttime.tv_sec) * 1000000) +
diff --git a/sys/nfs/nfs_vfsops.c b/sys/nfs/nfs_vfsops.c
index f867948eeb29..12f168cc6ddb 100644
--- a/sys/nfs/nfs_vfsops.c
+++ b/sys/nfs/nfs_vfsops.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_vfsops.c 8.12 (Berkeley) 5/20/95
- * $Id: nfs_vfsops.c,v 1.43 1997/06/03 17:22:47 dfr Exp $
+ * $Id: nfs_vfsops.c,v 1.44 1997/06/27 19:10:46 wpaul Exp $
*/
#include <sys/param.h>
@@ -86,7 +86,7 @@ SYSCTL_INT(_vfs_nfs, OID_AUTO, debug, CTLFLAG_RW, &nfs_debug, 0, "");
static int nfs_iosize __P((struct nfsmount *nmp));
static int mountnfs __P((struct nfs_args *,struct mount *,
- struct mbuf *,char *,char *,struct vnode **));
+ struct sockaddr *,char *,char *,struct vnode **));
static int nfs_mount __P(( struct mount *mp, char *path, caddr_t data,
struct nameidata *ndp, struct proc *p));
static int nfs_start __P(( struct mount *mp, int flags,
@@ -102,7 +102,7 @@ static int nfs_sync __P(( struct mount *mp, int waitfor,
struct ucred *cred, struct proc *p));
static int nfs_vptofh __P(( struct vnode *vp, struct fid *fhp));
static int nfs_fhtovp __P((struct mount *mp, struct fid *fhp,
- struct mbuf *nam, struct vnode **vpp,
+ struct sockaddr *nam, struct vnode **vpp,
int *exflagsp, struct ucred **credanonp));
static int nfs_vget __P((struct mount *, ino_t, struct vnode **));
@@ -557,25 +557,24 @@ nfs_mountdiskless(path, which, mountflag, sin, args, p, vpp, mpp)
struct mount **mpp;
{
struct mount *mp;
- struct mbuf *m;
+ struct sockaddr *nam;
int error;
mp = *mpp;
- if (!mp && ( error = vfs_rootmountalloc("nfs", path, &mp))) {
+ if (!mp && (error = vfs_rootmountalloc("nfs", path, &mp))) {
printf("nfs_mountroot: NFS not configured");
return (error);
}
mp->mnt_flag = mountflag;
- MGET(m, MT_SONAME, M_WAITOK);
- bcopy((caddr_t)sin, mtod(m, caddr_t), sin->sin_len);
- m->m_len = sin->sin_len;
- if (error = mountnfs(args, mp, m, which, path, vpp)) {
+ nam = dup_sockaddr((struct sockaddr *)sin, 1);
+ if (error = mountnfs(args, mp, nam, which, path, vpp)) {
printf("nfs_mountroot: mount %s on %s: %d", path, which, error);
mp->mnt_vfc->vfc_refcount--;
vfs_unbusy(mp, p);
free(mp, M_MOUNT);
+ FREE(nam, M_SONAME);
return (error);
}
(void) copystr(which, mp->mnt_stat.f_mntonname, MNAMELEN - 1, 0);
@@ -603,7 +602,7 @@ nfs_mount(mp, path, data, ndp, p)
{
int error;
struct nfs_args args;
- struct mbuf *nam;
+ struct sockaddr *nam;
struct vnode *vp;
char pth[MNAMELEN], hst[MNAMELEN];
u_int len;
@@ -644,7 +643,7 @@ nfs_mount(mp, path, data, ndp, p)
return (error);
bzero(&hst[len], MNAMELEN - len);
/* sockargs() call must be after above copyin() calls */
- error = sockargs(&nam, (caddr_t)args.addr, args.addrlen, MT_SONAME);
+ error = getsockaddr(&nam, (caddr_t)args.addr, args.addrlen);
if (error)
return (error);
args.fh = nfh;
@@ -659,7 +658,7 @@ static int
mountnfs(argp, mp, nam, pth, hst, vpp)
register struct nfs_args *argp;
register struct mount *mp;
- struct mbuf *nam;
+ struct sockaddr *nam;
char *pth, *hst;
struct vnode **vpp;
{
@@ -671,7 +670,7 @@ mountnfs(argp, mp, nam, pth, hst, vpp)
if (mp->mnt_flag & MNT_UPDATE) {
nmp = VFSTONFS(mp);
/* update paths, file handles, etc, here XXX */
- m_freem(nam);
+ FREE(nam, M_SONAME);
return (0);
} else {
MALLOC(nmp, struct nfsmount *, sizeof (struct nfsmount),
@@ -829,7 +828,7 @@ mountnfs(argp, mp, nam, pth, hst, vpp)
bad:
nfs_disconnect(nmp);
free((caddr_t)nmp, M_NFSMNT);
- m_freem(nam);
+ FREE(nam, M_SONAME);
return (error);
}
@@ -900,7 +899,7 @@ nfs_unmount(mp, mntflags, p)
vrele(vp);
vgone(vp);
nfs_disconnect(nmp);
- m_freem(nmp->nm_nam);
+ FREE(nmp->nm_nam, M_SONAME);
if ((nmp->nm_flag & (NFSMNT_NQNFS | NFSMNT_KERB)) == 0)
free((caddr_t)nmp, M_NFSMNT);
@@ -996,7 +995,7 @@ static int
nfs_fhtovp(mp, fhp, nam, vpp, exflagsp, credanonp)
register struct mount *mp;
struct fid *fhp;
- struct mbuf *nam;
+ struct sockaddr *nam;
struct vnode **vpp;
int *exflagsp;
struct ucred **credanonp;
diff --git a/sys/nfs/nfsmount.h b/sys/nfs/nfsmount.h
index d119a204fd42..63de0add0aca 100644
--- a/sys/nfs/nfsmount.h
+++ b/sys/nfs/nfsmount.h
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfsmount.h 8.3 (Berkeley) 3/30/95
- * $Id: nfsmount.h,v 1.11 1997/02/22 09:42:48 peter Exp $
+ * $Id: nfsmount.h,v 1.12 1997/05/10 16:12:03 dfr Exp $
*/
@@ -56,7 +56,7 @@ struct nfsmount {
int nm_sotype; /* Type of socket */
int nm_soproto; /* and protocol */
int nm_soflags; /* pr_flags for socket protocol */
- struct mbuf *nm_nam; /* Addr of server */
+ struct sockaddr *nm_nam; /* Addr of server */
int nm_timeo; /* Init timer for NFSMNT_DUMBTIMR */
int nm_retry; /* Max retries */
int nm_srtt[4]; /* Timers for rpcs */
diff --git a/sys/nfs/nqnfs.h b/sys/nfs/nqnfs.h
index 7e2f749c038b..4c9108fc8be1 100644
--- a/sys/nfs/nqnfs.h
+++ b/sys/nfs/nqnfs.h
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nqnfs.h 8.3 (Berkeley) 3/30/95
- * $Id$
+ * $Id: nqnfs.h,v 1.13 1997/02/22 09:42:52 peter Exp $
*/
@@ -201,7 +201,10 @@ extern u_long nqfhhash;
#if defined(KERNEL) || defined(_KERNEL)
void nqnfs_lease_check __P((struct vnode *, struct proc *, struct ucred *, int));
void nqnfs_lease_updatetime __P((int));
-int nqsrv_getlease __P((struct vnode *,u_long *,int,struct nfssvc_sock *,struct proc *,struct mbuf *,int *,u_quad_t *,struct ucred *));
+int nqsrv_getlease __P((struct vnode *, u_long *, int,
+ struct nfssvc_sock *, struct proc *,
+ struct sockaddr *, int *, u_quad_t *,
+ struct ucred *));
int nqnfs_getlease __P((struct vnode *,int,struct ucred *,struct proc *));
int nqnfs_callback __P((struct nfsmount *,struct mbuf *,struct mbuf *,caddr_t));
int nqnfs_clientd __P((struct nfsmount *,struct ucred *,struct nfsd_cargs *,int,caddr_t,struct proc *));
diff --git a/sys/nfsclient/bootp_subr.c b/sys/nfsclient/bootp_subr.c
index 3d0f5870b137..b1fd7161dc6b 100644
--- a/sys/nfsclient/bootp_subr.c
+++ b/sys/nfsclient/bootp_subr.c
@@ -1,4 +1,4 @@
-/* $Id: bootp_subr.c,v 1.3 1997/05/14 01:31:54 tegge Exp $ */
+/* $Id: bootp_subr.c,v 1.4 1997/06/12 14:08:20 tegge Exp $ */
/*
* Copyright (c) 1995 Gordon Ross, Adam Glass
@@ -260,16 +260,13 @@ bootpc_call(call,reply,procp)
struct proc *procp;
{
struct socket *so;
- struct sockaddr_in *sin,sa;
- struct mbuf *m, *nam;
+ struct sockaddr_in *sin, sa;
+ struct mbuf *m;
struct uio auio;
struct iovec aio;
int error, rcvflg, timo, secs, len;
u_int tport;
- /* Free at end if not null. */
- nam = NULL;
-
/*
* Create socket and set its recieve timeout.
*/
@@ -310,14 +307,13 @@ bootpc_call(call,reply,procp)
/*
* Bind the local endpoint to a bootp client port.
*/
- m = m_getclr(M_WAIT, MT_SONAME);
- sin = mtod(m, struct sockaddr_in *);
- sin->sin_len = m->m_len = sizeof(*sin);
+ sin = &sa;
+ bzero(sin, sizeof *sin);
+ sin->sin_len = sizeof(*sin);
sin->sin_family = AF_INET;
sin->sin_addr.s_addr = INADDR_ANY;
sin->sin_port = htons(IPPORT_BOOTPC);
- error = sobind(so, m, procp);
- m_freem(m);
+ error = sobind(so, (struct sockaddr *)sin, procp);
if (error) {
printf("bind failed\n");
goto out;
@@ -326,19 +322,13 @@ bootpc_call(call,reply,procp)
/*
* Setup socket address for the server.
*/
- nam = m_get(M_WAIT, MT_SONAME);
- if (nam == NULL) {
- error = ENOBUFS;
- goto out;
- }
- sin = mtod(nam, struct sockaddr_in *);
- sin-> sin_len = sizeof(*sin);
- sin-> sin_family = AF_INET;
+ sin = &sa;
+ bzero(sin, sizeof *sin);
+ sin->sin_len = sizeof(*sin);
+ sin->sin_family = AF_INET;
sin->sin_addr.s_addr = INADDR_BROADCAST;
sin->sin_port = htons(IPPORT_BOOTPS);
- nam->m_len = sizeof(*sin);
-
/*
* Send it, repeatedly, until a reply is received,
* but delay each re-send by an increasing amount.
@@ -359,7 +349,8 @@ bootpc_call(call,reply,procp)
auio.uio_resid = sizeof(*call);
auio.uio_procp = procp;
- error = sosend(so, nam, &auio, NULL, NULL, 0);
+ error = sosend(so, (struct sockaddr *)sin, &auio, NULL,
+ NULL, 0, procp);
if (error) {
printf("bootpc_call: sosend: %d\n", error);
goto out;
@@ -427,7 +418,6 @@ bootpc_call(call,reply,procp)
gotreply:
out:
- if (nam) m_freem(nam);
soclose(so);
return error;
}
diff --git a/sys/nfsclient/krpc.h b/sys/nfsclient/krpc.h
index 88687ae169f5..d84768330c9f 100644
--- a/sys/nfsclient/krpc.h
+++ b/sys/nfsclient/krpc.h
@@ -1,11 +1,11 @@
/* $NetBSD: krpc.h,v 1.4 1995/12/19 23:07:11 cgd Exp $ */
-/* $Id: krpc.h,v 1.2 1997/05/11 18:05:39 tegge Exp $ */
+/* $Id: krpc.h,v 1.3 1997/06/12 14:03:16 tegge Exp $ */
#include <sys/cdefs.h>
int krpc_call __P((struct sockaddr_in *sin,
u_int prog, u_int vers, u_int func,
- struct mbuf **data, struct mbuf **from, struct proc *procp));
+ struct mbuf **data, struct sockaddr **from, struct proc *procp));
int krpc_portmap __P((struct sockaddr_in *sin,
u_int prog, u_int vers, u_int16_t *portp,struct proc *procp));
diff --git a/sys/nfsclient/krpc_subr.c b/sys/nfsclient/krpc_subr.c
index e3eadb6616fc..2d8ca1d4c0c1 100644
--- a/sys/nfsclient/krpc_subr.c
+++ b/sys/nfsclient/krpc_subr.c
@@ -1,5 +1,5 @@
/* $NetBSD: krpc_subr.c,v 1.12.4.1 1996/06/07 00:52:26 cgd Exp $ */
-/* $Id: krpc_subr.c,v 1.2 1997/05/11 18:05:39 tegge Exp $ */
+/* $Id: krpc_subr.c,v 1.3 1997/06/12 14:03:16 tegge Exp $ */
/*
* Copyright (c) 1995 Gordon Ross, Adam Glass
@@ -192,12 +192,13 @@ krpc_call(sa, prog, vers, func, data, from_p, procp)
struct sockaddr_in *sa;
u_int prog, vers, func;
struct mbuf **data; /* input/output */
- struct mbuf **from_p; /* output */
+ struct sockaddr **from_p; /* output */
struct proc *procp;
{
struct socket *so;
- struct sockaddr_in *sin;
- struct mbuf *m, *nam, *mhead, *from;
+ struct sockaddr_in *sin, ssin;
+ struct sockaddr *from;
+ struct mbuf *m, *nam, *mhead;
struct rpc_call *call;
struct rpc_reply *reply;
struct uio auio;
@@ -258,19 +259,18 @@ krpc_call(sa, prog, vers, func, data, from_p, procp)
* because some NFS servers refuse requests from
* non-reserved (non-privileged) ports.
*/
- m = m_getclr(M_WAIT, MT_SONAME);
- sin = mtod(m, struct sockaddr_in *);
- sin->sin_len = m->m_len = sizeof(*sin);
+ sin = &ssin;
+ bzero(sin, sizeof *sin);
+ sin->sin_len = sizeof(*sin);
sin->sin_family = AF_INET;
sin->sin_addr.s_addr = INADDR_ANY;
tport = IPPORT_RESERVED;
do {
tport--;
sin->sin_port = htons(tport);
- error = sobind(so, m, procp);
+ error = sobind(so, (struct sockaddr *)sin, procp);
} while (error == EADDRINUSE &&
tport > IPPORT_RESERVED / 2);
- m_freem(m);
if (error) {
printf("bind failed\n");
goto out;
@@ -279,14 +279,6 @@ krpc_call(sa, prog, vers, func, data, from_p, procp)
/*
* Setup socket address for the server.
*/
- nam = m_get(M_WAIT, MT_SONAME);
- if (nam == NULL) {
- error = ENOBUFS;
- goto out;
- }
- sin = mtod(nam, struct sockaddr_in *);
- bcopy((caddr_t)sa, (caddr_t)sin,
- (nam->m_len = sa->sin_len));
/*
* Prepend RPC message header.
@@ -336,7 +328,8 @@ krpc_call(sa, prog, vers, func, data, from_p, procp)
error = ENOBUFS;
goto out;
}
- error = sosend(so, nam, NULL, m, NULL, 0);
+ error = sosend(so, (struct sockaddr *)sa, NULL, m,
+ NULL, 0, 0);
if (error) {
printf("krpc_call: sosend: %d\n", error);
goto out;
@@ -357,7 +350,7 @@ krpc_call(sa, prog, vers, func, data, from_p, procp)
secs = timo;
while (secs > 0) {
if (from) {
- m_freem(from);
+ FREE(from, M_SONAME);
from = NULL;
}
if (m) {
@@ -445,9 +438,8 @@ krpc_call(sa, prog, vers, func, data, from_p, procp)
}
out:
- if (nam) m_freem(nam);
if (mhead) m_freem(mhead);
- if (from) m_freem(from);
+ if (from) free(from, M_SONAME);
soclose(so);
return error;
}
diff --git a/sys/nfsclient/nfs.h b/sys/nfsclient/nfs.h
index 528a366c1e67..e1a47551689b 100644
--- a/sys/nfsclient/nfs.h
+++ b/sys/nfsclient/nfs.h
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs.h 8.4 (Berkeley) 5/1/95
- * $Id: nfs.h,v 1.28 1997/06/03 17:22:45 dfr Exp $
+ * $Id: nfs.h,v 1.29 1997/07/16 09:06:27 dfr Exp $
*/
#ifndef _NFS_NFS_H_
@@ -382,7 +382,7 @@ extern TAILQ_HEAD(nfs_reqq, nfsreq) nfs_reqq;
*/
union nethostaddr {
u_long had_inetaddr;
- struct mbuf *had_nam;
+ struct sockaddr *had_nam;
};
struct nfsuid {
@@ -406,7 +406,7 @@ struct nfsuid {
struct nfsrv_rec {
STAILQ_ENTRY(nfsrv_rec) nr_link;
- struct mbuf *nr_address;
+ struct sockaddr *nr_address;
struct mbuf *nr_packet;
};
@@ -415,7 +415,7 @@ struct nfssvc_sock {
TAILQ_HEAD(, nfsuid) ns_uidlruhead;
struct file *ns_fp;
struct socket *ns_so;
- struct mbuf *ns_nam;
+ struct sockaddr *ns_nam;
struct mbuf *ns_raw;
struct mbuf *ns_rawend;
STAILQ_HEAD(, nfsrv_rec) ns_rec;
@@ -480,8 +480,8 @@ struct nfsrv_descript {
struct mbuf *nd_mrep; /* Request mbuf list */
struct mbuf *nd_md; /* Current dissect mbuf */
struct mbuf *nd_mreq; /* Reply mbuf list */
- struct mbuf *nd_nam; /* and socket addr */
- struct mbuf *nd_nam2; /* return socket addr */
+ struct sockaddr *nd_nam; /* and socket addr */
+ struct sockaddr *nd_nam2; /* return socket addr */
caddr_t nd_dpos; /* Current dissect pos */
u_int32_t nd_procnum; /* RPC # */
int nd_stable; /* storage type */
@@ -567,70 +567,91 @@ extern int nfs_debug;
int nfs_init __P((struct vfsconf *vfsp));
int nfs_reply __P((struct nfsreq *));
int nfs_getreq __P((struct nfsrv_descript *,struct nfsd *,int));
-int nfs_send __P((struct socket *,struct mbuf *,struct mbuf *,struct nfsreq *));
-int nfs_rephead __P((int,struct nfsrv_descript *,struct nfssvc_sock *,int,int,u_quad_t *,struct mbuf **,struct mbuf **,caddr_t *));
-int nfs_sndlock __P((int *,struct nfsreq *));
+int nfs_send __P((struct socket *, struct sockaddr *, struct mbuf *,
+ struct nfsreq *));
+int nfs_rephead __P((int, struct nfsrv_descript *, struct nfssvc_sock *,
+ int, int, u_quad_t *, struct mbuf **, struct mbuf **,
+ caddr_t *));
+int nfs_sndlock __P((int *, struct nfsreq *));
void nfs_sndunlock __P((int *flagp));
-int nfs_disct __P((struct mbuf **,caddr_t *,int,int,caddr_t *));
-int nfs_vinvalbuf __P((struct vnode *,int,struct ucred *,struct proc *,int));
-int nfs_readrpc __P((struct vnode *,struct uio *,struct ucred *));
-int nfs_writerpc __P((struct vnode *,struct uio *,struct ucred *,int *,int *));
-int nfs_readdirrpc __P((register struct vnode *,struct uio *,struct ucred *));
-int nfs_asyncio __P((struct buf *,struct ucred *));
-int nfs_doio __P((struct buf *,struct ucred *,struct proc *));
-int nfs_readlinkrpc __P((struct vnode *,struct uio *,struct ucred *));
-int nfs_sigintr __P((struct nfsmount *,struct nfsreq *r,struct proc *));
-int nfs_readdirplusrpc __P((struct vnode *,register struct uio *,struct ucred *));
-int nfsm_disct __P((struct mbuf **,caddr_t *,int,int,caddr_t *));
-void nfsm_srvfattr __P((struct nfsrv_descript *,struct vattr *,struct nfs_fattr *));
-void nfsm_srvwcc __P((struct nfsrv_descript *,int,struct vattr *,int,struct vattr *,struct mbuf **,char **));
-void nfsm_srvpostopattr __P((struct nfsrv_descript *,int,struct vattr *,struct mbuf **,char **));
-int netaddr_match __P((int,union nethostaddr *,struct mbuf *));
-int nfs_request __P((struct vnode *,struct mbuf *,int,struct proc *,struct ucred *,struct mbuf **,struct mbuf **,caddr_t *));
-int nfs_loadattrcache __P((struct vnode **,struct mbuf **,caddr_t *,struct vattr *));
-int nfs_namei __P((struct nameidata *,fhandle_t *,int,struct nfssvc_sock *,struct mbuf *,struct mbuf **,caddr_t *,struct vnode **,struct proc *,int,int));
-void nfsm_adj __P((struct mbuf *,int,int));
-int nfsm_mbuftouio __P((struct mbuf **,struct uio *,int,caddr_t *));
+int nfs_disct __P((struct mbuf **, caddr_t *, int, int, caddr_t *));
+int nfs_vinvalbuf __P((struct vnode *, int, struct ucred *, struct proc *,
+ int));
+int nfs_readrpc __P((struct vnode *, struct uio *, struct ucred *));
+int nfs_writerpc __P((struct vnode *, struct uio *, struct ucred *, int *,
+ int *));
+int nfs_readdirrpc __P((struct vnode *, struct uio *, struct ucred *));
+int nfs_asyncio __P((struct buf *, struct ucred *));
+int nfs_doio __P((struct buf *, struct ucred *, struct proc *));
+int nfs_readlinkrpc __P((struct vnode *, struct uio *, struct ucred *));
+int nfs_sigintr __P((struct nfsmount *, struct nfsreq *, struct proc *));
+int nfs_readdirplusrpc __P((struct vnode *, struct uio *, struct ucred *));
+int nfsm_disct __P((struct mbuf **, caddr_t *, int, int, caddr_t *));
+void nfsm_srvfattr __P((struct nfsrv_descript *, struct vattr *,
+ struct nfs_fattr *));
+void nfsm_srvwcc __P((struct nfsrv_descript *, int, struct vattr *, int,
+ struct vattr *, struct mbuf **, char **));
+void nfsm_srvpostopattr __P((struct nfsrv_descript *, int, struct vattr *,
+ struct mbuf **, char **));
+int netaddr_match __P((int, union nethostaddr *, struct sockaddr *));
+int nfs_request __P((struct vnode *, struct mbuf *, int, struct proc *,
+ struct ucred *, struct mbuf **, struct mbuf **,
+ caddr_t *));
+int nfs_loadattrcache __P((struct vnode **, struct mbuf **, caddr_t *,
+ struct vattr *));
+int nfs_namei __P((struct nameidata *, fhandle_t *, int,
+ struct nfssvc_sock *, struct sockaddr *, struct mbuf **,
+ caddr_t *, struct vnode **, struct proc *, int, int));
+void nfsm_adj __P((struct mbuf *, int, int));
+int nfsm_mbuftouio __P((struct mbuf **, struct uio *, int, caddr_t *));
void nfsrv_initcache __P((void));
-int nfs_getauth __P((struct nfsmount *,struct nfsreq *,struct ucred *,char **,int *,char *,int *,NFSKERBKEY_T));
-int nfs_getnickauth __P((struct nfsmount *,struct ucred *,char **,int *,char *,int));
-int nfs_savenickauth __P((struct nfsmount *,struct ucred *,int,NFSKERBKEY_T,struct mbuf **,char **,struct mbuf *));
-int nfs_adv __P((struct mbuf **,caddr_t *,int,int));
+int nfs_getauth __P((struct nfsmount *, struct nfsreq *, struct ucred *,
+ char **, int *, char *, int *, NFSKERBKEY_T));
+int nfs_getnickauth __P((struct nfsmount *, struct ucred *, char **,
+ int *, char *, int));
+int nfs_savenickauth __P((struct nfsmount *, struct ucred *, int,
+ NFSKERBKEY_T, struct mbuf **, char **,
+ struct mbuf *));
+int nfs_adv __P((struct mbuf **, caddr_t *, int, int));
void nfs_nhinit __P((void));
void nfs_timer __P((void*));
-u_long nfs_hash __P((nfsfh_t *,int));
-int nfsrv_dorec __P((struct nfssvc_sock *,struct nfsd *,struct nfsrv_descript **));
-int nfsrv_getcache __P((struct nfsrv_descript *,struct nfssvc_sock *,struct mbuf **));
-void nfsrv_updatecache __P((struct nfsrv_descript *,int,struct mbuf *));
+u_long nfs_hash __P((nfsfh_t *, int));
+int nfsrv_dorec __P((struct nfssvc_sock *, struct nfsd *,
+ struct nfsrv_descript **));
+int nfsrv_getcache __P((struct nfsrv_descript *, struct nfssvc_sock *,
+ struct mbuf **));
+void nfsrv_updatecache __P((struct nfsrv_descript *, int, struct mbuf *));
void nfsrv_cleancache __P((void));
-int nfs_connect __P((struct nfsmount *,struct nfsreq *));
+int nfs_connect __P((struct nfsmount *, struct nfsreq *));
void nfs_disconnect __P((struct nfsmount *));
-int nfs_getattrcache __P((struct vnode *,struct vattr *));
-int nfsm_strtmbuf __P((struct mbuf **,char **,char *,long));
-int nfs_bioread __P((struct vnode *,struct uio *,int,struct ucred *, int getpages));
-int nfsm_uiotombuf __P((struct uio *,struct mbuf **,int,caddr_t *));
+int nfs_getattrcache __P((struct vnode *, struct vattr *));
+int nfsm_strtmbuf __P((struct mbuf **, char **, char *, long));
+int nfs_bioread __P((struct vnode *, struct uio *, int, struct ucred *,
+ int));
+int nfsm_uiotombuf __P((struct uio *, struct mbuf **, int, caddr_t *));
void nfsrv_init __P((int));
void nfs_clearcommit __P((struct mount *));
int nfsrv_errmap __P((struct nfsrv_descript *, int));
-void nfsrvw_sort __P((gid_t [],int));
-void nfsrv_setcred __P((struct ucred *,struct ucred *));
-int nfs_writebp __P((struct buf *,int));
-int nfsrv_object_create __P(( struct vnode * ));
+void nfsrvw_sort __P((gid_t *, int));
+void nfsrv_setcred __P((struct ucred *, struct ucred *));
+int nfs_writebp __P((struct buf *, int));
+int nfsrv_object_create __P((struct vnode *));
void nfsrv_wakenfsd __P((struct nfssvc_sock *slp));
int nfsrv_writegather __P((struct nfsrv_descript **, struct nfssvc_sock *,
struct proc *, struct mbuf **));
int nfs_fsinfo __P((struct nfsmount *, struct vnode *, struct ucred *,
struct proc *p));
-int nfsrv3_access __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
+int nfsrv3_access __P((struct nfsrv_descript *nfsd,
+ struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
int nfsrv_commit __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
int nfsrv_create __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
-int nfsrv_fhtovp __P((fhandle_t *,int,struct vnode **,
- struct ucred *,struct nfssvc_sock *,struct mbuf *,
- int *,int,int));
+int nfsrv_fhtovp __P((fhandle_t *, int, struct vnode **, struct ucred *,
+ struct nfssvc_sock *, struct sockaddr *, int *,
+ int, int));
int nfsrv_setpublicfs __P((struct mount *, struct netexport *,
struct export_args *));
int nfs_ispublicfh __P((fhandle_t *));
@@ -655,7 +676,8 @@ int nfsrv_pathconf __P((struct nfsrv_descript *nfsd,
struct mbuf **mrq));
int nfsrv_read __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
-int nfsrv_readdir __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
+int nfsrv_readdir __P((struct nfsrv_descript *nfsd,
+ struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
int nfsrv_readdirplus __P((struct nfsrv_descript *nfsd,
struct nfssvc_sock *slp, struct proc *procp,
@@ -669,11 +691,14 @@ int nfsrv_rename __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
int nfsrv_rmdir __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
-int nfsrv_setattr __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
+int nfsrv_setattr __P((struct nfsrv_descript *nfsd,
+ struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
-int nfsrv_statfs __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
+int nfsrv_statfs __P((struct nfsrv_descript *nfsd,
+ struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
-int nfsrv_symlink __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
+int nfsrv_symlink __P((struct nfsrv_descript *nfsd,
+ struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
int nfsrv_write __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
diff --git a/sys/nfsclient/nfs_nfsiod.c b/sys/nfsclient/nfs_nfsiod.c
index 0c46e2817651..ad93ce67a708 100644
--- a/sys/nfsclient/nfs_nfsiod.c
+++ b/sys/nfsclient/nfs_nfsiod.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_syscalls.c 8.5 (Berkeley) 3/30/95
- * $Id: nfs_syscalls.c,v 1.25 1997/06/25 21:07:26 tegge Exp $
+ * $Id: nfs_syscalls.c,v 1.26 1997/07/16 09:06:29 dfr Exp $
*/
#include <sys/param.h>
@@ -106,7 +106,7 @@ static int notstarted = 1;
static int modify_flag = 0;
static void nfsd_rt __P((int sotype, struct nfsrv_descript *nd,
int cacherep));
-static int nfssvc_addsock __P((struct file *, struct mbuf *,
+static int nfssvc_addsock __P((struct file *, struct sockaddr *,
struct proc *));
static int nfssvc_nfsd __P((struct nfsd_srvargs *,caddr_t,struct proc *));
@@ -184,7 +184,7 @@ nfssvc(p, uap, retval)
#ifndef NFS_NOSERVER
struct nameidata nd;
struct file *fp;
- struct mbuf *nam;
+ struct sockaddr *nam;
struct nfsd_args nfsdarg;
struct nfsd_srvargs nfsd_srvargs, *nsd = &nfsd_srvargs;
struct nfsd_cargs ncd;
@@ -243,10 +243,10 @@ nfssvc(p, uap, retval)
* Get the client address for connected sockets.
*/
if (nfsdarg.name == NULL || nfsdarg.namelen == 0)
- nam = (struct mbuf *)0;
+ nam = (struct sockaddr *)0;
else {
- error = sockargs(&nam, nfsdarg.name, nfsdarg.namelen,
- MT_SONAME);
+ error = getsockaddr(&nam, nfsdarg.name,
+ nfsdarg.namelen);
if (error)
return (error);
}
@@ -295,7 +295,7 @@ nfssvc(p, uap, retval)
TAILQ_REMOVE(&slp->ns_uidlruhead, nuidp,
nu_lru);
if (nuidp->nu_flag & NU_NAM)
- m_freem(nuidp->nu_nam);
+ FREE(nuidp->nu_nam, M_SONAME);
}
nuidp->nu_flag = 0;
nuidp->nu_cr = nsd->nsd_cr;
@@ -312,8 +312,8 @@ nfssvc(p, uap, retval)
if (nfsd->nfsd_nd->nd_nam2) {
struct sockaddr_in *saddr;
- saddr = mtod(nfsd->nfsd_nd->nd_nam2,
- struct sockaddr_in *);
+ saddr = (struct sockaddr_in *)
+ nfsd->nfsd_nd->nd_nam2;
switch (saddr->sin_family) {
case AF_INET:
nuidp->nu_flag |= NU_INETADDR;
@@ -323,9 +323,9 @@ nfssvc(p, uap, retval)
case AF_ISO:
default:
nuidp->nu_flag |= NU_NAM;
- nuidp->nu_nam = m_copym(
- nfsd->nfsd_nd->nd_nam2, 0,
- M_COPYALL, M_WAIT);
+ nuidp->nu_nam =
+ dup_sockaddr(nfsd->nfsd_nd->
+ nd_nam2, 1);
break;
};
}
@@ -356,7 +356,7 @@ nfssvc(p, uap, retval)
static int
nfssvc_addsock(fp, mynam, p)
struct file *fp;
- struct mbuf *mynam;
+ struct sockaddr *mynam;
struct proc *p;
{
register struct mbuf *m;
@@ -374,14 +374,14 @@ nfssvc_addsock(fp, mynam, p)
if (so->so_proto->pr_protocol == IPPROTO_UDP) {
tslp = nfs_udpsock;
if (tslp->ns_flag & SLP_VALID) {
- m_freem(mynam);
+ FREE(mynam, M_SONAME);
return (EPERM);
}
#ifdef ISO
} else if (so->so_proto->pr_protocol == ISOPROTO_CLTP) {
tslp = nfs_cltpsock;
if (tslp->ns_flag & SLP_VALID) {
- m_freem(mynam);
+ FREE(mynam, M_SONAME);
return (EPERM);
}
#endif /* ISO */
@@ -392,7 +392,7 @@ nfssvc_addsock(fp, mynam, p)
siz = NFS_MAXPACKET;
error = soreserve(so, siz, siz);
if (error) {
- m_freem(mynam);
+ FREE(mynam, M_SONAME);
return (error);
}
@@ -564,8 +564,9 @@ nfssvc_nfsd(nsd, argp, p)
*/
if (nfsd->nfsd_flag & NFSD_NEEDAUTH) {
nfsd->nfsd_flag &= ~NFSD_NEEDAUTH;
- nsd->nsd_haddr = mtod(nd->nd_nam,
- struct sockaddr_in *)->sin_addr.s_addr;
+ nsd->nsd_haddr =
+ ((struct sockaddr_in *)
+ nd->nd_nam)->sin_addr.s_addr;
nsd->nsd_authlen = nfsd->nfsd_authlen;
nsd->nsd_verflen = nfsd->nfsd_verflen;
if (!copyout(nfsd->nfsd_authstr,nsd->nsd_authstr,
@@ -607,10 +608,10 @@ nfssvc_nfsd(nsd, argp, p)
/* Check if source port is privileged */
u_short port;
u_long addr;
- struct mbuf *nam = nd->nd_nam;
+ struct sockaddr *nam = nd->nd_nam;
struct sockaddr_in *sin;
- sin = mtod(nam, struct sockaddr_in *);
+ sin = (struct sockaddr_in *)nam;
port = ntohs(sin->sin_port);
if (port >= IPPORT_RESERVED &&
nd->nd_procnum != NFSPROC_NULL) {
@@ -649,7 +650,7 @@ nfssvc_nfsd(nsd, argp, p)
nfsstats.srv_errs++;
nfsrv_updatecache(nd, FALSE, mreq);
if (nd->nd_nam2)
- m_freem(nd->nd_nam2);
+ FREE(nd->nd_nam2, M_SONAME);
break;
}
nfsstats.srvrpccnt[nd->nd_procnum]++;
@@ -688,7 +689,7 @@ nfssvc_nfsd(nsd, argp, p)
if (nfsrtton)
nfsd_rt(sotype, nd, cacherep);
if (nd->nd_nam2)
- MFREE(nd->nd_nam2, m);
+ FREE(nd->nd_nam2, M_SONAME);
if (nd->nd_mrep)
m_freem(nd->nd_mrep);
if (error == EPIPE)
@@ -706,7 +707,7 @@ nfssvc_nfsd(nsd, argp, p)
if (nfsrtton)
nfsd_rt(sotype, nd, cacherep);
m_freem(nd->nd_mrep);
- m_freem(nd->nd_nam2);
+ FREE(nd->nd_nam2, M_SONAME);
break;
};
if (nd) {
@@ -857,12 +858,12 @@ nfsrv_zapsock(slp)
soshutdown(so, 2);
closef(fp, (struct proc *)0);
if (slp->ns_nam)
- MFREE(slp->ns_nam, m);
+ FREE(slp->ns_nam, M_SONAME);
m_freem(slp->ns_raw);
while (rec = STAILQ_FIRST(&slp->ns_rec)) {
STAILQ_REMOVE_HEAD(&slp->ns_rec, nr_link);
if (rec->nr_address)
- m_freem(rec->nr_address);
+ FREE(rec->nr_address, M_SONAME);
m_freem(rec->nr_packet);
free(rec, M_NFSRVDESC);
}
@@ -872,7 +873,7 @@ nfsrv_zapsock(slp)
LIST_REMOVE(nuidp, nu_hash);
TAILQ_REMOVE(&slp->ns_uidlruhead, nuidp, nu_lru);
if (nuidp->nu_flag & NU_NAM)
- m_freem(nuidp->nu_nam);
+ FREE(nuidp->nu_nam, M_SONAME);
free((caddr_t)nuidp, M_NFSUID);
}
s = splsoftclock();
@@ -1182,8 +1183,8 @@ nfsd_rt(sotype, nd, cacherep)
else if (nd->nd_flag & ND_NFSV3)
rt->flag |= DRT_NFSV3;
rt->proc = nd->nd_procnum;
- if (mtod(nd->nd_nam, struct sockaddr *)->sa_family == AF_INET)
- rt->ipadr = mtod(nd->nd_nam, struct sockaddr_in *)->sin_addr.s_addr;
+ if (nd->nd_nam->sa_family == AF_INET)
+ rt->ipadr = ((struct sockaddr_in *)nd->nd_nam)->sin_addr.s_addr;
else
rt->ipadr = INADDR_ANY;
rt->resptime = ((time.tv_sec - nd->nd_starttime.tv_sec) * 1000000) +
diff --git a/sys/nfsclient/nfs_socket.c b/sys/nfsclient/nfs_socket.c
index 0ea7f690f274..4b41e67f6a22 100644
--- a/sys/nfsclient/nfs_socket.c
+++ b/sys/nfsclient/nfs_socket.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_socket.c 8.5 (Berkeley) 3/30/95
- * $Id: nfs_socket.c,v 1.25 1997/05/13 17:25:44 dfr Exp $
+ * $Id: nfs_socket.c,v 1.26 1997/06/03 17:22:46 dfr Exp $
*/
/*
@@ -138,7 +138,7 @@ static int nfs_msg __P((struct proc *,char *,char *));
static int nfs_rcvlock __P((struct nfsreq *));
static void nfs_rcvunlock __P((int *flagp));
static void nfs_realign __P((struct mbuf *m, int hsiz));
-static int nfs_receive __P((struct nfsreq *rep, struct mbuf **aname,
+static int nfs_receive __P((struct nfsreq *rep, struct sockaddr **aname,
struct mbuf **mp));
static int nfs_reconnect __P((struct nfsreq *rep));
#ifndef NFS_NOSERVER
@@ -195,7 +195,7 @@ nfs_connect(nmp, rep)
struct proc *p = &proc0; /* only used for socreate and sobind */
nmp->nm_so = (struct socket *)0;
- saddr = mtod(nmp->nm_nam, struct sockaddr *);
+ saddr = nmp->nm_nam;
error = socreate(saddr->sa_family, &nmp->nm_so, nmp->nm_sotype,
nmp->nm_soproto, p);
if (error)
@@ -207,17 +207,18 @@ nfs_connect(nmp, rep)
* Some servers require that the client port be a reserved port number.
*/
if (saddr->sa_family == AF_INET && (nmp->nm_flag & NFSMNT_RESVPORT)) {
- MGET(m, M_WAIT, MT_SONAME);
- sin = mtod(m, struct sockaddr_in *);
- sin->sin_len = m->m_len = sizeof (struct sockaddr_in);
+ struct sockaddr_in ssin;
+ bzero(&ssin, sizeof ssin);
+ sin = &ssin;
+ sin->sin_len = sizeof (struct sockaddr_in);
sin->sin_family = AF_INET;
sin->sin_addr.s_addr = INADDR_ANY;
tport = IPPORT_RESERVED - 1;
sin->sin_port = htons(tport);
- while ((error = sobind(so, m, p)) == EADDRINUSE &&
+ while ((error = sobind(so, (struct sockaddr *)sin, p))
+ == EADDRINUSE &&
--tport > IPPORT_RESERVED / 2)
sin->sin_port = htons(tport);
- m_freem(m);
if (error)
goto bad;
}
@@ -232,6 +233,7 @@ nfs_connect(nmp, rep)
goto bad;
}
} else {
+ /* XXX should not use mbuf */
error = soconnect(so, nmp->nm_nam, p);
if (error)
goto bad;
@@ -383,11 +385,11 @@ nfs_disconnect(nmp)
int
nfs_send(so, nam, top, rep)
register struct socket *so;
- struct mbuf *nam;
+ struct sockaddr *nam;
register struct mbuf *top;
struct nfsreq *rep;
{
- struct mbuf *sendnam;
+ struct sockaddr *sendnam;
int error, soflags, flags;
if (rep) {
@@ -405,7 +407,7 @@ nfs_send(so, nam, top, rep)
} else
soflags = so->so_proto->pr_flags;
if ((soflags & PR_CONNREQUIRED) || (so->so_state & SS_ISCONNECTED))
- sendnam = (struct mbuf *)0;
+ sendnam = (struct sockaddr *)0;
else
sendnam = nam;
if (so->so_type == SOCK_SEQPACKET)
@@ -414,10 +416,11 @@ nfs_send(so, nam, top, rep)
flags = 0;
error = so->so_proto->pr_usrreqs->pru_sosend(so, sendnam, 0, top, 0,
- flags);
+ flags, curproc /*XXX*/);
if (error) {
if (rep) {
- log(LOG_INFO, "nfs send error %d for server %s\n",error,
+ log(LOG_INFO, "nfs send error %d for server %s\n",
+ error,
rep->r_nmp->nm_mountp->mnt_stat.f_mntfromname);
/*
* Deal with errors for the client side.
@@ -451,7 +454,7 @@ nfs_send(so, nam, top, rep)
static int
nfs_receive(rep, aname, mp)
register struct nfsreq *rep;
- struct mbuf **aname;
+ struct sockaddr **aname;
struct mbuf **mp;
{
register struct socket *so;
@@ -460,7 +463,7 @@ nfs_receive(rep, aname, mp)
register struct mbuf *m;
struct mbuf *control;
u_long len;
- struct mbuf **getnam;
+ struct sockaddr **getnam;
int error, sotype, rcvflg;
struct proc *p = curproc; /* XXX */
@@ -468,7 +471,7 @@ nfs_receive(rep, aname, mp)
* Set up arguments for soreceive()
*/
*mp = (struct mbuf *)0;
- *aname = (struct mbuf *)0;
+ *aname = (struct sockaddr *)0;
sotype = rep->r_nmp->nm_sotype;
/*
@@ -533,7 +536,7 @@ tryagain:
do {
rcvflg = MSG_WAITALL;
error = so->so_proto->pr_usrreqs->pru_soreceive
- (so, (struct mbuf **)0, &auio,
+ (so, (struct sockaddr **)0, &auio,
(struct mbuf **)0, (struct mbuf **)0,
&rcvflg);
if (error == EWOULDBLOCK && rep) {
@@ -568,7 +571,7 @@ tryagain:
do {
rcvflg = MSG_WAITALL;
error = so->so_proto->pr_usrreqs->pru_soreceive
- (so, (struct mbuf **)0,
+ (so, (struct sockaddr **)0,
&auio, mp, (struct mbuf **)0, &rcvflg);
} while (error == EWOULDBLOCK || error == EINTR ||
error == ERESTART);
@@ -593,7 +596,7 @@ tryagain:
do {
rcvflg = 0;
error = so->so_proto->pr_usrreqs->pru_soreceive
- (so, (struct mbuf **)0,
+ (so, (struct sockaddr **)0,
&auio, mp, &control, &rcvflg);
if (control)
m_freem(control);
@@ -628,7 +631,7 @@ errout:
if ((so = rep->r_nmp->nm_so) == NULL)
return (EACCES);
if (so->so_state & SS_ISCONNECTED)
- getnam = (struct mbuf **)0;
+ getnam = (struct sockaddr **)0;
else
getnam = aname;
auio.uio_resid = len = 1000000;
@@ -671,7 +674,8 @@ nfs_reply(myrep)
register struct nfsreq *rep;
register struct nfsmount *nmp = myrep->r_nmp;
register long t1;
- struct mbuf *mrep, *nam, *md;
+ struct mbuf *mrep, *md;
+ struct sockaddr *nam;
u_long rxid, *tl;
caddr_t dpos, cp2;
int error;
@@ -715,7 +719,7 @@ nfs_reply(myrep)
return (error);
}
if (nam)
- m_freem(nam);
+ FREE(nam, M_SONAME);
/*
* Get the xid and check that it is an rpc reply
@@ -1356,7 +1360,7 @@ nfs_timer(arg)
(m = m_copym(rep->r_mreq, 0, M_COPYALL, M_DONTWAIT))){
if ((nmp->nm_flag & NFSMNT_NOCONN) == 0)
error = (*so->so_proto->pr_usrreqs->pru_send)
- (so, 0, m, (struct mbuf *)0,
+ (so, 0, m, (struct sockaddr *)0,
(struct mbuf *)0, p);
else
error = (*so->so_proto->pr_usrreqs->pru_send)
@@ -1642,7 +1646,8 @@ nfsrv_rcv(so, arg, waitflag)
{
register struct nfssvc_sock *slp = (struct nfssvc_sock *)arg;
register struct mbuf *m;
- struct mbuf *mp, *nam;
+ struct mbuf *mp;
+ struct sockaddr *nam;
struct uio auio;
int flags, error;
@@ -1717,7 +1722,7 @@ nfsrv_rcv(so, arg, waitflag)
M_NFSRVDESC, waitflag);
if (!rec) {
if (nam)
- m_freem(nam);
+ FREE(nam, M_SONAME);
m_freem(mp);
continue;
}
@@ -1864,7 +1869,7 @@ nfsrv_getstream(slp, waitflag)
m_freem(slp->ns_frag);
} else {
nfs_realign(slp->ns_frag, 10 * NFSX_UNSIGNED);
- rec->nr_address = (struct mbuf*)0;
+ rec->nr_address = (struct sockaddr *)0;
rec->nr_packet = slp->ns_frag;
STAILQ_INSERT_TAIL(&slp->ns_rec, rec, nr_link);
}
@@ -1883,7 +1888,8 @@ nfsrv_dorec(slp, nfsd, ndp)
struct nfsrv_descript **ndp;
{
struct nfsrv_rec *rec;
- register struct mbuf *m, *nam;
+ register struct mbuf *m;
+ struct sockaddr *nam;
register struct nfsrv_descript *nd;
int error;
@@ -1902,7 +1908,7 @@ nfsrv_dorec(slp, nfsd, ndp)
nd->nd_dpos = mtod(m, caddr_t);
error = nfs_getreq(nd, nfsd, TRUE);
if (error) {
- m_freem(nam);
+ FREE(nam, M_SONAME);
free((caddr_t)nd, M_NFSRVDESC);
return (error);
}
diff --git a/sys/nfsclient/nfs_subs.c b/sys/nfsclient/nfs_subs.c
index 4c102c865edd..69baccb1d64b 100644
--- a/sys/nfsclient/nfs_subs.c
+++ b/sys/nfsclient/nfs_subs.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_subs.c 8.3 (Berkeley) 1/4/94
- * $Id: nfs_subs.c,v 1.39 1997/07/16 09:06:29 dfr Exp $
+ * $Id: nfs_subs.c,v 1.40 1997/07/22 15:35:57 dfr Exp $
*/
/*
@@ -1429,7 +1429,7 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag, pubflag)
fhandle_t *fhp;
int len;
struct nfssvc_sock *slp;
- struct mbuf *nam;
+ struct sockaddr *nam;
struct mbuf **mdp;
caddr_t *dposp;
struct vnode **retdirp;
@@ -1840,7 +1840,7 @@ nfsrv_fhtovp(fhp, lockflag, vpp, cred, slp, nam, rdonlyp, kerbflag, pubflag)
struct vnode **vpp;
struct ucred *cred;
struct nfssvc_sock *slp;
- struct mbuf *nam;
+ struct sockaddr *nam;
int *rdonlyp;
int kerbflag;
int pubflag;
@@ -1925,13 +1925,13 @@ int
netaddr_match(family, haddr, nam)
int family;
union nethostaddr *haddr;
- struct mbuf *nam;
+ struct sockaddr *nam;
{
register struct sockaddr_in *inetaddr;
switch (family) {
case AF_INET:
- inetaddr = mtod(nam, struct sockaddr_in *);
+ inetaddr = (struct sockaddr_in *)nam;
if (inetaddr->sin_family == AF_INET &&
inetaddr->sin_addr.s_addr == haddr->had_inetaddr)
return (1);
@@ -1941,8 +1941,8 @@ netaddr_match(family, haddr, nam)
{
register struct sockaddr_iso *isoaddr1, *isoaddr2;
- isoaddr1 = mtod(nam, struct sockaddr_iso *);
- isoaddr2 = mtod(haddr->had_nam, struct sockaddr_iso *);
+ isoaddr1 = (struct sockaddr_iso *)nam;
+ isoaddr2 = (struct sockaddr_iso *)haddr->had_nam;
if (isoaddr1->siso_family == AF_ISO &&
isoaddr1->siso_nlen > 0 &&
isoaddr1->siso_nlen == isoaddr2->siso_nlen &&
diff --git a/sys/nfsclient/nfs_vfsops.c b/sys/nfsclient/nfs_vfsops.c
index f867948eeb29..12f168cc6ddb 100644
--- a/sys/nfsclient/nfs_vfsops.c
+++ b/sys/nfsclient/nfs_vfsops.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_vfsops.c 8.12 (Berkeley) 5/20/95
- * $Id: nfs_vfsops.c,v 1.43 1997/06/03 17:22:47 dfr Exp $
+ * $Id: nfs_vfsops.c,v 1.44 1997/06/27 19:10:46 wpaul Exp $
*/
#include <sys/param.h>
@@ -86,7 +86,7 @@ SYSCTL_INT(_vfs_nfs, OID_AUTO, debug, CTLFLAG_RW, &nfs_debug, 0, "");
static int nfs_iosize __P((struct nfsmount *nmp));
static int mountnfs __P((struct nfs_args *,struct mount *,
- struct mbuf *,char *,char *,struct vnode **));
+ struct sockaddr *,char *,char *,struct vnode **));
static int nfs_mount __P(( struct mount *mp, char *path, caddr_t data,
struct nameidata *ndp, struct proc *p));
static int nfs_start __P(( struct mount *mp, int flags,
@@ -102,7 +102,7 @@ static int nfs_sync __P(( struct mount *mp, int waitfor,
struct ucred *cred, struct proc *p));
static int nfs_vptofh __P(( struct vnode *vp, struct fid *fhp));
static int nfs_fhtovp __P((struct mount *mp, struct fid *fhp,
- struct mbuf *nam, struct vnode **vpp,
+ struct sockaddr *nam, struct vnode **vpp,
int *exflagsp, struct ucred **credanonp));
static int nfs_vget __P((struct mount *, ino_t, struct vnode **));
@@ -557,25 +557,24 @@ nfs_mountdiskless(path, which, mountflag, sin, args, p, vpp, mpp)
struct mount **mpp;
{
struct mount *mp;
- struct mbuf *m;
+ struct sockaddr *nam;
int error;
mp = *mpp;
- if (!mp && ( error = vfs_rootmountalloc("nfs", path, &mp))) {
+ if (!mp && (error = vfs_rootmountalloc("nfs", path, &mp))) {
printf("nfs_mountroot: NFS not configured");
return (error);
}
mp->mnt_flag = mountflag;
- MGET(m, MT_SONAME, M_WAITOK);
- bcopy((caddr_t)sin, mtod(m, caddr_t), sin->sin_len);
- m->m_len = sin->sin_len;
- if (error = mountnfs(args, mp, m, which, path, vpp)) {
+ nam = dup_sockaddr((struct sockaddr *)sin, 1);
+ if (error = mountnfs(args, mp, nam, which, path, vpp)) {
printf("nfs_mountroot: mount %s on %s: %d", path, which, error);
mp->mnt_vfc->vfc_refcount--;
vfs_unbusy(mp, p);
free(mp, M_MOUNT);
+ FREE(nam, M_SONAME);
return (error);
}
(void) copystr(which, mp->mnt_stat.f_mntonname, MNAMELEN - 1, 0);
@@ -603,7 +602,7 @@ nfs_mount(mp, path, data, ndp, p)
{
int error;
struct nfs_args args;
- struct mbuf *nam;
+ struct sockaddr *nam;
struct vnode *vp;
char pth[MNAMELEN], hst[MNAMELEN];
u_int len;
@@ -644,7 +643,7 @@ nfs_mount(mp, path, data, ndp, p)
return (error);
bzero(&hst[len], MNAMELEN - len);
/* sockargs() call must be after above copyin() calls */
- error = sockargs(&nam, (caddr_t)args.addr, args.addrlen, MT_SONAME);
+ error = getsockaddr(&nam, (caddr_t)args.addr, args.addrlen);
if (error)
return (error);
args.fh = nfh;
@@ -659,7 +658,7 @@ static int
mountnfs(argp, mp, nam, pth, hst, vpp)
register struct nfs_args *argp;
register struct mount *mp;
- struct mbuf *nam;
+ struct sockaddr *nam;
char *pth, *hst;
struct vnode **vpp;
{
@@ -671,7 +670,7 @@ mountnfs(argp, mp, nam, pth, hst, vpp)
if (mp->mnt_flag & MNT_UPDATE) {
nmp = VFSTONFS(mp);
/* update paths, file handles, etc, here XXX */
- m_freem(nam);
+ FREE(nam, M_SONAME);
return (0);
} else {
MALLOC(nmp, struct nfsmount *, sizeof (struct nfsmount),
@@ -829,7 +828,7 @@ mountnfs(argp, mp, nam, pth, hst, vpp)
bad:
nfs_disconnect(nmp);
free((caddr_t)nmp, M_NFSMNT);
- m_freem(nam);
+ FREE(nam, M_SONAME);
return (error);
}
@@ -900,7 +899,7 @@ nfs_unmount(mp, mntflags, p)
vrele(vp);
vgone(vp);
nfs_disconnect(nmp);
- m_freem(nmp->nm_nam);
+ FREE(nmp->nm_nam, M_SONAME);
if ((nmp->nm_flag & (NFSMNT_NQNFS | NFSMNT_KERB)) == 0)
free((caddr_t)nmp, M_NFSMNT);
@@ -996,7 +995,7 @@ static int
nfs_fhtovp(mp, fhp, nam, vpp, exflagsp, credanonp)
register struct mount *mp;
struct fid *fhp;
- struct mbuf *nam;
+ struct sockaddr *nam;
struct vnode **vpp;
int *exflagsp;
struct ucred **credanonp;
diff --git a/sys/nfsclient/nfsargs.h b/sys/nfsclient/nfsargs.h
index 528a366c1e67..e1a47551689b 100644
--- a/sys/nfsclient/nfsargs.h
+++ b/sys/nfsclient/nfsargs.h
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs.h 8.4 (Berkeley) 5/1/95
- * $Id: nfs.h,v 1.28 1997/06/03 17:22:45 dfr Exp $
+ * $Id: nfs.h,v 1.29 1997/07/16 09:06:27 dfr Exp $
*/
#ifndef _NFS_NFS_H_
@@ -382,7 +382,7 @@ extern TAILQ_HEAD(nfs_reqq, nfsreq) nfs_reqq;
*/
union nethostaddr {
u_long had_inetaddr;
- struct mbuf *had_nam;
+ struct sockaddr *had_nam;
};
struct nfsuid {
@@ -406,7 +406,7 @@ struct nfsuid {
struct nfsrv_rec {
STAILQ_ENTRY(nfsrv_rec) nr_link;
- struct mbuf *nr_address;
+ struct sockaddr *nr_address;
struct mbuf *nr_packet;
};
@@ -415,7 +415,7 @@ struct nfssvc_sock {
TAILQ_HEAD(, nfsuid) ns_uidlruhead;
struct file *ns_fp;
struct socket *ns_so;
- struct mbuf *ns_nam;
+ struct sockaddr *ns_nam;
struct mbuf *ns_raw;
struct mbuf *ns_rawend;
STAILQ_HEAD(, nfsrv_rec) ns_rec;
@@ -480,8 +480,8 @@ struct nfsrv_descript {
struct mbuf *nd_mrep; /* Request mbuf list */
struct mbuf *nd_md; /* Current dissect mbuf */
struct mbuf *nd_mreq; /* Reply mbuf list */
- struct mbuf *nd_nam; /* and socket addr */
- struct mbuf *nd_nam2; /* return socket addr */
+ struct sockaddr *nd_nam; /* and socket addr */
+ struct sockaddr *nd_nam2; /* return socket addr */
caddr_t nd_dpos; /* Current dissect pos */
u_int32_t nd_procnum; /* RPC # */
int nd_stable; /* storage type */
@@ -567,70 +567,91 @@ extern int nfs_debug;
int nfs_init __P((struct vfsconf *vfsp));
int nfs_reply __P((struct nfsreq *));
int nfs_getreq __P((struct nfsrv_descript *,struct nfsd *,int));
-int nfs_send __P((struct socket *,struct mbuf *,struct mbuf *,struct nfsreq *));
-int nfs_rephead __P((int,struct nfsrv_descript *,struct nfssvc_sock *,int,int,u_quad_t *,struct mbuf **,struct mbuf **,caddr_t *));
-int nfs_sndlock __P((int *,struct nfsreq *));
+int nfs_send __P((struct socket *, struct sockaddr *, struct mbuf *,
+ struct nfsreq *));
+int nfs_rephead __P((int, struct nfsrv_descript *, struct nfssvc_sock *,
+ int, int, u_quad_t *, struct mbuf **, struct mbuf **,
+ caddr_t *));
+int nfs_sndlock __P((int *, struct nfsreq *));
void nfs_sndunlock __P((int *flagp));
-int nfs_disct __P((struct mbuf **,caddr_t *,int,int,caddr_t *));
-int nfs_vinvalbuf __P((struct vnode *,int,struct ucred *,struct proc *,int));
-int nfs_readrpc __P((struct vnode *,struct uio *,struct ucred *));
-int nfs_writerpc __P((struct vnode *,struct uio *,struct ucred *,int *,int *));
-int nfs_readdirrpc __P((register struct vnode *,struct uio *,struct ucred *));
-int nfs_asyncio __P((struct buf *,struct ucred *));
-int nfs_doio __P((struct buf *,struct ucred *,struct proc *));
-int nfs_readlinkrpc __P((struct vnode *,struct uio *,struct ucred *));
-int nfs_sigintr __P((struct nfsmount *,struct nfsreq *r,struct proc *));
-int nfs_readdirplusrpc __P((struct vnode *,register struct uio *,struct ucred *));
-int nfsm_disct __P((struct mbuf **,caddr_t *,int,int,caddr_t *));
-void nfsm_srvfattr __P((struct nfsrv_descript *,struct vattr *,struct nfs_fattr *));
-void nfsm_srvwcc __P((struct nfsrv_descript *,int,struct vattr *,int,struct vattr *,struct mbuf **,char **));
-void nfsm_srvpostopattr __P((struct nfsrv_descript *,int,struct vattr *,struct mbuf **,char **));
-int netaddr_match __P((int,union nethostaddr *,struct mbuf *));
-int nfs_request __P((struct vnode *,struct mbuf *,int,struct proc *,struct ucred *,struct mbuf **,struct mbuf **,caddr_t *));
-int nfs_loadattrcache __P((struct vnode **,struct mbuf **,caddr_t *,struct vattr *));
-int nfs_namei __P((struct nameidata *,fhandle_t *,int,struct nfssvc_sock *,struct mbuf *,struct mbuf **,caddr_t *,struct vnode **,struct proc *,int,int));
-void nfsm_adj __P((struct mbuf *,int,int));
-int nfsm_mbuftouio __P((struct mbuf **,struct uio *,int,caddr_t *));
+int nfs_disct __P((struct mbuf **, caddr_t *, int, int, caddr_t *));
+int nfs_vinvalbuf __P((struct vnode *, int, struct ucred *, struct proc *,
+ int));
+int nfs_readrpc __P((struct vnode *, struct uio *, struct ucred *));
+int nfs_writerpc __P((struct vnode *, struct uio *, struct ucred *, int *,
+ int *));
+int nfs_readdirrpc __P((struct vnode *, struct uio *, struct ucred *));
+int nfs_asyncio __P((struct buf *, struct ucred *));
+int nfs_doio __P((struct buf *, struct ucred *, struct proc *));
+int nfs_readlinkrpc __P((struct vnode *, struct uio *, struct ucred *));
+int nfs_sigintr __P((struct nfsmount *, struct nfsreq *, struct proc *));
+int nfs_readdirplusrpc __P((struct vnode *, struct uio *, struct ucred *));
+int nfsm_disct __P((struct mbuf **, caddr_t *, int, int, caddr_t *));
+void nfsm_srvfattr __P((struct nfsrv_descript *, struct vattr *,
+ struct nfs_fattr *));
+void nfsm_srvwcc __P((struct nfsrv_descript *, int, struct vattr *, int,
+ struct vattr *, struct mbuf **, char **));
+void nfsm_srvpostopattr __P((struct nfsrv_descript *, int, struct vattr *,
+ struct mbuf **, char **));
+int netaddr_match __P((int, union nethostaddr *, struct sockaddr *));
+int nfs_request __P((struct vnode *, struct mbuf *, int, struct proc *,
+ struct ucred *, struct mbuf **, struct mbuf **,
+ caddr_t *));
+int nfs_loadattrcache __P((struct vnode **, struct mbuf **, caddr_t *,
+ struct vattr *));
+int nfs_namei __P((struct nameidata *, fhandle_t *, int,
+ struct nfssvc_sock *, struct sockaddr *, struct mbuf **,
+ caddr_t *, struct vnode **, struct proc *, int, int));
+void nfsm_adj __P((struct mbuf *, int, int));
+int nfsm_mbuftouio __P((struct mbuf **, struct uio *, int, caddr_t *));
void nfsrv_initcache __P((void));
-int nfs_getauth __P((struct nfsmount *,struct nfsreq *,struct ucred *,char **,int *,char *,int *,NFSKERBKEY_T));
-int nfs_getnickauth __P((struct nfsmount *,struct ucred *,char **,int *,char *,int));
-int nfs_savenickauth __P((struct nfsmount *,struct ucred *,int,NFSKERBKEY_T,struct mbuf **,char **,struct mbuf *));
-int nfs_adv __P((struct mbuf **,caddr_t *,int,int));
+int nfs_getauth __P((struct nfsmount *, struct nfsreq *, struct ucred *,
+ char **, int *, char *, int *, NFSKERBKEY_T));
+int nfs_getnickauth __P((struct nfsmount *, struct ucred *, char **,
+ int *, char *, int));
+int nfs_savenickauth __P((struct nfsmount *, struct ucred *, int,
+ NFSKERBKEY_T, struct mbuf **, char **,
+ struct mbuf *));
+int nfs_adv __P((struct mbuf **, caddr_t *, int, int));
void nfs_nhinit __P((void));
void nfs_timer __P((void*));
-u_long nfs_hash __P((nfsfh_t *,int));
-int nfsrv_dorec __P((struct nfssvc_sock *,struct nfsd *,struct nfsrv_descript **));
-int nfsrv_getcache __P((struct nfsrv_descript *,struct nfssvc_sock *,struct mbuf **));
-void nfsrv_updatecache __P((struct nfsrv_descript *,int,struct mbuf *));
+u_long nfs_hash __P((nfsfh_t *, int));
+int nfsrv_dorec __P((struct nfssvc_sock *, struct nfsd *,
+ struct nfsrv_descript **));
+int nfsrv_getcache __P((struct nfsrv_descript *, struct nfssvc_sock *,
+ struct mbuf **));
+void nfsrv_updatecache __P((struct nfsrv_descript *, int, struct mbuf *));
void nfsrv_cleancache __P((void));
-int nfs_connect __P((struct nfsmount *,struct nfsreq *));
+int nfs_connect __P((struct nfsmount *, struct nfsreq *));
void nfs_disconnect __P((struct nfsmount *));
-int nfs_getattrcache __P((struct vnode *,struct vattr *));
-int nfsm_strtmbuf __P((struct mbuf **,char **,char *,long));
-int nfs_bioread __P((struct vnode *,struct uio *,int,struct ucred *, int getpages));
-int nfsm_uiotombuf __P((struct uio *,struct mbuf **,int,caddr_t *));
+int nfs_getattrcache __P((struct vnode *, struct vattr *));
+int nfsm_strtmbuf __P((struct mbuf **, char **, char *, long));
+int nfs_bioread __P((struct vnode *, struct uio *, int, struct ucred *,
+ int));
+int nfsm_uiotombuf __P((struct uio *, struct mbuf **, int, caddr_t *));
void nfsrv_init __P((int));
void nfs_clearcommit __P((struct mount *));
int nfsrv_errmap __P((struct nfsrv_descript *, int));
-void nfsrvw_sort __P((gid_t [],int));
-void nfsrv_setcred __P((struct ucred *,struct ucred *));
-int nfs_writebp __P((struct buf *,int));
-int nfsrv_object_create __P(( struct vnode * ));
+void nfsrvw_sort __P((gid_t *, int));
+void nfsrv_setcred __P((struct ucred *, struct ucred *));
+int nfs_writebp __P((struct buf *, int));
+int nfsrv_object_create __P((struct vnode *));
void nfsrv_wakenfsd __P((struct nfssvc_sock *slp));
int nfsrv_writegather __P((struct nfsrv_descript **, struct nfssvc_sock *,
struct proc *, struct mbuf **));
int nfs_fsinfo __P((struct nfsmount *, struct vnode *, struct ucred *,
struct proc *p));
-int nfsrv3_access __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
+int nfsrv3_access __P((struct nfsrv_descript *nfsd,
+ struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
int nfsrv_commit __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
int nfsrv_create __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
-int nfsrv_fhtovp __P((fhandle_t *,int,struct vnode **,
- struct ucred *,struct nfssvc_sock *,struct mbuf *,
- int *,int,int));
+int nfsrv_fhtovp __P((fhandle_t *, int, struct vnode **, struct ucred *,
+ struct nfssvc_sock *, struct sockaddr *, int *,
+ int, int));
int nfsrv_setpublicfs __P((struct mount *, struct netexport *,
struct export_args *));
int nfs_ispublicfh __P((fhandle_t *));
@@ -655,7 +676,8 @@ int nfsrv_pathconf __P((struct nfsrv_descript *nfsd,
struct mbuf **mrq));
int nfsrv_read __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
-int nfsrv_readdir __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
+int nfsrv_readdir __P((struct nfsrv_descript *nfsd,
+ struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
int nfsrv_readdirplus __P((struct nfsrv_descript *nfsd,
struct nfssvc_sock *slp, struct proc *procp,
@@ -669,11 +691,14 @@ int nfsrv_rename __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
int nfsrv_rmdir __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
-int nfsrv_setattr __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
+int nfsrv_setattr __P((struct nfsrv_descript *nfsd,
+ struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
-int nfsrv_statfs __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
+int nfsrv_statfs __P((struct nfsrv_descript *nfsd,
+ struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
-int nfsrv_symlink __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
+int nfsrv_symlink __P((struct nfsrv_descript *nfsd,
+ struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
int nfsrv_write __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
diff --git a/sys/nfsclient/nfsmount.h b/sys/nfsclient/nfsmount.h
index d119a204fd42..63de0add0aca 100644
--- a/sys/nfsclient/nfsmount.h
+++ b/sys/nfsclient/nfsmount.h
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfsmount.h 8.3 (Berkeley) 3/30/95
- * $Id: nfsmount.h,v 1.11 1997/02/22 09:42:48 peter Exp $
+ * $Id: nfsmount.h,v 1.12 1997/05/10 16:12:03 dfr Exp $
*/
@@ -56,7 +56,7 @@ struct nfsmount {
int nm_sotype; /* Type of socket */
int nm_soproto; /* and protocol */
int nm_soflags; /* pr_flags for socket protocol */
- struct mbuf *nm_nam; /* Addr of server */
+ struct sockaddr *nm_nam; /* Addr of server */
int nm_timeo; /* Init timer for NFSMNT_DUMBTIMR */
int nm_retry; /* Max retries */
int nm_srtt[4]; /* Timers for rpcs */
diff --git a/sys/nfsclient/nfsstats.h b/sys/nfsclient/nfsstats.h
index 528a366c1e67..e1a47551689b 100644
--- a/sys/nfsclient/nfsstats.h
+++ b/sys/nfsclient/nfsstats.h
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs.h 8.4 (Berkeley) 5/1/95
- * $Id: nfs.h,v 1.28 1997/06/03 17:22:45 dfr Exp $
+ * $Id: nfs.h,v 1.29 1997/07/16 09:06:27 dfr Exp $
*/
#ifndef _NFS_NFS_H_
@@ -382,7 +382,7 @@ extern TAILQ_HEAD(nfs_reqq, nfsreq) nfs_reqq;
*/
union nethostaddr {
u_long had_inetaddr;
- struct mbuf *had_nam;
+ struct sockaddr *had_nam;
};
struct nfsuid {
@@ -406,7 +406,7 @@ struct nfsuid {
struct nfsrv_rec {
STAILQ_ENTRY(nfsrv_rec) nr_link;
- struct mbuf *nr_address;
+ struct sockaddr *nr_address;
struct mbuf *nr_packet;
};
@@ -415,7 +415,7 @@ struct nfssvc_sock {
TAILQ_HEAD(, nfsuid) ns_uidlruhead;
struct file *ns_fp;
struct socket *ns_so;
- struct mbuf *ns_nam;
+ struct sockaddr *ns_nam;
struct mbuf *ns_raw;
struct mbuf *ns_rawend;
STAILQ_HEAD(, nfsrv_rec) ns_rec;
@@ -480,8 +480,8 @@ struct nfsrv_descript {
struct mbuf *nd_mrep; /* Request mbuf list */
struct mbuf *nd_md; /* Current dissect mbuf */
struct mbuf *nd_mreq; /* Reply mbuf list */
- struct mbuf *nd_nam; /* and socket addr */
- struct mbuf *nd_nam2; /* return socket addr */
+ struct sockaddr *nd_nam; /* and socket addr */
+ struct sockaddr *nd_nam2; /* return socket addr */
caddr_t nd_dpos; /* Current dissect pos */
u_int32_t nd_procnum; /* RPC # */
int nd_stable; /* storage type */
@@ -567,70 +567,91 @@ extern int nfs_debug;
int nfs_init __P((struct vfsconf *vfsp));
int nfs_reply __P((struct nfsreq *));
int nfs_getreq __P((struct nfsrv_descript *,struct nfsd *,int));
-int nfs_send __P((struct socket *,struct mbuf *,struct mbuf *,struct nfsreq *));
-int nfs_rephead __P((int,struct nfsrv_descript *,struct nfssvc_sock *,int,int,u_quad_t *,struct mbuf **,struct mbuf **,caddr_t *));
-int nfs_sndlock __P((int *,struct nfsreq *));
+int nfs_send __P((struct socket *, struct sockaddr *, struct mbuf *,
+ struct nfsreq *));
+int nfs_rephead __P((int, struct nfsrv_descript *, struct nfssvc_sock *,
+ int, int, u_quad_t *, struct mbuf **, struct mbuf **,
+ caddr_t *));
+int nfs_sndlock __P((int *, struct nfsreq *));
void nfs_sndunlock __P((int *flagp));
-int nfs_disct __P((struct mbuf **,caddr_t *,int,int,caddr_t *));
-int nfs_vinvalbuf __P((struct vnode *,int,struct ucred *,struct proc *,int));
-int nfs_readrpc __P((struct vnode *,struct uio *,struct ucred *));
-int nfs_writerpc __P((struct vnode *,struct uio *,struct ucred *,int *,int *));
-int nfs_readdirrpc __P((register struct vnode *,struct uio *,struct ucred *));
-int nfs_asyncio __P((struct buf *,struct ucred *));
-int nfs_doio __P((struct buf *,struct ucred *,struct proc *));
-int nfs_readlinkrpc __P((struct vnode *,struct uio *,struct ucred *));
-int nfs_sigintr __P((struct nfsmount *,struct nfsreq *r,struct proc *));
-int nfs_readdirplusrpc __P((struct vnode *,register struct uio *,struct ucred *));
-int nfsm_disct __P((struct mbuf **,caddr_t *,int,int,caddr_t *));
-void nfsm_srvfattr __P((struct nfsrv_descript *,struct vattr *,struct nfs_fattr *));
-void nfsm_srvwcc __P((struct nfsrv_descript *,int,struct vattr *,int,struct vattr *,struct mbuf **,char **));
-void nfsm_srvpostopattr __P((struct nfsrv_descript *,int,struct vattr *,struct mbuf **,char **));
-int netaddr_match __P((int,union nethostaddr *,struct mbuf *));
-int nfs_request __P((struct vnode *,struct mbuf *,int,struct proc *,struct ucred *,struct mbuf **,struct mbuf **,caddr_t *));
-int nfs_loadattrcache __P((struct vnode **,struct mbuf **,caddr_t *,struct vattr *));
-int nfs_namei __P((struct nameidata *,fhandle_t *,int,struct nfssvc_sock *,struct mbuf *,struct mbuf **,caddr_t *,struct vnode **,struct proc *,int,int));
-void nfsm_adj __P((struct mbuf *,int,int));
-int nfsm_mbuftouio __P((struct mbuf **,struct uio *,int,caddr_t *));
+int nfs_disct __P((struct mbuf **, caddr_t *, int, int, caddr_t *));
+int nfs_vinvalbuf __P((struct vnode *, int, struct ucred *, struct proc *,
+ int));
+int nfs_readrpc __P((struct vnode *, struct uio *, struct ucred *));
+int nfs_writerpc __P((struct vnode *, struct uio *, struct ucred *, int *,
+ int *));
+int nfs_readdirrpc __P((struct vnode *, struct uio *, struct ucred *));
+int nfs_asyncio __P((struct buf *, struct ucred *));
+int nfs_doio __P((struct buf *, struct ucred *, struct proc *));
+int nfs_readlinkrpc __P((struct vnode *, struct uio *, struct ucred *));
+int nfs_sigintr __P((struct nfsmount *, struct nfsreq *, struct proc *));
+int nfs_readdirplusrpc __P((struct vnode *, struct uio *, struct ucred *));
+int nfsm_disct __P((struct mbuf **, caddr_t *, int, int, caddr_t *));
+void nfsm_srvfattr __P((struct nfsrv_descript *, struct vattr *,
+ struct nfs_fattr *));
+void nfsm_srvwcc __P((struct nfsrv_descript *, int, struct vattr *, int,
+ struct vattr *, struct mbuf **, char **));
+void nfsm_srvpostopattr __P((struct nfsrv_descript *, int, struct vattr *,
+ struct mbuf **, char **));
+int netaddr_match __P((int, union nethostaddr *, struct sockaddr *));
+int nfs_request __P((struct vnode *, struct mbuf *, int, struct proc *,
+ struct ucred *, struct mbuf **, struct mbuf **,
+ caddr_t *));
+int nfs_loadattrcache __P((struct vnode **, struct mbuf **, caddr_t *,
+ struct vattr *));
+int nfs_namei __P((struct nameidata *, fhandle_t *, int,
+ struct nfssvc_sock *, struct sockaddr *, struct mbuf **,
+ caddr_t *, struct vnode **, struct proc *, int, int));
+void nfsm_adj __P((struct mbuf *, int, int));
+int nfsm_mbuftouio __P((struct mbuf **, struct uio *, int, caddr_t *));
void nfsrv_initcache __P((void));
-int nfs_getauth __P((struct nfsmount *,struct nfsreq *,struct ucred *,char **,int *,char *,int *,NFSKERBKEY_T));
-int nfs_getnickauth __P((struct nfsmount *,struct ucred *,char **,int *,char *,int));
-int nfs_savenickauth __P((struct nfsmount *,struct ucred *,int,NFSKERBKEY_T,struct mbuf **,char **,struct mbuf *));
-int nfs_adv __P((struct mbuf **,caddr_t *,int,int));
+int nfs_getauth __P((struct nfsmount *, struct nfsreq *, struct ucred *,
+ char **, int *, char *, int *, NFSKERBKEY_T));
+int nfs_getnickauth __P((struct nfsmount *, struct ucred *, char **,
+ int *, char *, int));
+int nfs_savenickauth __P((struct nfsmount *, struct ucred *, int,
+ NFSKERBKEY_T, struct mbuf **, char **,
+ struct mbuf *));
+int nfs_adv __P((struct mbuf **, caddr_t *, int, int));
void nfs_nhinit __P((void));
void nfs_timer __P((void*));
-u_long nfs_hash __P((nfsfh_t *,int));
-int nfsrv_dorec __P((struct nfssvc_sock *,struct nfsd *,struct nfsrv_descript **));
-int nfsrv_getcache __P((struct nfsrv_descript *,struct nfssvc_sock *,struct mbuf **));
-void nfsrv_updatecache __P((struct nfsrv_descript *,int,struct mbuf *));
+u_long nfs_hash __P((nfsfh_t *, int));
+int nfsrv_dorec __P((struct nfssvc_sock *, struct nfsd *,
+ struct nfsrv_descript **));
+int nfsrv_getcache __P((struct nfsrv_descript *, struct nfssvc_sock *,
+ struct mbuf **));
+void nfsrv_updatecache __P((struct nfsrv_descript *, int, struct mbuf *));
void nfsrv_cleancache __P((void));
-int nfs_connect __P((struct nfsmount *,struct nfsreq *));
+int nfs_connect __P((struct nfsmount *, struct nfsreq *));
void nfs_disconnect __P((struct nfsmount *));
-int nfs_getattrcache __P((struct vnode *,struct vattr *));
-int nfsm_strtmbuf __P((struct mbuf **,char **,char *,long));
-int nfs_bioread __P((struct vnode *,struct uio *,int,struct ucred *, int getpages));
-int nfsm_uiotombuf __P((struct uio *,struct mbuf **,int,caddr_t *));
+int nfs_getattrcache __P((struct vnode *, struct vattr *));
+int nfsm_strtmbuf __P((struct mbuf **, char **, char *, long));
+int nfs_bioread __P((struct vnode *, struct uio *, int, struct ucred *,
+ int));
+int nfsm_uiotombuf __P((struct uio *, struct mbuf **, int, caddr_t *));
void nfsrv_init __P((int));
void nfs_clearcommit __P((struct mount *));
int nfsrv_errmap __P((struct nfsrv_descript *, int));
-void nfsrvw_sort __P((gid_t [],int));
-void nfsrv_setcred __P((struct ucred *,struct ucred *));
-int nfs_writebp __P((struct buf *,int));
-int nfsrv_object_create __P(( struct vnode * ));
+void nfsrvw_sort __P((gid_t *, int));
+void nfsrv_setcred __P((struct ucred *, struct ucred *));
+int nfs_writebp __P((struct buf *, int));
+int nfsrv_object_create __P((struct vnode *));
void nfsrv_wakenfsd __P((struct nfssvc_sock *slp));
int nfsrv_writegather __P((struct nfsrv_descript **, struct nfssvc_sock *,
struct proc *, struct mbuf **));
int nfs_fsinfo __P((struct nfsmount *, struct vnode *, struct ucred *,
struct proc *p));
-int nfsrv3_access __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
+int nfsrv3_access __P((struct nfsrv_descript *nfsd,
+ struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
int nfsrv_commit __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
int nfsrv_create __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
-int nfsrv_fhtovp __P((fhandle_t *,int,struct vnode **,
- struct ucred *,struct nfssvc_sock *,struct mbuf *,
- int *,int,int));
+int nfsrv_fhtovp __P((fhandle_t *, int, struct vnode **, struct ucred *,
+ struct nfssvc_sock *, struct sockaddr *, int *,
+ int, int));
int nfsrv_setpublicfs __P((struct mount *, struct netexport *,
struct export_args *));
int nfs_ispublicfh __P((fhandle_t *));
@@ -655,7 +676,8 @@ int nfsrv_pathconf __P((struct nfsrv_descript *nfsd,
struct mbuf **mrq));
int nfsrv_read __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
-int nfsrv_readdir __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
+int nfsrv_readdir __P((struct nfsrv_descript *nfsd,
+ struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
int nfsrv_readdirplus __P((struct nfsrv_descript *nfsd,
struct nfssvc_sock *slp, struct proc *procp,
@@ -669,11 +691,14 @@ int nfsrv_rename __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
int nfsrv_rmdir __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
-int nfsrv_setattr __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
+int nfsrv_setattr __P((struct nfsrv_descript *nfsd,
+ struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
-int nfsrv_statfs __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
+int nfsrv_statfs __P((struct nfsrv_descript *nfsd,
+ struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
-int nfsrv_symlink __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
+int nfsrv_symlink __P((struct nfsrv_descript *nfsd,
+ struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
int nfsrv_write __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
diff --git a/sys/nfsserver/nfs.h b/sys/nfsserver/nfs.h
index 528a366c1e67..e1a47551689b 100644
--- a/sys/nfsserver/nfs.h
+++ b/sys/nfsserver/nfs.h
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs.h 8.4 (Berkeley) 5/1/95
- * $Id: nfs.h,v 1.28 1997/06/03 17:22:45 dfr Exp $
+ * $Id: nfs.h,v 1.29 1997/07/16 09:06:27 dfr Exp $
*/
#ifndef _NFS_NFS_H_
@@ -382,7 +382,7 @@ extern TAILQ_HEAD(nfs_reqq, nfsreq) nfs_reqq;
*/
union nethostaddr {
u_long had_inetaddr;
- struct mbuf *had_nam;
+ struct sockaddr *had_nam;
};
struct nfsuid {
@@ -406,7 +406,7 @@ struct nfsuid {
struct nfsrv_rec {
STAILQ_ENTRY(nfsrv_rec) nr_link;
- struct mbuf *nr_address;
+ struct sockaddr *nr_address;
struct mbuf *nr_packet;
};
@@ -415,7 +415,7 @@ struct nfssvc_sock {
TAILQ_HEAD(, nfsuid) ns_uidlruhead;
struct file *ns_fp;
struct socket *ns_so;
- struct mbuf *ns_nam;
+ struct sockaddr *ns_nam;
struct mbuf *ns_raw;
struct mbuf *ns_rawend;
STAILQ_HEAD(, nfsrv_rec) ns_rec;
@@ -480,8 +480,8 @@ struct nfsrv_descript {
struct mbuf *nd_mrep; /* Request mbuf list */
struct mbuf *nd_md; /* Current dissect mbuf */
struct mbuf *nd_mreq; /* Reply mbuf list */
- struct mbuf *nd_nam; /* and socket addr */
- struct mbuf *nd_nam2; /* return socket addr */
+ struct sockaddr *nd_nam; /* and socket addr */
+ struct sockaddr *nd_nam2; /* return socket addr */
caddr_t nd_dpos; /* Current dissect pos */
u_int32_t nd_procnum; /* RPC # */
int nd_stable; /* storage type */
@@ -567,70 +567,91 @@ extern int nfs_debug;
int nfs_init __P((struct vfsconf *vfsp));
int nfs_reply __P((struct nfsreq *));
int nfs_getreq __P((struct nfsrv_descript *,struct nfsd *,int));
-int nfs_send __P((struct socket *,struct mbuf *,struct mbuf *,struct nfsreq *));
-int nfs_rephead __P((int,struct nfsrv_descript *,struct nfssvc_sock *,int,int,u_quad_t *,struct mbuf **,struct mbuf **,caddr_t *));
-int nfs_sndlock __P((int *,struct nfsreq *));
+int nfs_send __P((struct socket *, struct sockaddr *, struct mbuf *,
+ struct nfsreq *));
+int nfs_rephead __P((int, struct nfsrv_descript *, struct nfssvc_sock *,
+ int, int, u_quad_t *, struct mbuf **, struct mbuf **,
+ caddr_t *));
+int nfs_sndlock __P((int *, struct nfsreq *));
void nfs_sndunlock __P((int *flagp));
-int nfs_disct __P((struct mbuf **,caddr_t *,int,int,caddr_t *));
-int nfs_vinvalbuf __P((struct vnode *,int,struct ucred *,struct proc *,int));
-int nfs_readrpc __P((struct vnode *,struct uio *,struct ucred *));
-int nfs_writerpc __P((struct vnode *,struct uio *,struct ucred *,int *,int *));
-int nfs_readdirrpc __P((register struct vnode *,struct uio *,struct ucred *));
-int nfs_asyncio __P((struct buf *,struct ucred *));
-int nfs_doio __P((struct buf *,struct ucred *,struct proc *));
-int nfs_readlinkrpc __P((struct vnode *,struct uio *,struct ucred *));
-int nfs_sigintr __P((struct nfsmount *,struct nfsreq *r,struct proc *));
-int nfs_readdirplusrpc __P((struct vnode *,register struct uio *,struct ucred *));
-int nfsm_disct __P((struct mbuf **,caddr_t *,int,int,caddr_t *));
-void nfsm_srvfattr __P((struct nfsrv_descript *,struct vattr *,struct nfs_fattr *));
-void nfsm_srvwcc __P((struct nfsrv_descript *,int,struct vattr *,int,struct vattr *,struct mbuf **,char **));
-void nfsm_srvpostopattr __P((struct nfsrv_descript *,int,struct vattr *,struct mbuf **,char **));
-int netaddr_match __P((int,union nethostaddr *,struct mbuf *));
-int nfs_request __P((struct vnode *,struct mbuf *,int,struct proc *,struct ucred *,struct mbuf **,struct mbuf **,caddr_t *));
-int nfs_loadattrcache __P((struct vnode **,struct mbuf **,caddr_t *,struct vattr *));
-int nfs_namei __P((struct nameidata *,fhandle_t *,int,struct nfssvc_sock *,struct mbuf *,struct mbuf **,caddr_t *,struct vnode **,struct proc *,int,int));
-void nfsm_adj __P((struct mbuf *,int,int));
-int nfsm_mbuftouio __P((struct mbuf **,struct uio *,int,caddr_t *));
+int nfs_disct __P((struct mbuf **, caddr_t *, int, int, caddr_t *));
+int nfs_vinvalbuf __P((struct vnode *, int, struct ucred *, struct proc *,
+ int));
+int nfs_readrpc __P((struct vnode *, struct uio *, struct ucred *));
+int nfs_writerpc __P((struct vnode *, struct uio *, struct ucred *, int *,
+ int *));
+int nfs_readdirrpc __P((struct vnode *, struct uio *, struct ucred *));
+int nfs_asyncio __P((struct buf *, struct ucred *));
+int nfs_doio __P((struct buf *, struct ucred *, struct proc *));
+int nfs_readlinkrpc __P((struct vnode *, struct uio *, struct ucred *));
+int nfs_sigintr __P((struct nfsmount *, struct nfsreq *, struct proc *));
+int nfs_readdirplusrpc __P((struct vnode *, struct uio *, struct ucred *));
+int nfsm_disct __P((struct mbuf **, caddr_t *, int, int, caddr_t *));
+void nfsm_srvfattr __P((struct nfsrv_descript *, struct vattr *,
+ struct nfs_fattr *));
+void nfsm_srvwcc __P((struct nfsrv_descript *, int, struct vattr *, int,
+ struct vattr *, struct mbuf **, char **));
+void nfsm_srvpostopattr __P((struct nfsrv_descript *, int, struct vattr *,
+ struct mbuf **, char **));
+int netaddr_match __P((int, union nethostaddr *, struct sockaddr *));
+int nfs_request __P((struct vnode *, struct mbuf *, int, struct proc *,
+ struct ucred *, struct mbuf **, struct mbuf **,
+ caddr_t *));
+int nfs_loadattrcache __P((struct vnode **, struct mbuf **, caddr_t *,
+ struct vattr *));
+int nfs_namei __P((struct nameidata *, fhandle_t *, int,
+ struct nfssvc_sock *, struct sockaddr *, struct mbuf **,
+ caddr_t *, struct vnode **, struct proc *, int, int));
+void nfsm_adj __P((struct mbuf *, int, int));
+int nfsm_mbuftouio __P((struct mbuf **, struct uio *, int, caddr_t *));
void nfsrv_initcache __P((void));
-int nfs_getauth __P((struct nfsmount *,struct nfsreq *,struct ucred *,char **,int *,char *,int *,NFSKERBKEY_T));
-int nfs_getnickauth __P((struct nfsmount *,struct ucred *,char **,int *,char *,int));
-int nfs_savenickauth __P((struct nfsmount *,struct ucred *,int,NFSKERBKEY_T,struct mbuf **,char **,struct mbuf *));
-int nfs_adv __P((struct mbuf **,caddr_t *,int,int));
+int nfs_getauth __P((struct nfsmount *, struct nfsreq *, struct ucred *,
+ char **, int *, char *, int *, NFSKERBKEY_T));
+int nfs_getnickauth __P((struct nfsmount *, struct ucred *, char **,
+ int *, char *, int));
+int nfs_savenickauth __P((struct nfsmount *, struct ucred *, int,
+ NFSKERBKEY_T, struct mbuf **, char **,
+ struct mbuf *));
+int nfs_adv __P((struct mbuf **, caddr_t *, int, int));
void nfs_nhinit __P((void));
void nfs_timer __P((void*));
-u_long nfs_hash __P((nfsfh_t *,int));
-int nfsrv_dorec __P((struct nfssvc_sock *,struct nfsd *,struct nfsrv_descript **));
-int nfsrv_getcache __P((struct nfsrv_descript *,struct nfssvc_sock *,struct mbuf **));
-void nfsrv_updatecache __P((struct nfsrv_descript *,int,struct mbuf *));
+u_long nfs_hash __P((nfsfh_t *, int));
+int nfsrv_dorec __P((struct nfssvc_sock *, struct nfsd *,
+ struct nfsrv_descript **));
+int nfsrv_getcache __P((struct nfsrv_descript *, struct nfssvc_sock *,
+ struct mbuf **));
+void nfsrv_updatecache __P((struct nfsrv_descript *, int, struct mbuf *));
void nfsrv_cleancache __P((void));
-int nfs_connect __P((struct nfsmount *,struct nfsreq *));
+int nfs_connect __P((struct nfsmount *, struct nfsreq *));
void nfs_disconnect __P((struct nfsmount *));
-int nfs_getattrcache __P((struct vnode *,struct vattr *));
-int nfsm_strtmbuf __P((struct mbuf **,char **,char *,long));
-int nfs_bioread __P((struct vnode *,struct uio *,int,struct ucred *, int getpages));
-int nfsm_uiotombuf __P((struct uio *,struct mbuf **,int,caddr_t *));
+int nfs_getattrcache __P((struct vnode *, struct vattr *));
+int nfsm_strtmbuf __P((struct mbuf **, char **, char *, long));
+int nfs_bioread __P((struct vnode *, struct uio *, int, struct ucred *,
+ int));
+int nfsm_uiotombuf __P((struct uio *, struct mbuf **, int, caddr_t *));
void nfsrv_init __P((int));
void nfs_clearcommit __P((struct mount *));
int nfsrv_errmap __P((struct nfsrv_descript *, int));
-void nfsrvw_sort __P((gid_t [],int));
-void nfsrv_setcred __P((struct ucred *,struct ucred *));
-int nfs_writebp __P((struct buf *,int));
-int nfsrv_object_create __P(( struct vnode * ));
+void nfsrvw_sort __P((gid_t *, int));
+void nfsrv_setcred __P((struct ucred *, struct ucred *));
+int nfs_writebp __P((struct buf *, int));
+int nfsrv_object_create __P((struct vnode *));
void nfsrv_wakenfsd __P((struct nfssvc_sock *slp));
int nfsrv_writegather __P((struct nfsrv_descript **, struct nfssvc_sock *,
struct proc *, struct mbuf **));
int nfs_fsinfo __P((struct nfsmount *, struct vnode *, struct ucred *,
struct proc *p));
-int nfsrv3_access __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
+int nfsrv3_access __P((struct nfsrv_descript *nfsd,
+ struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
int nfsrv_commit __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
int nfsrv_create __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
-int nfsrv_fhtovp __P((fhandle_t *,int,struct vnode **,
- struct ucred *,struct nfssvc_sock *,struct mbuf *,
- int *,int,int));
+int nfsrv_fhtovp __P((fhandle_t *, int, struct vnode **, struct ucred *,
+ struct nfssvc_sock *, struct sockaddr *, int *,
+ int, int));
int nfsrv_setpublicfs __P((struct mount *, struct netexport *,
struct export_args *));
int nfs_ispublicfh __P((fhandle_t *));
@@ -655,7 +676,8 @@ int nfsrv_pathconf __P((struct nfsrv_descript *nfsd,
struct mbuf **mrq));
int nfsrv_read __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
-int nfsrv_readdir __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
+int nfsrv_readdir __P((struct nfsrv_descript *nfsd,
+ struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
int nfsrv_readdirplus __P((struct nfsrv_descript *nfsd,
struct nfssvc_sock *slp, struct proc *procp,
@@ -669,11 +691,14 @@ int nfsrv_rename __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
int nfsrv_rmdir __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
-int nfsrv_setattr __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
+int nfsrv_setattr __P((struct nfsrv_descript *nfsd,
+ struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
-int nfsrv_statfs __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
+int nfsrv_statfs __P((struct nfsrv_descript *nfsd,
+ struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
-int nfsrv_symlink __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
+int nfsrv_symlink __P((struct nfsrv_descript *nfsd,
+ struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
int nfsrv_write __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
diff --git a/sys/nfsserver/nfs_serv.c b/sys/nfsserver/nfs_serv.c
index 0ca0a9a8e475..ce2ed4359d02 100644
--- a/sys/nfsserver/nfs_serv.c
+++ b/sys/nfsserver/nfs_serv.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_serv.c 8.3 (Berkeley) 1/12/94
- * $Id: nfs_serv.c,v 1.45 1997/07/16 09:06:28 dfr Exp $
+ * $Id: nfs_serv.c,v 1.46 1997/07/22 15:35:15 dfr Exp $
*/
/*
@@ -117,7 +117,7 @@ nfsrv3_access(nfsd, slp, procp, mrq)
struct mbuf **mrq;
{
struct mbuf *mrep = nfsd->nd_mrep, *md = nfsd->nd_md;
- struct mbuf *nam = nfsd->nd_nam;
+ struct sockaddr *nam = nfsd->nd_nam;
caddr_t dpos = nfsd->nd_dpos;
struct ucred *cred = &nfsd->nd_cr;
struct vnode *vp;
@@ -184,7 +184,7 @@ nfsrv_getattr(nfsd, slp, procp, mrq)
struct mbuf **mrq;
{
struct mbuf *mrep = nfsd->nd_mrep, *md = nfsd->nd_md;
- struct mbuf *nam = nfsd->nd_nam;
+ struct sockaddr *nam = nfsd->nd_nam;
caddr_t dpos = nfsd->nd_dpos;
struct ucred *cred = &nfsd->nd_cr;
register struct nfs_fattr *fp;
@@ -230,7 +230,7 @@ nfsrv_setattr(nfsd, slp, procp, mrq)
struct mbuf **mrq;
{
struct mbuf *mrep = nfsd->nd_mrep, *md = nfsd->nd_md;
- struct mbuf *nam = nfsd->nd_nam;
+ struct sockaddr *nam = nfsd->nd_nam;
caddr_t dpos = nfsd->nd_dpos;
struct ucred *cred = &nfsd->nd_cr;
struct vattr va, preat;
@@ -361,7 +361,7 @@ nfsrv_lookup(nfsd, slp, procp, mrq)
struct mbuf **mrq;
{
struct mbuf *mrep = nfsd->nd_mrep, *md = nfsd->nd_md;
- struct mbuf *nam = nfsd->nd_nam;
+ struct sockaddr *nam = nfsd->nd_nam;
caddr_t dpos = nfsd->nd_dpos;
struct ucred *cred = &nfsd->nd_cr;
register struct nfs_fattr *fp;
@@ -482,7 +482,7 @@ nfsrv_readlink(nfsd, slp, procp, mrq)
struct mbuf **mrq;
{
struct mbuf *mrep = nfsd->nd_mrep, *md = nfsd->nd_md;
- struct mbuf *nam = nfsd->nd_nam;
+ struct sockaddr *nam = nfsd->nd_nam;
caddr_t dpos = nfsd->nd_dpos;
struct ucred *cred = &nfsd->nd_cr;
struct iovec iv[(NFS_MAXPATHLEN+MLEN-1)/MLEN];
@@ -585,7 +585,7 @@ nfsrv_read(nfsd, slp, procp, mrq)
struct mbuf **mrq;
{
struct mbuf *mrep = nfsd->nd_mrep, *md = nfsd->nd_md;
- struct mbuf *nam = nfsd->nd_nam;
+ struct sockaddr *nam = nfsd->nd_nam;
caddr_t dpos = nfsd->nd_dpos;
struct ucred *cred = &nfsd->nd_cr;
register struct iovec *iv;
@@ -750,7 +750,7 @@ nfsrv_write(nfsd, slp, procp, mrq)
struct mbuf **mrq;
{
struct mbuf *mrep = nfsd->nd_mrep, *md = nfsd->nd_md;
- struct mbuf *nam = nfsd->nd_nam;
+ struct sockaddr *nam = nfsd->nd_nam;
caddr_t dpos = nfsd->nd_dpos;
struct ucred *cred = &nfsd->nd_cr;
register struct iovec *ivp;
@@ -1355,7 +1355,7 @@ nfsrv_create(nfsd, slp, procp, mrq)
struct mbuf **mrq;
{
struct mbuf *mrep = nfsd->nd_mrep, *md = nfsd->nd_md;
- struct mbuf *nam = nfsd->nd_nam;
+ struct sockaddr *nam = nfsd->nd_nam;
caddr_t dpos = nfsd->nd_dpos;
struct ucred *cred = &nfsd->nd_cr;
register struct nfs_fattr *fp;
@@ -1593,7 +1593,7 @@ nfsrv_mknod(nfsd, slp, procp, mrq)
struct mbuf **mrq;
{
struct mbuf *mrep = nfsd->nd_mrep, *md = nfsd->nd_md;
- struct mbuf *nam = nfsd->nd_nam;
+ struct sockaddr *nam = nfsd->nd_nam;
caddr_t dpos = nfsd->nd_dpos;
struct ucred *cred = &nfsd->nd_cr;
struct vattr va, dirfor, diraft;
@@ -1742,7 +1742,7 @@ nfsrv_remove(nfsd, slp, procp, mrq)
struct mbuf **mrq;
{
struct mbuf *mrep = nfsd->nd_mrep, *md = nfsd->nd_md;
- struct mbuf *nam = nfsd->nd_nam;
+ struct sockaddr *nam = nfsd->nd_nam;
caddr_t dpos = nfsd->nd_dpos;
struct ucred *cred = &nfsd->nd_cr;
struct nameidata nd;
@@ -1830,7 +1830,7 @@ nfsrv_rename(nfsd, slp, procp, mrq)
struct mbuf **mrq;
{
struct mbuf *mrep = nfsd->nd_mrep, *md = nfsd->nd_md;
- struct mbuf *nam = nfsd->nd_nam;
+ struct sockaddr *nam = nfsd->nd_nam;
caddr_t dpos = nfsd->nd_dpos;
struct ucred *cred = &nfsd->nd_cr;
register u_long *tl;
@@ -2037,7 +2037,7 @@ nfsrv_link(nfsd, slp, procp, mrq)
struct mbuf **mrq;
{
struct mbuf *mrep = nfsd->nd_mrep, *md = nfsd->nd_md;
- struct mbuf *nam = nfsd->nd_nam;
+ struct sockaddr *nam = nfsd->nd_nam;
caddr_t dpos = nfsd->nd_dpos;
struct ucred *cred = &nfsd->nd_cr;
struct nameidata nd;
@@ -2140,7 +2140,7 @@ nfsrv_symlink(nfsd, slp, procp, mrq)
struct mbuf **mrq;
{
struct mbuf *mrep = nfsd->nd_mrep, *md = nfsd->nd_md;
- struct mbuf *nam = nfsd->nd_nam;
+ struct sockaddr *nam = nfsd->nd_nam;
caddr_t dpos = nfsd->nd_dpos;
struct ucred *cred = &nfsd->nd_cr;
struct vattr va, dirfor, diraft;
@@ -2283,7 +2283,7 @@ nfsrv_mkdir(nfsd, slp, procp, mrq)
struct mbuf **mrq;
{
struct mbuf *mrep = nfsd->nd_mrep, *md = nfsd->nd_md;
- struct mbuf *nam = nfsd->nd_nam;
+ struct sockaddr *nam = nfsd->nd_nam;
caddr_t dpos = nfsd->nd_dpos;
struct ucred *cred = &nfsd->nd_cr;
struct vattr va, dirfor, diraft;
@@ -2399,7 +2399,7 @@ nfsrv_rmdir(nfsd, slp, procp, mrq)
struct mbuf **mrq;
{
struct mbuf *mrep = nfsd->nd_mrep, *md = nfsd->nd_md;
- struct mbuf *nam = nfsd->nd_nam;
+ struct sockaddr *nam = nfsd->nd_nam;
caddr_t dpos = nfsd->nd_dpos;
struct ucred *cred = &nfsd->nd_cr;
register u_long *tl;
@@ -2528,7 +2528,7 @@ nfsrv_readdir(nfsd, slp, procp, mrq)
struct mbuf **mrq;
{
struct mbuf *mrep = nfsd->nd_mrep, *md = nfsd->nd_md;
- struct mbuf *nam = nfsd->nd_nam;
+ struct sockaddr *nam = nfsd->nd_nam;
caddr_t dpos = nfsd->nd_dpos;
struct ucred *cred = &nfsd->nd_cr;
register char *bp, *be;
@@ -2795,7 +2795,7 @@ nfsrv_readdirplus(nfsd, slp, procp, mrq)
struct mbuf **mrq;
{
struct mbuf *mrep = nfsd->nd_mrep, *md = nfsd->nd_md;
- struct mbuf *nam = nfsd->nd_nam;
+ struct sockaddr *nam = nfsd->nd_nam;
caddr_t dpos = nfsd->nd_dpos;
struct ucred *cred = &nfsd->nd_cr;
register char *bp, *be;
@@ -3111,7 +3111,7 @@ nfsrv_commit(nfsd, slp, procp, mrq)
struct mbuf **mrq;
{
struct mbuf *mrep = nfsd->nd_mrep, *md = nfsd->nd_md;
- struct mbuf *nam = nfsd->nd_nam;
+ struct sockaddr *nam = nfsd->nd_nam;
caddr_t dpos = nfsd->nd_dpos;
struct ucred *cred = &nfsd->nd_cr;
struct vattr bfor, aft;
@@ -3172,7 +3172,7 @@ nfsrv_statfs(nfsd, slp, procp, mrq)
struct mbuf **mrq;
{
struct mbuf *mrep = nfsd->nd_mrep, *md = nfsd->nd_md;
- struct mbuf *nam = nfsd->nd_nam;
+ struct sockaddr *nam = nfsd->nd_nam;
caddr_t dpos = nfsd->nd_dpos;
struct ucred *cred = &nfsd->nd_cr;
register struct statfs *sf;
@@ -3250,7 +3250,7 @@ nfsrv_fsinfo(nfsd, slp, procp, mrq)
struct mbuf **mrq;
{
struct mbuf *mrep = nfsd->nd_mrep, *md = nfsd->nd_md;
- struct mbuf *nam = nfsd->nd_nam;
+ struct sockaddr *nam = nfsd->nd_nam;
caddr_t dpos = nfsd->nd_dpos;
struct ucred *cred = &nfsd->nd_cr;
register u_long *tl;
@@ -3320,7 +3320,7 @@ nfsrv_pathconf(nfsd, slp, procp, mrq)
struct mbuf **mrq;
{
struct mbuf *mrep = nfsd->nd_mrep, *md = nfsd->nd_md;
- struct mbuf *nam = nfsd->nd_nam;
+ struct sockaddr *nam = nfsd->nd_nam;
caddr_t dpos = nfsd->nd_dpos;
struct ucred *cred = &nfsd->nd_cr;
register u_long *tl;
diff --git a/sys/nfsserver/nfs_srvcache.c b/sys/nfsserver/nfs_srvcache.c
index c2623a30a471..6c6be6d08d83 100644
--- a/sys/nfsserver/nfs_srvcache.c
+++ b/sys/nfsserver/nfs_srvcache.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_srvcache.c 8.3 (Berkeley) 3/30/95
- * $Id: nfs_srvcache.c,v 1.12 1997/05/10 16:12:03 dfr Exp $
+ * $Id: nfs_srvcache.c,v 1.13 1997/08/02 14:33:07 bde Exp $
*/
#ifndef NFS_NOSERVER
@@ -49,6 +49,7 @@
#include <sys/mbuf.h>
#include <sys/malloc.h>
#include <sys/socket.h>
+#include <sys/socketvar.h> /* for dup_sockaddr */
#include <netinet/in.h>
#ifdef ISO
@@ -239,13 +240,13 @@ loop:
if (rp->rc_flag & RC_REPMBUF)
m_freem(rp->rc_reply);
if (rp->rc_flag & RC_NAM)
- MFREE(rp->rc_nam, mb);
+ FREE(rp->rc_nam, M_SONAME);
rp->rc_flag &= (RC_LOCKED | RC_WANTED);
}
TAILQ_INSERT_TAIL(&nfsrvlruhead, rp, rc_lru);
rp->rc_state = RC_INPROG;
rp->rc_xid = nd->nd_retxid;
- saddr = mtod(nd->nd_nam, struct sockaddr_in *);
+ saddr = (struct sockaddr_in *)nd->nd_nam;
switch (saddr->sin_family) {
case AF_INET:
rp->rc_flag |= RC_INETADDR;
@@ -254,7 +255,7 @@ loop:
case AF_ISO:
default:
rp->rc_flag |= RC_NAM;
- rp->rc_nam = m_copym(nd->nd_nam, 0, M_COPYALL, M_WAIT);
+ rp->rc_nam = dup_sockaddr(nd->nd_nam, 1);
break;
};
rp->rc_proc = nd->nd_procnum;
diff --git a/sys/nfsserver/nfs_srvsock.c b/sys/nfsserver/nfs_srvsock.c
index 0ea7f690f274..4b41e67f6a22 100644
--- a/sys/nfsserver/nfs_srvsock.c
+++ b/sys/nfsserver/nfs_srvsock.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_socket.c 8.5 (Berkeley) 3/30/95
- * $Id: nfs_socket.c,v 1.25 1997/05/13 17:25:44 dfr Exp $
+ * $Id: nfs_socket.c,v 1.26 1997/06/03 17:22:46 dfr Exp $
*/
/*
@@ -138,7 +138,7 @@ static int nfs_msg __P((struct proc *,char *,char *));
static int nfs_rcvlock __P((struct nfsreq *));
static void nfs_rcvunlock __P((int *flagp));
static void nfs_realign __P((struct mbuf *m, int hsiz));
-static int nfs_receive __P((struct nfsreq *rep, struct mbuf **aname,
+static int nfs_receive __P((struct nfsreq *rep, struct sockaddr **aname,
struct mbuf **mp));
static int nfs_reconnect __P((struct nfsreq *rep));
#ifndef NFS_NOSERVER
@@ -195,7 +195,7 @@ nfs_connect(nmp, rep)
struct proc *p = &proc0; /* only used for socreate and sobind */
nmp->nm_so = (struct socket *)0;
- saddr = mtod(nmp->nm_nam, struct sockaddr *);
+ saddr = nmp->nm_nam;
error = socreate(saddr->sa_family, &nmp->nm_so, nmp->nm_sotype,
nmp->nm_soproto, p);
if (error)
@@ -207,17 +207,18 @@ nfs_connect(nmp, rep)
* Some servers require that the client port be a reserved port number.
*/
if (saddr->sa_family == AF_INET && (nmp->nm_flag & NFSMNT_RESVPORT)) {
- MGET(m, M_WAIT, MT_SONAME);
- sin = mtod(m, struct sockaddr_in *);
- sin->sin_len = m->m_len = sizeof (struct sockaddr_in);
+ struct sockaddr_in ssin;
+ bzero(&ssin, sizeof ssin);
+ sin = &ssin;
+ sin->sin_len = sizeof (struct sockaddr_in);
sin->sin_family = AF_INET;
sin->sin_addr.s_addr = INADDR_ANY;
tport = IPPORT_RESERVED - 1;
sin->sin_port = htons(tport);
- while ((error = sobind(so, m, p)) == EADDRINUSE &&
+ while ((error = sobind(so, (struct sockaddr *)sin, p))
+ == EADDRINUSE &&
--tport > IPPORT_RESERVED / 2)
sin->sin_port = htons(tport);
- m_freem(m);
if (error)
goto bad;
}
@@ -232,6 +233,7 @@ nfs_connect(nmp, rep)
goto bad;
}
} else {
+ /* XXX should not use mbuf */
error = soconnect(so, nmp->nm_nam, p);
if (error)
goto bad;
@@ -383,11 +385,11 @@ nfs_disconnect(nmp)
int
nfs_send(so, nam, top, rep)
register struct socket *so;
- struct mbuf *nam;
+ struct sockaddr *nam;
register struct mbuf *top;
struct nfsreq *rep;
{
- struct mbuf *sendnam;
+ struct sockaddr *sendnam;
int error, soflags, flags;
if (rep) {
@@ -405,7 +407,7 @@ nfs_send(so, nam, top, rep)
} else
soflags = so->so_proto->pr_flags;
if ((soflags & PR_CONNREQUIRED) || (so->so_state & SS_ISCONNECTED))
- sendnam = (struct mbuf *)0;
+ sendnam = (struct sockaddr *)0;
else
sendnam = nam;
if (so->so_type == SOCK_SEQPACKET)
@@ -414,10 +416,11 @@ nfs_send(so, nam, top, rep)
flags = 0;
error = so->so_proto->pr_usrreqs->pru_sosend(so, sendnam, 0, top, 0,
- flags);
+ flags, curproc /*XXX*/);
if (error) {
if (rep) {
- log(LOG_INFO, "nfs send error %d for server %s\n",error,
+ log(LOG_INFO, "nfs send error %d for server %s\n",
+ error,
rep->r_nmp->nm_mountp->mnt_stat.f_mntfromname);
/*
* Deal with errors for the client side.
@@ -451,7 +454,7 @@ nfs_send(so, nam, top, rep)
static int
nfs_receive(rep, aname, mp)
register struct nfsreq *rep;
- struct mbuf **aname;
+ struct sockaddr **aname;
struct mbuf **mp;
{
register struct socket *so;
@@ -460,7 +463,7 @@ nfs_receive(rep, aname, mp)
register struct mbuf *m;
struct mbuf *control;
u_long len;
- struct mbuf **getnam;
+ struct sockaddr **getnam;
int error, sotype, rcvflg;
struct proc *p = curproc; /* XXX */
@@ -468,7 +471,7 @@ nfs_receive(rep, aname, mp)
* Set up arguments for soreceive()
*/
*mp = (struct mbuf *)0;
- *aname = (struct mbuf *)0;
+ *aname = (struct sockaddr *)0;
sotype = rep->r_nmp->nm_sotype;
/*
@@ -533,7 +536,7 @@ tryagain:
do {
rcvflg = MSG_WAITALL;
error = so->so_proto->pr_usrreqs->pru_soreceive
- (so, (struct mbuf **)0, &auio,
+ (so, (struct sockaddr **)0, &auio,
(struct mbuf **)0, (struct mbuf **)0,
&rcvflg);
if (error == EWOULDBLOCK && rep) {
@@ -568,7 +571,7 @@ tryagain:
do {
rcvflg = MSG_WAITALL;
error = so->so_proto->pr_usrreqs->pru_soreceive
- (so, (struct mbuf **)0,
+ (so, (struct sockaddr **)0,
&auio, mp, (struct mbuf **)0, &rcvflg);
} while (error == EWOULDBLOCK || error == EINTR ||
error == ERESTART);
@@ -593,7 +596,7 @@ tryagain:
do {
rcvflg = 0;
error = so->so_proto->pr_usrreqs->pru_soreceive
- (so, (struct mbuf **)0,
+ (so, (struct sockaddr **)0,
&auio, mp, &control, &rcvflg);
if (control)
m_freem(control);
@@ -628,7 +631,7 @@ errout:
if ((so = rep->r_nmp->nm_so) == NULL)
return (EACCES);
if (so->so_state & SS_ISCONNECTED)
- getnam = (struct mbuf **)0;
+ getnam = (struct sockaddr **)0;
else
getnam = aname;
auio.uio_resid = len = 1000000;
@@ -671,7 +674,8 @@ nfs_reply(myrep)
register struct nfsreq *rep;
register struct nfsmount *nmp = myrep->r_nmp;
register long t1;
- struct mbuf *mrep, *nam, *md;
+ struct mbuf *mrep, *md;
+ struct sockaddr *nam;
u_long rxid, *tl;
caddr_t dpos, cp2;
int error;
@@ -715,7 +719,7 @@ nfs_reply(myrep)
return (error);
}
if (nam)
- m_freem(nam);
+ FREE(nam, M_SONAME);
/*
* Get the xid and check that it is an rpc reply
@@ -1356,7 +1360,7 @@ nfs_timer(arg)
(m = m_copym(rep->r_mreq, 0, M_COPYALL, M_DONTWAIT))){
if ((nmp->nm_flag & NFSMNT_NOCONN) == 0)
error = (*so->so_proto->pr_usrreqs->pru_send)
- (so, 0, m, (struct mbuf *)0,
+ (so, 0, m, (struct sockaddr *)0,
(struct mbuf *)0, p);
else
error = (*so->so_proto->pr_usrreqs->pru_send)
@@ -1642,7 +1646,8 @@ nfsrv_rcv(so, arg, waitflag)
{
register struct nfssvc_sock *slp = (struct nfssvc_sock *)arg;
register struct mbuf *m;
- struct mbuf *mp, *nam;
+ struct mbuf *mp;
+ struct sockaddr *nam;
struct uio auio;
int flags, error;
@@ -1717,7 +1722,7 @@ nfsrv_rcv(so, arg, waitflag)
M_NFSRVDESC, waitflag);
if (!rec) {
if (nam)
- m_freem(nam);
+ FREE(nam, M_SONAME);
m_freem(mp);
continue;
}
@@ -1864,7 +1869,7 @@ nfsrv_getstream(slp, waitflag)
m_freem(slp->ns_frag);
} else {
nfs_realign(slp->ns_frag, 10 * NFSX_UNSIGNED);
- rec->nr_address = (struct mbuf*)0;
+ rec->nr_address = (struct sockaddr *)0;
rec->nr_packet = slp->ns_frag;
STAILQ_INSERT_TAIL(&slp->ns_rec, rec, nr_link);
}
@@ -1883,7 +1888,8 @@ nfsrv_dorec(slp, nfsd, ndp)
struct nfsrv_descript **ndp;
{
struct nfsrv_rec *rec;
- register struct mbuf *m, *nam;
+ register struct mbuf *m;
+ struct sockaddr *nam;
register struct nfsrv_descript *nd;
int error;
@@ -1902,7 +1908,7 @@ nfsrv_dorec(slp, nfsd, ndp)
nd->nd_dpos = mtod(m, caddr_t);
error = nfs_getreq(nd, nfsd, TRUE);
if (error) {
- m_freem(nam);
+ FREE(nam, M_SONAME);
free((caddr_t)nd, M_NFSRVDESC);
return (error);
}
diff --git a/sys/nfsserver/nfs_srvsubs.c b/sys/nfsserver/nfs_srvsubs.c
index 4c102c865edd..69baccb1d64b 100644
--- a/sys/nfsserver/nfs_srvsubs.c
+++ b/sys/nfsserver/nfs_srvsubs.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_subs.c 8.3 (Berkeley) 1/4/94
- * $Id: nfs_subs.c,v 1.39 1997/07/16 09:06:29 dfr Exp $
+ * $Id: nfs_subs.c,v 1.40 1997/07/22 15:35:57 dfr Exp $
*/
/*
@@ -1429,7 +1429,7 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag, pubflag)
fhandle_t *fhp;
int len;
struct nfssvc_sock *slp;
- struct mbuf *nam;
+ struct sockaddr *nam;
struct mbuf **mdp;
caddr_t *dposp;
struct vnode **retdirp;
@@ -1840,7 +1840,7 @@ nfsrv_fhtovp(fhp, lockflag, vpp, cred, slp, nam, rdonlyp, kerbflag, pubflag)
struct vnode **vpp;
struct ucred *cred;
struct nfssvc_sock *slp;
- struct mbuf *nam;
+ struct sockaddr *nam;
int *rdonlyp;
int kerbflag;
int pubflag;
@@ -1925,13 +1925,13 @@ int
netaddr_match(family, haddr, nam)
int family;
union nethostaddr *haddr;
- struct mbuf *nam;
+ struct sockaddr *nam;
{
register struct sockaddr_in *inetaddr;
switch (family) {
case AF_INET:
- inetaddr = mtod(nam, struct sockaddr_in *);
+ inetaddr = (struct sockaddr_in *)nam;
if (inetaddr->sin_family == AF_INET &&
inetaddr->sin_addr.s_addr == haddr->had_inetaddr)
return (1);
@@ -1941,8 +1941,8 @@ netaddr_match(family, haddr, nam)
{
register struct sockaddr_iso *isoaddr1, *isoaddr2;
- isoaddr1 = mtod(nam, struct sockaddr_iso *);
- isoaddr2 = mtod(haddr->had_nam, struct sockaddr_iso *);
+ isoaddr1 = (struct sockaddr_iso *)nam;
+ isoaddr2 = (struct sockaddr_iso *)haddr->had_nam;
if (isoaddr1->siso_family == AF_ISO &&
isoaddr1->siso_nlen > 0 &&
isoaddr1->siso_nlen == isoaddr2->siso_nlen &&
diff --git a/sys/nfsserver/nfs_syscalls.c b/sys/nfsserver/nfs_syscalls.c
index 0c46e2817651..ad93ce67a708 100644
--- a/sys/nfsserver/nfs_syscalls.c
+++ b/sys/nfsserver/nfs_syscalls.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_syscalls.c 8.5 (Berkeley) 3/30/95
- * $Id: nfs_syscalls.c,v 1.25 1997/06/25 21:07:26 tegge Exp $
+ * $Id: nfs_syscalls.c,v 1.26 1997/07/16 09:06:29 dfr Exp $
*/
#include <sys/param.h>
@@ -106,7 +106,7 @@ static int notstarted = 1;
static int modify_flag = 0;
static void nfsd_rt __P((int sotype, struct nfsrv_descript *nd,
int cacherep));
-static int nfssvc_addsock __P((struct file *, struct mbuf *,
+static int nfssvc_addsock __P((struct file *, struct sockaddr *,
struct proc *));
static int nfssvc_nfsd __P((struct nfsd_srvargs *,caddr_t,struct proc *));
@@ -184,7 +184,7 @@ nfssvc(p, uap, retval)
#ifndef NFS_NOSERVER
struct nameidata nd;
struct file *fp;
- struct mbuf *nam;
+ struct sockaddr *nam;
struct nfsd_args nfsdarg;
struct nfsd_srvargs nfsd_srvargs, *nsd = &nfsd_srvargs;
struct nfsd_cargs ncd;
@@ -243,10 +243,10 @@ nfssvc(p, uap, retval)
* Get the client address for connected sockets.
*/
if (nfsdarg.name == NULL || nfsdarg.namelen == 0)
- nam = (struct mbuf *)0;
+ nam = (struct sockaddr *)0;
else {
- error = sockargs(&nam, nfsdarg.name, nfsdarg.namelen,
- MT_SONAME);
+ error = getsockaddr(&nam, nfsdarg.name,
+ nfsdarg.namelen);
if (error)
return (error);
}
@@ -295,7 +295,7 @@ nfssvc(p, uap, retval)
TAILQ_REMOVE(&slp->ns_uidlruhead, nuidp,
nu_lru);
if (nuidp->nu_flag & NU_NAM)
- m_freem(nuidp->nu_nam);
+ FREE(nuidp->nu_nam, M_SONAME);
}
nuidp->nu_flag = 0;
nuidp->nu_cr = nsd->nsd_cr;
@@ -312,8 +312,8 @@ nfssvc(p, uap, retval)
if (nfsd->nfsd_nd->nd_nam2) {
struct sockaddr_in *saddr;
- saddr = mtod(nfsd->nfsd_nd->nd_nam2,
- struct sockaddr_in *);
+ saddr = (struct sockaddr_in *)
+ nfsd->nfsd_nd->nd_nam2;
switch (saddr->sin_family) {
case AF_INET:
nuidp->nu_flag |= NU_INETADDR;
@@ -323,9 +323,9 @@ nfssvc(p, uap, retval)
case AF_ISO:
default:
nuidp->nu_flag |= NU_NAM;
- nuidp->nu_nam = m_copym(
- nfsd->nfsd_nd->nd_nam2, 0,
- M_COPYALL, M_WAIT);
+ nuidp->nu_nam =
+ dup_sockaddr(nfsd->nfsd_nd->
+ nd_nam2, 1);
break;
};
}
@@ -356,7 +356,7 @@ nfssvc(p, uap, retval)
static int
nfssvc_addsock(fp, mynam, p)
struct file *fp;
- struct mbuf *mynam;
+ struct sockaddr *mynam;
struct proc *p;
{
register struct mbuf *m;
@@ -374,14 +374,14 @@ nfssvc_addsock(fp, mynam, p)
if (so->so_proto->pr_protocol == IPPROTO_UDP) {
tslp = nfs_udpsock;
if (tslp->ns_flag & SLP_VALID) {
- m_freem(mynam);
+ FREE(mynam, M_SONAME);
return (EPERM);
}
#ifdef ISO
} else if (so->so_proto->pr_protocol == ISOPROTO_CLTP) {
tslp = nfs_cltpsock;
if (tslp->ns_flag & SLP_VALID) {
- m_freem(mynam);
+ FREE(mynam, M_SONAME);
return (EPERM);
}
#endif /* ISO */
@@ -392,7 +392,7 @@ nfssvc_addsock(fp, mynam, p)
siz = NFS_MAXPACKET;
error = soreserve(so, siz, siz);
if (error) {
- m_freem(mynam);
+ FREE(mynam, M_SONAME);
return (error);
}
@@ -564,8 +564,9 @@ nfssvc_nfsd(nsd, argp, p)
*/
if (nfsd->nfsd_flag & NFSD_NEEDAUTH) {
nfsd->nfsd_flag &= ~NFSD_NEEDAUTH;
- nsd->nsd_haddr = mtod(nd->nd_nam,
- struct sockaddr_in *)->sin_addr.s_addr;
+ nsd->nsd_haddr =
+ ((struct sockaddr_in *)
+ nd->nd_nam)->sin_addr.s_addr;
nsd->nsd_authlen = nfsd->nfsd_authlen;
nsd->nsd_verflen = nfsd->nfsd_verflen;
if (!copyout(nfsd->nfsd_authstr,nsd->nsd_authstr,
@@ -607,10 +608,10 @@ nfssvc_nfsd(nsd, argp, p)
/* Check if source port is privileged */
u_short port;
u_long addr;
- struct mbuf *nam = nd->nd_nam;
+ struct sockaddr *nam = nd->nd_nam;
struct sockaddr_in *sin;
- sin = mtod(nam, struct sockaddr_in *);
+ sin = (struct sockaddr_in *)nam;
port = ntohs(sin->sin_port);
if (port >= IPPORT_RESERVED &&
nd->nd_procnum != NFSPROC_NULL) {
@@ -649,7 +650,7 @@ nfssvc_nfsd(nsd, argp, p)
nfsstats.srv_errs++;
nfsrv_updatecache(nd, FALSE, mreq);
if (nd->nd_nam2)
- m_freem(nd->nd_nam2);
+ FREE(nd->nd_nam2, M_SONAME);
break;
}
nfsstats.srvrpccnt[nd->nd_procnum]++;
@@ -688,7 +689,7 @@ nfssvc_nfsd(nsd, argp, p)
if (nfsrtton)
nfsd_rt(sotype, nd, cacherep);
if (nd->nd_nam2)
- MFREE(nd->nd_nam2, m);
+ FREE(nd->nd_nam2, M_SONAME);
if (nd->nd_mrep)
m_freem(nd->nd_mrep);
if (error == EPIPE)
@@ -706,7 +707,7 @@ nfssvc_nfsd(nsd, argp, p)
if (nfsrtton)
nfsd_rt(sotype, nd, cacherep);
m_freem(nd->nd_mrep);
- m_freem(nd->nd_nam2);
+ FREE(nd->nd_nam2, M_SONAME);
break;
};
if (nd) {
@@ -857,12 +858,12 @@ nfsrv_zapsock(slp)
soshutdown(so, 2);
closef(fp, (struct proc *)0);
if (slp->ns_nam)
- MFREE(slp->ns_nam, m);
+ FREE(slp->ns_nam, M_SONAME);
m_freem(slp->ns_raw);
while (rec = STAILQ_FIRST(&slp->ns_rec)) {
STAILQ_REMOVE_HEAD(&slp->ns_rec, nr_link);
if (rec->nr_address)
- m_freem(rec->nr_address);
+ FREE(rec->nr_address, M_SONAME);
m_freem(rec->nr_packet);
free(rec, M_NFSRVDESC);
}
@@ -872,7 +873,7 @@ nfsrv_zapsock(slp)
LIST_REMOVE(nuidp, nu_hash);
TAILQ_REMOVE(&slp->ns_uidlruhead, nuidp, nu_lru);
if (nuidp->nu_flag & NU_NAM)
- m_freem(nuidp->nu_nam);
+ FREE(nuidp->nu_nam, M_SONAME);
free((caddr_t)nuidp, M_NFSUID);
}
s = splsoftclock();
@@ -1182,8 +1183,8 @@ nfsd_rt(sotype, nd, cacherep)
else if (nd->nd_flag & ND_NFSV3)
rt->flag |= DRT_NFSV3;
rt->proc = nd->nd_procnum;
- if (mtod(nd->nd_nam, struct sockaddr *)->sa_family == AF_INET)
- rt->ipadr = mtod(nd->nd_nam, struct sockaddr_in *)->sin_addr.s_addr;
+ if (nd->nd_nam->sa_family == AF_INET)
+ rt->ipadr = ((struct sockaddr_in *)nd->nd_nam)->sin_addr.s_addr;
else
rt->ipadr = INADDR_ANY;
rt->resptime = ((time.tv_sec - nd->nd_starttime.tv_sec) * 1000000) +
diff --git a/sys/nfsserver/nfsrvstats.h b/sys/nfsserver/nfsrvstats.h
index 528a366c1e67..e1a47551689b 100644
--- a/sys/nfsserver/nfsrvstats.h
+++ b/sys/nfsserver/nfsrvstats.h
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs.h 8.4 (Berkeley) 5/1/95
- * $Id: nfs.h,v 1.28 1997/06/03 17:22:45 dfr Exp $
+ * $Id: nfs.h,v 1.29 1997/07/16 09:06:27 dfr Exp $
*/
#ifndef _NFS_NFS_H_
@@ -382,7 +382,7 @@ extern TAILQ_HEAD(nfs_reqq, nfsreq) nfs_reqq;
*/
union nethostaddr {
u_long had_inetaddr;
- struct mbuf *had_nam;
+ struct sockaddr *had_nam;
};
struct nfsuid {
@@ -406,7 +406,7 @@ struct nfsuid {
struct nfsrv_rec {
STAILQ_ENTRY(nfsrv_rec) nr_link;
- struct mbuf *nr_address;
+ struct sockaddr *nr_address;
struct mbuf *nr_packet;
};
@@ -415,7 +415,7 @@ struct nfssvc_sock {
TAILQ_HEAD(, nfsuid) ns_uidlruhead;
struct file *ns_fp;
struct socket *ns_so;
- struct mbuf *ns_nam;
+ struct sockaddr *ns_nam;
struct mbuf *ns_raw;
struct mbuf *ns_rawend;
STAILQ_HEAD(, nfsrv_rec) ns_rec;
@@ -480,8 +480,8 @@ struct nfsrv_descript {
struct mbuf *nd_mrep; /* Request mbuf list */
struct mbuf *nd_md; /* Current dissect mbuf */
struct mbuf *nd_mreq; /* Reply mbuf list */
- struct mbuf *nd_nam; /* and socket addr */
- struct mbuf *nd_nam2; /* return socket addr */
+ struct sockaddr *nd_nam; /* and socket addr */
+ struct sockaddr *nd_nam2; /* return socket addr */
caddr_t nd_dpos; /* Current dissect pos */
u_int32_t nd_procnum; /* RPC # */
int nd_stable; /* storage type */
@@ -567,70 +567,91 @@ extern int nfs_debug;
int nfs_init __P((struct vfsconf *vfsp));
int nfs_reply __P((struct nfsreq *));
int nfs_getreq __P((struct nfsrv_descript *,struct nfsd *,int));
-int nfs_send __P((struct socket *,struct mbuf *,struct mbuf *,struct nfsreq *));
-int nfs_rephead __P((int,struct nfsrv_descript *,struct nfssvc_sock *,int,int,u_quad_t *,struct mbuf **,struct mbuf **,caddr_t *));
-int nfs_sndlock __P((int *,struct nfsreq *));
+int nfs_send __P((struct socket *, struct sockaddr *, struct mbuf *,
+ struct nfsreq *));
+int nfs_rephead __P((int, struct nfsrv_descript *, struct nfssvc_sock *,
+ int, int, u_quad_t *, struct mbuf **, struct mbuf **,
+ caddr_t *));
+int nfs_sndlock __P((int *, struct nfsreq *));
void nfs_sndunlock __P((int *flagp));
-int nfs_disct __P((struct mbuf **,caddr_t *,int,int,caddr_t *));
-int nfs_vinvalbuf __P((struct vnode *,int,struct ucred *,struct proc *,int));
-int nfs_readrpc __P((struct vnode *,struct uio *,struct ucred *));
-int nfs_writerpc __P((struct vnode *,struct uio *,struct ucred *,int *,int *));
-int nfs_readdirrpc __P((register struct vnode *,struct uio *,struct ucred *));
-int nfs_asyncio __P((struct buf *,struct ucred *));
-int nfs_doio __P((struct buf *,struct ucred *,struct proc *));
-int nfs_readlinkrpc __P((struct vnode *,struct uio *,struct ucred *));
-int nfs_sigintr __P((struct nfsmount *,struct nfsreq *r,struct proc *));
-int nfs_readdirplusrpc __P((struct vnode *,register struct uio *,struct ucred *));
-int nfsm_disct __P((struct mbuf **,caddr_t *,int,int,caddr_t *));
-void nfsm_srvfattr __P((struct nfsrv_descript *,struct vattr *,struct nfs_fattr *));
-void nfsm_srvwcc __P((struct nfsrv_descript *,int,struct vattr *,int,struct vattr *,struct mbuf **,char **));
-void nfsm_srvpostopattr __P((struct nfsrv_descript *,int,struct vattr *,struct mbuf **,char **));
-int netaddr_match __P((int,union nethostaddr *,struct mbuf *));
-int nfs_request __P((struct vnode *,struct mbuf *,int,struct proc *,struct ucred *,struct mbuf **,struct mbuf **,caddr_t *));
-int nfs_loadattrcache __P((struct vnode **,struct mbuf **,caddr_t *,struct vattr *));
-int nfs_namei __P((struct nameidata *,fhandle_t *,int,struct nfssvc_sock *,struct mbuf *,struct mbuf **,caddr_t *,struct vnode **,struct proc *,int,int));
-void nfsm_adj __P((struct mbuf *,int,int));
-int nfsm_mbuftouio __P((struct mbuf **,struct uio *,int,caddr_t *));
+int nfs_disct __P((struct mbuf **, caddr_t *, int, int, caddr_t *));
+int nfs_vinvalbuf __P((struct vnode *, int, struct ucred *, struct proc *,
+ int));
+int nfs_readrpc __P((struct vnode *, struct uio *, struct ucred *));
+int nfs_writerpc __P((struct vnode *, struct uio *, struct ucred *, int *,
+ int *));
+int nfs_readdirrpc __P((struct vnode *, struct uio *, struct ucred *));
+int nfs_asyncio __P((struct buf *, struct ucred *));
+int nfs_doio __P((struct buf *, struct ucred *, struct proc *));
+int nfs_readlinkrpc __P((struct vnode *, struct uio *, struct ucred *));
+int nfs_sigintr __P((struct nfsmount *, struct nfsreq *, struct proc *));
+int nfs_readdirplusrpc __P((struct vnode *, struct uio *, struct ucred *));
+int nfsm_disct __P((struct mbuf **, caddr_t *, int, int, caddr_t *));
+void nfsm_srvfattr __P((struct nfsrv_descript *, struct vattr *,
+ struct nfs_fattr *));
+void nfsm_srvwcc __P((struct nfsrv_descript *, int, struct vattr *, int,
+ struct vattr *, struct mbuf **, char **));
+void nfsm_srvpostopattr __P((struct nfsrv_descript *, int, struct vattr *,
+ struct mbuf **, char **));
+int netaddr_match __P((int, union nethostaddr *, struct sockaddr *));
+int nfs_request __P((struct vnode *, struct mbuf *, int, struct proc *,
+ struct ucred *, struct mbuf **, struct mbuf **,
+ caddr_t *));
+int nfs_loadattrcache __P((struct vnode **, struct mbuf **, caddr_t *,
+ struct vattr *));
+int nfs_namei __P((struct nameidata *, fhandle_t *, int,
+ struct nfssvc_sock *, struct sockaddr *, struct mbuf **,
+ caddr_t *, struct vnode **, struct proc *, int, int));
+void nfsm_adj __P((struct mbuf *, int, int));
+int nfsm_mbuftouio __P((struct mbuf **, struct uio *, int, caddr_t *));
void nfsrv_initcache __P((void));
-int nfs_getauth __P((struct nfsmount *,struct nfsreq *,struct ucred *,char **,int *,char *,int *,NFSKERBKEY_T));
-int nfs_getnickauth __P((struct nfsmount *,struct ucred *,char **,int *,char *,int));
-int nfs_savenickauth __P((struct nfsmount *,struct ucred *,int,NFSKERBKEY_T,struct mbuf **,char **,struct mbuf *));
-int nfs_adv __P((struct mbuf **,caddr_t *,int,int));
+int nfs_getauth __P((struct nfsmount *, struct nfsreq *, struct ucred *,
+ char **, int *, char *, int *, NFSKERBKEY_T));
+int nfs_getnickauth __P((struct nfsmount *, struct ucred *, char **,
+ int *, char *, int));
+int nfs_savenickauth __P((struct nfsmount *, struct ucred *, int,
+ NFSKERBKEY_T, struct mbuf **, char **,
+ struct mbuf *));
+int nfs_adv __P((struct mbuf **, caddr_t *, int, int));
void nfs_nhinit __P((void));
void nfs_timer __P((void*));
-u_long nfs_hash __P((nfsfh_t *,int));
-int nfsrv_dorec __P((struct nfssvc_sock *,struct nfsd *,struct nfsrv_descript **));
-int nfsrv_getcache __P((struct nfsrv_descript *,struct nfssvc_sock *,struct mbuf **));
-void nfsrv_updatecache __P((struct nfsrv_descript *,int,struct mbuf *));
+u_long nfs_hash __P((nfsfh_t *, int));
+int nfsrv_dorec __P((struct nfssvc_sock *, struct nfsd *,
+ struct nfsrv_descript **));
+int nfsrv_getcache __P((struct nfsrv_descript *, struct nfssvc_sock *,
+ struct mbuf **));
+void nfsrv_updatecache __P((struct nfsrv_descript *, int, struct mbuf *));
void nfsrv_cleancache __P((void));
-int nfs_connect __P((struct nfsmount *,struct nfsreq *));
+int nfs_connect __P((struct nfsmount *, struct nfsreq *));
void nfs_disconnect __P((struct nfsmount *));
-int nfs_getattrcache __P((struct vnode *,struct vattr *));
-int nfsm_strtmbuf __P((struct mbuf **,char **,char *,long));
-int nfs_bioread __P((struct vnode *,struct uio *,int,struct ucred *, int getpages));
-int nfsm_uiotombuf __P((struct uio *,struct mbuf **,int,caddr_t *));
+int nfs_getattrcache __P((struct vnode *, struct vattr *));
+int nfsm_strtmbuf __P((struct mbuf **, char **, char *, long));
+int nfs_bioread __P((struct vnode *, struct uio *, int, struct ucred *,
+ int));
+int nfsm_uiotombuf __P((struct uio *, struct mbuf **, int, caddr_t *));
void nfsrv_init __P((int));
void nfs_clearcommit __P((struct mount *));
int nfsrv_errmap __P((struct nfsrv_descript *, int));
-void nfsrvw_sort __P((gid_t [],int));
-void nfsrv_setcred __P((struct ucred *,struct ucred *));
-int nfs_writebp __P((struct buf *,int));
-int nfsrv_object_create __P(( struct vnode * ));
+void nfsrvw_sort __P((gid_t *, int));
+void nfsrv_setcred __P((struct ucred *, struct ucred *));
+int nfs_writebp __P((struct buf *, int));
+int nfsrv_object_create __P((struct vnode *));
void nfsrv_wakenfsd __P((struct nfssvc_sock *slp));
int nfsrv_writegather __P((struct nfsrv_descript **, struct nfssvc_sock *,
struct proc *, struct mbuf **));
int nfs_fsinfo __P((struct nfsmount *, struct vnode *, struct ucred *,
struct proc *p));
-int nfsrv3_access __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
+int nfsrv3_access __P((struct nfsrv_descript *nfsd,
+ struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
int nfsrv_commit __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
int nfsrv_create __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
-int nfsrv_fhtovp __P((fhandle_t *,int,struct vnode **,
- struct ucred *,struct nfssvc_sock *,struct mbuf *,
- int *,int,int));
+int nfsrv_fhtovp __P((fhandle_t *, int, struct vnode **, struct ucred *,
+ struct nfssvc_sock *, struct sockaddr *, int *,
+ int, int));
int nfsrv_setpublicfs __P((struct mount *, struct netexport *,
struct export_args *));
int nfs_ispublicfh __P((fhandle_t *));
@@ -655,7 +676,8 @@ int nfsrv_pathconf __P((struct nfsrv_descript *nfsd,
struct mbuf **mrq));
int nfsrv_read __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
-int nfsrv_readdir __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
+int nfsrv_readdir __P((struct nfsrv_descript *nfsd,
+ struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
int nfsrv_readdirplus __P((struct nfsrv_descript *nfsd,
struct nfssvc_sock *slp, struct proc *procp,
@@ -669,11 +691,14 @@ int nfsrv_rename __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
int nfsrv_rmdir __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
-int nfsrv_setattr __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
+int nfsrv_setattr __P((struct nfsrv_descript *nfsd,
+ struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
-int nfsrv_statfs __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
+int nfsrv_statfs __P((struct nfsrv_descript *nfsd,
+ struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
-int nfsrv_symlink __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
+int nfsrv_symlink __P((struct nfsrv_descript *nfsd,
+ struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
int nfsrv_write __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
diff --git a/sys/sys/malloc.h b/sys/sys/malloc.h
index fd827652b3a3..1895b454d37b 100644
--- a/sys/sys/malloc.h
+++ b/sys/sys/malloc.h
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)malloc.h 8.5 (Berkeley) 5/3/95
- * $Id: malloc.h,v 1.21 1997/07/06 02:40:35 dyson Exp $
+ * $Id: malloc.h,v 1.22 1997/08/05 00:01:43 dyson Exp $
*/
#ifndef _SYS_MALLOC_H_
@@ -136,7 +136,8 @@
#define M_VFSCONF 89 /* vfsconf structure */
#define M_AIO 90 /* AIO structure(s) */
#define M_ZONE 91 /* Zone header */
-#define M_LAST 92 /* Must be last type + 1 */
+#define M_HOSTCACHE 92 /* per-host information cache structure */
+#define M_LAST 93 /* Must be last type + 1 */
#define INITKMEMNAMES { \
"free", /* 0 M_FREE */ \
@@ -228,6 +229,7 @@
"VFS conf", /* 89 M_VFSCONF */ \
"AIO", /* 90 M_AIO */ \
"ZONE", /* 91 M_ZONE */ \
+ "hostcache", /* 92 M_HOSTCACHE */ \
}
struct kmemstats {
diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h
index 7911cd843856..9053c4cbe0b0 100644
--- a/sys/sys/mbuf.h
+++ b/sys/sys/mbuf.h
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)mbuf.h 8.5 (Berkeley) 2/19/95
- * $Id: mbuf.h,v 1.20 1997/02/22 09:45:32 peter Exp $
+ * $Id: mbuf.h,v 1.21 1997/02/24 20:32:07 wollman Exp $
*/
#ifndef _SYS_MBUF_H_
@@ -135,16 +135,16 @@ struct mbuf {
#define MT_FREE 0 /* should be on free list */
#define MT_DATA 1 /* dynamic (data) allocation */
#define MT_HEADER 2 /* packet header */
-#define MT_SOCKET 3 /* socket structure */
-#define MT_PCB 4 /* protocol control block */
+/*efine MT_SOCKET 3*/ /* socket structure */
+/*efine MT_PCB 4*/ /* protocol control block */
#define MT_RTABLE 5 /* routing tables */
-#define MT_HTABLE 6 /* IMP host tables */
-#define MT_ATABLE 7 /* address resolution tables */
+/*efine MT_HTABLE 6*/ /* IMP host tables */
+/*efine MT_ATABLE 7*/ /* address resolution tables */
#define MT_SONAME 8 /* socket name */
#define MT_SOOPTS 10 /* socket options */
#define MT_FTABLE 11 /* fragment reassembly header */
-#define MT_RIGHTS 12 /* access rights */
-#define MT_IFADDR 13 /* interface address */
+/*efine MT_RIGHTS 12*/ /* access rights */
+/*efine MT_IFADDR 13*/ /* interface address */
#define MT_CONTROL 14 /* extra-data protocol message */
#define MT_OOBDATA 15 /* expedited data */
@@ -423,22 +423,19 @@ int mbtypes[] = { /* XXX */
M_FREE, /* MT_FREE 0 should be on free list */
M_MBUF, /* MT_DATA 1 dynamic (data) allocation */
M_MBUF, /* MT_HEADER 2 packet header */
- M_SOCKET, /* MT_SOCKET 3 socket structure */
- M_PCB, /* MT_PCB 4 protocol control block */
+ 0, /* 3 */
+ 0, /* 4 */
M_RTABLE, /* MT_RTABLE 5 routing tables */
- M_HTABLE, /* MT_HTABLE 6 IMP host tables */
- 0, /* MT_ATABLE 7 address resolution tables */
+ 0, /* 6 */
+ 0, /* 7 */
M_MBUF, /* MT_SONAME 8 socket name */
0, /* 9 */
M_SOOPTS, /* MT_SOOPTS 10 socket options */
M_FTABLE, /* MT_FTABLE 11 fragment reassembly header */
- M_MBUF, /* MT_RIGHTS 12 access rights */
- M_IFADDR, /* MT_IFADDR 13 interface address */
+ 0, /* 12 */
+ 0, /* 13 */
M_MBUF, /* MT_CONTROL 14 extra-data protocol message */
M_MBUF, /* MT_OOBDATA 15 expedited data */
-#ifdef DATAKIT
- 25, 26, 27, 28, 29, 30, 31, 32 /* datakit ugliness */
-#endif
};
#endif
#endif
diff --git a/sys/sys/mount.h b/sys/sys/mount.h
index 284ccaa3ec11..7e3b297576ac 100644
--- a/sys/sys/mount.h
+++ b/sys/sys/mount.h
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)mount.h 8.21 (Berkeley) 5/20/95
- * $Id: mount.h,v 1.43 1997/07/16 18:04:52 dfr Exp $
+ * $Id: mount.h,v 1.44 1997/07/22 08:03:19 bde Exp $
*/
#ifndef _SYS_MOUNT_H_
@@ -334,7 +334,7 @@ struct vfsops {
int (*vfs_vget) __P((struct mount *mp, ino_t ino,
struct vnode **vpp));
int (*vfs_fhtovp) __P((struct mount *mp, struct fid *fhp,
- struct mbuf *nam, struct vnode **vpp,
+ struct sockaddr *nam, struct vnode **vpp,
int *exflagsp, struct ucred **credanonp));
int (*vfs_vptofh) __P((struct vnode *vp, struct fid *fhp));
int (*vfs_init) __P((struct vfsconf *));
@@ -426,7 +426,7 @@ int vfs_busy __P((struct mount *, int, struct simplelock *, struct proc *));
int vfs_export /* process mount export info */
__P((struct mount *, struct netexport *, struct export_args *));
struct netcred *vfs_export_lookup /* lookup host in fs export list */
- __P((struct mount *, struct netexport *, struct mbuf *));
+ __P((struct mount *, struct netexport *, struct sockaddr *));
void vfs_getnewfsid __P((struct mount *));
struct mount *vfs_getvfs __P((fsid_t *)); /* return vfs given fsid */
int vfs_mountedon __P((struct vnode *)); /* is a vfs mounted on vp */
diff --git a/sys/sys/protosw.h b/sys/sys/protosw.h
index 5406e7ef2e34..745a67dd926a 100644
--- a/sys/sys/protosw.h
+++ b/sys/sys/protosw.h
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)protosw.h 8.1 (Berkeley) 6/2/93
- * $Id: protosw.h,v 1.18 1997/05/24 17:23:10 peter Exp $
+ * $Id: protosw.h,v 1.19 1997/05/27 06:17:22 charnier Exp $
*/
#ifndef _SYS_PROTOSW_H_
@@ -40,6 +40,7 @@
/* Forward declare these structures referenced from prototypes below. */
struct ifnet;
struct mbuf;
+struct proc;
struct sockaddr;
struct socket;
struct sockproto;
@@ -47,6 +48,7 @@ struct stat;
struct uio;
struct proc;
+/*#ifdef KERNEL*/
/*
* Protocol switch table.
*
@@ -96,6 +98,7 @@ struct protosw {
/* flush any excess space possible */
struct pr_usrreqs *pr_usrreqs; /* supersedes pr_usrreq() */
};
+/*#endif*/
#define PR_SLOWHZ 2 /* 2 slow timeouts per second */
#define PR_FASTHZ 5 /* 5 fast timeouts per second */
@@ -177,12 +180,12 @@ char *prurequests[] = {
*/
struct pr_usrreqs {
int (*pru_abort) __P((struct socket *so));
- int (*pru_accept) __P((struct socket *so, struct mbuf *nam));
+ int (*pru_accept) __P((struct socket *so, struct sockaddr **nam));
int (*pru_attach) __P((struct socket *so, int proto,
struct proc *p));
- int (*pru_bind) __P((struct socket *so, struct mbuf *nam,
+ int (*pru_bind) __P((struct socket *so, struct sockaddr *nam,
struct proc *p));
- int (*pru_connect) __P((struct socket *so, struct mbuf *nam,
+ int (*pru_connect) __P((struct socket *so, struct sockaddr *nam,
struct proc *p));
int (*pru_connect2) __P((struct socket *so1, struct socket *so2));
int (*pru_control) __P((struct socket *so, int cmd, caddr_t data,
@@ -190,18 +193,20 @@ struct pr_usrreqs {
int (*pru_detach) __P((struct socket *so));
int (*pru_disconnect) __P((struct socket *so));
int (*pru_listen) __P((struct socket *so, struct proc *p));
- int (*pru_peeraddr) __P((struct socket *so, struct mbuf *nam));
+ int (*pru_peeraddr) __P((struct socket *so,
+ struct sockaddr **nam));
int (*pru_rcvd) __P((struct socket *so, int flags));
int (*pru_rcvoob) __P((struct socket *so, struct mbuf *m,
int flags));
int (*pru_send) __P((struct socket *so, int flags, struct mbuf *m,
- struct mbuf *addr, struct mbuf *control,
+ struct sockaddr *addr, struct mbuf *control,
struct proc *p));
#define PRUS_OOB 0x1
#define PRUS_EOF 0x2
int (*pru_sense) __P((struct socket *so, struct stat *sb));
int (*pru_shutdown) __P((struct socket *so));
- int (*pru_sockaddr) __P((struct socket *so, struct mbuf *nam));
+ int (*pru_sockaddr) __P((struct socket *so,
+ struct sockaddr **nam));
/*
* These three added later, so they are out of order. They are used
@@ -211,18 +216,20 @@ struct pr_usrreqs {
* through these entry points. For protocols which still use
* the generic code, these just point to those routines.
*/
- int (*pru_sosend) __P((struct socket *so, struct mbuf *addr,
+ int (*pru_sosend) __P((struct socket *so, struct sockaddr *addr,
struct uio *uio, struct mbuf *top,
- struct mbuf *control, int flags));
- int (*pru_soreceive) __P((struct socket *so, struct mbuf **paddr,
+ struct mbuf *control, int flags,
+ struct proc *p));
+ int (*pru_soreceive) __P((struct socket *so,
+ struct sockaddr **paddr,
struct uio *uio, struct mbuf **mp0,
struct mbuf **controlp, int *flagsp));
int (*pru_soselect) __P((struct socket *so, int which,
struct proc *p));
};
-int pru_accept_notsupp __P((struct socket *so, struct mbuf *nam));
-int pru_connect_notsupp __P((struct socket *so, struct mbuf *nam,
+int pru_accept_notsupp __P((struct socket *so, struct sockaddr **nam));
+int pru_connect_notsupp __P((struct socket *so, struct sockaddr *nam,
struct proc *p));
int pru_connect2_notsupp __P((struct socket *so1, struct socket *so2));
int pru_control_notsupp __P((struct socket *so, int cmd, caddr_t data,
diff --git a/sys/sys/socket.h b/sys/sys/socket.h
index db873c37afd3..2d0114315e8e 100644
--- a/sys/sys/socket.h
+++ b/sys/sys/socket.h
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)socket.h 8.4 (Berkeley) 2/21/94
- * $Id: socket.h,v 1.19 1997/04/30 15:32:52 wollman Exp $
+ * $Id: socket.h,v 1.20 1997/05/09 12:19:06 kjc Exp $
*/
#ifndef _SYS_SOCKET_H_
@@ -139,6 +139,7 @@ struct sockaddr {
u_char sa_family; /* address family */
char sa_data[14]; /* actually longer; address value */
};
+#define SOCK_MAXADDRLEN 255 /* longest possible addresses */
/*
* Structure used by kernel to pass protocol
diff --git a/sys/sys/socketvar.h b/sys/sys/socketvar.h
index 2a4ddae306bf..74757fb43f71 100644
--- a/sys/sys/socketvar.h
+++ b/sys/sys/socketvar.h
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)socketvar.h 8.3 (Berkeley) 2/19/95
- * $Id: socketvar.h,v 1.19 1997/04/27 20:01:28 wollman Exp $
+ * $Id: socketvar.h,v 1.20 1997/07/19 20:15:43 fenner Exp $
*/
#ifndef _SYS_SOCKETVAR_H_
@@ -216,8 +216,10 @@ int soo_stat __P((struct socket *so, struct stat *ub));
/*
* From uipc_socket and friends
*/
+struct sockaddr *dup_sockaddr __P((struct sockaddr *sa, int canwait));
int getsock __P((struct filedesc *fdp, int fdes, struct file **fpp));
int sockargs __P((struct mbuf **mp, caddr_t buf, int buflen, int type));
+int getsockaddr __P((struct sockaddr **namp, caddr_t uaddr, size_t len));
void sbappend __P((struct sockbuf *sb, struct mbuf *m));
int sbappendaddr __P((struct sockbuf *sb, struct sockaddr *asa,
struct mbuf *m0, struct mbuf *control));
@@ -237,12 +239,12 @@ int sbreserve __P((struct sockbuf *sb, u_long cc));
int sbwait __P((struct sockbuf *sb));
int sb_lock __P((struct sockbuf *sb));
int soabort __P((struct socket *so));
-int soaccept __P((struct socket *so, struct mbuf *nam));
-int sobind __P((struct socket *so, struct mbuf *nam, struct proc *p));
+int soaccept __P((struct socket *so, struct sockaddr **nam));
+int sobind __P((struct socket *so, struct sockaddr *nam, struct proc *p));
void socantrcvmore __P((struct socket *so));
void socantsendmore __P((struct socket *so));
int soclose __P((struct socket *so));
-int soconnect __P((struct socket *so, struct mbuf *nam, struct proc *p));
+int soconnect __P((struct socket *so, struct sockaddr *nam, struct proc *p));
int soconnect2 __P((struct socket *so1, struct socket *so2));
int socreate __P((int dom, struct socket **aso, int type, int proto,
struct proc *p));
@@ -260,13 +262,15 @@ struct socket *
sodropablereq __P((struct socket *head));
struct socket *
sonewconn __P((struct socket *head, int connstatus));
-int soreceive __P((struct socket *so, struct mbuf **paddr, struct uio *uio,
- struct mbuf **mp0, struct mbuf **controlp, int *flagsp));
+int soreceive __P((struct socket *so, struct sockaddr **paddr,
+ struct uio *uio, struct mbuf **mp0,
+ struct mbuf **controlp, int *flagsp));
int soreserve __P((struct socket *so, u_long sndcc, u_long rcvcc));
void sorflush __P((struct socket *so));
int soselect __P((struct socket *so, int which, struct proc *p));
-int sosend __P((struct socket *so, struct mbuf *addr, struct uio *uio,
- struct mbuf *top, struct mbuf *control, int flags));
+int sosend __P((struct socket *so, struct sockaddr *addr, struct uio *uio,
+ struct mbuf *top, struct mbuf *control, int flags,
+ struct proc *p));
int sosetopt __P((struct socket *so, int level, int optname,
struct mbuf *m0, struct proc *p));
int soshutdown __P((struct socket *so, int how));
diff --git a/sys/sys/un.h b/sys/sys/un.h
index 74870a32cb41..3d7d7ede9131 100644
--- a/sys/sys/un.h
+++ b/sys/sys/un.h
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)un.h 8.3 (Berkeley) 2/19/95
- * $Id: un.h,v 1.11 1997/02/22 09:46:20 peter Exp $
+ * $Id: un.h,v 1.12 1997/04/27 20:01:29 wollman Exp $
*/
#ifndef _SYS_UN_H_
@@ -52,6 +52,7 @@ struct sockaddr_un {
#ifdef KERNEL
struct unpcb;
+struct mbuf;
int uipc_usrreq __P((struct socket *so, int req, struct mbuf *m,
struct mbuf *nam, struct mbuf *control));
diff --git a/sys/sys/unpcb.h b/sys/sys/unpcb.h
index 4269831ccfa5..6cf0855f339d 100644
--- a/sys/sys/unpcb.h
+++ b/sys/sys/unpcb.h
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)unpcb.h 8.1 (Berkeley) 6/2/93
- * $Id$
+ * $Id: unpcb.h,v 1.5 1997/02/22 09:46:22 peter Exp $
*/
#ifndef _SYS_UNPCB_H_
@@ -69,7 +69,7 @@ struct unpcb {
struct unpcb *unp_conn; /* control block of connected socket */
struct unpcb *unp_refs; /* referencing socket linked list */
struct unpcb *unp_nextref; /* link in unp_refs list */
- struct mbuf *unp_addr; /* bound address of socket */
+ struct sockaddr_un *unp_addr; /* bound address of socket */
int unp_cc; /* copy of rcv.sb_cc */
int unp_mbcnt; /* copy of rcv.sb_mbcnt */
};
diff --git a/sys/ufs/ffs/ffs_extern.h b/sys/ufs/ffs/ffs_extern.h
index 8d14f3af6f82..5c6a519b5cfe 100644
--- a/sys/ufs/ffs/ffs_extern.h
+++ b/sys/ufs/ffs/ffs_extern.h
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)ffs_extern.h 8.6 (Berkeley) 3/30/95
- * $Id$
+ * $Id: ffs_extern.h,v 1.15 1997/02/22 09:47:02 peter Exp $
*/
#ifndef _UFS_FFS_EXTERN_H
@@ -58,11 +58,10 @@ struct buf;
struct fid;
struct fs;
struct inode;
-struct mbuf;
struct mount;
+struct sockaddr;
struct statfs;
struct vnode;
-struct mbuf;
int ffs_alloc __P((struct inode *,
ufs_daddr_t, ufs_daddr_t, int, struct ucred *, ufs_daddr_t *));
@@ -73,7 +72,7 @@ void ffs_blkfree __P((struct inode *, ufs_daddr_t, long));
ufs_daddr_t ffs_blkpref __P((struct inode *, ufs_daddr_t, int, ufs_daddr_t *));
int ffs_bmap __P((struct vop_bmap_args *));
void ffs_clrblock __P((struct fs *, u_char *, ufs_daddr_t));
-int ffs_fhtovp __P((struct mount *, struct fid *, struct mbuf *,
+int ffs_fhtovp __P((struct mount *, struct fid *, struct sockaddr *,
struct vnode **, int *, struct ucred **));
int ffs_flushfiles __P((struct mount *, int, struct proc *));
void ffs_fragacct __P((struct fs *, int, int32_t [], int));
diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c
index e552c7e5ef93..ef256be0e8c8 100644
--- a/sys/ufs/ffs/ffs_vfsops.c
+++ b/sys/ufs/ffs/ffs_vfsops.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)ffs_vfsops.c 8.31 (Berkeley) 5/20/95
- * $Id: ffs_vfsops.c,v 1.51 1997/03/23 20:08:19 guido Exp $
+ * $Id: ffs_vfsops.c,v 1.52 1997/03/24 11:25:07 bde Exp $
*/
#include "opt_quota.h"
@@ -1046,7 +1046,7 @@ int
ffs_fhtovp(mp, fhp, nam, vpp, exflagsp, credanonp)
register struct mount *mp;
struct fid *fhp;
- struct mbuf *nam;
+ struct sockaddr *nam;
struct vnode **vpp;
int *exflagsp;
struct ucred **credanonp;
diff --git a/sys/ufs/lfs/lfs_vfsops.c b/sys/ufs/lfs/lfs_vfsops.c
index b1c1c0e01957..b4fef3da5125 100644
--- a/sys/ufs/lfs/lfs_vfsops.c
+++ b/sys/ufs/lfs/lfs_vfsops.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)lfs_vfsops.c 8.20 (Berkeley) 6/10/95
- * $Id: lfs_vfsops.c,v 1.19 1997/03/24 11:25:08 bde Exp $
+ * $Id: lfs_vfsops.c,v 1.20 1997/08/02 14:33:21 bde Exp $
*/
#include "opt_quota.h"
@@ -58,7 +58,7 @@
#include <ufs/lfs/lfs.h>
#include <ufs/lfs/lfs_extern.h>
-static int lfs_fhtovp __P((struct mount *, struct fid *, struct mbuf *,
+static int lfs_fhtovp __P((struct mount *, struct fid *, struct sockaddr *,
struct vnode **, int *, struct ucred **));
static int lfs_mount __P((struct mount *, char *, caddr_t,
struct nameidata *, struct proc *));
@@ -91,9 +91,9 @@ VFS_SET(lfs_vfsops, lfs, MOUNT_LFS, 0);
/*
* Called by main() when ufs is going to be mounted as root.
*/
+int
lfs_mountroot()
{
- extern struct vnode *rootvp;
struct fs *fs;
struct mount *mp;
struct proc *p = curproc; /* XXX */
@@ -683,7 +683,7 @@ static int
lfs_fhtovp(mp, fhp, nam, vpp, exflagsp, credanonp)
register struct mount *mp;
struct fid *fhp;
- struct mbuf *nam;
+ struct sockaddr *nam;
struct vnode **vpp;
int *exflagsp;
struct ucred **credanonp;
diff --git a/sys/ufs/ufs/ufs_extern.h b/sys/ufs/ufs/ufs_extern.h
index 8e71f919d72d..e1f38aff0bbf 100644
--- a/sys/ufs/ufs/ufs_extern.h
+++ b/sys/ufs/ufs/ufs_extern.h
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)ufs_extern.h 8.10 (Berkeley) 5/14/95
- * $Id$
+ * $Id: ufs_extern.h,v 1.14 1997/02/22 09:47:46 peter Exp $
*/
#ifndef _UFS_UFS_EXTERN_H_
@@ -42,10 +42,10 @@ struct direct;
struct fid;
struct flock;
struct inode;
-struct mbuf;
struct mount;
struct nameidata;
struct proc;
+struct sockaddr;
struct ucred;
struct uio;
struct vattr;
@@ -58,8 +58,9 @@ int ufs_advlock __P((struct vop_advlock_args *));
int ufs_bmap __P((struct vop_bmap_args *));
int ufs_bmaparray __P((struct vnode *, daddr_t, daddr_t *, struct indir *,
int *, int *, int *));
-int ufs_check_export __P((struct mount *, struct ufid *, struct mbuf *,
- struct vnode **, int *exflagsp, struct ucred **));
+int ufs_check_export __P((struct mount *, struct ufid *,
+ struct sockaddr *, struct vnode **,
+ int *exflagsp, struct ucred **));
int ufs_checkpath __P((struct inode *, struct inode *, struct ucred *));
int ufs_close __P((struct vop_close_args *));
int ufs_create __P((struct vop_create_args *));
diff --git a/sys/ufs/ufs/ufs_vfsops.c b/sys/ufs/ufs/ufs_vfsops.c
index ba994b84844d..ffc61f263e04 100644
--- a/sys/ufs/ufs/ufs_vfsops.c
+++ b/sys/ufs/ufs/ufs_vfsops.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)ufs_vfsops.c 8.8 (Berkeley) 5/20/95
- * $Id: ufs_vfsops.c,v 1.8 1997/02/22 09:47:52 peter Exp $
+ * $Id: ufs_vfsops.c,v 1.9 1997/08/02 14:33:24 bde Exp $
*/
#include "opt_quota.h"
@@ -187,7 +187,7 @@ int
ufs_check_export(mp, ufhp, nam, vpp, exflagsp, credanonp)
register struct mount *mp;
struct ufid *ufhp;
- struct mbuf *nam;
+ struct sockaddr *nam;
struct vnode **vpp;
int *exflagsp;
struct ucred **credanonp;