Author: julian Date: Sun Aug 2 16:59:02 2009 New Revision: 196038 URL: http://svn.freebsd.org/changeset/base/196038
Log: Stop uuidgen(2) from crashing in vimage kerenels. make curvnet valid when needed. Reviewed by: bz@ Approved by: re (kib) Modified: head/sys/kern/kern_uuid.c Modified: head/sys/kern/kern_uuid.c ============================================================================== --- head/sys/kern/kern_uuid.c Sun Aug 2 14:28:40 2009 (r196037) +++ head/sys/kern/kern_uuid.c Sun Aug 2 16:59:02 2009 (r196038) @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include <sys/socket.h> #include <sys/sysproto.h> #include <sys/systm.h> +#include <sys/jail.h> #include <sys/uuid.h> #include <net/if.h> @@ -93,6 +94,7 @@ uuid_node(uint16_t *node) struct sockaddr_dl *sdl; int i; + CURVNET_SET(TD_TO_VNET(curthread)); IFNET_RLOCK(); TAILQ_FOREACH(ifp, &V_ifnet, if_link) { /* Walk the address list */ @@ -105,6 +107,7 @@ uuid_node(uint16_t *node) bcopy(LLADDR(sdl), node, UUID_NODE_LEN); IF_ADDR_UNLOCK(ifp); IFNET_RUNLOCK(); + CURVNET_RESTORE(); return; } } @@ -115,6 +118,7 @@ uuid_node(uint16_t *node) for (i = 0; i < (UUID_NODE_LEN>>1); i++) node[i] = (uint16_t)arc4random(); *((uint8_t*)node) |= 0x01; + CURVNET_RESTORE(); } /* _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"