if_vlan_var.h revision 50477
134649Swollman/* 234649Swollman * Copyright 1998 Massachusetts Institute of Technology 334649Swollman * 434649Swollman * Permission to use, copy, modify, and distribute this software and 534649Swollman * its documentation for any purpose and without fee is hereby 634649Swollman * granted, provided that both the above copyright notice and this 734649Swollman * permission notice appear in all copies, that both the above 834649Swollman * copyright notice and this permission notice appear in all 934649Swollman * supporting documentation, and that the name of M.I.T. not be used 1034649Swollman * in advertising or publicity pertaining to distribution of the 1134649Swollman * software without specific, written prior permission. M.I.T. makes 1234649Swollman * no representations about the suitability of this software for any 1334649Swollman * purpose. It is provided "as is" without express or implied 1434649Swollman * warranty. 1534649Swollman * 1634649Swollman * THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS 1734649Swollman * ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE, 1834649Swollman * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 1934649Swollman * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT 2034649Swollman * SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 2134649Swollman * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 2234649Swollman * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 2334649Swollman * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 2434649Swollman * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 2534649Swollman * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 2634649Swollman * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2734649Swollman * SUCH DAMAGE. 2834649Swollman * 2950477Speter * $FreeBSD: head/sys/net/if_vlan_var.h 50477 1999-08-28 01:08:13Z peter $ 3034649Swollman */ 3134649Swollman 3234649Swollman#ifndef _NET_IF_VLAN_VAR_H_ 3334649Swollman#define _NET_IF_VLAN_VAR_H_ 1 3434649Swollman 3534649Swollman#ifdef KERNEL 3644764Swpaulstruct vlan_mc_entry { 3744764Swpaul struct ether_addr mc_addr; 3844764Swpaul SLIST_ENTRY(vlan_mc_entry) mc_entries; 3944764Swpaul}; 4044764Swpaul 4134649Swollmanstruct ifvlan { 4234649Swollman struct arpcom ifv_ac; /* make this an interface */ 4334649Swollman struct ifnet *ifv_p; /* parent inteface of this vlan */ 4434649Swollman struct ifv_linkmib { 4534649Swollman int ifvm_parent; 4634649Swollman u_int16_t ifvm_proto; /* encapsulation ethertype */ 4734649Swollman u_int16_t ifvm_tag; /* tag to apply on packets leaving if */ 4834649Swollman } ifv_mib; 4944764Swpaul SLIST_HEAD(__vlan_mchead, vlan_mc_entry) vlan_mc_listhead; 5034649Swollman}; 5134649Swollman#define ifv_if ifv_ac.ac_if 5234649Swollman#define ifv_tag ifv_mib.ifvm_tag 5334649Swollman#endif /* KERNEL */ 5434649Swollman 5534649Swollmanstruct ether_vlan_header { 5634649Swollman u_char evl_dhost[ETHER_ADDR_LEN]; 5734649Swollman u_char evl_shost[ETHER_ADDR_LEN]; 5834649Swollman u_int16_t evl_encap_proto; 5934649Swollman u_int16_t evl_tag; 6034649Swollman u_int16_t evl_proto; 6134649Swollman}; 6234649Swollman 6334649Swollman#define EVL_VLANOFTAG(tag) ((tag) & 4095) 6434649Swollman#define EVL_PRIOFTAG(tag) (((tag) >> 13) & 7) 6534649Swollman#define EVL_ENCAPLEN 4 /* length in octets of encapsulation */ 6634649Swollman 6734649Swollman/* When these sorts of interfaces get their own identifier... */ 6834649Swollman#define IFT_8021_VLAN IFT_PROPVIRTUAL 6934649Swollman 7034649Swollman/* sysctl(3) tags, for compatibility purposes */ 7134649Swollman#define VLANCTL_PROTO 1 7234649Swollman#define VLANCTL_MAX 2 7334649Swollman 7434649Swollman/* 7534649Swollman * Configuration structure for SIOCSETVLAN and SIOCGETVLAN ioctls. 7634649Swollman */ 7734649Swollmanstruct vlanreq { 7834649Swollman char vlr_parent[IFNAMSIZ]; 7934649Swollman u_short vlr_tag; 8034649Swollman}; 8134649Swollman#define SIOCSETVLAN SIOCSIFGENERIC 8234649Swollman#define SIOCGETVLAN SIOCGIFGENERIC 8334649Swollman 8434649Swollman#ifdef KERNEL 8534649Swollman/* shared with if_ethersubr.c: */ 8634649Swollmanextern u_int vlan_proto; 8734649Swollmanextern int vlan_input(struct ether_header *eh, struct mbuf *m); 8844764Swpaulextern void vlan_input_tag(struct ether_header *eh, 8944764Swpaul struct mbuf *m, u_int16_t t); 9034649Swollman#endif 9134649Swollman 9234649Swollman#endif /* _NET_IF_VLAN_VAR_H_ */ 93