Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/sys/netinet/udp_usrreq.c,v retrieving revision 1.168.2.1 retrieving revision 1.169 diff -u -p -r1.168.2.1 -r1.169 --- src/sys/netinet/udp_usrreq.c 2008/05/18 12:35:30 1.168.2.1 +++ src/sys/netinet/udp_usrreq.c 2008/04/23 06:09:05 1.169 @@ -1,4 +1,4 @@ -/* $NetBSD: udp_usrreq.c,v 1.168.2.1 2008/05/18 12:35:30 yamt Exp $ */ +/* $NetBSD: udp_usrreq.c,v 1.169 2008/04/23 06:09:05 thorpej Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -61,7 +61,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: udp_usrreq.c,v 1.168.2.1 2008/05/18 12:35:30 yamt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: udp_usrreq.c,v 1.169 2008/04/23 06:09:05 thorpej Exp $"); #include "opt_inet.h" #include "opt_ipsec.h" @@ -237,12 +237,7 @@ udp_init(void) MOWNER_ATTACH(&udp_rx_mowner); MOWNER_ATTACH(&udp_mowner); -#ifdef INET udpstat_percpu = percpu_alloc(sizeof(uint64_t) * UDP_NSTATS); -#endif -#ifdef INET6 - udp6stat_percpu = percpu_alloc(sizeof(uint64_t) * UDP6_NSTATS); -#endif } /* @@ -1186,11 +1181,9 @@ udp_usrreq(struct socket *so, int req, s s = splsoftnet(); if (req == PRU_PURGEIF) { - mutex_enter(softnet_lock); in_pcbpurgeif0(&udbtable, (struct ifnet *)control); in_purgeif((struct ifnet *)control); in_pcbpurgeif(&udbtable, (struct ifnet *)control); - mutex_exit(softnet_lock); splx(s); return (0); } @@ -1200,9 +1193,7 @@ udp_usrreq(struct socket *so, int req, s if (req != PRU_SEND && req != PRU_SENDOOB && control) panic("udp_usrreq: unexpected control mbuf"); #endif - if (req == PRU_ATTACH) { - sosetlock(so); - } else if (inp == 0) { + if (inp == 0 && req != PRU_ATTACH) { error = EINVAL; goto release; } @@ -1349,8 +1340,13 @@ release: static int sysctl_net_inet_udp_stats(SYSCTLFN_ARGS) { + netstat_sysctl_context ctx; + uint64_t udps[UDP_NSTATS]; - return (NETSTAT_SYSCTL(udpstat_percpu, UDP_NSTATS)); + ctx.ctx_stat = udpstat_percpu; + ctx.ctx_counters = udps; + ctx.ctx_ncounters = UDP_NSTATS; + return (NETSTAT_SYSCTL(&ctx)); } /*