From owner-p4-projects@FreeBSD.ORG Mon Aug 24 11:08:17 2009 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id EE34B1065690; Mon, 24 Aug 2009 11:08:16 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 99B5210656A4 for ; Mon, 24 Aug 2009 11:08:16 +0000 (UTC) (envelope-from zec@fer.hr) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 8818A8FC08 for ; Mon, 24 Aug 2009 11:08:16 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id n7OB8Gom046148 for ; Mon, 24 Aug 2009 11:08:16 GMT (envelope-from zec@fer.hr) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id n7OB8GsM046146 for perforce@freebsd.org; Mon, 24 Aug 2009 11:08:16 GMT (envelope-from zec@fer.hr) Date: Mon, 24 Aug 2009 11:08:16 GMT Message-Id: <200908241108.n7OB8GsM046146@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to zec@fer.hr using -f From: Marko Zec To: Perforce Change Reviews Cc: Subject: PERFORCE change 167720 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2009 11:08:17 -0000 http://perforce.freebsd.org/chv.cgi?CH=167720 Change 167720 by zec@zec_tpx32 on 2009/08/24 11:08:13 Garbage collect old / dead code. Affected files ... .. //depot/projects/vimage/src/sys/cddl/compat/opensolaris/rpc/xdr.h#3 edit .. //depot/projects/vimage/src/sys/kern/uipc_accf.c#5 edit .. //depot/projects/vimage/src/sys/kern/vfs_export.c#23 edit .. //depot/projects/vimage/src/sys/kern/vfs_lookup.c#27 edit .. //depot/projects/vimage/src/sys/modules/if_epair/Makefile#4 edit .. //depot/projects/vimage/src/sys/modules/netgraph/pipe/Makefile#4 edit .. //depot/projects/vimage/src/sys/netinet/accf_http.c#12 edit .. //depot/projects/vimage/src/sys/netinet/in_mcast.c#32 edit .. //depot/projects/vimage/src/sys/netinet/ip_divert.c#38 edit .. //depot/projects/vimage/src/sys/netinet/ip_fw.h#38 edit .. //depot/projects/vimage/src/sys/netinet/ipfw/ip_fw2.c#9 edit .. //depot/projects/vimage/src/sys/netinet/ipfw/ip_fw_nat.c#6 edit .. //depot/projects/vimage/src/sys/netinet6/sctp6_usrreq.c#30 edit .. //depot/projects/vimage/src/sys/nfsclient/nfs_vfsops.c#32 edit .. //depot/projects/vimage/src/sys/rpc/rpc_generic.c#5 edit .. //depot/projects/vimage/src/sys/rpc/svc_dg.c#7 edit .. //depot/projects/vimage/src/sys/rpc/svc_generic.c#6 edit .. //depot/projects/vimage/src/sys/sys/socketvar.h#17 edit Differences ... ==== //depot/projects/vimage/src/sys/cddl/compat/opensolaris/rpc/xdr.h#3 (text+ko) ==== @@ -1,112 +1,70 @@ /* - * CDDL HEADER START + * Sun RPC is a product of Sun Microsystems, Inc. and is provided for + * unrestricted use provided that this legend is included on all tape + * media and as a part of the software program in whole or part. Users + * may copy or modify Sun RPC without charge, but are not authorized + * to license or distribute it to anyone else except as part of a product or + * program developed by the user. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE + * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. + * Sun RPC is provided with no support and without any obligation on the + * part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC + * OR ANY PART THEREOF. * - * CDDL HEADER END + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. * - * $FreeBSD: src/sys/cddl/compat/opensolaris/rpc/xdr.h,v 1.4 2008/04/22 07:42:59 jb Exp $ + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 */ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ -/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ -/* All Rights Reserved */ - -/* - * Portions of this source code were derived from Berkeley 4.3 BSD - * under license from the Regents of the University of California. - */ - #ifndef _OPENSOLARIS_RPC_XDR_H_ #define _OPENSOLARIS_RPC_XDR_H_ #include_next #ifndef _KERNEL -#include_next -/* - * Strangely, my glibc version (2.3.6) doesn't have xdr_control(), so - * we have to hack it in here (source taken from OpenSolaris). - * By the way, it is assumed the xdrmem implementation is used. - */ - -#undef xdr_control -#define xdr_control(a,b,c) xdrmem_control(a,b,c) +#include /* - * These are the request arguments to XDR_CONTROL. + * Taken from sys/xdr/xdr_mem.c. * - * XDR_PEEK - returns the contents of the next XDR unit on the XDR stream. - * XDR_SKIPBYTES - skips the next N bytes in the XDR stream. - * XDR_RDMAGET - for xdr implementation over RDMA, gets private flags from - * the XDR stream being moved over RDMA - * XDR_RDMANOCHUNK - for xdr implementaion over RDMA, sets private flags in - * the XDR stream moving over RDMA. + * FreeBSD's userland XDR doesn't implement control method (only the kernel), + * but OpenSolaris nvpair still depend on it, so we have to implement it here. */ -#define XDR_PEEK 2 -#define XDR_SKIPBYTES 3 -#define XDR_RDMAGET 4 -#define XDR_RDMASET 5 - -/* FIXME: probably doesn't work */ static __inline bool_t xdrmem_control(XDR *xdrs, int request, void *info) { xdr_bytesrec *xptr; - int32_t *int32p; - int len; switch (request) { - case XDR_GET_BYTES_AVAIL: xptr = (xdr_bytesrec *)info; xptr->xc_is_last_record = TRUE; xptr->xc_num_avail = xdrs->x_handy; return (TRUE); - - case XDR_PEEK: - /* - * Return the next 4 byte unit in the XDR stream. - */ - if (xdrs->x_handy < sizeof (int32_t)) - return (FALSE); - int32p = (int32_t *)info; - *int32p = (int32_t)ntohl((uint32_t) - (*((int32_t *)(xdrs->x_private)))); - return (TRUE); - - case XDR_SKIPBYTES: - /* - * Skip the next N bytes in the XDR stream. - */ - int32p = (int32_t *)info; - len = RNDUP((int)(*int32p)); - if ((xdrs->x_handy -= len) < 0) - return (FALSE); - xdrs->x_private += len; - return (TRUE); - + default: + assert(!"unexpected request"); } return (FALSE); } + +#undef XDR_CONTROL +#define XDR_CONTROL(xdrs, req, op) \ + (((xdrs)->x_ops->x_control == NULL) ? \ + xdrmem_control((xdrs), (req), (op)) : \ + (*(xdrs)->x_ops->x_control)(xdrs, req, op)) + #endif /* !_KERNEL */ #endif /* !_OPENSOLARIS_RPC_XDR_H_ */ ==== //depot/projects/vimage/src/sys/kern/uipc_accf.c#5 (text+ko) ==== @@ -58,12 +58,11 @@ MALLOC_DEFINE(M_ACCF, "accf", "accept filter data"); -int accf_unloadable = 0; +static int unloadable = 0; SYSCTL_DECL(_net_inet); /* XXX: some header should do this for me */ SYSCTL_NODE(_net_inet, OID_AUTO, accf, CTLFLAG_RW, 0, "Accept filters"); -SYSCTL_INT(_net_inet_accf, OID_AUTO, unloadable, CTLFLAG_RW, - &accf_unloadable, 0, +SYSCTL_INT(_net_inet_accf, OID_AUTO, unloadable, CTLFLAG_RW, &unloadable, 0, "Allow unload of accept filters (not recommended)"); /* @@ -145,7 +144,7 @@ * having it called is a bad thing. A simple fix would be to * track the refcount in the struct accept_filter. */ - if (accf_unloadable != 0) { + if (unloadable != 0) { error = accept_filt_del(accfp->accf_name); } else error = EOPNOTSUPP; ==== //depot/projects/vimage/src/sys/kern/vfs_export.c#23 (text+ko) ==== @@ -52,7 +52,6 @@ #include #include #include -#include #include ==== //depot/projects/vimage/src/sys/kern/vfs_lookup.c#27 (text+ko) ==== @@ -55,7 +55,6 @@ #include #include #include -#include #ifdef KTRACE #include #endif ==== //depot/projects/vimage/src/sys/modules/if_epair/Makefile#4 (text+ko) ==== @@ -1,4 +1,4 @@ -# $FreeBSD$ +# $FreeBSD: src/sys/modules/if_epair/Makefile,v 1.1 2009/07/26 12:20:07 bz Exp $ .PATH: ${.CURDIR}/../../net ==== //depot/projects/vimage/src/sys/modules/netgraph/pipe/Makefile#4 (text+ko) ==== @@ -1,6 +1,5 @@ # $FreeBSD: src/sys/modules/netgraph/pipe/Makefile,v 1.1 2009/06/23 06:11:04 zec Exp $ - KMOD= ng_pipe SRCS= ng_pipe.c ==== //depot/projects/vimage/src/sys/netinet/accf_http.c#12 (text+ko) ==== @@ -37,7 +37,6 @@ #include #include #include -#include /* check for GET/HEAD */ static int sohashttpget(struct socket *so, void *arg, int waitflag); @@ -52,8 +51,6 @@ int max, char *cmp); /* socketbuffer is full */ static int sbfull(struct sockbuf *sb); -static int -accept_filt_http_mod_event(module_t mod, int event, void *data); static struct accept_filter accf_http_filter = { "httpready", @@ -64,51 +61,19 @@ static moduledata_t accf_http_mod = { "accf_http", - accept_filt_http_mod_event, - NULL, + accept_filt_generic_mod_event, + &accf_http_filter }; DECLARE_MODULE(accf_http, accf_http_mod, SI_SUB_DRIVERS, SI_ORDER_MIDDLE); -#ifdef VIMAGE_GLOBALS -static int parse_http_version; -#endif +static int parse_http_version = 1; -struct vnet_accf_http { - int _parse_http_version; -}; - -#ifndef VIMAGE -#ifndef VIMAGE_GLOBALS -struct vnet_accf_http vnet_accf_http_0; -#endif -#endif - -#define INIT_VNET_ACCF_HTTP(vnet) \ - INIT_FROM_VNET(vnet, VNET_MOD_ACCF_HTTP, struct vnet_accf_http, vnet_accf_http) - -#define VNET_ACCF_HTTP(sym) VSYM(vnet_accf_http, sym) - -#define V_parse_http_version VNET_ACCF_HTTP(parse_http_version) - -#define V_MOD_vnet_accf_http VNET_MOD_ACCF_HTTP - -static vnet_attach_fn vnet_accf_http_iattach; - -#ifndef VIMAGE_GLOBALS -vnet_modinfo_t vnet_accf_http_modinfo = { - .vmi_id = VNET_MOD_ACCF_HTTP, - .vmi_name = "accf_http", - .vmi_dependson = VNET_MOD_INET, - .vmi_iattach = vnet_accf_http_iattach -}; -#endif - SYSCTL_NODE(_net_inet_accf, OID_AUTO, http, CTLFLAG_RW, 0, "HTTP accept filter"); -SYSCTL_V_INT(V_NET, vnet_accf_http, _net_inet_accf_http, OID_AUTO, - parsehttpversion, CTLFLAG_RW, parse_http_version, 1, - "Parse http version so that non 1.x requests work"); +SYSCTL_INT(_net_inet_accf_http, OID_AUTO, parsehttpversion, CTLFLAG_RW, +&parse_http_version, 1, +"Parse http version so that non 1.x requests work"); #ifdef ACCF_HTTP_DEBUG #define DPRINT(fmt, args...) \ @@ -196,7 +161,6 @@ static int sohashttpget(struct socket *so, void *arg, int waitflag) { - INIT_VNET_ACCF_HTTP(so->so_vnet); if ((so->so_rcv.sb_state & SBS_CANTRCVMORE) == 0 && !sbfull(&so->so_rcv)) { struct mbuf *m; @@ -228,7 +192,7 @@ } if (mbufstrcmp(m, m->m_nextpkt, 1, cmp) == 1) { DPRINT("mbufstrcmp ok"); - if (V_parse_http_version == 0) + if (parse_http_version == 0) return (soishttpconnected(so, arg, waitflag)); else return (soparsehttpvers(so, arg, waitflag)); @@ -383,58 +347,3 @@ gotit: return (SU_ISCONNECTED); } - -static int -accept_filt_http_mod_event(module_t mod, int event, void *data) -{ - struct accept_filter *p; - int error; - - switch (event) { - case MOD_LOAD: -#ifndef VIMAGE_GLOBALS - vnet_mod_register(&vnet_accf_http_modinfo); -#else - vnet_accf_http_iattach(NULL); -#endif /* !VIMAGE */ - - MALLOC(p, struct accept_filter *, sizeof(*p), M_ACCF, - M_WAITOK); - bcopy(&accf_http_filter, p, sizeof(*p)); - error = accept_filt_add(p); - break; - - case MOD_UNLOAD: - /* - * Do not support unloading yet. we don't keep track of - * refcounts and unloading an accept filter callback and then - * having it called is a bad thing. A simple fix would be to - * track the refcount in the struct accept_filter. - */ - if (accf_unloadable != 0) { - error = accept_filt_del(accf_http_filter.accf_name); - } else - error = EOPNOTSUPP; - break; - - case MOD_SHUTDOWN: - error = 0; - break; - - default: - error = EOPNOTSUPP; - break; - } - - return (error); -} - -static int vnet_accf_http_iattach(const void *unused) -{ - INIT_VNET_ACCF_HTTP(curvnet); - - V_parse_http_version = 1; - - return (0); -} - ==== //depot/projects/vimage/src/sys/netinet/in_mcast.c#32 (text+ko) ==== @@ -201,8 +201,6 @@ return (ifp == NULL); } -static struct ifnet *ip_multicast_if(const struct in_addr *a); - /* * Initialize an in_mfilter structure to a known state at t0, t1 * with an empty source filter list. @@ -1809,7 +1807,7 @@ ifp = NULL; if (!in_nullhost(ina)) { - ifp = ip_multicast_if(&ina); + INADDR_TO_IFP(ina, ifp); } else { struct route ro; @@ -2334,7 +2332,7 @@ if (in_nullhost(addr)) { ifp = NULL; } else { - ifp = ip_multicast_if(&addr); + INADDR_TO_IFP(addr, ifp); if (ifp == NULL) return (EADDRNOTAVAIL); } @@ -2854,24 +2852,3 @@ #endif /* KTR */ RB_GENERATE(ip_msource_tree, ip_msource, ims_link, ip_msource_cmp); -/* - * following RFC1724 section 3.3, 0.0.0.0/8 is interpreted as interface index. - */ -static struct ifnet * -ip_multicast_if(const struct in_addr *a) -{ - INIT_VNET_NET(curvnet); - INIT_VNET_INET(curvnet); - int ifindex; - struct ifnet *ifp; - - if (ntohl(a->s_addr) >> 24 == 0) { - ifindex = ntohl(a->s_addr) & 0xffffff; - if (ifindex < 0 || V_if_index < ifindex) - return NULL; - ifp = ifnet_byindex(ifindex); - } else - INADDR_TO_IFP(*a, ifp); - return ifp; -} - ==== //depot/projects/vimage/src/sys/netinet/ip_divert.c#38 (text+ko) ==== @@ -28,7 +28,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/netinet/ip_divert.c,v 1.156 2009/08/02 19:43:32 rwatson Exp $"); +__FBSDID("$FreeBSD: src/sys/netinet/ip_divert.c,v 1.157 2009/08/24 10:06:02 zec Exp $"); #if !defined(KLD_MODULE) #include "opt_inet.h" @@ -125,7 +125,36 @@ static u_long div_sendspace = DIVSNDQ; /* XXX sysctl ? */ static u_long div_recvspace = DIVRCVQ; /* XXX sysctl ? */ -void +static eventhandler_tag ip_divert_event_tag; + +/* + * Initialize divert connection block queue. + */ +static void +div_zone_change(void *tag) +{ + + uma_zone_set_max(V_divcbinfo.ipi_zone, maxsockets); +} + +static int +div_inpcb_init(void *mem, int size, int flags) +{ + struct inpcb *inp = mem; + + INP_LOCK_INIT(inp, "inp", "divinp"); + return (0); +} + +static void +div_inpcb_fini(void *mem, int size) +{ + struct inpcb *inp = mem; + + INP_LOCK_DESTROY(inp); +} + +static void div_init(void) { @@ -143,6 +172,21 @@ V_divcbinfo.ipi_hashbase = hashinit(1, M_PCB, &V_divcbinfo.ipi_hashmask); V_divcbinfo.ipi_porthashbase = hashinit(1, M_PCB, &V_divcbinfo.ipi_porthashmask); + V_divcbinfo.ipi_zone = uma_zcreate("divcb", sizeof(struct inpcb), + NULL, NULL, div_inpcb_init, div_inpcb_fini, UMA_ALIGN_PTR, + UMA_ZONE_NOFREE); + uma_zone_set_max(V_divcbinfo.ipi_zone, maxsockets); +} + +static void +div_destroy(void) +{ + + INP_INFO_LOCK_DESTROY(&V_divcbinfo); + uma_zdestroy(V_divcbinfo.ipi_zone); + hashdestroy(V_divcbinfo.ipi_hashbase, M_PCB, V_divcbinfo.ipi_hashmask); + hashdestroy(V_divcbinfo.ipi_porthashbase, M_PCB, + V_divcbinfo.ipi_porthashmask); } /* @@ -676,6 +720,9 @@ .pr_ctlinput = div_ctlinput, .pr_ctloutput = ip_ctloutput, .pr_init = div_init, +#ifdef VIMAGE + .pr_destroy = div_destroy, +#endif .pr_usrreqs = &div_usrreqs }; @@ -683,7 +730,9 @@ div_modevent(module_t mod, int type, void *unused) { int err = 0; +#ifndef VIMAGE int n; +#endif switch (type) { case MOD_LOAD: @@ -693,7 +742,11 @@ * a true IP protocol that goes over the wire. */ err = pf_proto_register(PF_INET, &div_protosw); + if (err != 0) + return (err); ip_divert_ptr = divert_packet; + ip_divert_event_tag = EVENTHANDLER_REGISTER(maxsockets_change, + div_zone_change, NULL, EVENTHANDLER_PRI_ANY); break; case MOD_QUIESCE: /* @@ -704,6 +757,10 @@ err = EPERM; break; case MOD_UNLOAD: +#ifdef VIMAGE + err = EPERM; + break; +#else /* * Forced unload. * @@ -725,8 +782,10 @@ ip_divert_ptr = NULL; err = pf_proto_unregister(PF_INET, IPPROTO_DIVERT, SOCK_RAW); INP_INFO_WUNLOCK(&V_divcbinfo); - INP_INFO_LOCK_DESTROY(&V_divcbinfo); + div_destroy(); + EVENTHANDLER_DEREGISTER(maxsockets_change, ip_divert_event_tag); break; +#endif /* !VIMAGE */ default: err = EOPNOTSUPP; break; ==== //depot/projects/vimage/src/sys/netinet/ip_fw.h#38 (text+ko) ==== @@ -28,9 +28,6 @@ #ifndef _IPFW2_H #define _IPFW2_H -#include -#include - /* * The default rule number. By the design of ip_fw, the default rule * is the last one, so its number can also serve as the highest number @@ -581,35 +578,6 @@ #define MTAG_IPFW 1148380143 /* IPFW-tagged cookie */ -/* - * Data structure to cache our ucred related - * information. This structure only gets used if - * the user specified UID/GID based constraints in - * a firewall rule. - */ -struct ip_fw_ugid { - gid_t fw_groups[NGROUPS]; - int fw_ngroups; - uid_t fw_uid; - int fw_prid; -}; - -#define IPFW_TABLES_MAX 128 -struct ip_fw_chain { - struct ip_fw *rules; /* list of rules */ - struct ip_fw *reap; /* list of rules to reap */ - LIST_HEAD(, cfg_nat) nat; /* list of nat entries */ - struct radix_node_head *tables[IPFW_TABLES_MAX]; - struct rwlock rwmtx; - uint32_t id; /* ruleset id */ -}; - -struct table_entry { - struct radix_node rn[2]; - struct sockaddr_in addr, mask; - u_int32_t value; -}; - /* Return values from ipfw_chk() */ enum { IP_FW_PASS = 0, @@ -683,6 +651,7 @@ int ipfw6_unhook(void); #ifdef NOTYET void ipfw_nat_destroy(void); +#endif VNET_DECLARE(int, fw_one_pass); VNET_DECLARE(int, fw_enable); @@ -694,6 +663,15 @@ #define V_fw6_enable VNET(fw6_enable) #endif +struct ip_fw_chain { + struct ip_fw *rules; /* list of rules */ + struct ip_fw *reap; /* list of rules to reap */ + LIST_HEAD(, cfg_nat) nat; /* list of nat entries */ + struct radix_node_head *tables[IPFW_TABLES_MAX]; + struct rwlock rwmtx; + uint32_t id; /* ruleset id */ +}; + #ifdef IPFW_INTERNAL #define IPFW_LOCK_INIT(_chain) \ ==== //depot/projects/vimage/src/sys/netinet/ipfw/ip_fw2.c#9 (text+ko) ==== @@ -24,7 +24,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/netinet/ipfw/ip_fw2.c,v 1.13 2009/08/21 11:20:10 julian Exp $"); +__FBSDID("$FreeBSD: src/sys/netinet/ipfw/ip_fw2.c,v 1.15 2009/08/23 08:49:32 julian Exp $"); #define DEB(x) #define DDB(x) x @@ -145,6 +145,12 @@ ipfw_nat_cfg_t *ipfw_nat_get_cfg_ptr; ipfw_nat_cfg_t *ipfw_nat_get_log_ptr; +struct table_entry { + struct radix_node rn[2]; + struct sockaddr_in addr, mask; + u_int32_t value; +}; + static VNET_DEFINE(int, autoinc_step); #define V_autoinc_step VNET(autoinc_step) static VNET_DEFINE(int, fw_deny_unknown_exthdrs); @@ -4647,7 +4653,7 @@ #endif /* * Other things that are only done the first time. - * (now that we a re cuaranteed of success). + * (now that we are guaranteed of success). */ ip_fw_ctl_ptr = ipfw_ctl; ip_fw_chk_ptr = ipfw_chk; ==== //depot/projects/vimage/src/sys/netinet/ipfw/ip_fw_nat.c#6 (text+ko) ==== @@ -599,7 +599,7 @@ NULL, EVENTHANDLER_PRI_ANY); } -void +static void ipfw_nat_destroy(void) { struct ip_fw *rule; ==== //depot/projects/vimage/src/sys/netinet6/sctp6_usrreq.c#30 (text+ko) ==== @@ -34,7 +34,6 @@ #include #include -#include #include #include #include @@ -804,7 +803,6 @@ sctp6_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *addr, struct mbuf *control, struct thread *p) { - INIT_VNET_INET6(curvnet); struct sctp_inpcb *inp; struct inpcb *in_inp; struct in6pcb *inp6; @@ -917,7 +915,6 @@ static int sctp6_connect(struct socket *so, struct sockaddr *addr, struct thread *p) { - INIT_VNET_INET6(curvnet); uint32_t vrf_id; int error = 0; struct sctp_inpcb *inp; ==== //depot/projects/vimage/src/sys/nfsclient/nfs_vfsops.c#32 (text+ko) ==== @@ -57,7 +57,6 @@ #include #include #include -#include #include #include @@ -422,17 +421,14 @@ char buf[128]; char *cp; - CURVNET_SET(TD_TO_VNET(td)); #if defined(BOOTP_NFSROOT) && defined(BOOTP) bootpc_init(); /* use bootp to get nfs_diskless filled in */ #elif defined(NFS_ROOT) nfs_setup_diskless(); #endif - if (nfs_diskless_valid == 0) { - CURVNET_RESTORE(); + if (nfs_diskless_valid == 0) return (-1); - } if (nfs_diskless_valid == 1) nfs_convert_diskless(); @@ -516,7 +512,6 @@ nd->root_args.hostname = buf; if ((error = nfs_mountdiskless(buf, &nd->root_saddr, &nd->root_args, td, &vp, mp)) != 0) { - CURVNET_RESTORE(); return (error); } @@ -530,8 +525,6 @@ sizeof (prison0.pr_hostname)); mtx_unlock(&prison0.pr_mtx); inittodr(ntohl(nd->root_time)); - - CURVNET_RESTORE(); return (0); } ==== //depot/projects/vimage/src/sys/rpc/rpc_generic.c#5 (text+ko) ==== @@ -34,7 +34,7 @@ /* #pragma ident "@(#)rpc_generic.c 1.17 94/04/24 SMI" */ #include -__FBSDID("$FreeBSD: src/sys/rpc/rpc_generic.c,v 1.4 2008/11/03 10:38:00 dfr Exp $"); +__FBSDID("$FreeBSD: src/sys/rpc/rpc_generic.c,v 1.5 2009/08/24 10:09:30 zec Exp $"); /* * rpc_generic.c, Miscl routines for RPC. @@ -55,7 +55,8 @@ #include #include #include -#include + +#include #include #include @@ -185,12 +186,9 @@ struct sockopt opt; int error; - CURVNET_SET(so->so_vnet); error = so->so_proto->pr_usrreqs->pru_sockaddr(so, &sa); - if (error) { - CURVNET_RESTORE(); + if (error) return 0; - } sip->si_alen = sa->sa_len; family = sa->sa_family; @@ -203,7 +201,6 @@ opt.sopt_valsize = sizeof type; opt.sopt_td = NULL; error = sogetopt(so, &opt); - CURVNET_RESTORE(); if (error) return 0; @@ -700,9 +697,7 @@ struct sockaddr *sa; int error, bound; - CURVNET_SET(so->so_vnet); error = so->so_proto->pr_usrreqs->pru_sockaddr(so, &sa); - CURVNET_RESTORE(); if (error) return (0); @@ -829,6 +824,7 @@ sa->sa_len = salen; if (*portp == 0) { + CURVNET_SET(so->so_vnet); bzero(&opt, sizeof(opt)); opt.sopt_dir = SOPT_GET; opt.sopt_level = proto; @@ -836,12 +832,15 @@ opt.sopt_val = &old; opt.sopt_valsize = sizeof(old); error = sogetopt(so, &opt); - if (error) + if (error) { + CURVNET_RESTORE(); goto out; + } opt.sopt_dir = SOPT_SET; opt.sopt_val = &portlow; error = sosetopt(so, &opt); + CURVNET_RESTORE(); if (error) goto out; } @@ -852,7 +851,9 @@ if (error) { opt.sopt_dir = SOPT_SET; opt.sopt_val = &old; + CURVNET_SET(so->so_vnet); sosetopt(so, &opt); + CURVNET_RESTORE(); } } out: ==== //depot/projects/vimage/src/sys/rpc/svc_dg.c#7 (text+ko) ==== @@ -37,7 +37,7 @@ #ident "@(#)svc_dg.c 1.17 94/04/24 SMI" #endif #include -__FBSDID("$FreeBSD: src/sys/rpc/svc_dg.c,v 1.4 2009/06/01 21:17:03 jhb Exp $"); +__FBSDID("$FreeBSD: src/sys/rpc/svc_dg.c,v 1.5 2009/08/24 10:09:30 zec Exp $"); /* * svc_dg.c, Server side for connectionless RPC. @@ -56,7 +56,8 @@ #include #include #include -#include + +#include #include @@ -102,8 +103,10 @@ struct sockaddr* sa; int error; + CURVNET_SET(so->so_vnet); if (!__rpc_socket2sockinfo(so, &si)) { printf(svc_dg_str, svc_dg_err1); + CURVNET_RESTORE(); return (NULL); } /* @@ -113,6 +116,7 @@ recvsize = __rpc_get_t_size(si.si_af, si.si_proto, (int)recvsize); if ((sendsize == 0) || (recvsize == 0)) { printf(svc_dg_str, svc_dg_err2); + CURVNET_RESTORE(); return (NULL); } @@ -124,7 +128,6 @@ xprt->xp_p2 = NULL; xprt->xp_ops = &svc_dg_ops; - CURVNET_SET(so->so_vnet); error = so->so_proto->pr_usrreqs->pru_sockaddr(so, &sa); CURVNET_RESTORE(); if (error) ==== //depot/projects/vimage/src/sys/rpc/svc_generic.c#6 (text+ko) ==== @@ -38,7 +38,7 @@ static char sccsid[] = "@(#)svc_generic.c 1.21 89/02/28 Copyr 1988 Sun Micro"; #endif #include -__FBSDID("$FreeBSD: src/sys/rpc/svc_generic.c,v 1.4 2009/06/17 22:50:26 rmacklem Exp $"); +__FBSDID("$FreeBSD: src/sys/rpc/svc_generic.c,v 1.5 2009/08/24 10:09:30 zec Exp $"); /* * svc_generic.c, Server side for RPC. @@ -59,7 +59,8 @@ #include #include #include -#include + +#include #include #include @@ -229,17 +230,19 @@ /* * It is an open socket. Get the transport info. */ + CURVNET_SET(so->so_vnet); if (!__rpc_socket2sockinfo(so, &si)) { printf( "svc_tli_create: could not get transport information\n"); + CURVNET_RESTORE(); return (NULL); } + CURVNET_RESTORE(); } /* * If the socket is unbound, try to bind it. */ - CURVNET_SET(so->so_vnet); if (madeso || !__rpc_sockisbound(so)) { if (bindaddr == NULL) { if (bindresvport(so, NULL)) { @@ -261,7 +264,9 @@ "svc_tli_create: could not bind to requested address\n"); goto freedata; } + CURVNET_SET(so->so_vnet); solisten(so, (int)bindaddr->qlen, curthread); + CURVNET_RESTORE(); } } @@ -309,11 +314,9 @@ if (nconf) { xprt->xp_netid = strdup(nconf->nc_netid, M_RPC); } - CURVNET_RESTORE(); return (xprt); freedata: - CURVNET_RESTORE(); if (madeso) (void)soclose(so); if (xprt) { ==== //depot/projects/vimage/src/sys/sys/socketvar.h#17 (text+ko) ==== @@ -296,7 +296,6 @@ MALLOC_DECLARE(M_SONAME); #endif -extern int accf_unloadable; extern int maxsockets; extern u_long sb_max; extern struct uma_zone *socket_zone;