87 (iptun_type == IPTUN_TYPE_6TO4 && family == AF_INET))
88
89 #define IPTUN_HASH_KEY(key) ((mod_hash_key_t)(uintptr_t)(key))
90
91 #define IPTUN_MIN_IPV4_MTU 576 /* ip.h still uses 68 (!) */
92 #define IPTUN_MIN_IPV6_MTU IPV6_MIN_MTU
93 #define IPTUN_MAX_IPV4_MTU (IP_MAXPACKET - sizeof (ipha_t))
94 #define IPTUN_MAX_IPV6_MTU (IP_MAXPACKET - sizeof (ip6_t) - \
95 sizeof (iptun_encaplim_t))
96
97 #define IPTUN_MIN_HOPLIMIT 1
98 #define IPTUN_MAX_HOPLIMIT UINT8_MAX
99
100 #define IPTUN_MIN_ENCAPLIMIT 0
101 #define IPTUN_MAX_ENCAPLIMIT UINT8_MAX
102
103 #define IPTUN_IPSEC_REQ_MASK (IPSEC_PREF_REQUIRED | IPSEC_PREF_NEVER)
104
105 static iptun_encaplim_t iptun_encaplim_init = {
106 { IPPROTO_NONE, 0 },
107 IP6OPT_TUNNEL_LIMIT,
108 1,
109 IPTUN_DEFAULT_ENCAPLIMIT, /* filled in with actual value later */
110 IP6OPT_PADN,
111 1,
112 0
113 };
114
115 /*
116 * Table containing per-iptun-type information.
117 * Since IPv6 can run over all of these we have the IPv6 min as the min MTU.
118 */
119 static iptun_typeinfo_t iptun_type_table[] = {
120 { IPTUN_TYPE_IPV4, MAC_PLUGIN_IDENT_IPV4, IPV4_VERSION,
121 IPTUN_MIN_IPV6_MTU, IPTUN_MAX_IPV4_MTU, B_TRUE },
122 { IPTUN_TYPE_IPV6, MAC_PLUGIN_IDENT_IPV6, IPV6_VERSION,
123 IPTUN_MIN_IPV6_MTU, IPTUN_MAX_IPV6_MTU, B_TRUE },
124 { IPTUN_TYPE_6TO4, MAC_PLUGIN_IDENT_6TO4, IPV4_VERSION,
125 IPTUN_MIN_IPV6_MTU, IPTUN_MAX_IPV4_MTU, B_FALSE },
126 { IPTUN_TYPE_UNKNOWN, NULL, 0, 0, 0, B_FALSE }
127 };
128
129 /*
130 * iptun_hash is an iptun_t lookup table by link ID protected by
131 * iptun_hash_lock. While the hash table's integrity is maintained via
132 * internal locking in the mod_hash_*() functions, we need additional locking
|
87 (iptun_type == IPTUN_TYPE_6TO4 && family == AF_INET))
88
89 #define IPTUN_HASH_KEY(key) ((mod_hash_key_t)(uintptr_t)(key))
90
91 #define IPTUN_MIN_IPV4_MTU 576 /* ip.h still uses 68 (!) */
92 #define IPTUN_MIN_IPV6_MTU IPV6_MIN_MTU
93 #define IPTUN_MAX_IPV4_MTU (IP_MAXPACKET - sizeof (ipha_t))
94 #define IPTUN_MAX_IPV6_MTU (IP_MAXPACKET - sizeof (ip6_t) - \
95 sizeof (iptun_encaplim_t))
96
97 #define IPTUN_MIN_HOPLIMIT 1
98 #define IPTUN_MAX_HOPLIMIT UINT8_MAX
99
100 #define IPTUN_MIN_ENCAPLIMIT 0
101 #define IPTUN_MAX_ENCAPLIMIT UINT8_MAX
102
103 #define IPTUN_IPSEC_REQ_MASK (IPSEC_PREF_REQUIRED | IPSEC_PREF_NEVER)
104
105 static iptun_encaplim_t iptun_encaplim_init = {
106 { IPPROTO_NONE, 0 },
107 { IP6OPT_TUNNEL_LIMIT,
108 1,
109 IPTUN_DEFAULT_ENCAPLIMIT }, /* filled in with actual value later */
110 { IP6OPT_PADN,
111 1,
112 0 }
113 };
114
115 /*
116 * Table containing per-iptun-type information.
117 * Since IPv6 can run over all of these we have the IPv6 min as the min MTU.
118 */
119 static iptun_typeinfo_t iptun_type_table[] = {
120 { IPTUN_TYPE_IPV4, MAC_PLUGIN_IDENT_IPV4, IPV4_VERSION,
121 IPTUN_MIN_IPV6_MTU, IPTUN_MAX_IPV4_MTU, B_TRUE },
122 { IPTUN_TYPE_IPV6, MAC_PLUGIN_IDENT_IPV6, IPV6_VERSION,
123 IPTUN_MIN_IPV6_MTU, IPTUN_MAX_IPV6_MTU, B_TRUE },
124 { IPTUN_TYPE_6TO4, MAC_PLUGIN_IDENT_6TO4, IPV4_VERSION,
125 IPTUN_MIN_IPV6_MTU, IPTUN_MAX_IPV4_MTU, B_FALSE },
126 { IPTUN_TYPE_UNKNOWN, NULL, 0, 0, 0, B_FALSE }
127 };
128
129 /*
130 * iptun_hash is an iptun_t lookup table by link ID protected by
131 * iptun_hash_lock. While the hash table's integrity is maintained via
132 * internal locking in the mod_hash_*() functions, we need additional locking
|