From owner-p4-projects@FreeBSD.ORG Mon Dec 11 12:21:58 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 0145C16A416; Mon, 11 Dec 2006 12:21:58 +0000 (UTC) X-Original-To: perforce@FreeBSD.org Delivered-To: perforce@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 99CCE16A40F for ; Mon, 11 Dec 2006 12:21:57 +0000 (UTC) (envelope-from zec@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [69.147.83.41]) by mx1.FreeBSD.org (Postfix) with ESMTP id 38ECC43C9E for ; Mon, 11 Dec 2006 12:20:41 +0000 (GMT) (envelope-from zec@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id kBBCLvVk049749 for ; Mon, 11 Dec 2006 12:21:57 GMT (envelope-from zec@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id kBBCLuJa049739 for perforce@freebsd.org; Mon, 11 Dec 2006 12:21:56 GMT (envelope-from zec@FreeBSD.org) Date: Mon, 11 Dec 2006 12:21:56 GMT Message-Id: <200612111221.kBBCLuJa049739@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to zec@FreeBSD.org using -f From: Marko Zec To: Perforce Change Reviews Cc: Subject: PERFORCE change 111452 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, 11 Dec 2006 12:21:58 -0000 http://perforce.freebsd.org/chv.cgi?CH=111452 Change 111452 by zec@zec_tca51 on 2006/12/11 12:21:41 Attempt to virtualize raw sockets. Affected files ... .. //depot/projects/vimage/src/sys/net/raw_cb.c#2 edit .. //depot/projects/vimage/src/sys/net/raw_cb.h#2 edit .. //depot/projects/vimage/src/sys/net/raw_usrreq.c#2 edit .. //depot/projects/vimage/src/sys/net/vnet.h#3 edit Differences ... ==== //depot/projects/vimage/src/sys/net/raw_cb.c#2 (text+ko) ==== @@ -30,6 +30,8 @@ * $FreeBSD: src/sys/net/raw_cb.c,v 1.34 2006/06/02 08:27:15 rwatson Exp $ */ +#include "opt_vimage.h" + #include #include #include @@ -39,7 +41,9 @@ #include #include #include +#include +#include #include /* @@ -52,7 +56,9 @@ */ struct mtx rawcb_mtx; +#ifndef VIMAGE struct rawcb_list_head rawcb_list; +#endif const static u_long raw_sendspace = RAWSNDQ; const static u_long raw_recvspace = RAWRCVQ; @@ -66,6 +72,7 @@ register struct socket *so; int proto; { + INIT_VNET_NET(so->so_vnetb); register struct rawcb *rp = sotorawcb(so); int error; @@ -83,7 +90,7 @@ rp->rcb_proto.sp_family = so->so_proto->pr_domain->dom_family; rp->rcb_proto.sp_protocol = proto; mtx_lock(&rawcb_mtx); - LIST_INSERT_HEAD(&rawcb_list, rp, list); + LIST_INSERT_HEAD(&V_rawcb_list, rp, list); mtx_unlock(&rawcb_mtx); return (0); } ==== //depot/projects/vimage/src/sys/net/raw_cb.h#2 (text+ko) ==== @@ -56,7 +56,11 @@ #define RAWRCVQ 8192 #ifdef _KERNEL + +#ifndef VIMAGE extern LIST_HEAD(rawcb_list_head, rawcb) rawcb_list; +#endif + extern struct mtx rawcb_mtx; /* protosw entries */ ==== //depot/projects/vimage/src/sys/net/raw_usrreq.c#2 (text+ko) ==== @@ -30,6 +30,8 @@ * $FreeBSD: src/sys/net/raw_usrreq.c,v 1.44 2006/11/06 13:42:02 rwatson Exp $ */ +#include "opt_vimage.h" + #include #include #include @@ -43,7 +45,9 @@ #include #include #include +#include +#include #include MTX_SYSINIT(rawcb_mtx, &rawcb_mtx, "rawcb", MTX_DEF); @@ -54,8 +58,11 @@ void raw_init() { +#ifndef VIMAGE + INIT_VNET_NET(curvnetb); - LIST_INIT(&rawcb_list); + LIST_INIT(&V_rawcb_list); +#endif } @@ -73,13 +80,14 @@ register struct sockproto *proto; struct sockaddr *src, *dst; { + INIT_VNET_NET(curvnetb); register struct rawcb *rp; register struct mbuf *m = m0; struct socket *last; last = 0; mtx_lock(&rawcb_mtx); - LIST_FOREACH(rp, &rawcb_list, list) { + LIST_FOREACH(rp, &V_rawcb_list, list) { if (rp->rcb_proto.sp_family != proto->sp_family) continue; if (rp->rcb_proto.sp_protocol && ==== //depot/projects/vimage/src/sys/net/vnet.h#3 (text+ko) ==== @@ -36,11 +36,13 @@ #ifdef VIMAGE #include +#include #include #include #include #include +#include struct vnet_net { struct vnet_base *parent_vnetb; @@ -58,7 +60,9 @@ int _rttrash; struct ifnet *_loif; - LIST_HEAD(lo_list, lo_softc) _lo_list; + LIST_HEAD(, lo_softc) _lo_list; + + LIST_HEAD(, rawcb) _rawcb_list; }; extern struct vnet_net vnet_net_0; @@ -84,5 +88,6 @@ #define V_rttrash VNET_NET(rttrash) #define V_loif VNET_NET(loif) #define V_lo_list VNET_NET(lo_list) +#define V_rawcb_list VNET_NET(rawcb_list) #endif /* !_NET_VNET_H_ */