CVS commit: src/sys/rump/net/lib/libsockin
Module Name:src Committed By: ozaki-r Date: Tue Nov 15 09:04:30 UTC 2016 Modified Files: src/sys/rump/net/lib/libsockin: sockin.c Log Message: Fix build of usr.sbin/puffs/rump_nfs XXX a better fix should be to separate nfs codes and let rump_nfs link only XXX one that doesn't depend on rt_delete_matched_entries (and rtrequest). To generate a diff of this commit: cvs rdiff -u -r1.63 -r1.64 src/sys/rump/net/lib/libsockin/sockin.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/net/lib/libsockin/sockin.c diff -u src/sys/rump/net/lib/libsockin/sockin.c:1.63 src/sys/rump/net/lib/libsockin/sockin.c:1.64 --- src/sys/rump/net/lib/libsockin/sockin.c:1.63 Tue Jan 26 23:12:19 2016 +++ src/sys/rump/net/lib/libsockin/sockin.c Tue Nov 15 09:04:30 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: sockin.c,v 1.63 2016/01/26 23:12:19 pooka Exp $ */ +/* $NetBSD: sockin.c,v 1.64 2016/11/15 09:04:30 ozaki-r Exp $ */ /* * Copyright (c) 2008, 2009 Antti Kantee. All Rights Reserved. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sockin.c,v 1.63 2016/01/26 23:12:19 pooka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sockin.c,v 1.64 2016/11/15 09:04:30 ozaki-r Exp $"); #include #include @@ -707,3 +707,4 @@ sockin_unavailable(void) __strong_alias(rtrequest,sockin_unavailable); __strong_alias(ifunit,sockin_unavailable); __strong_alias(ifreq_setaddr,sockin_unavailable); +__strong_alias(rt_delete_matched_entries,sockin_unavailable);
CVS commit: src/sys/rump/net/lib/libsockin
Module Name:src Committed By: rtr Date: Mon Jul 28 10:09:51 UTC 2014 Modified Files: src/sys/rump/net/lib/libsockin: sockin.c Log Message: add missing KASSERT()s at the top of sockin_usrreq(), req shall not be either of these operations. KASSERT(req != PRU_BIND); KASSERT(req != PRU_LISTEN); To generate a diff of this commit: cvs rdiff -u -r1.51 -r1.52 src/sys/rump/net/lib/libsockin/sockin.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/net/lib/libsockin/sockin.c diff -u src/sys/rump/net/lib/libsockin/sockin.c:1.51 src/sys/rump/net/lib/libsockin/sockin.c:1.52 --- src/sys/rump/net/lib/libsockin/sockin.c:1.51 Thu Jul 24 15:12:03 2014 +++ src/sys/rump/net/lib/libsockin/sockin.c Mon Jul 28 10:09:51 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: sockin.c,v 1.51 2014/07/24 15:12:03 rtr Exp $ */ +/* $NetBSD: sockin.c,v 1.52 2014/07/28 10:09:51 rtr Exp $ */ /* * Copyright (c) 2008, 2009 Antti Kantee. All Rights Reserved. @@ -26,7 +26,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: sockin.c,v 1.51 2014/07/24 15:12:03 rtr Exp $); +__KERNEL_RCSID(0, $NetBSD: sockin.c,v 1.52 2014/07/28 10:09:51 rtr Exp $); #include sys/param.h #include sys/condvar.h @@ -558,6 +558,8 @@ sockin_usrreq(struct socket *so, int req int error = 0; KASSERT(req != PRU_ACCEPT); + KASSERT(req != PRU_BIND); + KASSERT(req != PRU_LISTEN); KASSERT(req != PRU_CONTROL); KASSERT(req != PRU_SENSE); KASSERT(req != PRU_PEERADDR);
CVS commit: src/sys/rump/net/lib/libsockin
Module Name:src Committed By: rtr Date: Wed Jul 9 15:37:55 UTC 2014 Modified Files: src/sys/rump/net/lib/libsockin: sockin.c Log Message: fix name clash i introduced when adding sockin_accept() pru by renaming the rump sockin_accept(struct socket *) to sockin_waccept(struct socket *) not a very creative name the 'w' indicates worker and was chosen to prefix the word accept to make it not pattern match with _accept. if someone prefers a different name then please feel free to change it. To generate a diff of this commit: cvs rdiff -u -r1.48 -r1.49 src/sys/rump/net/lib/libsockin/sockin.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/net/lib/libsockin/sockin.c diff -u src/sys/rump/net/lib/libsockin/sockin.c:1.48 src/sys/rump/net/lib/libsockin/sockin.c:1.49 --- src/sys/rump/net/lib/libsockin/sockin.c:1.48 Wed Jul 9 14:41:43 2014 +++ src/sys/rump/net/lib/libsockin/sockin.c Wed Jul 9 15:37:55 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: sockin.c,v 1.48 2014/07/09 14:41:43 rtr Exp $ */ +/* $NetBSD: sockin.c,v 1.49 2014/07/09 15:37:55 rtr Exp $ */ /* * Copyright (c) 2008, 2009 Antti Kantee. All Rights Reserved. @@ -26,7 +26,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: sockin.c,v 1.48 2014/07/09 14:41:43 rtr Exp $); +__KERNEL_RCSID(0, $NetBSD: sockin.c,v 1.49 2014/07/09 15:37:55 rtr Exp $); #include sys/param.h #include sys/condvar.h @@ -284,7 +284,7 @@ sockin_process(struct socket *so) } static void -sockin_accept(struct socket *so) +sockin_waccept(struct socket *so) { struct socket *nso; struct sockaddr_in6 sin; @@ -363,7 +363,7 @@ sockinworker(void *arg) so = su_iter-su_so; mutex_exit(su_mtx); if(so-so_optionsSO_ACCEPTCONN) - sockin_accept(so); + sockin_waccept(so); else sockin_process(so); mutex_enter(su_mtx);
CVS commit: src/sys/rump/net/lib/libsockin
Module Name:src Committed By: rtr Date: Sun Jul 6 16:18:46 UTC 2014 Modified Files: src/sys/rump/net/lib/libsockin: sockin.c Log Message: * split PRU_SENSE functionality out of sockin_usrreq() and place into separate sockin_stat(struct socket *, struct stat *) function. * change behavior of function to just return success (like pretty much every other implementation) instead of panic()ing due to lack of implementation. To generate a diff of this commit: cvs rdiff -u -r1.42 -r1.43 src/sys/rump/net/lib/libsockin/sockin.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/net/lib/libsockin/sockin.c diff -u src/sys/rump/net/lib/libsockin/sockin.c:1.42 src/sys/rump/net/lib/libsockin/sockin.c:1.43 --- src/sys/rump/net/lib/libsockin/sockin.c:1.42 Tue Jul 1 05:49:19 2014 +++ src/sys/rump/net/lib/libsockin/sockin.c Sun Jul 6 16:18:46 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: sockin.c,v 1.42 2014/07/01 05:49:19 rtr Exp $ */ +/* $NetBSD: sockin.c,v 1.43 2014/07/06 16:18:46 rtr Exp $ */ /* * Copyright (c) 2008, 2009 Antti Kantee. All Rights Reserved. @@ -26,7 +26,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: sockin.c,v 1.42 2014/07/01 05:49:19 rtr Exp $); +__KERNEL_RCSID(0, $NetBSD: sockin.c,v 1.43 2014/07/06 16:18:46 rtr Exp $); #include sys/param.h #include sys/condvar.h @@ -69,6 +69,7 @@ static void sockin_init(void); static int sockin_attach(struct socket *, int); static void sockin_detach(struct socket *); static int sockin_ioctl(struct socket *, u_long, void *, struct ifnet *); +static int sockin_stat(struct socket *, struct stat *); static int sockin_usrreq(struct socket *, int, struct mbuf *, struct mbuf *, struct mbuf *, struct lwp *); static int sockin_ctloutput(int op, struct socket *, struct sockopt *); @@ -77,6 +78,7 @@ static const struct pr_usrreqs sockin_us .pr_attach = sockin_attach, .pr_detach = sockin_detach, .pr_ioctl = sockin_ioctl, + .pr_stat = sockin_stat, .pr_generic = sockin_usrreq, }; @@ -458,12 +460,19 @@ sockin_ioctl(struct socket *so, u_long c } static int +sockin_stat(struct socket *so, struct stat *ub) +{ + return 0; +} + +static int sockin_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam, struct mbuf *control, struct lwp *l) { int error = 0; KASSERT(req != PRU_CONTROL); + KASSERT(req != PRU_SENSE); switch (req) { case PRU_ACCEPT:
CVS commit: src/sys/rump/net/lib/libsockin
Module Name:src Committed By: rmind Date: Sun May 18 17:57:44 UTC 2014 Modified Files: src/sys/rump/net/lib/libsockin: sockin.c Log Message: Fix RUMP build. To generate a diff of this commit: cvs rdiff -u -r1.38 -r1.39 src/sys/rump/net/lib/libsockin/sockin.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/net/lib/libsockin/sockin.c diff -u src/sys/rump/net/lib/libsockin/sockin.c:1.38 src/sys/rump/net/lib/libsockin/sockin.c:1.39 --- src/sys/rump/net/lib/libsockin/sockin.c:1.38 Fri May 9 06:12:48 2014 +++ src/sys/rump/net/lib/libsockin/sockin.c Sun May 18 17:57:44 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: sockin.c,v 1.38 2014/05/09 06:12:48 pooka Exp $ */ +/* $NetBSD: sockin.c,v 1.39 2014/05/18 17:57:44 rmind Exp $ */ /* * Copyright (c) 2008, 2009 Antti Kantee. All Rights Reserved. @@ -26,7 +26,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: sockin.c,v 1.38 2014/05/09 06:12:48 pooka Exp $); +__KERNEL_RCSID(0, $NetBSD: sockin.c,v 1.39 2014/05/18 17:57:44 rmind Exp $); #include sys/param.h #include sys/condvar.h @@ -70,13 +70,17 @@ static int sockin_usrreq(struct socket * struct mbuf *, struct mbuf *, struct lwp *); static int sockin_ctloutput(int op, struct socket *, struct sockopt *); +static const struct pr_usrreqs sockin_usrreqs = { + .pr_generic = sockin_usrreq, +}; + const struct protosw sockinsw[] = { { .pr_type = SOCK_DGRAM, .pr_domain = sockindomain, .pr_protocol = IPPROTO_UDP, .pr_flags = PR_ATOMIC|PR_ADDR, - .pr_usrreq = sockin_usrreq, + .pr_usrreqs = sockin_usrreqs, .pr_ctloutput = sockin_ctloutput, }, { @@ -84,7 +88,7 @@ const struct protosw sockinsw[] = { .pr_domain = sockindomain, .pr_protocol = IPPROTO_TCP, .pr_flags = PR_CONNREQUIRED|PR_WANTRCVD|PR_LISTEN|PR_ABRTACPTDIS, - .pr_usrreq = sockin_usrreq, + .pr_usrreqs = sockin_usrreqs, .pr_ctloutput = sockin_ctloutput, }}; const struct protosw sockin6sw[] = { @@ -93,7 +97,7 @@ const struct protosw sockin6sw[] = { .pr_domain = sockin6domain, .pr_protocol = IPPROTO_UDP, .pr_flags = PR_ATOMIC|PR_ADDR, - .pr_usrreq = sockin_usrreq, + .pr_usrreqs = sockin_usrreqs, .pr_ctloutput = sockin_ctloutput, }, { @@ -101,7 +105,7 @@ const struct protosw sockin6sw[] = { .pr_domain = sockin6domain, .pr_protocol = IPPROTO_TCP, .pr_flags = PR_CONNREQUIRED|PR_WANTRCVD|PR_LISTEN|PR_ABRTACPTDIS, - .pr_usrreq = sockin_usrreq, + .pr_usrreqs = sockin_usrreqs, .pr_ctloutput = sockin_ctloutput, }};
CVS commit: src/sys/rump/net/lib/libsockin
Module Name:src Committed By: pooka Date: Fri May 9 06:12:48 UTC 2014 Modified Files: src/sys/rump/net/lib/libsockin: sockin.c Log Message: comment meets reality To generate a diff of this commit: cvs rdiff -u -r1.37 -r1.38 src/sys/rump/net/lib/libsockin/sockin.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/net/lib/libsockin/sockin.c diff -u src/sys/rump/net/lib/libsockin/sockin.c:1.37 src/sys/rump/net/lib/libsockin/sockin.c:1.38 --- src/sys/rump/net/lib/libsockin/sockin.c:1.37 Sat Apr 26 11:23:03 2014 +++ src/sys/rump/net/lib/libsockin/sockin.c Fri May 9 06:12:48 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: sockin.c,v 1.37 2014/04/26 11:23:03 pooka Exp $ */ +/* $NetBSD: sockin.c,v 1.38 2014/05/09 06:12:48 pooka Exp $ */ /* * Copyright (c) 2008, 2009 Antti Kantee. All Rights Reserved. @@ -26,7 +26,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: sockin.c,v 1.37 2014/04/26 11:23:03 pooka Exp $); +__KERNEL_RCSID(0, $NetBSD: sockin.c,v 1.38 2014/05/09 06:12:48 pooka Exp $); #include sys/param.h #include sys/condvar.h @@ -58,8 +58,7 @@ __KERNEL_RCSID(0, $NetBSD: sockin.c,v 1 /* * An inet communication domain which uses the socket interface. - * Currently supports only IPv4 UDP, but could easily be extended to - * support IPv6 and TCP by adding more stuff to the protosw. + * Supports IPv4 IPv6 UDP/TCP. */ DOMAIN_DEFINE(sockindomain);
CVS commit: src/sys/rump/net/lib/libsockin
Module Name:src Committed By: pooka Date: Thu Mar 13 01:40:30 UTC 2014 Modified Files: src/sys/rump/net/lib/libsockin: Makefile sockin.c Added Files: src/sys/rump/net/lib/libsockin: sockin_user.c sockin_user.h Removed Files: src/sys/rump/net/lib/libsockin: rumpcomp_user.c rumpcomp_user.h Log Message: rename rumpcomp_user.* - sockin_user.* To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/rump/net/lib/libsockin/Makefile cvs rdiff -u -r1.8 -r0 src/sys/rump/net/lib/libsockin/rumpcomp_user.c cvs rdiff -u -r1.3 -r0 src/sys/rump/net/lib/libsockin/rumpcomp_user.h cvs rdiff -u -r1.35 -r1.36 src/sys/rump/net/lib/libsockin/sockin.c cvs rdiff -u -r0 -r1.1 src/sys/rump/net/lib/libsockin/sockin_user.c \ src/sys/rump/net/lib/libsockin/sockin_user.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/net/lib/libsockin/Makefile diff -u src/sys/rump/net/lib/libsockin/Makefile:1.6 src/sys/rump/net/lib/libsockin/Makefile:1.7 --- src/sys/rump/net/lib/libsockin/Makefile:1.6 Mon Mar 18 13:14:11 2013 +++ src/sys/rump/net/lib/libsockin/Makefile Thu Mar 13 01:40:30 2014 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.6 2013/03/18 13:14:11 pooka Exp $ +# $NetBSD: Makefile,v 1.7 2014/03/13 01:40:30 pooka Exp $ # LIB= rumpnet_sockin @@ -8,7 +8,7 @@ SRCS+= component.c CPPFLAGS+= -I${RUMPTOP}/librump/rumpkern -RUMPCOMP_USER= #defined +RUMPCOMP_USER_SRCS= sockin_user.c .include bsd.lib.mk .include bsd.klinks.mk Index: src/sys/rump/net/lib/libsockin/sockin.c diff -u src/sys/rump/net/lib/libsockin/sockin.c:1.35 src/sys/rump/net/lib/libsockin/sockin.c:1.36 --- src/sys/rump/net/lib/libsockin/sockin.c:1.35 Thu Aug 29 17:49:21 2013 +++ src/sys/rump/net/lib/libsockin/sockin.c Thu Mar 13 01:40:30 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: sockin.c,v 1.35 2013/08/29 17:49:21 rmind Exp $ */ +/* $NetBSD: sockin.c,v 1.36 2014/03/13 01:40:30 pooka Exp $ */ /* * Copyright (c) 2008, 2009 Antti Kantee. All Rights Reserved. @@ -26,7 +26,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: sockin.c,v 1.35 2013/08/29 17:49:21 rmind Exp $); +__KERNEL_RCSID(0, $NetBSD: sockin.c,v 1.36 2014/03/13 01:40:30 pooka Exp $); #include sys/param.h #include sys/condvar.h @@ -54,7 +54,7 @@ __KERNEL_RCSID(0, $NetBSD: sockin.c,v 1 #include rump/rumpuser.h #include rump_private.h -#include rumpcomp_user.h +#include sockin_user.h /* * An inet communication domain which uses the socket interface. Added files: Index: src/sys/rump/net/lib/libsockin/sockin_user.c diff -u /dev/null src/sys/rump/net/lib/libsockin/sockin_user.c:1.1 --- /dev/null Thu Mar 13 01:40:30 2014 +++ src/sys/rump/net/lib/libsockin/sockin_user.c Thu Mar 13 01:40:30 2014 @@ -0,0 +1,587 @@ +/* $NetBSD: sockin_user.c,v 1.1 2014/03/13 01:40:30 pooka Exp $ */ + +/* + * Copyright (c) 2008 Antti Kantee. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* for struct msghdr content visibility */ +#define _XOPEN_SOURCE 4 +#define _XOPEN_SOURCE_EXTENDED 1 + +#ifndef _KERNEL +#include sys/types.h +#include sys/socket.h + +#include errno.h +#include poll.h +#include stdlib.h +#include string.h +#include stdint.h + +#include rump/rumpuser_component.h +#include rump/rumpdefs.h + +#include sockin_user.h + +#define seterror(_v_) if ((_v_) == -1) rv = errno; else rv = 0; + +#ifndef __arraycount +#define __arraycount(a) (sizeof(a) / sizeof(*a)) +#endif + +#ifndef __UNCONST +#define __UNCONST(a) ((void*)(const void*)a) +#endif + +#include netinet/in.h +#include netinet/tcp.h +#include netinet/udp.h + + +static int translate_so_sockopt(int); +static int translate_ip_sockopt(int); +static int
CVS commit: src/sys/rump/net/lib/libsockin
Module Name:src Committed By: pooka Date: Thu Mar 13 02:05:50 UTC 2014 Modified Files: src/sys/rump/net/lib/libsockin: Makefile Added Files: src/sys/rump/net/lib/libsockin: sockin_component.c Removed Files: src/sys/rump/net/lib/libsockin: component.c Log Message: rename component.c - sockin_component.c To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/rump/net/lib/libsockin/Makefile cvs rdiff -u -r1.3 -r0 src/sys/rump/net/lib/libsockin/component.c cvs rdiff -u -r0 -r1.1 src/sys/rump/net/lib/libsockin/sockin_component.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/net/lib/libsockin/Makefile diff -u src/sys/rump/net/lib/libsockin/Makefile:1.7 src/sys/rump/net/lib/libsockin/Makefile:1.8 --- src/sys/rump/net/lib/libsockin/Makefile:1.7 Thu Mar 13 01:40:30 2014 +++ src/sys/rump/net/lib/libsockin/Makefile Thu Mar 13 02:05:49 2014 @@ -1,10 +1,10 @@ -# $NetBSD: Makefile,v 1.7 2014/03/13 01:40:30 pooka Exp $ +# $NetBSD: Makefile,v 1.8 2014/03/13 02:05:49 pooka Exp $ # LIB= rumpnet_sockin SRCS= sockin.c -SRCS+= component.c +SRCS+= sockin_component.c CPPFLAGS+= -I${RUMPTOP}/librump/rumpkern Added files: Index: src/sys/rump/net/lib/libsockin/sockin_component.c diff -u /dev/null src/sys/rump/net/lib/libsockin/sockin_component.c:1.1 --- /dev/null Thu Mar 13 02:05:50 2014 +++ src/sys/rump/net/lib/libsockin/sockin_component.c Thu Mar 13 02:05:49 2014 @@ -0,0 +1,47 @@ +/* $NetBSD: sockin_component.c,v 1.1 2014/03/13 02:05:49 pooka Exp $ */ + +/* + * Copyright (c) 2009 Antti Kantee. All Rights Reserved. + * + * Development of this software was supported by The Nokia Foundation + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include sys/cdefs.h +__KERNEL_RCSID(0, $NetBSD: sockin_component.c,v 1.1 2014/03/13 02:05:49 pooka Exp $); + +#include sys/param.h +#include sys/domain.h +#include sys/protosw.h + +#include rump_private.h +#include rump_net_private.h + +RUMP_COMPONENT(RUMP_COMPONENT_NET) +{ + extern struct domain sockindomain; + extern struct domain sockin6domain; + + DOMAINADD(sockindomain); + DOMAINADD(sockin6domain); +}
CVS commit: src/sys/rump/net/lib/libsockin
Module Name:src Committed By: pooka Date: Thu Jul 4 09:58:28 UTC 2013 Modified Files: src/sys/rump/net/lib/libsockin: rumpcomp_user.c Log Message: Avoid not-used warning on NetBSD To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/rump/net/lib/libsockin/rumpcomp_user.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/net/lib/libsockin/rumpcomp_user.c diff -u src/sys/rump/net/lib/libsockin/rumpcomp_user.c:1.7 src/sys/rump/net/lib/libsockin/rumpcomp_user.c:1.8 --- src/sys/rump/net/lib/libsockin/rumpcomp_user.c:1.7 Sat Jun 1 11:46:14 2013 +++ src/sys/rump/net/lib/libsockin/rumpcomp_user.c Thu Jul 4 09:58:28 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpcomp_user.c,v 1.7 2013/06/01 11:46:14 pooka Exp $ */ +/* $NetBSD: rumpcomp_user.c,v 1.8 2013/07/04 09:58:28 pooka Exp $ */ /* * Copyright (c) 2008 Antti Kantee. All Rights Reserved. @@ -129,20 +129,6 @@ translate_domain(int domain) } #undef translate -#define translate_back(_a_) case _a_: return RUMP_##_a_ -static int translate_domain_back(int); -static int -translate_domain_back(int domain) -{ - - switch (domain) { - translate_back(AF_INET); - translate_back(AF_INET6); - default: return RUMP_AF_UNSPEC; - } -} - -#undef translate_back static void translate_sockopt(int *levelp, int *namep) @@ -326,6 +312,20 @@ translate_sockaddr(const struct sockaddr return laddr; } +#define translate_back(_a_) case _a_: return RUMP_##_a_ +static int translate_domain_back(int); +static int +translate_domain_back(int domain) +{ + + switch (domain) { + translate_back(AF_INET); + translate_back(AF_INET6); + default: return RUMP_AF_UNSPEC; + } +} +#undef translate_back + static void translate_sockaddr_back(const struct sockaddr *laddr, struct rump_sockaddr *baddr,
CVS commit: src/sys/rump/net/lib/libsockin
Module Name:src Committed By: stacktic Date: Sat Jun 1 10:09:05 UTC 2013 Modified Files: src/sys/rump/net/lib/libsockin: rumpcomp_user.c Log Message: Translate function parameters between the hypervisor and rump kernel To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/rump/net/lib/libsockin/rumpcomp_user.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/net/lib/libsockin/rumpcomp_user.c diff -u src/sys/rump/net/lib/libsockin/rumpcomp_user.c:1.5 src/sys/rump/net/lib/libsockin/rumpcomp_user.c:1.6 --- src/sys/rump/net/lib/libsockin/rumpcomp_user.c:1.5 Tue Apr 30 12:39:21 2013 +++ src/sys/rump/net/lib/libsockin/rumpcomp_user.c Sat Jun 1 10:09:05 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpcomp_user.c,v 1.5 2013/04/30 12:39:21 pooka Exp $ */ +/* $NetBSD: rumpcomp_user.c,v 1.6 2013/06/01 10:09:05 stacktic Exp $ */ /* * Copyright (c) 2008 Antti Kantee. All Rights Reserved. @@ -32,18 +32,388 @@ #include errno.h #include poll.h +#include stdint.h + #include rump/rumpuser_component.h +#include rump/rumpdefs.h #include rumpcomp_user.h #define seterror(_v_) if ((_v_) == -1) rv = errno; else rv = 0; +#ifndef __arraycount +#define __arraycount(a) (sizeof(a) / sizeof(*a)) +#endif + +#ifndef __UNCONST +#define __UNCONST(a) ((void*)(const void*)a) +#endif + +#include netinet/in.h +#include netinet/tcp.h +#include netinet/udp.h + +#include stdlib.h +#include string.h + + +static int translate_so_sockopt(int); +static int translate_ip_sockopt(int); +static int translate_tcp_sockopt(int); +static int translate_domain(int); + +#define translate(_a_) case RUMP_##_a_: return _a_ +static int +translate_so_sockopt(int lopt) +{ + + switch (lopt) { + translate(SO_DEBUG); +#ifndef SO_REUSEPORT + case RUMP_SO_REUSEPORT: return SO_REUSEADDR; +#else + translate(SO_REUSEPORT); +#endif + translate(SO_TYPE); + translate(SO_ERROR); + translate(SO_DONTROUTE); + translate(SO_BROADCAST); + translate(SO_SNDBUF); + translate(SO_RCVBUF); + translate(SO_KEEPALIVE); + translate(SO_OOBINLINE); + translate(SO_LINGER); + default: return -1; + } +} + +static int +translate_ip_sockopt(int lopt) +{ + + switch (lopt) { + translate(IP_TOS); + translate(IP_TTL); + translate(IP_HDRINCL); + translate(IP_MULTICAST_TTL); + translate(IP_MULTICAST_LOOP); + translate(IP_MULTICAST_IF); + translate(IP_ADD_MEMBERSHIP); + translate(IP_DROP_MEMBERSHIP); + default: return -1; + } +} + +static int +translate_tcp_sockopt(int lopt) +{ + + switch (lopt) { + translate(TCP_NODELAY); + translate(TCP_MAXSEG); + default: return -1; + } +} + +static int +translate_domain(int domain) +{ + + switch (domain) { + translate(AF_UNIX); + translate(AF_INET); + translate(AF_SNA); + translate(AF_DECnet); + translate(AF_APPLETALK); + translate(AF_IPX); + translate(AF_INET6); + translate(AF_ISDN); + translate(AF_BLUETOOTH); + translate(AF_ROUTE); + default: return AF_UNSPEC; + } +} + +#undef translate +#define translate_back(_a_) case _a_: return RUMP_##_a_ +static int translate_domain_back(int); +static int +translate_domain_back(int domain) +{ + + switch (domain) { + translate_back(AF_UNIX); + translate_back(AF_INET); + translate_back(AF_SNA); + translate_back(AF_DECnet); + translate_back(AF_APPLETALK); + translate_back(AF_IPX); + translate_back(AF_INET6); + translate_back(AF_ISDN); + translate_back(AF_BLUETOOTH); + translate_back(AF_ROUTE); + default: return RUMP_AF_UNSPEC; + } +} + +#undef translate_back + +static void +translate_sockopt(int *levelp, int *namep) +{ + int level, name; + + level = *levelp; + name = *namep; + + switch (level) { + case RUMP_SOL_SOCKET: + level = SOL_SOCKET; + name = translate_so_sockopt(name); + break; + case RUMP_IPPROTO_IP: +#ifdef SOL_IP + level = SOL_IP; +#else + level = IPPROTO_IP; +#endif + name = translate_ip_sockopt(name); + break; + case RUMP_IPPROTO_TCP: +#ifdef SOL_TCP + level = SOL_TCP; +#else + level = IPPROTO_TCP; +#endif + name = translate_tcp_sockopt(name); + break; + case RUMP_IPPROTO_UDP: +#ifdef SOL_UDP + level = SOL_UDP; +#else + level = IPPROTO_UDP; +#endif + name = -1; + break; + default: + level = -1; + } + *levelp = level; + *namep = name; +} + +#ifndef __NetBSD__ +static const struct { + int bfl; + int lfl; +} bsd_to_native_msg_flags_[] = { + {RUMP_MSG_OOB, MSG_OOB}, + {RUMP_MSG_PEEK, MSG_PEEK}, + {RUMP_MSG_DONTROUTE, MSG_DONTROUTE}, + {RUMP_MSG_EOR, MSG_EOR}, + {RUMP_MSG_TRUNC, MSG_TRUNC}, + {RUMP_MSG_CTRUNC, MSG_CTRUNC}, + {RUMP_MSG_WAITALL, MSG_WAITALL}, + {RUMP_MSG_DONTWAIT, MSG_DONTWAIT}, + {RUMP_MSG_NOSIGNAL, MSG_NOSIGNAL}, +}; + +static int native_to_bsd_msg_flags(int); + +static int +native_to_bsd_msg_flags(int lflag) +{ + unsigned int i; + int bfl, lfl; + int bflag = 0; + + if (lflag == 0) + return (0); + + for(i = 0; i __arraycount(bsd_to_native_msg_flags_); i++) { + bfl = bsd_to_native_msg_flags_[i].bfl; + lfl =
CVS commit: src/sys/rump/net/lib/libsockin
Module Name:src Committed By: stacktic Date: Sat Jun 1 10:10:57 UTC 2013 Modified Files: src/sys/rump/net/lib/libsockin: component.c sockin.c Log Message: Add IPv6 support To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/rump/net/lib/libsockin/component.c cvs rdiff -u -r1.30 -r1.31 src/sys/rump/net/lib/libsockin/sockin.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/net/lib/libsockin/component.c diff -u src/sys/rump/net/lib/libsockin/component.c:1.2 src/sys/rump/net/lib/libsockin/component.c:1.3 --- src/sys/rump/net/lib/libsockin/component.c:1.2 Mon Mar 1 13:12:21 2010 +++ src/sys/rump/net/lib/libsockin/component.c Sat Jun 1 10:10:57 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: component.c,v 1.2 2010/03/01 13:12:21 pooka Exp $ */ +/* $NetBSD: component.c,v 1.3 2013/06/01 10:10:57 stacktic Exp $ */ /* * Copyright (c) 2009 Antti Kantee. All Rights Reserved. @@ -28,7 +28,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: component.c,v 1.2 2010/03/01 13:12:21 pooka Exp $); +__KERNEL_RCSID(0, $NetBSD: component.c,v 1.3 2013/06/01 10:10:57 stacktic Exp $); #include sys/param.h #include sys/domain.h @@ -40,6 +40,8 @@ __KERNEL_RCSID(0, $NetBSD: component.c, RUMP_COMPONENT(RUMP_COMPONENT_NET) { extern struct domain sockindomain; + extern struct domain sockin6domain; DOMAINADD(sockindomain); + DOMAINADD(sockin6domain); } Index: src/sys/rump/net/lib/libsockin/sockin.c diff -u src/sys/rump/net/lib/libsockin/sockin.c:1.30 src/sys/rump/net/lib/libsockin/sockin.c:1.31 --- src/sys/rump/net/lib/libsockin/sockin.c:1.30 Tue Apr 30 00:12:35 2013 +++ src/sys/rump/net/lib/libsockin/sockin.c Sat Jun 1 10:10:57 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: sockin.c,v 1.30 2013/04/30 00:12:35 pooka Exp $ */ +/* $NetBSD: sockin.c,v 1.31 2013/06/01 10:10:57 stacktic Exp $ */ /* * Copyright (c) 2008, 2009 Antti Kantee. All Rights Reserved. @@ -26,7 +26,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: sockin.c,v 1.30 2013/04/30 00:12:35 pooka Exp $); +__KERNEL_RCSID(0, $NetBSD: sockin.c,v 1.31 2013/06/01 10:10:57 stacktic Exp $); #include sys/param.h #include sys/condvar.h @@ -62,6 +62,8 @@ __KERNEL_RCSID(0, $NetBSD: sockin.c,v 1 */ DOMAIN_DEFINE(sockindomain); +DOMAIN_DEFINE(sockin6domain); + static void sockin_init(void); static int sockin_usrreq(struct socket *, int, struct mbuf *, @@ -85,6 +87,23 @@ const struct protosw sockinsw[] = { .pr_usrreq = sockin_usrreq, .pr_ctloutput = sockin_ctloutput, }}; +const struct protosw sockin6sw[] = { +{ + .pr_type = SOCK_DGRAM, + .pr_domain = sockin6domain, + .pr_protocol = IPPROTO_UDP, + .pr_flags = PR_ATOMIC|PR_ADDR, + .pr_usrreq = sockin_usrreq, + .pr_ctloutput = sockin_ctloutput, +}, +{ + .pr_type = SOCK_STREAM, + .pr_domain = sockin6domain, + .pr_protocol = IPPROTO_TCP, + .pr_flags = PR_CONNREQUIRED|PR_WANTRCVD|PR_LISTEN|PR_ABRTACPTDIS, + .pr_usrreq = sockin_usrreq, + .pr_ctloutput = sockin_ctloutput, +}}; struct domain sockindomain = { .dom_family = PF_INET, @@ -105,6 +124,25 @@ struct domain sockindomain = { .dom_rtcache = { NULL }, .dom_sockaddr_cmp = NULL }; +struct domain sockin6domain = { + .dom_family = PF_INET6, + .dom_name = socket_inet6, + .dom_init = sockin_init, + .dom_externalize = NULL, + .dom_dispose = NULL, + .dom_protosw = sockin6sw, + .dom_protoswNPROTOSW = sockin6sw[__arraycount(sockin6sw)], + .dom_rtattach = rt_inithead, + .dom_rtoffset = 32, + .dom_maxrtkey = sizeof(struct sockaddr_in6), + .dom_ifattach = NULL, + .dom_ifdetach = NULL, + .dom_ifqueues = { NULL }, + .dom_link = { NULL }, + .dom_mowner = MOWNER_INIT(,), + .dom_rtcache = { NULL }, + .dom_sockaddr_cmp = NULL +}; #define SO2S(so) ((intptr_t)(so-so_internal)) #define SOCKIN_SBSIZE 65536 @@ -169,7 +207,7 @@ removesock(struct socket *so) static void sockin_process(struct socket *so) { - struct sockaddr_in from; + struct sockaddr_in6 from; struct iovec io; struct msghdr rmsg; struct mbuf *m; @@ -231,7 +269,7 @@ static void sockin_accept(struct socket *so) { struct socket *nso; - struct sockaddr_in sin; + struct sockaddr_in6 sin; int news, error, slen; slen = sizeof(sin); @@ -331,7 +369,7 @@ sockinworker(void *arg) } KASSERT(rv = 0); } - + } static void @@ -370,8 +408,9 @@ sockin_usrreq(struct socket *so, int req break; } - error = rumpcomp_sockin_socket(PF_INET, so-so_proto-pr_type, - 0, news); + error = rumpcomp_sockin_socket( + so-so_proto-pr_domain-dom_family, + so-so_proto-pr_type, 0, news); if (error) break; @@ -400,12 +439,12 @@ sockin_usrreq(struct socket *so, int req case PRU_BIND: error = rumpcomp_sockin_bind(SO2S(so), mtod(nam, const struct sockaddr *), - sizeof(struct sockaddr_in)); + nam-m_len); break; case PRU_CONNECT: error = rumpcomp_sockin_connect(SO2S(so), - mtod(nam, struct
CVS commit: src/sys/rump/net/lib/libsockin
Module Name:src Committed By: pooka Date: Sat Jun 1 11:44:37 UTC 2013 Modified Files: src/sys/rump/net/lib/libsockin: sockin.c Log Message: Assert that we get PRU_ATTACH requests only for the families we have registered. To generate a diff of this commit: cvs rdiff -u -r1.31 -r1.32 src/sys/rump/net/lib/libsockin/sockin.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/net/lib/libsockin/sockin.c diff -u src/sys/rump/net/lib/libsockin/sockin.c:1.31 src/sys/rump/net/lib/libsockin/sockin.c:1.32 --- src/sys/rump/net/lib/libsockin/sockin.c:1.31 Sat Jun 1 10:10:57 2013 +++ src/sys/rump/net/lib/libsockin/sockin.c Sat Jun 1 11:44:37 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: sockin.c,v 1.31 2013/06/01 10:10:57 stacktic Exp $ */ +/* $NetBSD: sockin.c,v 1.32 2013/06/01 11:44:37 pooka Exp $ */ /* * Copyright (c) 2008, 2009 Antti Kantee. All Rights Reserved. @@ -26,7 +26,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: sockin.c,v 1.31 2013/06/01 10:10:57 stacktic Exp $); +__KERNEL_RCSID(0, $NetBSD: sockin.c,v 1.32 2013/06/01 11:44:37 pooka Exp $); #include sys/param.h #include sys/condvar.h @@ -400,6 +400,7 @@ sockin_usrreq(struct socket *so, int req { int news; int sbsize; + int family; sosetlock(so); if (so-so_snd.sb_hiwat == 0 || so-so_rcv.sb_hiwat == 0) { @@ -408,8 +409,9 @@ sockin_usrreq(struct socket *so, int req break; } - error = rumpcomp_sockin_socket( - so-so_proto-pr_domain-dom_family, + family = so-so_proto-pr_domain-dom_family; + KASSERT(family == PF_INET || family == PF_INET6); + error = rumpcomp_sockin_socket(family, so-so_proto-pr_type, 0, news); if (error) break;
CVS commit: src/sys/rump/net/lib/libsockin
Module Name:src Committed By: pooka Date: Sat Jun 1 11:46:14 UTC 2013 Modified Files: src/sys/rump/net/lib/libsockin: rumpcomp_user.c Log Message: Some minor tweaks to make this compile on Solaris. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/rump/net/lib/libsockin/rumpcomp_user.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/net/lib/libsockin/rumpcomp_user.c diff -u src/sys/rump/net/lib/libsockin/rumpcomp_user.c:1.6 src/sys/rump/net/lib/libsockin/rumpcomp_user.c:1.7 --- src/sys/rump/net/lib/libsockin/rumpcomp_user.c:1.6 Sat Jun 1 10:09:05 2013 +++ src/sys/rump/net/lib/libsockin/rumpcomp_user.c Sat Jun 1 11:46:14 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpcomp_user.c,v 1.6 2013/06/01 10:09:05 stacktic Exp $ */ +/* $NetBSD: rumpcomp_user.c,v 1.7 2013/06/01 11:46:14 pooka Exp $ */ /* * Copyright (c) 2008 Antti Kantee. All Rights Reserved. @@ -25,13 +25,18 @@ * SUCH DAMAGE. */ +/* for struct msghdr content visibility */ +#define _XOPEN_SOURCE 4 +#define _XOPEN_SOURCE_EXTENDED 1 + #ifndef _KERNEL #include sys/types.h #include sys/socket.h #include errno.h #include poll.h - +#include stdlib.h +#include string.h #include stdint.h #include rump/rumpuser_component.h @@ -53,9 +58,6 @@ #include netinet/tcp.h #include netinet/udp.h -#include stdlib.h -#include string.h - static int translate_so_sockopt(int); static int translate_ip_sockopt(int); @@ -120,16 +122,8 @@ translate_domain(int domain) { switch (domain) { - translate(AF_UNIX); translate(AF_INET); - translate(AF_SNA); - translate(AF_DECnet); - translate(AF_APPLETALK); - translate(AF_IPX); translate(AF_INET6); - translate(AF_ISDN); - translate(AF_BLUETOOTH); - translate(AF_ROUTE); default: return AF_UNSPEC; } } @@ -142,16 +136,8 @@ translate_domain_back(int domain) { switch (domain) { - translate_back(AF_UNIX); translate_back(AF_INET); - translate_back(AF_SNA); - translate_back(AF_DECnet); - translate_back(AF_APPLETALK); - translate_back(AF_IPX); translate_back(AF_INET6); - translate_back(AF_ISDN); - translate_back(AF_BLUETOOTH); - translate_back(AF_ROUTE); default: return RUMP_AF_UNSPEC; } } @@ -215,7 +201,11 @@ static const struct { {RUMP_MSG_CTRUNC, MSG_CTRUNC}, {RUMP_MSG_WAITALL, MSG_WAITALL}, {RUMP_MSG_DONTWAIT, MSG_DONTWAIT}, + + /* might be better to always set NOSIGNAL ... */ +#ifdef MSG_NOSIGNAL {RUMP_MSG_NOSIGNAL, MSG_NOSIGNAL}, +#endif }; static int native_to_bsd_msg_flags(int); @@ -264,8 +254,8 @@ bsd_to_native_msg_flags(int bflag) #endif struct rump_sockaddr { - __uint8_t sa_len; /* total length */ - __uint8_t sa_family; /* address family */ + uint8_t sa_len; /* total length */ + uint8_t sa_family; /* address family */ char sa_data[14]; /* actually longer; address value */ };
CVS commit: src/sys/rump/net/lib/libsockin
Module Name:src Committed By: pooka Date: Sat Jun 1 20:22:27 UTC 2013 Modified Files: src/sys/rump/net/lib/libsockin: sockin.c Log Message: check for EOF from backing sucket To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/sys/rump/net/lib/libsockin/sockin.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/net/lib/libsockin/sockin.c diff -u src/sys/rump/net/lib/libsockin/sockin.c:1.32 src/sys/rump/net/lib/libsockin/sockin.c:1.33 --- src/sys/rump/net/lib/libsockin/sockin.c:1.32 Sat Jun 1 11:44:37 2013 +++ src/sys/rump/net/lib/libsockin/sockin.c Sat Jun 1 20:22:27 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: sockin.c,v 1.32 2013/06/01 11:44:37 pooka Exp $ */ +/* $NetBSD: sockin.c,v 1.33 2013/06/01 20:22:27 pooka Exp $ */ /* * Copyright (c) 2008, 2009 Antti Kantee. All Rights Reserved. @@ -26,7 +26,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: sockin.c,v 1.32 2013/06/01 11:44:37 pooka Exp $); +__KERNEL_RCSID(0, $NetBSD: sockin.c,v 1.33 2013/06/01 20:22:27 pooka Exp $); #include sys/param.h #include sys/condvar.h @@ -236,7 +236,7 @@ sockin_process(struct socket *so) rmsg.msg_namelen = sizeof(from); error = rumpcomp_sockin_recvmsg(SO2S(so), rmsg, 0, n); - if (error) { + if (error || n == 0) { m_freem(m); /* Treat a TCP socket a goner */
CVS commit: src/sys/rump/net/lib/libsockin
Module Name:src Committed By: pooka Date: Tue Apr 30 00:12:36 UTC 2013 Modified Files: src/sys/rump/net/lib/libsockin: sockin.c Log Message: few more conversions To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 src/sys/rump/net/lib/libsockin/sockin.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/net/lib/libsockin/sockin.c diff -u src/sys/rump/net/lib/libsockin/sockin.c:1.29 src/sys/rump/net/lib/libsockin/sockin.c:1.30 --- src/sys/rump/net/lib/libsockin/sockin.c:1.29 Tue Apr 30 00:03:54 2013 +++ src/sys/rump/net/lib/libsockin/sockin.c Tue Apr 30 00:12:35 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: sockin.c,v 1.29 2013/04/30 00:03:54 pooka Exp $ */ +/* $NetBSD: sockin.c,v 1.30 2013/04/30 00:12:35 pooka Exp $ */ /* * Copyright (c) 2008, 2009 Antti Kantee. All Rights Reserved. @@ -26,7 +26,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: sockin.c,v 1.29 2013/04/30 00:03:54 pooka Exp $); +__KERNEL_RCSID(0, $NetBSD: sockin.c,v 1.30 2013/04/30 00:12:35 pooka Exp $); #include sys/param.h #include sys/condvar.h @@ -173,8 +173,7 @@ sockin_process(struct socket *so) struct iovec io; struct msghdr rmsg; struct mbuf *m; - ssize_t n; - size_t plen; + size_t n, plen; int error; m = m_gethdr(M_WAIT, MT_DATA); @@ -198,8 +197,8 @@ sockin_process(struct socket *so) rmsg.msg_name = (struct sockaddr *)from; rmsg.msg_namelen = sizeof(from); - n = rumpcomp_sockin_recvmsg(SO2S(so), rmsg, 0, error); - if (n = 0) { + error = rumpcomp_sockin_recvmsg(SO2S(so), rmsg, 0, n); + if (error) { m_freem(m); /* Treat a TCP socket a goner */ @@ -371,9 +370,9 @@ sockin_usrreq(struct socket *so, int req break; } - news = rumpcomp_sockin_socket(PF_INET, so-so_proto-pr_type, - 0, error); - if (news == -1) + error = rumpcomp_sockin_socket(PF_INET, so-so_proto-pr_type, + 0, news); + if (error) break; /* for UDP sockets, make sure we can sendrecv max */ @@ -422,7 +421,7 @@ sockin_usrreq(struct socket *so, int req size_t iov_max, i; struct iovec iov_buf[32], *iov; struct mbuf *m2; - size_t tot; + size_t tot, n; int s; bpf_mtap_af(sockin_if, AF_UNSPEC, m); @@ -457,7 +456,7 @@ sockin_usrreq(struct socket *so, int req mhdr.msg_namelen = saddr-sa_len; } - rumpcomp_sockin_sendmsg(s, mhdr, 0, error); + rumpcomp_sockin_sendmsg(s, mhdr, 0, n); if (iov != iov_buf) kmem_free(iov, sizeof(struct iovec) * iov_max);
CVS commit: src/sys/rump/net/lib/libsockin
Module Name:src Committed By: christos Date: Tue Mar 19 02:07:44 UTC 2013 Modified Files: src/sys/rump/net/lib/libsockin: rumpcomp_user.c Log Message: can we please stop breaking the build? These get compiled by the kernel environment when there are no userland header files! To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/rump/net/lib/libsockin/rumpcomp_user.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/net/lib/libsockin/rumpcomp_user.c diff -u src/sys/rump/net/lib/libsockin/rumpcomp_user.c:1.1 src/sys/rump/net/lib/libsockin/rumpcomp_user.c:1.2 --- src/sys/rump/net/lib/libsockin/rumpcomp_user.c:1.1 Mon Mar 18 09:14:11 2013 +++ src/sys/rump/net/lib/libsockin/rumpcomp_user.c Mon Mar 18 22:07:43 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpcomp_user.c,v 1.1 2013/03/18 13:14:11 pooka Exp $ */ +/* $NetBSD: rumpcomp_user.c,v 1.2 2013/03/19 02:07:43 christos Exp $ */ /* * Copyright (c) 2008 Antti Kantee. All Rights Reserved. @@ -25,6 +25,7 @@ * SUCH DAMAGE. */ +#ifndef _KERNEL #include sys/types.h #include sys/socket.h @@ -164,3 +165,4 @@ rumpcomp_sockin_setsockopt(int s, int le seterror(); return rv; } +#endif
CVS commit: src/sys/rump/net/lib/libsockin
Module Name:src Committed By: pooka Date: Sun Dec 5 15:54:50 UTC 2010 Modified Files: src/sys/rump/net/lib/libsockin: sockin.c Log Message: use in_control() for PRU_CONTROL To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/sys/rump/net/lib/libsockin/sockin.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/net/lib/libsockin/sockin.c diff -u src/sys/rump/net/lib/libsockin/sockin.c:1.22 src/sys/rump/net/lib/libsockin/sockin.c:1.23 --- src/sys/rump/net/lib/libsockin/sockin.c:1.22 Mon Apr 5 07:22:50 2010 +++ src/sys/rump/net/lib/libsockin/sockin.c Sun Dec 5 15:54:50 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: sockin.c,v 1.22 2010/04/05 07:22:50 joerg Exp $ */ +/* $NetBSD: sockin.c,v 1.23 2010/12/05 15:54:50 pooka Exp $ */ /* * Copyright (c) 2008, 2009 Antti Kantee. All Rights Reserved. @@ -26,7 +26,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: sockin.c,v 1.22 2010/04/05 07:22:50 joerg Exp $); +__KERNEL_RCSID(0, $NetBSD: sockin.c,v 1.23 2010/12/05 15:54:50 pooka Exp $); #include sys/param.h #include sys/condvar.h @@ -49,6 +49,7 @@ #include netinet/in.h #include netinet/in_systm.h #include netinet/ip.h +#include netinet/in_var.h #include rump/rumpuser.h @@ -490,6 +491,10 @@ break; } + case PRU_CONTROL: + return in_control(so, (long)m, (void *)nam, + (struct ifnet *)control, l); + default: panic(sockin_usrreq: IMPLEMENT ME, req %d not supported, req); }
CVS commit: src/sys/rump/net/lib/libsockin
Module Name:src Committed By: pooka Date: Sun Dec 5 17:59:12 UTC 2010 Modified Files: src/sys/rump/net/lib/libsockin: sockin.c Log Message: Revert previous: it introduces a dependency between sockin and the netinet rump components and will have to be done another way. To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/sys/rump/net/lib/libsockin/sockin.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/net/lib/libsockin/sockin.c diff -u src/sys/rump/net/lib/libsockin/sockin.c:1.23 src/sys/rump/net/lib/libsockin/sockin.c:1.24 --- src/sys/rump/net/lib/libsockin/sockin.c:1.23 Sun Dec 5 15:54:50 2010 +++ src/sys/rump/net/lib/libsockin/sockin.c Sun Dec 5 17:59:12 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: sockin.c,v 1.23 2010/12/05 15:54:50 pooka Exp $ */ +/* $NetBSD: sockin.c,v 1.24 2010/12/05 17:59:12 pooka Exp $ */ /* * Copyright (c) 2008, 2009 Antti Kantee. All Rights Reserved. @@ -26,7 +26,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: sockin.c,v 1.23 2010/12/05 15:54:50 pooka Exp $); +__KERNEL_RCSID(0, $NetBSD: sockin.c,v 1.24 2010/12/05 17:59:12 pooka Exp $); #include sys/param.h #include sys/condvar.h @@ -49,7 +49,6 @@ #include netinet/in.h #include netinet/in_systm.h #include netinet/ip.h -#include netinet/in_var.h #include rump/rumpuser.h @@ -491,10 +490,6 @@ break; } - case PRU_CONTROL: - return in_control(so, (long)m, (void *)nam, - (struct ifnet *)control, l); - default: panic(sockin_usrreq: IMPLEMENT ME, req %d not supported, req); }
CVS commit: src/sys/rump/net/lib/libsockin
Module Name:src Committed By: pooka Date: Sun Dec 5 18:01:46 UTC 2010 Modified Files: src/sys/rump/net/lib/libsockin: sockin.c Log Message: claim ENOTTY for PRU_CONTROL for now To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/sys/rump/net/lib/libsockin/sockin.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/net/lib/libsockin/sockin.c diff -u src/sys/rump/net/lib/libsockin/sockin.c:1.24 src/sys/rump/net/lib/libsockin/sockin.c:1.25 --- src/sys/rump/net/lib/libsockin/sockin.c:1.24 Sun Dec 5 17:59:12 2010 +++ src/sys/rump/net/lib/libsockin/sockin.c Sun Dec 5 18:01:46 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: sockin.c,v 1.24 2010/12/05 17:59:12 pooka Exp $ */ +/* $NetBSD: sockin.c,v 1.25 2010/12/05 18:01:46 pooka Exp $ */ /* * Copyright (c) 2008, 2009 Antti Kantee. All Rights Reserved. @@ -26,7 +26,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: sockin.c,v 1.24 2010/12/05 17:59:12 pooka Exp $); +__KERNEL_RCSID(0, $NetBSD: sockin.c,v 1.25 2010/12/05 18:01:46 pooka Exp $); #include sys/param.h #include sys/condvar.h @@ -490,6 +490,10 @@ break; } + case PRU_CONTROL: + error = ENOTTY; + break; + default: panic(sockin_usrreq: IMPLEMENT ME, req %d not supported, req); }
CVS commit: src/sys/rump/net/lib/libsockin
Module Name:src Committed By: pooka Date: Tue Jan 26 17:41:20 UTC 2010 Modified Files: src/sys/rump/net/lib/libsockin: sockin.c Log Message: support bpf To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/sys/rump/net/lib/libsockin/sockin.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/net/lib/libsockin/sockin.c diff -u src/sys/rump/net/lib/libsockin/sockin.c:1.20 src/sys/rump/net/lib/libsockin/sockin.c:1.21 --- src/sys/rump/net/lib/libsockin/sockin.c:1.20 Tue Oct 20 12:17:44 2009 +++ src/sys/rump/net/lib/libsockin/sockin.c Tue Jan 26 17:41:20 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: sockin.c,v 1.20 2009/10/20 12:17:44 tron Exp $ */ +/* $NetBSD: sockin.c,v 1.21 2010/01/26 17:41:20 pooka Exp $ */ /* * Copyright (c) 2008, 2009 Antti Kantee. All Rights Reserved. @@ -26,7 +26,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: sockin.c,v 1.20 2009/10/20 12:17:44 tron Exp $); +__KERNEL_RCSID(0, $NetBSD: sockin.c,v 1.21 2010/01/26 17:41:20 pooka Exp $); #include sys/param.h #include sys/condvar.h @@ -42,6 +42,8 @@ #include sys/socketvar.h #include sys/time.h +#include net/bpf.h +#include net/if.h #include net/radix.h #include netinet/in.h @@ -116,6 +118,10 @@ static bool rebuild; static int nsock; +/* XXX: for the bpf hack */ +static struct ifnet sockin_if; +int ifpromisc(struct ifnet *ifp, int pswitch) { return 0; } + static int registersock(struct socket *so, int news) { @@ -207,6 +213,9 @@ } m-m_len = m-m_pkthdr.len = n; + if (sockin_if.if_bpf) + bpf_ops-bpf_mtap_af(sockin_if.if_bpf, AF_UNSPEC, m); + mutex_enter(softnet_lock); if (so-so_proto-pr_type == SOCK_DGRAM) { if (!sbappendaddr(so-so_rcv, rmsg.msg_name, m, NULL)) { @@ -340,6 +349,8 @@ printf(sockin_init: no threads = no worker thread\n); } mutex_init(su_mtx, MUTEX_DEFAULT, IPL_NONE); + strlcpy(sockin_if.if_xname, sockin0, sizeof(sockin_if.if_xname)); + bpf_ops-bpf_attach(sockin_if, DLT_NULL, 0, sockin_if.if_bpf); } static int @@ -413,6 +424,9 @@ size_t tot; int s; + if (sockin_if.if_bpf) + bpf_ops-bpf_mtap_af(sockin_if.if_bpf, AF_UNSPEC, m); + memset(mhdr, 0, sizeof(mhdr)); iov_max = 0;
CVS commit: src/sys/rump/net/lib/libsockin
Module Name:src Committed By: tron Date: Tue Oct 20 12:17:44 UTC 2009 Modified Files: src/sys/rump/net/lib/libsockin: sockin.c Log Message: Only allocate a struct iovec array from the healp if a reasonably sized stack array isn't large enough. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sys/rump/net/lib/libsockin/sockin.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/net/lib/libsockin/sockin.c diff -u src/sys/rump/net/lib/libsockin/sockin.c:1.19 src/sys/rump/net/lib/libsockin/sockin.c:1.20 --- src/sys/rump/net/lib/libsockin/sockin.c:1.19 Sun Oct 18 22:55:56 2009 +++ src/sys/rump/net/lib/libsockin/sockin.c Tue Oct 20 12:17:44 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: sockin.c,v 1.19 2009/10/18 22:55:56 tron Exp $ */ +/* $NetBSD: sockin.c,v 1.20 2009/10/20 12:17:44 tron Exp $ */ /* * Copyright (c) 2008, 2009 Antti Kantee. All Rights Reserved. @@ -26,7 +26,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: sockin.c,v 1.19 2009/10/18 22:55:56 tron Exp $); +__KERNEL_RCSID(0, $NetBSD: sockin.c,v 1.20 2009/10/20 12:17:44 tron Exp $); #include sys/param.h #include sys/condvar.h @@ -408,7 +408,7 @@ struct sockaddr *saddr; struct msghdr mhdr; size_t iov_max, i; - struct iovec *iov; + struct iovec iov_buf[32], *iov; struct mbuf *m2; size_t tot; int s; @@ -419,10 +419,13 @@ for (m2 = m; m2 != NULL; m2 = m2-m_next) { iov_max++; } - if (iov_max == 0) - iov_max = 1; - iov = kmem_alloc(sizeof(struct iovec) * iov_max, KM_SLEEP); + if (iov_max = __arraycount(iov_buf)) { + iov = iov_buf; + } else { + iov = kmem_alloc(sizeof(struct iovec) * iov_max, + KM_SLEEP); + } tot = 0; for (i = 0, m2 = m; m2 != NULL; m2 = m2-m_next, i++) { @@ -442,7 +445,8 @@ rumpuser_net_sendmsg(s, mhdr, 0, error); - kmem_free(iov, sizeof(struct iovec) * iov_max); + if (iov != iov_buf) + kmem_free(iov, sizeof(struct iovec) * iov_max); m_freem(m); m_freem(control);
CVS commit: src/sys/rump/net/lib/libsockin
Module Name:src Committed By: tron Date: Sun Oct 18 22:55:56 UTC 2009 Modified Files: src/sys/rump/net/lib/libsockin: sockin.c Log Message: Avoid panic if a file system tries to write a chain of more than 32 mbuf-s to a socket. This happens e.g. when copying large files to SMBFS. Code reviewed by Antti Kantee. To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/sys/rump/net/lib/libsockin/sockin.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/net/lib/libsockin/sockin.c diff -u src/sys/rump/net/lib/libsockin/sockin.c:1.18 src/sys/rump/net/lib/libsockin/sockin.c:1.19 --- src/sys/rump/net/lib/libsockin/sockin.c:1.18 Sat Oct 17 20:35:52 2009 +++ src/sys/rump/net/lib/libsockin/sockin.c Sun Oct 18 22:55:56 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: sockin.c,v 1.18 2009/10/17 20:35:52 pooka Exp $ */ +/* $NetBSD: sockin.c,v 1.19 2009/10/18 22:55:56 tron Exp $ */ /* * Copyright (c) 2008, 2009 Antti Kantee. All Rights Reserved. @@ -26,7 +26,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: sockin.c,v 1.18 2009/10/17 20:35:52 pooka Exp $); +__KERNEL_RCSID(0, $NetBSD: sockin.c,v 1.19 2009/10/18 22:55:56 tron Exp $); #include sys/param.h #include sys/condvar.h @@ -407,17 +407,25 @@ { struct sockaddr *saddr; struct msghdr mhdr; - struct iovec iov[32]; + size_t iov_max, i; + struct iovec *iov; struct mbuf *m2; size_t tot; - int i, s; + int s; memset(mhdr, 0, sizeof(mhdr)); + iov_max = 0; + for (m2 = m; m2 != NULL; m2 = m2-m_next) { + iov_max++; + } + if (iov_max == 0) + iov_max = 1; + + iov = kmem_alloc(sizeof(struct iovec) * iov_max, KM_SLEEP); + tot = 0; - for (i = 0, m2 = m; m2; m2 = m2-m_next, i++) { - if (i = 32) -panic(lazy bum); + for (i = 0, m2 = m; m2 != NULL; m2 = m2-m_next, i++) { iov[i].iov_base = m2-m_data; iov[i].iov_len = m2-m_len; tot += m2-m_len; @@ -426,7 +434,7 @@ mhdr.msg_iovlen = i; s = SO2S(so); - if (nam) { + if (nam != NULL) { saddr = mtod(nam, struct sockaddr *); mhdr.msg_name = saddr; mhdr.msg_namelen = saddr-sa_len; @@ -434,6 +442,8 @@ rumpuser_net_sendmsg(s, mhdr, 0, error); + kmem_free(iov, sizeof(struct iovec) * iov_max); + m_freem(m); m_freem(control);
CVS commit: src/sys/rump/net/lib/libsockin
Module Name:src Committed By: pooka Date: Sat Oct 17 20:35:52 UTC 2009 Modified Files: src/sys/rump/net/lib/libsockin: sockin.c Log Message: fix off-by-one in sanity check and bump lazy bum magic value To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/rump/net/lib/libsockin/sockin.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/net/lib/libsockin/sockin.c diff -u src/sys/rump/net/lib/libsockin/sockin.c:1.17 src/sys/rump/net/lib/libsockin/sockin.c:1.18 --- src/sys/rump/net/lib/libsockin/sockin.c:1.17 Fri Oct 16 23:17:46 2009 +++ src/sys/rump/net/lib/libsockin/sockin.c Sat Oct 17 20:35:52 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: sockin.c,v 1.17 2009/10/16 23:17:46 pooka Exp $ */ +/* $NetBSD: sockin.c,v 1.18 2009/10/17 20:35:52 pooka Exp $ */ /* * Copyright (c) 2008, 2009 Antti Kantee. All Rights Reserved. @@ -26,7 +26,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: sockin.c,v 1.17 2009/10/16 23:17:46 pooka Exp $); +__KERNEL_RCSID(0, $NetBSD: sockin.c,v 1.18 2009/10/17 20:35:52 pooka Exp $); #include sys/param.h #include sys/condvar.h @@ -407,7 +407,7 @@ { struct sockaddr *saddr; struct msghdr mhdr; - struct iovec iov[16]; + struct iovec iov[32]; struct mbuf *m2; size_t tot; int i, s; @@ -416,7 +416,7 @@ tot = 0; for (i = 0, m2 = m; m2; m2 = m2-m_next, i++) { - if (i 16) + if (i = 32) panic(lazy bum); iov[i].iov_base = m2-m_data; iov[i].iov_len = m2-m_len;
CVS commit: src/sys/rump/net/lib/libsockin
Module Name:src Committed By: pooka Date: Fri Oct 16 23:17:46 UTC 2009 Modified Files: src/sys/rump/net/lib/libsockin: sockin.c Log Message: for udp sockets crank snd/rcvbufsize to 64k To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/sys/rump/net/lib/libsockin/sockin.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/net/lib/libsockin/sockin.c diff -u src/sys/rump/net/lib/libsockin/sockin.c:1.16 src/sys/rump/net/lib/libsockin/sockin.c:1.17 --- src/sys/rump/net/lib/libsockin/sockin.c:1.16 Wed Sep 2 19:04:51 2009 +++ src/sys/rump/net/lib/libsockin/sockin.c Fri Oct 16 23:17:46 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: sockin.c,v 1.16 2009/09/02 19:04:51 pooka Exp $ */ +/* $NetBSD: sockin.c,v 1.17 2009/10/16 23:17:46 pooka Exp $ */ /* * Copyright (c) 2008, 2009 Antti Kantee. All Rights Reserved. @@ -26,7 +26,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: sockin.c,v 1.16 2009/09/02 19:04:51 pooka Exp $); +__KERNEL_RCSID(0, $NetBSD: sockin.c,v 1.17 2009/10/16 23:17:46 pooka Exp $); #include sys/param.h #include sys/condvar.h @@ -352,6 +352,7 @@ case PRU_ATTACH: { int news, dummy; + int sbsize; sosetlock(so); if (so-so_snd.sb_hiwat == 0 || so-so_rcv.sb_hiwat == 0) { @@ -365,6 +366,16 @@ if (news == -1) break; + /* for UDP sockets, make sure we can sendrecv max */ + if (so-so_proto-pr_type == SOCK_DGRAM) { + sbsize = SOCKIN_SBSIZE; + rumpuser_net_setsockopt(news, SOL_SOCKET, SO_SNDBUF, + sbsize, sizeof(sbsize), error); + sbsize = SOCKIN_SBSIZE; + rumpuser_net_setsockopt(news, SOL_SOCKET, SO_RCVBUF, + sbsize, sizeof(sbsize), error); + } + if ((error = registersock(so, news)) != 0) rumpuser_close(news, dummy); @@ -410,7 +421,6 @@ iov[i].iov_base = m2-m_data; iov[i].iov_len = m2-m_len; tot += m2-m_len; - } mhdr.msg_iov = iov; mhdr.msg_iovlen = i;
CVS commit: src/sys/rump/net/lib/libsockin
Module Name:src Committed By: pooka Date: Wed Sep 2 19:04:52 UTC 2009 Modified Files: src/sys/rump/net/lib/libsockin: sockin.c Log Message: * implement pr_ctloutput * check for errno before more costly checks To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/rump/net/lib/libsockin/sockin.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/net/lib/libsockin/sockin.c diff -u src/sys/rump/net/lib/libsockin/sockin.c:1.15 src/sys/rump/net/lib/libsockin/sockin.c:1.16 --- src/sys/rump/net/lib/libsockin/sockin.c:1.15 Wed Mar 18 10:22:45 2009 +++ src/sys/rump/net/lib/libsockin/sockin.c Wed Sep 2 19:04:51 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: sockin.c,v 1.15 2009/03/18 10:22:45 cegger Exp $ */ +/* $NetBSD: sockin.c,v 1.16 2009/09/02 19:04:51 pooka Exp $ */ /* * Copyright (c) 2008, 2009 Antti Kantee. All Rights Reserved. @@ -26,7 +26,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: sockin.c,v 1.15 2009/03/18 10:22:45 cegger Exp $); +__KERNEL_RCSID(0, $NetBSD: sockin.c,v 1.16 2009/09/02 19:04:51 pooka Exp $); #include sys/param.h #include sys/condvar.h @@ -197,7 +197,7 @@ m_freem(m); /* Treat a TCP socket a goner */ - if (so-so_proto-pr_type == SOCK_STREAM error != EAGAIN) { + if (error != EAGAIN so-so_proto-pr_type == SOCK_STREAM) { mutex_enter(softnet_lock); soisdisconnected(so); mutex_exit(softnet_lock); @@ -464,7 +464,9 @@ static int sockin_ctloutput(int op, struct socket *so, struct sockopt *sopt) { + int error; - /* XXX: we should also do something here */ - return 0; + rumpuser_net_setsockopt(SO2S(so), sopt-sopt_level, + sopt-sopt_name, sopt-sopt_data, sopt-sopt_size, error); + return error; }