aboutsummaryrefslogtreecommitdiff
path: root/sys/sys
diff options
context:
space:
mode:
authorGarrett Wollman <wollman@FreeBSD.org>1997-08-16 19:16:27 +0000
committerGarrett Wollman <wollman@FreeBSD.org>1997-08-16 19:16:27 +0000
commit57bf258e3dc9e77a996e738e6bf3e894943970e2 (patch)
tree6c0a9710fd977c7f3055d78384c325bb09195b9e /sys/sys
parentcee405ba2712660bd47480f9c304163545121639 (diff)
downloadsrc-57bf258e3dc9e77a996e738e6bf3e894943970e2.tar.gz
src-57bf258e3dc9e77a996e738e6bf3e894943970e2.zip
Fix all areas of the system (or at least all those in LINT) to avoid storing
socket addresses in mbufs. (Socket buffers are the one exception.) A number of kernel APIs needed to get fixed in order to make this happen. Also, fix three protocol families which kept PCBs in mbufs to not malloc them instead. Delete some old compatibility cruft while we're at it, and add some new routines in the in_cksum family.
Notes
Notes: svn path=/head/; revision=28270
Diffstat (limited to 'sys/sys')
-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
8 files changed, 57 insertions, 45 deletions
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 */
};