xref: /freebsd/sys/net/vnet.h (revision 385195c062ad27bfd78b9f9592a8bbcb9419acfb)
18b615593SMarko Zec /*-
28b615593SMarko Zec  * Copyright (c) 2006-2008 University of Zagreb
38b615593SMarko Zec  * Copyright (c) 2006-2008 FreeBSD Foundation
48b615593SMarko Zec  *
58b615593SMarko Zec  * This software was developed by the University of Zagreb and the
68b615593SMarko Zec  * FreeBSD Foundation under sponsorship by the Stichting NLnet and the
78b615593SMarko Zec  * FreeBSD Foundation.
88b615593SMarko Zec  *
98b615593SMarko Zec  * Redistribution and use in source and binary forms, with or without
108b615593SMarko Zec  * modification, are permitted provided that the following conditions
118b615593SMarko Zec  * are met:
128b615593SMarko Zec  * 1. Redistributions of source code must retain the above copyright
138b615593SMarko Zec  *    notice, this list of conditions and the following disclaimer.
148b615593SMarko Zec  * 2. Redistributions in binary form must reproduce the above copyright
158b615593SMarko Zec  *    notice, this list of conditions and the following disclaimer in the
168b615593SMarko Zec  *    documentation and/or other materials provided with the distribution.
178b615593SMarko Zec  *
188b615593SMarko Zec  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
198b615593SMarko Zec  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
208b615593SMarko Zec  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
218b615593SMarko Zec  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
228b615593SMarko Zec  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
238b615593SMarko Zec  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
248b615593SMarko Zec  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
258b615593SMarko Zec  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
268b615593SMarko Zec  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
278b615593SMarko Zec  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
288b615593SMarko Zec  * SUCH DAMAGE.
298b615593SMarko Zec  *
308b615593SMarko Zec  * $FreeBSD$
318b615593SMarko Zec  */
328b615593SMarko Zec 
338b615593SMarko Zec #ifndef _NET_VNET_H_
348b615593SMarko Zec #define _NET_VNET_H_
358b615593SMarko Zec 
368b615593SMarko Zec #include "opt_route.h"
378b615593SMarko Zec 
38f02493cbSMarko Zec #include <sys/param.h>
39f02493cbSMarko Zec #include <sys/systm.h>
408b615593SMarko Zec #include <sys/protosw.h>
418b615593SMarko Zec 
428b615593SMarko Zec #include <net/if.h>
438b615593SMarko Zec #include <net/if_var.h>
448b615593SMarko Zec #include <net/route.h>
458b615593SMarko Zec #include <net/raw_cb.h>
468b615593SMarko Zec 
478b615593SMarko Zec struct vnet_net {
488b615593SMarko Zec 	int	_if_index;
498b615593SMarko Zec 	struct	ifindex_entry *_ifindex_table;
508b615593SMarko Zec 	struct	ifnethead _ifnet;
518b615593SMarko Zec 	struct	ifgrouphead _ifg_head;
528b615593SMarko Zec 
538b615593SMarko Zec 	int	_if_indexlim;
548b615593SMarko Zec 	struct	knlist _ifklist;
558b615593SMarko Zec 
568b615593SMarko Zec 	struct	rtstat _rtstat;
578b615593SMarko Zec 	struct	radix_node_head *_rt_tables[RT_MAXFIBS][AF_MAX+1];
588b615593SMarko Zec 	int	_rttrash;
598b615593SMarko Zec 
608b615593SMarko Zec 	struct	ifnet *_loif;
618b615593SMarko Zec 	LIST_HEAD(, lo_softc) _lo_list;
628b615593SMarko Zec 
638b615593SMarko Zec 	LIST_HEAD(, rawcb) _rawcb_list;
648b615593SMarko Zec 
658b615593SMarko Zec 	int	_ether_ipfw;
668b615593SMarko Zec };
678b615593SMarko Zec 
68385195c0SMarko Zec #ifndef VIMAGE
69385195c0SMarko Zec #ifndef VIMAGE_GLOBALS
70385195c0SMarko Zec extern struct vnet_net vnet_net_0;
71385195c0SMarko Zec #endif
72385195c0SMarko Zec #endif
73385195c0SMarko Zec 
748b615593SMarko Zec /*
758b615593SMarko Zec  * Symbol translation macros
768b615593SMarko Zec  */
778b615593SMarko Zec #define	INIT_VNET_NET(vnet) \
788b615593SMarko Zec 	INIT_FROM_VNET(vnet, VNET_MOD_NET, struct vnet_net, vnet_net)
798b615593SMarko Zec 
808b615593SMarko Zec #define	VNET_NET(sym)	VSYM(vnet_net, sym)
818b615593SMarko Zec 
828b615593SMarko Zec #define	V_ether_ipfw	VNET_NET(ether_ipfw)
838b615593SMarko Zec #define	V_if_index	VNET_NET(if_index)
848b615593SMarko Zec #define	V_if_indexlim	VNET_NET(if_indexlim)
858b615593SMarko Zec #define	V_ifg_head	VNET_NET(ifg_head)
868b615593SMarko Zec #define	V_ifindex_table	VNET_NET(ifindex_table)
878b615593SMarko Zec #define	V_ifklist	VNET_NET(ifklist)
888b615593SMarko Zec #define	V_ifnet		VNET_NET(ifnet)
898b615593SMarko Zec #define	V_lo_list	VNET_NET(lo_list)
908b615593SMarko Zec #define	V_loif		VNET_NET(loif)
918b615593SMarko Zec #define	V_rawcb_list	VNET_NET(rawcb_list)
928b615593SMarko Zec #define	V_rt_tables	VNET_NET(rt_tables)
938b615593SMarko Zec #define	V_rtstat	VNET_NET(rtstat)
948b615593SMarko Zec #define	V_rttrash	VNET_NET(rttrash)
958b615593SMarko Zec 
968b615593SMarko Zec #endif /* !_NET_VNET_H_ */
97