diff options
author | wollman <wollman@FreeBSD.org> | 1997-08-16 19:16:27 +0000 |
---|---|---|
committer | wollman <wollman@FreeBSD.org> | 1997-08-16 19:16:27 +0000 |
commit | 4542c1cf5d7077caf33d6d9468f5e647cd9d19e5 (patch) | |
tree | 69fd093ef1e8c080592999507b664fe6315c0e10 /sys/nfsclient/bootp_subr.c | |
parent | f4edc7fc6748272644fb845fc8636a5c261247d6 (diff) | |
download | FreeBSD-src-4542c1cf5d7077caf33d6d9468f5e647cd9d19e5.zip FreeBSD-src-4542c1cf5d7077caf33d6d9468f5e647cd9d19e5.tar.gz |
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.
Diffstat (limited to 'sys/nfsclient/bootp_subr.c')
-rw-r--r-- | sys/nfsclient/bootp_subr.c | 36 |
1 files changed, 13 insertions, 23 deletions
diff --git a/sys/nfsclient/bootp_subr.c b/sys/nfsclient/bootp_subr.c index 3d0f587..b1fd716 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; } |