if_vlan_var.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /* $OpenBSD: if_vlan_var.h,v 1.26 2015/05/20 08:54:37 mpi Exp $ */
  2. /*
  3. * Copyright 1998 Massachusetts Institute of Technology
  4. *
  5. * Permission to use, copy, modify, and distribute this software and
  6. * its documentation for any purpose and without fee is hereby
  7. * granted, provided that both the above copyright notice and this
  8. * permission notice appear in all copies, that both the above
  9. * copyright notice and this permission notice appear in all
  10. * supporting documentation, and that the name of M.I.T. not be used
  11. * in advertising or publicity pertaining to distribution of the
  12. * software without specific, written prior permission. M.I.T. makes
  13. * no representations about the suitability of this software for any
  14. * purpose. It is provided "as is" without express or implied
  15. * warranty.
  16. *
  17. * THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS
  18. * ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE,
  19. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  20. * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
  21. * SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  22. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  23. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  24. * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  25. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  26. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  27. * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  28. * SUCH DAMAGE.
  29. *
  30. * $FreeBSD: src/sys/net/if_vlan_var.h,v 1.3 1999/08/28 00:48:24 peter Exp $
  31. */
  32. #ifndef _NET_IF_VLAN_VAR_H_
  33. #define _NET_IF_VLAN_VAR_H_
  34. struct ether_vlan_header {
  35. u_char evl_dhost[ETHER_ADDR_LEN];
  36. u_char evl_shost[ETHER_ADDR_LEN];
  37. u_int16_t evl_encap_proto;
  38. u_int16_t evl_tag;
  39. u_int16_t evl_proto;
  40. };
  41. #define EVL_VLID_MASK 0x0FFF
  42. #define EVL_VLANOFTAG(tag) ((tag) & EVL_VLID_MASK)
  43. #define EVL_PRIOFTAG(tag) (((tag) >> EVL_PRIO_BITS) & 7)
  44. #define EVL_ENCAPLEN 4 /* length in octets of encapsulation */
  45. #define EVL_PRIO_MAX 7
  46. #define EVL_PRIO_BITS 13
  47. /* sysctl(3) tags, for compatibility purposes */
  48. #define VLANCTL_PROTO 1
  49. #define VLANCTL_MAX 2
  50. /*
  51. * Configuration structure for SIOCSETVLAN and SIOCGETVLAN ioctls.
  52. */
  53. struct vlanreq {
  54. char vlr_parent[IFNAMSIZ];
  55. u_short vlr_tag;
  56. };
  57. #ifdef _KERNEL
  58. #define mc_enm mc_u.mcu_enm
  59. struct vlan_mc_entry {
  60. LIST_ENTRY(vlan_mc_entry) mc_entries;
  61. union {
  62. struct ether_multi *mcu_enm;
  63. } mc_u;
  64. struct sockaddr_storage mc_addr;
  65. };
  66. struct ifvlan {
  67. struct arpcom ifv_ac; /* make this an interface */
  68. struct ifnet *ifv_p; /* parent interface of this vlan */
  69. struct ifv_linkmib {
  70. int ifvm_parent;
  71. u_int16_t ifvm_proto; /* encapsulation ethertype */
  72. u_int16_t ifvm_tag; /* tag to apply on packets leaving if */
  73. u_int16_t ifvm_prio; /* prio to apply on packet leaving if */
  74. u_int16_t ifvm_type; /* non-standard ethertype or 0x8100 */
  75. } ifv_mib;
  76. LIST_HEAD(__vlan_mchead, vlan_mc_entry) vlan_mc_listhead;
  77. LIST_ENTRY(ifvlan) ifv_list;
  78. int ifv_flags;
  79. void *lh_cookie;
  80. void *dh_cookie;
  81. struct ifih *ifv_ifih;
  82. };
  83. #define ifv_if ifv_ac.ac_if
  84. #define ifv_tag ifv_mib.ifvm_tag
  85. #define ifv_prio ifv_mib.ifvm_prio
  86. #define ifv_type ifv_mib.ifvm_type
  87. #define IFVF_PROMISC 0x01
  88. #endif /* _KERNEL */
  89. #endif /* _NET_IF_VLAN_VAR_H_ */