tech-net archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
mbuf -> sockaddr patch for get{sock,peer}name and accept
hi,
attached is the next patch for converting protocol
user-request methods to use sockaddr * instead of mbuf *.
This patch covers getsockname, getpeername and accept.
The only part of the patch I think needs help is what to do
with the ktrkuser(mbuftypes[MT_SONAME], addr, len) call from
copyout_sockname_sb(). Obviously mbuftypes[] makes no real
sense and addr is not in alias of an mbuf. What should be
done with the ktrace hook?
comments welcome
rtr
Index: compat/svr4/svr4_stream.c
===================================================================
RCS file: /cvsroot/src/sys/compat/svr4/svr4_stream.c,v
retrieving revision 1.83
diff -p -u -r1.83 svr4_stream.c
--- compat/svr4/svr4_stream.c 19 Apr 2015 19:17:37 -0000 1.83
+++ compat/svr4/svr4_stream.c 19 Apr 2015 20:50:25 -0000
@@ -872,11 +872,12 @@ svr4_stream_ti_ioctl(file_t *fp, struct
struct svr4_strm *st = svr4_stream_get(fp);
int error;
struct svr4_strmcmd sc;
- struct mbuf *name;
+ struct sockaddr_big sbig;
if (st == NULL)
return EINVAL;
+ sbig.sb_len = UCHAR_MAX;
sc.offs = 0x10;
if ((error = copyin(sub, &skb, sizeof(skb))) != 0) {
@@ -887,14 +888,14 @@ svr4_stream_ti_ioctl(file_t *fp, struct
switch (cmd) {
case SVR4_TI_GETMYNAME:
DPRINTF(("TI_GETMYNAME\n"));
- error = do_sys_getsockname(fd, &name);
+ error = do_sys_getsockname(fd, (struct sockaddr *)&sbig);
if (error != 0)
return error;
break;
case SVR4_TI_GETPEERNAME:
DPRINTF(("TI_GETPEERNAME\n"));
- error = do_sys_getpeername(fd, &name);
+ error = do_sys_getpeername(fd, (struct sockaddr *)&sbig);
if (error != 0)
return error;
break;
@@ -913,12 +914,12 @@ svr4_stream_ti_ioctl(file_t *fp, struct
switch (st->s_family) {
case AF_INET:
- sockaddr_to_netaddr_in(&sc, mtod(name, void *));
+ sockaddr_to_netaddr_in(&sc, (struct sockaddr_in *)&sbig);
skb.len = sizeof (struct sockaddr_in);
break;
case AF_LOCAL:
- sockaddr_to_netaddr_un(&sc, mtod(name, void *));
+ sockaddr_to_netaddr_un(&sc, (struct sockaddr_un *)&sbig);
/* XXX: the length gets adjusted but the copyout doesn't */
skb.len = sizeof (struct sockaddr_un) + 4;
break;
@@ -926,12 +927,10 @@ svr4_stream_ti_ioctl(file_t *fp, struct
default:
DPRINTF(("ti_ioctl: Unsupported address family %d\n",
st->s_family));
- m_free(name);
return ENOSYS;
}
- error = copyout(SVR4_ADDROF(&sc), NETBSD32PTR(skb.buf), name->m_len);
- m_free(name);
+ error = copyout(SVR4_ADDROF(&sc), NETBSD32PTR(skb.buf), sbig.sb_len);
if (error != 0) {
DPRINTF(("ti_ioctl: error copying out socket data\n"));
return error;
@@ -1539,8 +1538,10 @@ svr4_sys_getmsg(struct lwp *l, const str
struct iovec aiov;
struct svr4_strm *st;
int fl;
+ struct sockaddr_big sbig;
struct mbuf *name;
+ sbig.sb_len = UCHAR_MAX;
memset(&sc, 0, sizeof(sc));
#ifdef DEBUG_SVR4
@@ -1618,7 +1619,8 @@ svr4_sys_getmsg(struct lwp *l, const str
* a connect verification.
*/
- error = do_sys_getsockname(SCARG(uap, fd), &name);
+ error = do_sys_getsockname(SCARG(uap, fd),
+ (struct sockaddr *)&sbig);
if (error != 0) {
DPRINTF(("getmsg: getsockname failed %d\n", error));
goto out;
@@ -1633,20 +1635,20 @@ svr4_sys_getmsg(struct lwp *l, const str
switch (st->s_family) {
case AF_INET:
sc.len = sizeof (struct sockaddr_in) + 4;
- sockaddr_to_netaddr_in(&sc, mtod(name, void *));
+ sockaddr_to_netaddr_in(&sc,
+ (struct sockaddr_in *)&sbig);
break;
case AF_LOCAL:
sc.len = sizeof (struct sockaddr_un) + 4;
- sockaddr_to_netaddr_un(&sc, mtod(name, void *));
+ sockaddr_to_netaddr_un(&sc,
+ (struct sockaddr_un *)&sbig);
break;
default:
- m_free(name);
error = ENOSYS;
goto out;
}
- m_free(name);
ctl.len = 40;
dat.len = -1;
@@ -1675,8 +1677,8 @@ svr4_sys_getmsg(struct lwp *l, const str
* We are after a listen, so we try to accept...
*/
- error = do_sys_accept(l, SCARG(uap, fd), &name, retval,
- NULL, 0, FNONBLOCK);
+ error = do_sys_accept(l, SCARG(uap, fd),
+ (struct sockaddr *)&sbig, retval, NULL, 0, FNONBLOCK);
if (error != 0) {
DPRINTF(("getmsg: accept failed %d\n", error));
goto out;
@@ -1693,7 +1695,8 @@ svr4_sys_getmsg(struct lwp *l, const str
switch (st->s_family) {
case AF_INET:
sc.pad[1] = 0x28;
- sockaddr_to_netaddr_in(&sc, mtod(name, void *));
+ sockaddr_to_netaddr_in(&sc,
+ (struct sockaddr_in *)&sbig);
ctl.len = 40;
sc.len = sizeof (struct sockaddr_in);
break;
@@ -1707,11 +1710,9 @@ svr4_sys_getmsg(struct lwp *l, const str
break;
default:
- m_free(name);
error = ENOSYS;
goto out;
}
- m_free(name);
dat.len = -1;
fl = 0;
Index: kern/uipc_socket.c
===================================================================
RCS file: /cvsroot/src/sys/kern/uipc_socket.c,v
retrieving revision 1.238
diff -p -u -r1.238 uipc_socket.c
--- kern/uipc_socket.c 5 Apr 2015 23:19:56 -0000 1.238
+++ kern/uipc_socket.c 19 Apr 2015 20:50:26 -0000
@@ -793,7 +793,7 @@ soabort(struct socket *so)
}
int
-soaccept(struct socket *so, struct mbuf *nam)
+soaccept(struct socket *so, struct sockaddr *nam)
{
int error;
Index: kern/uipc_syscalls.c
===================================================================
RCS file: /cvsroot/src/sys/kern/uipc_syscalls.c,v
retrieving revision 1.175
diff -p -u -r1.175 uipc_syscalls.c
--- kern/uipc_syscalls.c 3 Apr 2015 20:01:07 -0000 1.175
+++ kern/uipc_syscalls.c 19 Apr 2015 20:50:26 -0000
@@ -92,6 +92,8 @@ __KERNEL_RCSID(0, "$NetBSD: uipc_syscall
extern const struct fileops socketops;
static int sockargs_sb(struct sockaddr_big *, const void *, socklen_t);
+static int copyout_sockname_sb(struct sockaddr *, unsigned int *,
+ int , struct sockaddr_big *);
int
sys___socket30(struct lwp *l, const struct sys___socket30_args *uap,
@@ -161,11 +163,10 @@ sys_listen(struct lwp *l, const struct s
}
int
-do_sys_accept(struct lwp *l, int sock, struct mbuf **name,
+do_sys_accept(struct lwp *l, int sock, struct sockaddr *name,
register_t *new_sock, const sigset_t *mask, int flags, int clrflags)
{
file_t *fp, *fp2;
- struct mbuf *nam;
int error, fd;
struct socket *so, *so2;
short wakeup_state = 0;
@@ -180,7 +181,6 @@ do_sys_accept(struct lwp *l, int sock, s
fd_putfile(sock);
return error;
}
- nam = m_get(M_WAIT, MT_SONAME);
*new_sock = fd;
so = fp->f_socket;
solock(so);
@@ -235,12 +235,11 @@ do_sys_accept(struct lwp *l, int sock, s
so2->so_state |= SS_NBIO;
else
so2->so_state &= ~SS_NBIO;
- error = soaccept(so2, nam);
+ error = soaccept(so2, name);
so2->so_cred = kauth_cred_dup(so->so_cred);
sounlock(so);
if (error) {
/* an error occurred, free the file descriptor and mbuf */
- m_freem(nam);
mutex_enter(&fp2->f_lock);
fp2->f_count++;
mutex_exit(&fp2->f_lock);
@@ -249,7 +248,6 @@ do_sys_accept(struct lwp *l, int sock, s
} else {
fd_set_exclose(l, fd, (flags & SOCK_CLOEXEC) != 0);
fd_affix(curproc, fp2, fd);
- *name = nam;
}
fd_putfile(sock);
if (__predict_false(mask))
@@ -257,7 +255,6 @@ do_sys_accept(struct lwp *l, int sock, s
return error;
bad:
sounlock(so);
- m_freem(nam);
fd_putfile(sock);
fd_abort(curproc, fp2, fd);
if (__predict_false(mask))
@@ -274,15 +271,15 @@ sys_accept(struct lwp *l, const struct s
syscallarg(unsigned int *) anamelen;
} */
int error, fd;
- struct mbuf *name;
+ struct sockaddr_big name;
- error = do_sys_accept(l, SCARG(uap, s), &name, retval, NULL, 0, 0);
+ name.sb_len = UCHAR_MAX;
+ error = do_sys_accept(l, SCARG(uap, s), (struct sockaddr *)&name,
+ retval, NULL, 0, 0);
if (error != 0)
return error;
- error = copyout_sockname(SCARG(uap, name), SCARG(uap, anamelen),
- MSG_LENUSRSPACE, name);
- if (name != NULL)
- m_free(name);
+ error = copyout_sockname_sb(SCARG(uap, name), SCARG(uap, anamelen),
+ MSG_LENUSRSPACE, &name);
if (error != 0) {
fd = (int)*retval;
if (fd_getfile(fd) != NULL)
@@ -303,7 +300,7 @@ sys_paccept(struct lwp *l, const struct
syscallarg(int) flags;
} */
int error, fd;
- struct mbuf *name;
+ struct sockaddr_big name;
sigset_t *mask, amask;
if (SCARG(uap, mask) != NULL) {
@@ -314,14 +311,13 @@ sys_paccept(struct lwp *l, const struct
} else
mask = NULL;
- error = do_sys_accept(l, SCARG(uap, s), &name, retval, mask,
- SCARG(uap, flags), FNONBLOCK);
+ name.sb_len = UCHAR_MAX;
+ error = do_sys_accept(l, SCARG(uap, s), (struct sockaddr *)&name,
+ retval, mask, SCARG(uap, flags), FNONBLOCK);
if (error != 0)
return error;
- error = copyout_sockname(SCARG(uap, name), SCARG(uap, anamelen),
- MSG_LENUSRSPACE, name);
- if (name != NULL)
- m_free(name);
+ error = copyout_sockname_sb(SCARG(uap, name), SCARG(uap, anamelen),
+ MSG_LENUSRSPACE, &name);
if (error != 0) {
fd = (int)*retval;
if (fd_getfile(fd) != NULL)
@@ -1296,28 +1292,21 @@ pipe1(struct lwp *l, register_t *retval,
* Get peer socket name.
*/
int
-do_sys_getpeername(int fd, struct mbuf **nam)
+do_sys_getpeername(int fd, struct sockaddr *nam)
{
struct socket *so;
- struct mbuf *m;
int error;
if ((error = fd_getsock(fd, &so)) != 0)
return error;
- m = m_getclr(M_WAIT, MT_SONAME);
- MCLAIM(m, so->so_mowner);
-
solock(so);
if ((so->so_state & SS_ISCONNECTED) == 0)
error = ENOTCONN;
else {
- *nam = m;
- error = (*so->so_proto->pr_usrreqs->pr_peeraddr)(so, m);
+ error = (*so->so_proto->pr_usrreqs->pr_peeraddr)(so, nam);
}
sounlock(so);
- if (error != 0)
- m_free(m);
fd_putfile(fd);
return error;
}
@@ -1326,29 +1315,63 @@ do_sys_getpeername(int fd, struct mbuf *
* Get local socket name.
*/
int
-do_sys_getsockname(int fd, struct mbuf **nam)
+do_sys_getsockname(int fd, struct sockaddr *nam)
{
struct socket *so;
- struct mbuf *m;
int error;
if ((error = fd_getsock(fd, &so)) != 0)
return error;
- m = m_getclr(M_WAIT, MT_SONAME);
- MCLAIM(m, so->so_mowner);
-
- *nam = m;
solock(so);
- error = (*so->so_proto->pr_usrreqs->pr_sockaddr)(so, m);
+ error = (*so->so_proto->pr_usrreqs->pr_sockaddr)(so, nam);
sounlock(so);
- if (error != 0)
- m_free(m);
fd_putfile(fd);
return error;
}
int
+copyout_sockname_sb(struct sockaddr *asa, unsigned int *alen, int flags,
+ struct sockaddr_big *addr)
+{
+ int len;
+ int error;
+
+ if (asa == NULL)
+ /* Assume application not interested */
+ return 0;
+
+ if (flags & MSG_LENUSRSPACE) {
+ error = copyin(alen, &len, sizeof(len));
+ if (error)
+ return error;
+ } else
+ len = *alen;
+ if (len < 0)
+ return EINVAL;
+
+ if (addr == NULL) {
+ len = 0;
+ error = 0;
+ } else {
+ if (len > addr->sb_len)
+ len = addr->sb_len;
+ /* XXX addr isn't an mbuf... */
+ ktrkuser(mbuftypes[MT_SONAME], addr, len);
+ error = copyout(addr, asa, len);
+ }
+
+ if (error == 0) {
+ if (flags & MSG_LENUSRSPACE)
+ error = copyout(&len, alen, sizeof(len));
+ else
+ *alen = len;
+ }
+
+ return error;
+}
+
+int
copyout_sockname(struct sockaddr *asa, unsigned int *alen, int flags,
struct mbuf *addr)
{
@@ -1401,17 +1424,16 @@ sys_getsockname(struct lwp *l, const str
syscallarg(struct sockaddr *) asa;
syscallarg(unsigned int *) alen;
} */
- struct mbuf *m;
- int error;
+ struct sockaddr_big sbig;
+ int error;
- error = do_sys_getsockname(SCARG(uap, fdes), &m);
+ sbig.sb_len = UCHAR_MAX;
+ error = do_sys_getsockname(SCARG(uap, fdes), (struct sockaddr *)&sbig);
if (error != 0)
return error;
- error = copyout_sockname(SCARG(uap, asa), SCARG(uap, alen),
- MSG_LENUSRSPACE, m);
- if (m != NULL)
- m_free(m);
+ error = copyout_sockname_sb(SCARG(uap, asa), SCARG(uap, alen),
+ MSG_LENUSRSPACE, &sbig);
return error;
}
@@ -1427,17 +1449,16 @@ sys_getpeername(struct lwp *l, const str
syscallarg(struct sockaddr *) asa;
syscallarg(unsigned int *) alen;
} */
- struct mbuf *m;
- int error;
+ struct sockaddr_big sbig;
+ int error;
- error = do_sys_getpeername(SCARG(uap, fdes), &m);
+ sbig.sb_len = UCHAR_MAX;
+ error = do_sys_getpeername(SCARG(uap, fdes), (struct sockaddr *)&sbig);
if (error != 0)
return error;
- error = copyout_sockname(SCARG(uap, asa), SCARG(uap, alen),
- MSG_LENUSRSPACE, m);
- if (m != NULL)
- m_free(m);
+ error = copyout_sockname_sb(SCARG(uap, asa), SCARG(uap, alen),
+ MSG_LENUSRSPACE, &sbig);
return error;
}
Index: kern/uipc_usrreq.c
===================================================================
RCS file: /cvsroot/src/sys/kern/uipc_usrreq.c,v
retrieving revision 1.176
diff -p -u -r1.176 uipc_usrreq.c
--- kern/uipc_usrreq.c 3 Apr 2015 20:01:07 -0000 1.176
+++ kern/uipc_usrreq.c 19 Apr 2015 20:50:26 -0000
@@ -333,39 +333,25 @@ unp_output(struct mbuf *m, struct mbuf *
}
static void
-unp_setaddr(struct socket *so, struct mbuf *nam, bool peeraddr)
+unp_setaddr(struct socket *so, struct sockaddr *nam, bool peeraddr)
{
- const struct sockaddr_un *sun;
+ const struct sockaddr_un *sun = NULL;
struct unpcb *unp;
- bool ext;
KASSERT(solocked(so));
unp = sotounpcb(so);
- ext = false;
- for (;;) {
- sun = NULL;
- if (peeraddr) {
- if (unp->unp_conn && unp->unp_conn->unp_addr)
- sun = unp->unp_conn->unp_addr;
- } else {
- if (unp->unp_addr)
- sun = unp->unp_addr;
- }
- if (sun == NULL)
- sun = &sun_noname;
- nam->m_len = sun->sun_len;
- if (nam->m_len > MLEN && !ext) {
- sounlock(so);
- MEXTMALLOC(nam, MAXPATHLEN * 2, M_WAITOK);
- solock(so);
- ext = true;
- } else {
- KASSERT(nam->m_len <= MAXPATHLEN * 2);
- memcpy(mtod(nam, void *), sun, (size_t)nam->m_len);
- break;
- }
+ if (peeraddr) {
+ if (unp->unp_conn && unp->unp_conn->unp_addr)
+ sun = unp->unp_conn->unp_addr;
+ } else {
+ if (unp->unp_addr)
+ sun = unp->unp_addr;
}
+ if (sun == NULL)
+ sun = &sun_noname;
+
+ memcpy(nam, sun, sun->sun_len);
}
static int
@@ -785,7 +771,7 @@ unp_detach(struct socket *so)
}
static int
-unp_accept(struct socket *so, struct mbuf *nam)
+unp_accept(struct socket *so, struct sockaddr *nam)
{
struct unpcb *unp = sotounpcb(so);
struct socket *so2;
@@ -888,7 +874,7 @@ unp_stat(struct socket *so, struct stat
}
static int
-unp_peeraddr(struct socket *so, struct mbuf *nam)
+unp_peeraddr(struct socket *so, struct sockaddr *nam)
{
KASSERT(solocked(so));
KASSERT(sotounpcb(so) != NULL);
@@ -899,7 +885,7 @@ unp_peeraddr(struct socket *so, struct m
}
static int
-unp_sockaddr(struct socket *so, struct mbuf *nam)
+unp_sockaddr(struct socket *so, struct sockaddr *nam)
{
KASSERT(solocked(so));
KASSERT(sotounpcb(so) != NULL);
Index: net/if_gre.c
===================================================================
RCS file: /cvsroot/src/sys/net/if_gre.c,v
retrieving revision 1.162
diff -p -u -r1.162 if_gre.c
--- net/if_gre.c 3 Apr 2015 20:01:07 -0000 1.162
+++ net/if_gre.c 19 Apr 2015 20:50:26 -0000
@@ -149,8 +149,8 @@ static bool gre_is_nullconf(const struct
static int gre_output(struct ifnet *, struct mbuf *,
const struct sockaddr *, struct rtentry *);
static int gre_ioctl(struct ifnet *, u_long, void *);
-static int gre_getsockname(struct socket *, struct mbuf *);
-static int gre_getpeername(struct socket *, struct mbuf *);
+static int gre_getsockname(struct socket *, struct sockaddr *);
+static int gre_getpeername(struct socket *, struct sockaddr *);
static int gre_getnames(struct socket *, struct lwp *,
struct sockaddr_storage *, struct sockaddr_storage *);
static void gre_clearconf(struct gre_soparm *, bool);
@@ -973,13 +973,13 @@ gre_output(struct ifnet *ifp, struct mbu
}
static int
-gre_getsockname(struct socket *so, struct mbuf *nam)
+gre_getsockname(struct socket *so, struct sockaddr *nam)
{
return (*so->so_proto->pr_usrreqs->pr_sockaddr)(so, nam);
}
static int
-gre_getpeername(struct socket *so, struct mbuf *nam)
+gre_getpeername(struct socket *so, struct sockaddr *nam)
{
return (*so->so_proto->pr_usrreqs->pr_peeraddr)(so, nam);
}
@@ -988,26 +988,19 @@ static int
gre_getnames(struct socket *so, struct lwp *l, struct sockaddr_storage *src,
struct sockaddr_storage *dst)
{
- struct mbuf *m;
- struct sockaddr_storage *ss;
+ struct sockaddr_storage ss;
int rc;
- if ((m = getsombuf(so, MT_SONAME)) == NULL)
- return ENOBUFS;
-
- ss = mtod(m, struct sockaddr_storage *);
-
solock(so);
- if ((rc = gre_getsockname(so, m)) != 0)
+ if ((rc = gre_getsockname(so, (struct sockaddr *)&ss)) != 0)
goto out;
- *src = *ss;
+ *src = ss;
- if ((rc = gre_getpeername(so, m)) != 0)
+ if ((rc = gre_getpeername(so, (struct sockaddr *)&ss)) != 0)
goto out;
- *dst = *ss;
+ *dst = ss;
out:
sounlock(so);
- m_freem(m);
return rc;
}
Index: net/link_proto.c
===================================================================
RCS file: /cvsroot/src/sys/net/link_proto.c,v
retrieving revision 1.25
diff -p -u -r1.25 link_proto.c
--- net/link_proto.c 3 Apr 2015 20:01:07 -0000 1.25
+++ net/link_proto.c 19 Apr 2015 20:50:26 -0000
@@ -50,7 +50,7 @@ __KERNEL_RCSID(0, "$NetBSD: link_proto.c
static int sockaddr_dl_cmp(const struct sockaddr *, const struct sockaddr *);
static int link_attach(struct socket *, int);
static void link_detach(struct socket *);
-static int link_accept(struct socket *, struct mbuf *);
+static int link_accept(struct socket *, struct sockaddr *);
static int link_bind(struct socket *, struct sockaddr *, struct lwp *);
static int link_listen(struct socket *, struct lwp *);
static int link_connect(struct socket *, struct mbuf *, struct lwp *);
@@ -60,8 +60,8 @@ static int link_shutdown(struct socket *
static int link_abort(struct socket *);
static int link_ioctl(struct socket *, u_long, void *, struct ifnet *);
static int link_stat(struct socket *, struct stat *);
-static int link_peeraddr(struct socket *, struct mbuf *);
-static int link_sockaddr(struct socket *, struct mbuf *);
+static int link_peeraddr(struct socket *, struct sockaddr *);
+static int link_sockaddr(struct socket *, struct sockaddr *);
static int link_rcvd(struct socket *, int, struct lwp *);
static int link_recvoob(struct socket *, struct mbuf *, int);
static int link_send(struct socket *, struct mbuf *, struct mbuf *,
@@ -266,7 +266,7 @@ link_detach(struct socket *so)
}
static int
-link_accept(struct socket *so, struct mbuf *nam)
+link_accept(struct socket *so, struct sockaddr *nam)
{
KASSERT(solocked(so));
@@ -344,7 +344,7 @@ link_stat(struct socket *so, struct stat
}
static int
-link_peeraddr(struct socket *so, struct mbuf *nam)
+link_peeraddr(struct socket *so, struct sockaddr *nam)
{
KASSERT(solocked(so));
@@ -352,7 +352,7 @@ link_peeraddr(struct socket *so, struct
}
static int
-link_sockaddr(struct socket *so, struct mbuf *nam)
+link_sockaddr(struct socket *so, struct sockaddr *nam)
{
KASSERT(solocked(so));
Index: net/raw_cb.h
===================================================================
RCS file: /cvsroot/src/sys/net/raw_cb.h,v
retrieving revision 1.23
diff -p -u -r1.23 raw_cb.h
--- net/raw_cb.h 5 Aug 2014 07:55:31 -0000 1.23
+++ net/raw_cb.h 19 Apr 2015 20:50:26 -0000
@@ -68,8 +68,8 @@ void raw_init(void);
void raw_input(struct mbuf *, ...);
int raw_usrreq(struct socket *,
int, struct mbuf *, struct mbuf *, struct mbuf *, struct lwp *);
-void raw_setsockaddr(struct rawcb *, struct mbuf *);
-void raw_setpeeraddr(struct rawcb *, struct mbuf *);
+void raw_setsockaddr(struct rawcb *, struct sockaddr *);
+void raw_setpeeraddr(struct rawcb *, struct sockaddr *);
int raw_send(struct socket *,
struct mbuf *, struct mbuf *, struct mbuf *, struct lwp *);
Index: net/raw_usrreq.c
===================================================================
RCS file: /cvsroot/src/sys/net/raw_usrreq.c,v
retrieving revision 1.52
diff -p -u -r1.52 raw_usrreq.c
--- net/raw_usrreq.c 9 Aug 2014 05:33:01 -0000 1.52
+++ net/raw_usrreq.c 19 Apr 2015 20:50:26 -0000
@@ -138,19 +138,17 @@ raw_ctlinput(int cmd, const struct socka
}
void
-raw_setsockaddr(struct rawcb *rp, struct mbuf *nam)
+raw_setsockaddr(struct rawcb *rp, struct sockaddr *nam)
{
- nam->m_len = rp->rcb_laddr->sa_len;
- memcpy(mtod(nam, void *), rp->rcb_laddr, (size_t)nam->m_len);
+ memcpy(nam, rp->rcb_laddr, rp->rcb_laddr->sa_len);
}
void
-raw_setpeeraddr(struct rawcb *rp, struct mbuf *nam)
+raw_setpeeraddr(struct rawcb *rp, struct sockaddr *nam)
{
- nam->m_len = rp->rcb_faddr->sa_len;
- memcpy(mtod(nam, void *), rp->rcb_faddr, (size_t)nam->m_len);
+ memcpy(nam, rp->rcb_faddr, rp->rcb_faddr->sa_len);
}
int
Index: net/rtsock.c
===================================================================
RCS file: /cvsroot/src/sys/net/rtsock.c,v
retrieving revision 1.168
diff -p -u -r1.168 rtsock.c
--- net/rtsock.c 6 Apr 2015 06:26:21 -0000 1.168
+++ net/rtsock.c 19 Apr 2015 20:50:26 -0000
@@ -229,7 +229,7 @@ COMPATNAME(route_detach)(struct socket *
}
static int
-COMPATNAME(route_accept)(struct socket *so, struct mbuf *nam)
+COMPATNAME(route_accept)(struct socket *so, struct sockaddr *nam)
{
KASSERT(solocked(so));
@@ -329,7 +329,7 @@ COMPATNAME(route_stat)(struct socket *so
}
static int
-COMPATNAME(route_peeraddr)(struct socket *so, struct mbuf *nam)
+COMPATNAME(route_peeraddr)(struct socket *so, struct sockaddr *nam)
{
struct rawcb *rp = sotorawcb(so);
@@ -345,7 +345,7 @@ COMPATNAME(route_peeraddr)(struct socket
}
static int
-COMPATNAME(route_sockaddr)(struct socket *so, struct mbuf *nam)
+COMPATNAME(route_sockaddr)(struct socket *so, struct sockaddr *nam)
{
struct rawcb *rp = sotorawcb(so);
Index: netatalk/ddp_usrreq.c
===================================================================
RCS file: /cvsroot/src/sys/netatalk/ddp_usrreq.c,v
retrieving revision 1.64
diff -p -u -r1.64 ddp_usrreq.c
--- netatalk/ddp_usrreq.c 3 Apr 2015 20:01:07 -0000 1.64
+++ netatalk/ddp_usrreq.c 19 Apr 2015 20:50:26 -0000
@@ -57,7 +57,7 @@ __KERNEL_RCSID(0, "$NetBSD: ddp_usrreq.c
#include <netatalk/at_extern.h>
static void at_pcbdisconnect(struct ddpcb *);
-static void at_sockaddr(struct ddpcb *, struct mbuf *);
+static void at_sockaddr(struct ddpcb *, struct sockaddr_at *);
static int at_pcbsetaddr(struct ddpcb *, struct sockaddr_at *);
static int at_pcbconnect(struct ddpcb *, struct mbuf *);
static void ddp_detach(struct socket *);
@@ -132,13 +132,10 @@ release:
}
static void
-at_sockaddr(struct ddpcb *ddp, struct mbuf *addr)
+at_sockaddr(struct ddpcb *ddp, struct sockaddr_at *addr)
{
- struct sockaddr_at *sat;
- addr->m_len = sizeof(struct sockaddr_at);
- sat = mtod(addr, struct sockaddr_at *);
- *sat = ddp->ddp_lsat;
+ *addr = ddp->ddp_lsat;
}
static int
@@ -402,7 +399,7 @@ ddp_detach(struct socket *so)
}
static int
-ddp_accept(struct socket *so, struct mbuf *nam)
+ddp_accept(struct socket *so, struct sockaddr *nam)
{
KASSERT(solocked(so));
@@ -504,7 +501,7 @@ ddp_stat(struct socket *so, struct stat
}
static int
-ddp_peeraddr(struct socket *so, struct mbuf *nam)
+ddp_peeraddr(struct socket *so, struct sockaddr *nam)
{
KASSERT(solocked(so));
@@ -512,13 +509,13 @@ ddp_peeraddr(struct socket *so, struct m
}
static int
-ddp_sockaddr(struct socket *so, struct mbuf *nam)
+ddp_sockaddr(struct socket *so, struct sockaddr *nam)
{
KASSERT(solocked(so));
KASSERT(sotoddpcb(so) != NULL);
KASSERT(nam != NULL);
- at_sockaddr(sotoddpcb(so), nam);
+ at_sockaddr(sotoddpcb(so), (struct sockaddr_at *)nam);
return 0;
}
Index: netbt/hci_socket.c
===================================================================
RCS file: /cvsroot/src/sys/netbt/hci_socket.c,v
retrieving revision 1.41
diff -p -u -r1.41 hci_socket.c
--- netbt/hci_socket.c 3 Apr 2015 20:01:07 -0000 1.41
+++ netbt/hci_socket.c 19 Apr 2015 20:50:26 -0000
@@ -484,7 +484,7 @@ hci_detach(struct socket *so)
}
static int
-hci_accept(struct socket *so, struct mbuf *nam)
+hci_accept(struct socket *so, struct sockaddr *nam)
{
KASSERT(solocked(so));
@@ -616,18 +616,16 @@ hci_stat(struct socket *so, struct stat
}
static int
-hci_peeraddr(struct socket *so, struct mbuf *nam)
+hci_peeraddr(struct socket *so, struct sockaddr *nam)
{
struct hci_pcb *pcb = (struct hci_pcb *)so->so_pcb;
- struct sockaddr_bt *sa;
+ struct sockaddr_bt *sa = (struct sockaddr_bt *)nam;
KASSERT(solocked(so));
KASSERT(pcb != NULL);
KASSERT(nam != NULL);
- sa = mtod(nam, struct sockaddr_bt *);
memset(sa, 0, sizeof(struct sockaddr_bt));
- nam->m_len =
sa->bt_len = sizeof(struct sockaddr_bt);
sa->bt_family = AF_BLUETOOTH;
bdaddr_copy(&sa->bt_bdaddr, &pcb->hp_raddr);
@@ -635,18 +633,16 @@ hci_peeraddr(struct socket *so, struct m
}
static int
-hci_sockaddr(struct socket *so, struct mbuf *nam)
+hci_sockaddr(struct socket *so, struct sockaddr *nam)
{
struct hci_pcb *pcb = (struct hci_pcb *)so->so_pcb;
- struct sockaddr_bt *sa;
+ struct sockaddr_bt *sa = (struct sockaddr_bt *)nam;
KASSERT(solocked(so));
KASSERT(pcb != NULL);
KASSERT(nam != NULL);
- sa = mtod(nam, struct sockaddr_bt *);
memset(sa, 0, sizeof(struct sockaddr_bt));
- nam->m_len =
sa->bt_len = sizeof(struct sockaddr_bt);
sa->bt_family = AF_BLUETOOTH;
bdaddr_copy(&sa->bt_bdaddr, &pcb->hp_laddr);
Index: netbt/l2cap_socket.c
===================================================================
RCS file: /cvsroot/src/sys/netbt/l2cap_socket.c,v
retrieving revision 1.32
diff -p -u -r1.32 l2cap_socket.c
--- netbt/l2cap_socket.c 3 Apr 2015 20:01:07 -0000 1.32
+++ netbt/l2cap_socket.c 19 Apr 2015 20:50:26 -0000
@@ -117,10 +117,9 @@ l2cap_detach(struct socket *so)
}
static int
-l2cap_accept(struct socket *so, struct mbuf *nam)
+l2cap_accept(struct socket *so, struct sockaddr *nam)
{
struct l2cap_channel *pcb = so->so_pcb;
- struct sockaddr_bt *sa;
KASSERT(solocked(so));
KASSERT(nam != NULL);
@@ -128,9 +127,7 @@ l2cap_accept(struct socket *so, struct m
if (pcb == NULL)
return EINVAL;
- sa = mtod(nam, struct sockaddr_bt *);
- nam->m_len = sizeof(struct sockaddr_bt);
- return l2cap_peeraddr_pcb(pcb, sa);
+ return l2cap_peeraddr_pcb(pcb, (struct sockaddr_bt *)nam);
}
static int
@@ -255,33 +252,27 @@ l2cap_stat(struct socket *so, struct sta
}
static int
-l2cap_peeraddr(struct socket *so, struct mbuf *nam)
+l2cap_peeraddr(struct socket *so, struct sockaddr *nam)
{
struct l2cap_channel *pcb = so->so_pcb;
- struct sockaddr_bt *sa;
KASSERT(solocked(so));
KASSERT(pcb != NULL);
KASSERT(nam != NULL);
- sa = mtod(nam, struct sockaddr_bt *);
- nam->m_len = sizeof(struct sockaddr_bt);
- return l2cap_peeraddr_pcb(pcb, sa);
+ return l2cap_peeraddr_pcb(pcb, (struct sockaddr_bt *)nam);
}
static int
-l2cap_sockaddr(struct socket *so, struct mbuf *nam)
+l2cap_sockaddr(struct socket *so, struct sockaddr *nam)
{
struct l2cap_channel *pcb = so->so_pcb;
- struct sockaddr_bt *sa;
KASSERT(solocked(so));
KASSERT(pcb != NULL);
KASSERT(nam != NULL);
- sa = mtod(nam, struct sockaddr_bt *);
- nam->m_len = sizeof(struct sockaddr_bt);
- return l2cap_sockaddr_pcb(pcb, sa);
+ return l2cap_sockaddr_pcb(pcb, (struct sockaddr_bt *)nam);
}
static int
Index: netbt/rfcomm_socket.c
===================================================================
RCS file: /cvsroot/src/sys/netbt/rfcomm_socket.c,v
retrieving revision 1.34
diff -p -u -r1.34 rfcomm_socket.c
--- netbt/rfcomm_socket.c 3 Apr 2015 20:01:07 -0000 1.34
+++ netbt/rfcomm_socket.c 19 Apr 2015 20:50:26 -0000
@@ -125,10 +125,9 @@ rfcomm_detach(struct socket *so)
}
static int
-rfcomm_accept(struct socket *so, struct mbuf *nam)
+rfcomm_accept(struct socket *so, struct sockaddr *nam)
{
struct rfcomm_dlc *pcb = so->so_pcb;
- struct sockaddr_bt *sa;
KASSERT(solocked(so));
KASSERT(nam != NULL);
@@ -136,9 +135,7 @@ rfcomm_accept(struct socket *so, struct
if (pcb == NULL)
return EINVAL;
- sa = mtod(nam, struct sockaddr_bt *);
- nam->m_len = sizeof(struct sockaddr_bt);
- return rfcomm_peeraddr_pcb(pcb, sa);
+ return rfcomm_peeraddr_pcb(pcb, (struct sockaddr_bt *)nam);
}
static int
@@ -265,33 +262,27 @@ rfcomm_stat(struct socket *so, struct st
}
static int
-rfcomm_peeraddr(struct socket *so, struct mbuf *nam)
+rfcomm_peeraddr(struct socket *so, struct sockaddr *nam)
{
struct rfcomm_dlc *pcb = so->so_pcb;
- struct sockaddr_bt *sa;
KASSERT(solocked(so));
KASSERT(pcb != NULL);
KASSERT(nam != NULL);
- sa = mtod(nam, struct sockaddr_bt *);
- nam->m_len = sizeof(struct sockaddr_bt);
- return rfcomm_peeraddr_pcb(pcb, sa);
+ return rfcomm_peeraddr_pcb(pcb, (struct sockaddr_bt *)nam);
}
static int
-rfcomm_sockaddr(struct socket *so, struct mbuf *nam)
+rfcomm_sockaddr(struct socket *so, struct sockaddr *nam)
{
struct rfcomm_dlc *pcb = so->so_pcb;
- struct sockaddr_bt *sa;
KASSERT(solocked(so));
KASSERT(pcb != NULL);
KASSERT(nam != NULL);
- sa = mtod(nam, struct sockaddr_bt *);
- nam->m_len = sizeof(struct sockaddr_bt);
- return rfcomm_sockaddr_pcb(pcb, sa);
+ return rfcomm_sockaddr_pcb(pcb, (struct sockaddr_bt *)nam);
}
static int
Index: netbt/sco_socket.c
===================================================================
RCS file: /cvsroot/src/sys/netbt/sco_socket.c,v
retrieving revision 1.34
diff -p -u -r1.34 sco_socket.c
--- netbt/sco_socket.c 3 Apr 2015 20:01:07 -0000 1.34
+++ netbt/sco_socket.c 19 Apr 2015 20:50:26 -0000
@@ -108,10 +108,9 @@ sco_detach(struct socket *so)
}
static int
-sco_accept(struct socket *so, struct mbuf *nam)
+sco_accept(struct socket *so, struct sockaddr *nam)
{
struct sco_pcb *pcb = so->so_pcb;
- struct sockaddr_bt *sa;
KASSERT(solocked(so));
KASSERT(nam != NULL);
@@ -119,9 +118,7 @@ sco_accept(struct socket *so, struct mbu
if (pcb == NULL)
return EINVAL;
- sa = mtod(nam, struct sockaddr_bt *);
- nam->m_len = sizeof(struct sockaddr_bt);
- return sco_peeraddr_pcb(pcb, sa);
+ return sco_peeraddr_pcb(pcb, (struct sockaddr_bt *)nam);
}
static int
@@ -248,33 +245,27 @@ sco_stat(struct socket *so, struct stat
}
static int
-sco_peeraddr(struct socket *so, struct mbuf *nam)
+sco_peeraddr(struct socket *so, struct sockaddr *nam)
{
struct sco_pcb *pcb = (struct sco_pcb *)so->so_pcb;
- struct sockaddr_bt *sa;
KASSERT(solocked(so));
KASSERT(pcb != NULL);
KASSERT(nam != NULL);
- sa = mtod(nam, struct sockaddr_bt *);
- nam->m_len = sizeof(struct sockaddr_bt);
- return sco_peeraddr_pcb(pcb, sa);
+ return sco_peeraddr_pcb(pcb, (struct sockaddr_bt *)nam);
}
static int
-sco_sockaddr(struct socket *so, struct mbuf *nam)
+sco_sockaddr(struct socket *so, struct sockaddr *nam)
{
struct sco_pcb *pcb = (struct sco_pcb *)so->so_pcb;
- struct sockaddr_bt *sa;
KASSERT(solocked(so));
KASSERT(pcb != NULL);
KASSERT(nam != NULL);
- sa = mtod(nam, struct sockaddr_bt *);
- nam->m_len = sizeof(struct sockaddr_bt);
- return sco_sockaddr_pcb(pcb, sa);
+ return sco_sockaddr_pcb(pcb, (struct sockaddr_bt *)nam);
}
static int
Index: netinet/dccp_usrreq.c
===================================================================
RCS file: /cvsroot/src/sys/netinet/dccp_usrreq.c,v
retrieving revision 1.2
diff -p -u -r1.2 dccp_usrreq.c
--- netinet/dccp_usrreq.c 4 Apr 2015 04:33:38 -0000 1.2
+++ netinet/dccp_usrreq.c 19 Apr 2015 20:50:26 -0000
@@ -2270,7 +2270,7 @@ dccp_listen(struct socket *so, struct lw
* Accepts a connection (accept system call)
*/
static int
-dccp_accept(struct socket *so, struct mbuf *nam)
+dccp_accept(struct socket *so, struct sockaddr *nam)
{
struct inpcb *inp = NULL;
int error = 0;
@@ -2293,7 +2293,7 @@ dccp_accept(struct socket *so, struct mb
}
INP_LOCK(inp);
INP_INFO_RUNLOCK(&dccpbinfo);
- in_setpeeraddr(inp, nam);
+ in_setpeeraddr(inp, (struct sockaddr_in *)nam);
return error;
}
@@ -2912,24 +2912,26 @@ dccp_stat(struct socket *so, struct stat
}
static int
-dccp_peeraddr(struct socket *so, struct mbuf *nam)
+dccp_peeraddr(struct socket *so, struct sockaddr *nam)
{
+
KASSERT(solocked(so));
KASSERT(sotoinpcb(so) != NULL);
KASSERT(nam != NULL);
- in_setpeeraddr(sotoinpcb(so), nam);
+ in_setpeeraddr(sotoinpcb(so), (struct sockaddr_in *)nam);
return 0;
}
static int
-dccp_sockaddr(struct socket *so, struct mbuf *nam)
+dccp_sockaddr(struct socket *so, struct sockaddr *nam)
{
+
KASSERT(solocked(so));
KASSERT(sotoinpcb(so) != NULL);
KASSERT(nam != NULL);
- in_setsockaddr(sotoinpcb(so), nam);
+ in_setsockaddr(sotoinpcb(so), (struct sockaddr_in *)nam);
return 0;
}
Index: netinet/in_pcb.c
===================================================================
RCS file: /cvsroot/src/sys/netinet/in_pcb.c,v
retrieving revision 1.156
diff -p -u -r1.156 in_pcb.c
--- netinet/in_pcb.c 3 Apr 2015 20:01:07 -0000 1.156
+++ netinet/in_pcb.c 19 Apr 2015 20:50:26 -0000
@@ -611,29 +611,23 @@ in_pcbdetach(void *v)
}
void
-in_setsockaddr(struct inpcb *inp, struct mbuf *nam)
+in_setsockaddr(struct inpcb *inp, struct sockaddr_in *sin)
{
- struct sockaddr_in *sin;
if (inp->inp_af != AF_INET)
return;
- sin = mtod(nam, struct sockaddr_in *);
sockaddr_in_init(sin, &inp->inp_laddr, inp->inp_lport);
- nam->m_len = sin->sin_len;
}
void
-in_setpeeraddr(struct inpcb *inp, struct mbuf *nam)
+in_setpeeraddr(struct inpcb *inp, struct sockaddr_in *sin)
{
- struct sockaddr_in *sin;
if (inp->inp_af != AF_INET)
return;
- sin = mtod(nam, struct sockaddr_in *);
sockaddr_in_init(sin, &inp->inp_faddr, inp->inp_fport);
- nam->m_len = sin->sin_len;
}
/*
Index: netinet/in_pcb.h
===================================================================
RCS file: /cvsroot/src/sys/netinet/in_pcb.h,v
retrieving revision 1.56
diff -p -u -r1.56 in_pcb.h
--- netinet/in_pcb.h 3 Apr 2015 20:01:07 -0000 1.56
+++ netinet/in_pcb.h 19 Apr 2015 20:50:26 -0000
@@ -155,8 +155,8 @@ void in_pcbpurgeif(struct inpcbtable *,
void in_purgeifmcast(struct ip_moptions *, struct ifnet *);
void in_pcbstate(struct inpcb *, int);
void in_rtchange(struct inpcb *, int);
-void in_setpeeraddr(struct inpcb *, struct mbuf *);
-void in_setsockaddr(struct inpcb *, struct mbuf *);
+void in_setpeeraddr(struct inpcb *, struct sockaddr_in *);
+void in_setsockaddr(struct inpcb *, struct sockaddr_in *);
struct rtentry *
in_pcbrtentry(struct inpcb *);
#endif
Index: netinet/raw_ip.c
===================================================================
RCS file: /cvsroot/src/sys/netinet/raw_ip.c,v
retrieving revision 1.147
diff -p -u -r1.147 raw_ip.c
--- netinet/raw_ip.c 3 Apr 2015 20:01:07 -0000 1.147
+++ netinet/raw_ip.c 19 Apr 2015 20:50:26 -0000
@@ -547,7 +547,7 @@ rip_detach(struct socket *so)
}
static int
-rip_accept(struct socket *so, struct mbuf *nam)
+rip_accept(struct socket *so, struct sockaddr *nam)
{
KASSERT(solocked(so));
@@ -688,7 +688,7 @@ rip_stat(struct socket *so, struct stat
}
static int
-rip_peeraddr(struct socket *so, struct mbuf *nam)
+rip_peeraddr(struct socket *so, struct sockaddr *nam)
{
int s;
@@ -697,14 +697,14 @@ rip_peeraddr(struct socket *so, struct m
KASSERT(nam != NULL);
s = splsoftnet();
- in_setpeeraddr(sotoinpcb(so), nam);
+ in_setpeeraddr(sotoinpcb(so), (struct sockaddr_in *)nam);
splx(s);
return 0;
}
static int
-rip_sockaddr(struct socket *so, struct mbuf *nam)
+rip_sockaddr(struct socket *so, struct sockaddr *nam)
{
int s;
@@ -713,7 +713,7 @@ rip_sockaddr(struct socket *so, struct m
KASSERT(nam != NULL);
s = splsoftnet();
- in_setsockaddr(sotoinpcb(so), nam);
+ in_setsockaddr(sotoinpcb(so), (struct sockaddr_in *)nam);
splx(s);
return 0;
Index: netinet/tcp_usrreq.c
===================================================================
RCS file: /cvsroot/src/sys/netinet/tcp_usrreq.c,v
retrieving revision 1.205
diff -p -u -r1.205 tcp_usrreq.c
--- netinet/tcp_usrreq.c 3 Apr 2015 20:01:07 -0000 1.205
+++ netinet/tcp_usrreq.c 19 Apr 2015 20:50:26 -0000
@@ -674,7 +674,7 @@ tcp_detach(struct socket *so)
}
static int
-tcp_accept(struct socket *so, struct mbuf *nam)
+tcp_accept(struct socket *so, struct sockaddr *nam)
{
struct inpcb *inp = NULL;
struct in6pcb *in6p = NULL;
@@ -696,12 +696,12 @@ tcp_accept(struct socket *so, struct mbu
s = splsoftnet();
#ifdef INET
if (inp) {
- in_setpeeraddr(inp, nam);
+ in_setpeeraddr(inp, (struct sockaddr_in *)nam);
}
#endif
#ifdef INET6
if (in6p) {
- in6_setpeeraddr(in6p, nam);
+ in6_setpeeraddr(in6p, (struct sockaddr_in6 *)nam);
}
#endif
tcp_debug_trace(so, tp, ostate, PRU_ACCEPT);
@@ -1023,7 +1023,7 @@ tcp_stat(struct socket *so, struct stat
}
static int
-tcp_peeraddr(struct socket *so, struct mbuf *nam)
+tcp_peeraddr(struct socket *so, struct sockaddr *nam)
{
struct inpcb *inp = NULL;
struct in6pcb *in6p = NULL;
@@ -1039,12 +1039,14 @@ tcp_peeraddr(struct socket *so, struct m
s = splsoftnet();
#ifdef INET
- if (inp)
- in_setpeeraddr(inp, nam);
+ if (inp) {
+ in_setpeeraddr(inp, (struct sockaddr_in *)nam);
+ }
#endif
#ifdef INET6
- if (in6p)
- in6_setpeeraddr(in6p, nam);
+ if (in6p) {
+ in6_setpeeraddr(in6p, (struct sockaddr_in6 *)nam);
+ }
#endif
tcp_debug_trace(so, tp, ostate, PRU_PEERADDR);
splx(s);
@@ -1053,7 +1055,7 @@ tcp_peeraddr(struct socket *so, struct m
}
static int
-tcp_sockaddr(struct socket *so, struct mbuf *nam)
+tcp_sockaddr(struct socket *so, struct sockaddr *nam)
{
struct inpcb *inp = NULL;
struct in6pcb *in6p = NULL;
@@ -1069,12 +1071,14 @@ tcp_sockaddr(struct socket *so, struct m
s = splsoftnet();
#ifdef INET
- if (inp)
- in_setsockaddr(inp, nam);
+ if (inp) {
+ in_setsockaddr(inp, (struct sockaddr_in *)nam);
+ }
#endif
#ifdef INET6
- if (in6p)
- in6_setsockaddr(in6p, nam);
+ if (in6p) {
+ in6_setsockaddr(in6p, (struct sockaddr_in6 *)nam);
+ }
#endif
tcp_debug_trace(so, tp, ostate, PRU_SOCKADDR);
splx(s);
Index: netinet/udp_usrreq.c
===================================================================
RCS file: /cvsroot/src/sys/netinet/udp_usrreq.c,v
retrieving revision 1.218
diff -p -u -r1.218 udp_usrreq.c
--- netinet/udp_usrreq.c 3 Apr 2015 20:01:07 -0000 1.218
+++ netinet/udp_usrreq.c 19 Apr 2015 20:50:26 -0000
@@ -895,7 +895,7 @@ udp_detach(struct socket *so)
}
static int
-udp_accept(struct socket *so, struct mbuf *nam)
+udp_accept(struct socket *so, struct sockaddr *nam)
{
KASSERT(solocked(so));
@@ -1018,7 +1018,7 @@ udp_stat(struct socket *so, struct stat
}
static int
-udp_peeraddr(struct socket *so, struct mbuf *nam)
+udp_peeraddr(struct socket *so, struct sockaddr *nam)
{
int s;
@@ -1027,14 +1027,14 @@ udp_peeraddr(struct socket *so, struct m
KASSERT(nam != NULL);
s = splsoftnet();
- in_setpeeraddr(sotoinpcb(so), nam);
+ in_setpeeraddr(sotoinpcb(so), (struct sockaddr_in *)nam);
splx(s);
return 0;
}
static int
-udp_sockaddr(struct socket *so, struct mbuf *nam)
+udp_sockaddr(struct socket *so, struct sockaddr *nam)
{
int s;
@@ -1043,7 +1043,7 @@ udp_sockaddr(struct socket *so, struct m
KASSERT(nam != NULL);
s = splsoftnet();
- in_setsockaddr(sotoinpcb(so), nam);
+ in_setsockaddr(sotoinpcb(so), (struct sockaddr_in *)nam);
splx(s);
return 0;
Index: netinet6/dccp6_usrreq.c
===================================================================
RCS file: /cvsroot/src/sys/netinet6/dccp6_usrreq.c,v
retrieving revision 1.2
diff -p -u -r1.2 dccp6_usrreq.c
--- netinet6/dccp6_usrreq.c 4 Apr 2015 04:33:39 -0000 1.2
+++ netinet6/dccp6_usrreq.c 19 Apr 2015 20:50:26 -0000
@@ -262,7 +262,7 @@ dccp6_listen(struct socket *so, struct l
}
int
-dccp6_accept(struct socket *so, struct mbuf *m)
+dccp6_accept(struct socket *so, struct sockaddr *nam)
{
struct in6pcb *in6p = NULL;
int error = 0;
@@ -284,7 +284,7 @@ dccp6_accept(struct socket *so, struct m
}
INP_LOCK(inp);
INP_INFO_RUNLOCK(&dccpbinfo);
- in6_setpeeraddr(in6p, m);
+ in6_setpeeraddr(in6p, (struct sockaddr_in6 *)nam);
INP_UNLOCK(inp);
return error;
@@ -420,24 +420,24 @@ dccp6_abort(struct socket *so)
static int
-dccp6_peeraddr(struct socket *so, struct mbuf *nam)
+dccp6_peeraddr(struct socket *so, struct sockaddr *nam)
{
KASSERT(solocked(so));
KASSERT(sotoinpcb(so) != NULL);
KASSERT(nam != NULL);
- in6_setpeeraddr(sotoin6pcb(so), nam);
+ in6_setpeeraddr(sotoin6pcb(so), (struct sockaddr_in6 *)nam);
return 0;
}
static int
-dccp6_sockaddr(struct socket *so, struct mbuf *nam)
+dccp6_sockaddr(struct socket *so, struct sockaddr *nam)
{
KASSERT(solocked(so));
KASSERT(sotoinpcb(so) != NULL);
KASSERT(nam != NULL);
- in6_setsockaddr(sotoin6pcb(so), nam);
+ in6_setsockaddr(sotoin6pcb(so), (struct sockaddr_in6 *)nam);
return 0;
}
Index: netinet6/in6_pcb.c
===================================================================
RCS file: /cvsroot/src/sys/netinet6/in6_pcb.c,v
retrieving revision 1.135
diff -p -u -r1.135 in6_pcb.c
--- netinet6/in6_pcb.c 3 Apr 2015 20:01:07 -0000 1.135
+++ netinet6/in6_pcb.c 19 Apr 2015 20:50:26 -0000
@@ -626,29 +626,23 @@ in6_pcbdetach(struct in6pcb *in6p)
}
void
-in6_setsockaddr(struct in6pcb *in6p, struct mbuf *nam)
+in6_setsockaddr(struct in6pcb *in6p, struct sockaddr_in6 *sin6)
{
- struct sockaddr_in6 *sin6;
if (in6p->in6p_af != AF_INET6)
return;
- nam->m_len = sizeof(*sin6);
- sin6 = mtod(nam, struct sockaddr_in6 *);
sockaddr_in6_init(sin6, &in6p->in6p_laddr, in6p->in6p_lport, 0, 0);
(void)sa6_recoverscope(sin6); /* XXX: should catch errors */
}
void
-in6_setpeeraddr(struct in6pcb *in6p, struct mbuf *nam)
+in6_setpeeraddr(struct in6pcb *in6p, struct sockaddr_in6 *sin6)
{
- struct sockaddr_in6 *sin6;
if (in6p->in6p_af != AF_INET6)
return;
- nam->m_len = sizeof(*sin6);
- sin6 = mtod(nam, struct sockaddr_in6 *);
sockaddr_in6_init(sin6, &in6p->in6p_faddr, in6p->in6p_fport, 0, 0);
(void)sa6_recoverscope(sin6); /* XXX: should catch errors */
}
Index: netinet6/in6_pcb.h
===================================================================
RCS file: /cvsroot/src/sys/netinet6/in6_pcb.h,v
retrieving revision 1.42
diff -p -u -r1.42 in6_pcb.h
--- netinet6/in6_pcb.h 3 Apr 2015 20:01:07 -0000 1.42
+++ netinet6/in6_pcb.h 19 Apr 2015 20:50:26 -0000
@@ -169,8 +169,8 @@ void in6_pcbpurgeif0(struct inpcbtable *
void in6_pcbpurgeif(struct inpcbtable *, struct ifnet *);
void in6_pcbstate(struct in6pcb *, int);
void in6_rtchange(struct in6pcb *, int);
-void in6_setpeeraddr(struct in6pcb *, struct mbuf *);
-void in6_setsockaddr(struct in6pcb *, struct mbuf *);
+void in6_setpeeraddr(struct in6pcb *, struct sockaddr_in6 *);
+void in6_setsockaddr(struct in6pcb *, struct sockaddr_in6 *);
/* in in6_src.c */
int in6_selecthlim(struct in6pcb *, struct ifnet *);
Index: netinet6/raw_ip6.c
===================================================================
RCS file: /cvsroot/src/sys/netinet6/raw_ip6.c,v
retrieving revision 1.137
diff -p -u -r1.137 raw_ip6.c
--- netinet6/raw_ip6.c 3 Apr 2015 20:01:07 -0000 1.137
+++ netinet6/raw_ip6.c 19 Apr 2015 20:50:26 -0000
@@ -645,7 +645,7 @@ rip6_detach(struct socket *so)
}
static int
-rip6_accept(struct socket *so, struct mbuf *nam)
+rip6_accept(struct socket *so, struct sockaddr *nam)
{
KASSERT(solocked(so));
@@ -815,24 +815,24 @@ rip6_stat(struct socket *so, struct stat
}
static int
-rip6_peeraddr(struct socket *so, struct mbuf *nam)
+rip6_peeraddr(struct socket *so, struct sockaddr *nam)
{
KASSERT(solocked(so));
KASSERT(sotoin6pcb(so) != NULL);
KASSERT(nam != NULL);
- in6_setpeeraddr(sotoin6pcb(so), nam);
+ in6_setpeeraddr(sotoin6pcb(so), (struct sockaddr_in6 *)nam);
return 0;
}
static int
-rip6_sockaddr(struct socket *so, struct mbuf *nam)
+rip6_sockaddr(struct socket *so, struct sockaddr *nam)
{
KASSERT(solocked(so));
KASSERT(sotoin6pcb(so) != NULL);
KASSERT(nam != NULL);
- in6_setsockaddr(sotoin6pcb(so), nam);
+ in6_setsockaddr(sotoin6pcb(so), (struct sockaddr_in6 *)nam);
return 0;
}
Index: netinet6/udp6_usrreq.c
===================================================================
RCS file: /cvsroot/src/sys/netinet6/udp6_usrreq.c,v
retrieving revision 1.117
diff -p -u -r1.117 udp6_usrreq.c
--- netinet6/udp6_usrreq.c 3 Apr 2015 20:01:07 -0000 1.117
+++ netinet6/udp6_usrreq.c 19 Apr 2015 20:50:26 -0000
@@ -688,7 +688,7 @@ udp6_detach(struct socket *so)
}
static int
-udp6_accept(struct socket *so, struct mbuf *nam)
+udp6_accept(struct socket *so, struct sockaddr *nam)
{
KASSERT(solocked(so));
@@ -825,24 +825,24 @@ udp6_stat(struct socket *so, struct stat
}
static int
-udp6_peeraddr(struct socket *so, struct mbuf *nam)
+udp6_peeraddr(struct socket *so, struct sockaddr *nam)
{
KASSERT(solocked(so));
KASSERT(sotoin6pcb(so) != NULL);
KASSERT(nam != NULL);
- in6_setpeeraddr(sotoin6pcb(so), nam);
+ in6_setpeeraddr(sotoin6pcb(so), (struct sockaddr_in6 *)nam);
return 0;
}
static int
-udp6_sockaddr(struct socket *so, struct mbuf *nam)
+udp6_sockaddr(struct socket *so, struct sockaddr *nam)
{
KASSERT(solocked(so));
KASSERT(sotoin6pcb(so) != NULL);
KASSERT(nam != NULL);
- in6_setsockaddr(sotoin6pcb(so), nam);
+ in6_setsockaddr(sotoin6pcb(so), (struct sockaddr_in6 *)nam);
return 0;
}
Index: netipsec/keysock.c
===================================================================
RCS file: /cvsroot/src/sys/netipsec/keysock.c,v
retrieving revision 1.45
diff -p -u -r1.45 keysock.c
--- netipsec/keysock.c 3 Apr 2015 20:01:07 -0000 1.45
+++ netipsec/keysock.c 19 Apr 2015 20:50:26 -0000
@@ -483,7 +483,7 @@ key_detach(struct socket *so)
}
static int
-key_accept(struct socket *so, struct mbuf *nam)
+key_accept(struct socket *so, struct sockaddr *nam)
{
KASSERT(solocked(so));
@@ -583,7 +583,7 @@ key_stat(struct socket *so, struct stat
}
static int
-key_peeraddr(struct socket *so, struct mbuf *nam)
+key_peeraddr(struct socket *so, struct sockaddr *nam)
{
struct rawcb *rp = sotorawcb(so);
@@ -599,7 +599,7 @@ key_peeraddr(struct socket *so, struct m
}
static int
-key_sockaddr(struct socket *so, struct mbuf *nam)
+key_sockaddr(struct socket *so, struct sockaddr *nam)
{
struct rawcb *rp = sotorawcb(so);
Index: netmpls/mpls_proto.c
===================================================================
RCS file: /cvsroot/src/sys/netmpls/mpls_proto.c,v
retrieving revision 1.25
diff -p -u -r1.25 mpls_proto.c
--- netmpls/mpls_proto.c 3 Apr 2015 20:01:07 -0000 1.25
+++ netmpls/mpls_proto.c 19 Apr 2015 20:50:26 -0000
@@ -95,7 +95,7 @@ mpls_detach(struct socket *so)
}
static int
-mpls_accept(struct socket *so, struct mbuf *nam)
+mpls_accept(struct socket *so, struct sockaddr *nam)
{
KASSERT(solocked(so));
@@ -173,7 +173,7 @@ mpls_stat(struct socket *so, struct stat
}
static int
-mpls_peeraddr(struct socket *so, struct mbuf *nam)
+mpls_peeraddr(struct socket *so, struct sockaddr *nam)
{
KASSERT(solocked(so));
@@ -181,7 +181,7 @@ mpls_peeraddr(struct socket *so, struct
}
static int
-mpls_sockaddr(struct socket *so, struct mbuf *nam)
+mpls_sockaddr(struct socket *so, struct sockaddr *nam)
{
KASSERT(solocked(so));
Index: netnatm/natm.c
===================================================================
RCS file: /cvsroot/src/sys/netnatm/natm.c,v
retrieving revision 1.46
diff -p -u -r1.46 natm.c
--- netnatm/natm.c 3 Apr 2015 20:01:07 -0000 1.46
+++ netnatm/natm.c 19 Apr 2015 20:50:26 -0000
@@ -98,7 +98,7 @@ natm_detach(struct socket *so)
}
static int
-natm_accept(struct socket *so, struct mbuf *nam)
+natm_accept(struct socket *so, struct sockaddr *nam)
{
KASSERT(solocked(so));
@@ -299,18 +299,17 @@ natm_stat(struct socket *so, struct stat
}
static int
-natm_peeraddr(struct socket *so, struct mbuf *nam)
+natm_peeraddr(struct socket *so, struct sockaddr *nam)
{
struct natmpcb *npcb = (struct natmpcb *) so->so_pcb;
- struct sockaddr_natm *snatm;
+ struct sockaddr_natm *snatm = (struct sockaddr_natm *)nam;
KASSERT(solocked(so));
KASSERT(pcb != NULL);
KASSERT(nam != NULL);
- snatm = mtod(nam, struct sockaddr_natm *);
memset(snatm, 0, sizeof(*snatm));
- nam->m_len = snatm->snatm_len = sizeof(*snatm);
+ snatm->snatm_len = sizeof(*snatm);
snatm->snatm_family = AF_NATM;
memcpy(snatm->snatm_if, npcb->npcb_ifp->if_xname, sizeof(snatm->snatm_if));
snatm->snatm_vci = npcb->npcb_vci;
@@ -319,7 +318,7 @@ natm_peeraddr(struct socket *so, struct
}
static int
-natm_sockaddr(struct socket *so, struct mbuf *nam)
+natm_sockaddr(struct socket *so, struct sockaddr *nam)
{
KASSERT(solocked(so));
Index: rump/net/lib/libsockin/sockin.c
===================================================================
RCS file: /cvsroot/src/sys/rump/net/lib/libsockin/sockin.c,v
retrieving revision 1.59
diff -p -u -r1.59 sockin.c
--- rump/net/lib/libsockin/sockin.c 3 Apr 2015 20:01:08 -0000 1.59
+++ rump/net/lib/libsockin/sockin.c 19 Apr 2015 20:50:26 -0000
@@ -68,7 +68,7 @@ static int sockin_do_init(void);
static void sockin_init(void);
static int sockin_attach(struct socket *, int);
static void sockin_detach(struct socket *);
-static int sockin_accept(struct socket *, struct mbuf *);
+static int sockin_accept(struct socket *, struct sockaddr *);
static int sockin_connect2(struct socket *, struct socket *);
static int sockin_bind(struct socket *, struct sockaddr *, struct lwp *);
static int sockin_listen(struct socket *, struct lwp *);
@@ -78,8 +78,8 @@ static int sockin_shutdown(struct socket
static int sockin_abort(struct socket *);
static int sockin_ioctl(struct socket *, u_long, void *, struct ifnet *);
static int sockin_stat(struct socket *, struct stat *);
-static int sockin_peeraddr(struct socket *, struct mbuf *);
-static int sockin_sockaddr(struct socket *, struct mbuf *);
+static int sockin_peeraddr(struct socket *, struct sockaddr *);
+static int sockin_sockaddr(struct socket *, struct sockaddr *);
static int sockin_rcvd(struct socket *, int, struct lwp *);
static int sockin_recvoob(struct socket *, struct mbuf *, int);
static int sockin_send(struct socket *, struct mbuf *, struct mbuf *,
@@ -485,7 +485,7 @@ sockin_detach(struct socket *so)
}
static int
-sockin_accept(struct socket *so, struct mbuf *nam)
+sockin_accept(struct socket *so, struct sockaddr *nam)
{
KASSERT(solocked(so));
@@ -574,32 +574,32 @@ sockin_stat(struct socket *so, struct st
}
static int
-sockin_peeraddr(struct socket *so, struct mbuf *nam)
+sockin_peeraddr(struct socket *so, struct sockaddr *nam)
{
KASSERT(solocked(so));
int error = 0;
- int slen = nam->m_len;
+ int slen = nam->sa_len;
error = rumpcomp_sockin_getname(SO2S(so),
- mtod(nam, struct sockaddr *), &slen, RUMPCOMP_SOCKIN_PEERNAME);
+ nam, &slen, RUMPCOMP_SOCKIN_PEERNAME);
if (error == 0)
- nam->m_len = slen;
+ nam->sa_len = slen;
return error;
}
static int
-sockin_sockaddr(struct socket *so, struct mbuf *nam)
+sockin_sockaddr(struct socket *so, struct sockaddr *nam)
{
KASSERT(solocked(so));
int error = 0;
- int slen = nam->m_len;
+ int slen = nam->sa_len;
error = rumpcomp_sockin_getname(SO2S(so),
- mtod(nam, struct sockaddr *), &slen, RUMPCOMP_SOCKIN_SOCKNAME);
+ nam, &slen, RUMPCOMP_SOCKIN_SOCKNAME);
if (error == 0)
- nam->m_len = slen;
+ nam->sa_len = slen;
return error;
}
Index: sys/param.h
===================================================================
RCS file: /cvsroot/src/sys/sys/param.h,v
retrieving revision 1.470
diff -p -u -r1.470 param.h
--- sys/param.h 13 Apr 2015 21:32:04 -0000 1.470
+++ sys/param.h 19 Apr 2015 20:50:26 -0000
@@ -63,7 +63,7 @@
* 2.99.9 (299000900)
*/
-#define __NetBSD_Version__ 799000900 /* NetBSD 7.99.9 */
+#define __NetBSD_Version__ 799001000 /* NetBSD 7.99.10 */
#define __NetBSD_Prereq__(M,m,p) (((((M) * 100000000) + \
(m) * 1000000) + (p) * 100) <= __NetBSD_Version__)
Index: sys/protosw.h
===================================================================
RCS file: /cvsroot/src/sys/sys/protosw.h,v
retrieving revision 1.61
diff -p -u -r1.61 protosw.h
--- sys/protosw.h 3 Apr 2015 20:01:08 -0000 1.61
+++ sys/protosw.h 19 Apr 2015 20:50:26 -0000
@@ -238,7 +238,7 @@ static const char * const prcorequests[]
struct pr_usrreqs {
int (*pr_attach)(struct socket *, int);
void (*pr_detach)(struct socket *);
- int (*pr_accept)(struct socket *, struct mbuf *);
+ int (*pr_accept)(struct socket *, struct sockaddr *);
int (*pr_connect)(struct socket *, struct mbuf *, struct lwp *);
int (*pr_connect2)(struct socket *, struct socket *);
int (*pr_bind)(struct socket *, struct sockaddr *, struct lwp *);
@@ -248,8 +248,8 @@ struct pr_usrreqs {
int (*pr_abort)(struct socket *);
int (*pr_ioctl)(struct socket *, u_long, void *, struct ifnet *);
int (*pr_stat)(struct socket *, struct stat *);
- int (*pr_peeraddr)(struct socket *, struct mbuf *);
- int (*pr_sockaddr)(struct socket *, struct mbuf *);
+ int (*pr_peeraddr)(struct socket *, struct sockaddr *);
+ int (*pr_sockaddr)(struct socket *, struct sockaddr *);
int (*pr_rcvd)(struct socket *, int, struct lwp *);
int (*pr_recvoob)(struct socket *, struct mbuf *, int);
int (*pr_send)(struct socket *, struct mbuf *, struct mbuf *,
@@ -308,7 +308,8 @@ name##_detach_wrapper(struct socket *a)
KERNEL_UNLOCK_ONE(NULL); \
} \
static int \
-name##_accept_wrapper(struct socket *a, struct mbuf *b) \
+name##_accept_wrapper(struct socket *a, \
+ struct sockaddr *b) \
{ \
int rv; \
KERNEL_LOCK(1, NULL); \
@@ -402,7 +403,8 @@ name##_stat_wrapper(struct socket *a, st
return rv; \
} \
static int \
-name##_peeraddr_wrapper(struct socket *a, struct mbuf *b) \
+name##_peeraddr_wrapper(struct socket *a, \
+ struct sockaddr *b) \
{ \
int rv; \
KERNEL_LOCK(1, NULL); \
@@ -411,7 +413,8 @@ name##_peeraddr_wrapper(struct socket *a
return rv; \
} \
static int \
-name##_sockaddr_wrapper(struct socket *a, struct mbuf *b) \
+name##_sockaddr_wrapper(struct socket *a, \
+ struct sockaddr *b) \
{ \
int rv; \
KERNEL_LOCK(1, NULL); \
Index: sys/socketvar.h
===================================================================
RCS file: /cvsroot/src/sys/sys/socketvar.h,v
retrieving revision 1.136
diff -p -u -r1.136 socketvar.h
--- sys/socketvar.h 3 Apr 2015 20:01:08 -0000 1.136
+++ sys/socketvar.h 19 Apr 2015 20:50:27 -0000
@@ -287,7 +287,7 @@ void soinit(void);
void soinit1(void);
void soinit2(void);
int soabort(struct socket *);
-int soaccept(struct socket *, struct mbuf *);
+int soaccept(struct socket *, struct sockaddr *);
int sofamily(const struct socket *);
int sobind(struct socket *, struct sockaddr *, struct lwp *);
void socantrcvmore(struct socket *);
@@ -348,15 +348,15 @@ int copyout_sockname(struct sockaddr *,
int copyout_msg_control(struct lwp *, struct msghdr *, struct mbuf *);
void free_control_mbuf(struct lwp *, struct mbuf *, struct mbuf *);
-int do_sys_getpeername(int, struct mbuf **);
-int do_sys_getsockname(int, struct mbuf **);
+int do_sys_getpeername(int, struct sockaddr *);
+int do_sys_getsockname(int, struct sockaddr *);
int do_sys_sendmsg(struct lwp *, int, struct msghdr *, int, register_t *);
int do_sys_recvmsg(struct lwp *, int, struct msghdr *, struct mbuf **,
struct mbuf **, register_t *);
int do_sys_bind(struct lwp *, int, struct sockaddr *);
int do_sys_connect(struct lwp *, int, struct mbuf *);
-int do_sys_accept(struct lwp *, int, struct mbuf **, register_t *,
+int do_sys_accept(struct lwp *, int, struct sockaddr *, register_t *,
const sigset_t *, int, int);
/*
Home |
Main Index |
Thread Index |
Old Index