64 #define NS_ALL -1 /* Match all */
65 #define NS_DLS 0
66 #define NS_IPTUN 1
67 #define NS_STR 2 /* autopush list etc */
68 #define NS_HOOK 3
69 #define NS_NETI 4
70 #define NS_ARP 5
71 #define NS_IP 6
72 #define NS_ICMP 7
73 #define NS_UDP 8
74 #define NS_TCP 9
75 #define NS_SCTP 10
76 #define NS_RTS 11
77 #define NS_IPSEC 12
78 #define NS_KEYSOCK 13
79 #define NS_SPDSOCK 14
80 #define NS_IPSECAH 15
81 #define NS_IPSECESP 16
82 #define NS_IPNET 17
83 #define NS_ILB 18
84 #define NS_MAX (NS_ILB+1)
85
86 /*
87 * State maintained for each module which tracks the state of
88 * the create, shutdown and destroy callbacks.
89 *
90 * Keeps track of pending actions to avoid holding locks when
91 * calling into the create/shutdown/destroy functions in the module.
92 */
93 #ifdef _KERNEL
94 typedef struct {
95 uint16_t nms_flags;
96 kcondvar_t nms_cv;
97 } nm_state_t;
98
99 /*
100 * nms_flags
101 */
102 #define NSS_CREATE_NEEDED 0x0001
103 #define NSS_CREATE_INPROGRESS 0x0002
104 #define NSS_CREATE_COMPLETED 0x0004
140 struct {
141 struct dls_stack *nu_dls;
142 struct iptun_stack *nu_iptun;
143 struct str_stack *nu_str;
144 struct hook_stack *nu_hook;
145 struct neti_stack *nu_neti;
146 struct arp_stack *nu_arp;
147 struct ip_stack *nu_ip;
148 struct icmp_stack *nu_icmp;
149 struct udp_stack *nu_udp;
150 struct tcp_stack *nu_tcp;
151 struct sctp_stack *nu_sctp;
152 struct rts_stack *nu_rts;
153 struct ipsec_stack *nu_ipsec;
154 struct keysock_stack *nu_keysock;
155 struct spd_stack *nu_spdsock;
156 struct ipsecah_stack *nu_ipsecah;
157 struct ipsecesp_stack *nu_ipsecesp;
158 struct ipnet_stack *nu_ipnet;
159 struct ilb_stack *nu_ilb;
160 } nu_s;
161 } netstack_u;
162 #define netstack_modules netstack_u.nu_modules
163 #define netstack_dls netstack_u.nu_s.nu_dls
164 #define netstack_iptun netstack_u.nu_s.nu_iptun
165 #define netstack_str netstack_u.nu_s.nu_str
166 #define netstack_hook netstack_u.nu_s.nu_hook
167 #define netstack_neti netstack_u.nu_s.nu_neti
168 #define netstack_arp netstack_u.nu_s.nu_arp
169 #define netstack_ip netstack_u.nu_s.nu_ip
170 #define netstack_icmp netstack_u.nu_s.nu_icmp
171 #define netstack_udp netstack_u.nu_s.nu_udp
172 #define netstack_tcp netstack_u.nu_s.nu_tcp
173 #define netstack_sctp netstack_u.nu_s.nu_sctp
174 #define netstack_rts netstack_u.nu_s.nu_rts
175 #define netstack_ipsec netstack_u.nu_s.nu_ipsec
176 #define netstack_keysock netstack_u.nu_s.nu_keysock
177 #define netstack_spdsock netstack_u.nu_s.nu_spdsock
178 #define netstack_ipsecah netstack_u.nu_s.nu_ipsecah
179 #define netstack_ipsecesp netstack_u.nu_s.nu_ipsecesp
180 #define netstack_ipnet netstack_u.nu_s.nu_ipnet
181 #define netstack_ilb netstack_u.nu_s.nu_ilb
182
183 nm_state_t netstack_m_state[NS_MAX]; /* module state */
184
185 kmutex_t netstack_lock;
186 struct netstack *netstack_next;
187 netstackid_t netstack_stackid;
188 int netstack_numzones; /* Number of zones using this */
189 int netstack_refcnt; /* Number of hold-rele */
190 int netstack_flags; /* See below */
191
192 #ifdef _KERNEL
193 /* Needed to ensure that we run the callback functions in order */
194 kcondvar_t netstack_cv;
195 #endif
196 };
197 typedef struct netstack netstack_t;
198
199 /* netstack_flags values */
200 #define NSF_UNINIT 0x01 /* Not initialized */
201 #define NSF_CLOSING 0x02 /* Going away */
|
64 #define NS_ALL -1 /* Match all */
65 #define NS_DLS 0
66 #define NS_IPTUN 1
67 #define NS_STR 2 /* autopush list etc */
68 #define NS_HOOK 3
69 #define NS_NETI 4
70 #define NS_ARP 5
71 #define NS_IP 6
72 #define NS_ICMP 7
73 #define NS_UDP 8
74 #define NS_TCP 9
75 #define NS_SCTP 10
76 #define NS_RTS 11
77 #define NS_IPSEC 12
78 #define NS_KEYSOCK 13
79 #define NS_SPDSOCK 14
80 #define NS_IPSECAH 15
81 #define NS_IPSECESP 16
82 #define NS_IPNET 17
83 #define NS_ILB 18
84 #define NS_DCCP 19
85 #define NS_MAX (NS_DCCP+1)
86
87 /*
88 * State maintained for each module which tracks the state of
89 * the create, shutdown and destroy callbacks.
90 *
91 * Keeps track of pending actions to avoid holding locks when
92 * calling into the create/shutdown/destroy functions in the module.
93 */
94 #ifdef _KERNEL
95 typedef struct {
96 uint16_t nms_flags;
97 kcondvar_t nms_cv;
98 } nm_state_t;
99
100 /*
101 * nms_flags
102 */
103 #define NSS_CREATE_NEEDED 0x0001
104 #define NSS_CREATE_INPROGRESS 0x0002
105 #define NSS_CREATE_COMPLETED 0x0004
141 struct {
142 struct dls_stack *nu_dls;
143 struct iptun_stack *nu_iptun;
144 struct str_stack *nu_str;
145 struct hook_stack *nu_hook;
146 struct neti_stack *nu_neti;
147 struct arp_stack *nu_arp;
148 struct ip_stack *nu_ip;
149 struct icmp_stack *nu_icmp;
150 struct udp_stack *nu_udp;
151 struct tcp_stack *nu_tcp;
152 struct sctp_stack *nu_sctp;
153 struct rts_stack *nu_rts;
154 struct ipsec_stack *nu_ipsec;
155 struct keysock_stack *nu_keysock;
156 struct spd_stack *nu_spdsock;
157 struct ipsecah_stack *nu_ipsecah;
158 struct ipsecesp_stack *nu_ipsecesp;
159 struct ipnet_stack *nu_ipnet;
160 struct ilb_stack *nu_ilb;
161 struct dccp_stack *nu_dccp;
162 } nu_s;
163 } netstack_u;
164 #define netstack_modules netstack_u.nu_modules
165 #define netstack_dls netstack_u.nu_s.nu_dls
166 #define netstack_iptun netstack_u.nu_s.nu_iptun
167 #define netstack_str netstack_u.nu_s.nu_str
168 #define netstack_hook netstack_u.nu_s.nu_hook
169 #define netstack_neti netstack_u.nu_s.nu_neti
170 #define netstack_arp netstack_u.nu_s.nu_arp
171 #define netstack_ip netstack_u.nu_s.nu_ip
172 #define netstack_icmp netstack_u.nu_s.nu_icmp
173 #define netstack_udp netstack_u.nu_s.nu_udp
174 #define netstack_tcp netstack_u.nu_s.nu_tcp
175 #define netstack_sctp netstack_u.nu_s.nu_sctp
176 #define netstack_rts netstack_u.nu_s.nu_rts
177 #define netstack_ipsec netstack_u.nu_s.nu_ipsec
178 #define netstack_keysock netstack_u.nu_s.nu_keysock
179 #define netstack_spdsock netstack_u.nu_s.nu_spdsock
180 #define netstack_ipsecah netstack_u.nu_s.nu_ipsecah
181 #define netstack_ipsecesp netstack_u.nu_s.nu_ipsecesp
182 #define netstack_ipnet netstack_u.nu_s.nu_ipnet
183 #define netstack_ilb netstack_u.nu_s.nu_ilb
184 #define netstack_dccp netstack_u.nu_s.nu_dccp
185
186 nm_state_t netstack_m_state[NS_MAX]; /* module state */
187
188 kmutex_t netstack_lock;
189 struct netstack *netstack_next;
190 netstackid_t netstack_stackid;
191 int netstack_numzones; /* Number of zones using this */
192 int netstack_refcnt; /* Number of hold-rele */
193 int netstack_flags; /* See below */
194
195 #ifdef _KERNEL
196 /* Needed to ensure that we run the callback functions in order */
197 kcondvar_t netstack_cv;
198 #endif
199 };
200 typedef struct netstack netstack_t;
201
202 /* netstack_flags values */
203 #define NSF_UNINIT 0x01 /* Not initialized */
204 #define NSF_CLOSING 0x02 /* Going away */
|