PERFORCE change 111452 for review
Marko Zec
zec at FreeBSD.org
Mon Dec 11 04:21:58 PST 2006
http://perforce.freebsd.org/chv.cgi?CH=111452
Change 111452 by zec at 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 <sys/param.h>
#include <sys/domain.h>
#include <sys/lock.h>
@@ -39,7 +41,9 @@
#include <sys/socket.h>
#include <sys/socketvar.h>
#include <sys/systm.h>
+#include <sys/vimage.h>
+#include <net/vnet.h>
#include <net/raw_cb.h>
/*
@@ -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 <sys/param.h>
#include <sys/kernel.h>
#include <sys/lock.h>
@@ -43,7 +45,9 @@
#include <sys/socketvar.h>
#include <sys/sx.h>
#include <sys/systm.h>
+#include <sys/vimage.h>
+#include <net/vnet.h>
#include <net/raw_cb.h>
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 <sys/proc.h>
+#include <sys/protosw.h>
#include <sys/socket.h>
#include <net/if.h>
#include <net/if_var.h>
#include <net/route.h>
+#include <net/raw_cb.h>
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_ */
More information about the p4-projects
mailing list