author | Rao Shoaib <Rao.Shoaib@Sun.COM> |
Tue, 23 Dec 2008 11:10:17 -0800 | |
changeset 8444 | af8f67c55009 |
parent 8348 | 4137e18bfaf0 |
child 8477 | eb9540d8095f |
permissions | -rw-r--r-- |
0 | 1 |
/* |
2 |
* CDDL HEADER START |
|
3 |
* |
|
4 |
* The contents of this file are subject to the terms of the |
|
1503
9c3595b79c0d
6376992 IP Classifier hash function for UDP is broken, causing poor UDP performance when using many ports
ericheng
parents:
1216
diff
changeset
|
5 |
* Common Development and Distribution License (the "License"). |
9c3595b79c0d
6376992 IP Classifier hash function for UDP is broken, causing poor UDP performance when using many ports
ericheng
parents:
1216
diff
changeset
|
6 |
* You may not use this file except in compliance with the License. |
0 | 7 |
* |
8 |
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE |
|
9 |
* or http://www.opensolaris.org/os/licensing. |
|
10 |
* See the License for the specific language governing permissions |
|
11 |
* and limitations under the License. |
|
12 |
* |
|
13 |
* When distributing Covered Code, include this CDDL HEADER in each |
|
14 |
* file and include the License file at usr/src/OPENSOLARIS.LICENSE. |
|
15 |
* If applicable, add the following below this CDDL HEADER, with the |
|
16 |
* fields enclosed by brackets "[]" replaced with your own identifying |
|
17 |
* information: Portions Copyright [yyyy] [name of copyright owner] |
|
18 |
* |
|
19 |
* CDDL HEADER END |
|
20 |
*/ |
|
21 |
/* |
|
5815
837c8cd4d6b6
6507173 Sockets should allocate minor numbers from higher order arena
gt145670
parents:
5455
diff
changeset
|
22 |
* Copyright 2008 Sun Microsystems, Inc. All rights reserved. |
0 | 23 |
* Use is subject to license terms. |
24 |
*/ |
|
25 |
||
26 |
#ifndef _INET_IPCLASSIFIER_H |
|
27 |
#define _INET_IPCLASSIFIER_H |
|
28 |
||
29 |
#ifdef __cplusplus |
|
30 |
extern "C" { |
|
31 |
#endif |
|
32 |
||
33 |
#include <inet/common.h> |
|
34 |
#include <inet/ip.h> |
|
35 |
#include <inet/mi.h> |
|
36 |
#include <inet/tcp.h> |
|
37 |
#include <inet/ip6.h> |
|
38 |
#include <netinet/in.h> /* for IPPROTO_* constants */ |
|
39 |
#include <sys/sdt.h> |
|
8348
4137e18bfaf0
PSARC 2007/587 Volo -- Low Latency Socket Framework
Yu Xiangning<Eric.Yu@Sun.COM>
parents:
8275
diff
changeset
|
40 |
#include <sys/socket_proto.h> |
4137e18bfaf0
PSARC 2007/587 Volo -- Low Latency Socket Framework
Yu Xiangning<Eric.Yu@Sun.COM>
parents:
8275
diff
changeset
|
41 |
#include <sys/sunddi.h> |
4137e18bfaf0
PSARC 2007/587 Volo -- Low Latency Socket Framework
Yu Xiangning<Eric.Yu@Sun.COM>
parents:
8275
diff
changeset
|
42 |
#include <sys/sunldi.h> |
0 | 43 |
|
44 |
typedef void (*edesc_spf)(void *, mblk_t *, void *, int); |
|
45 |
typedef void (*edesc_rpf)(void *, mblk_t *, void *); |
|
46 |
||
47 |
/* |
|
48 |
* ============================== |
|
49 |
* = The CONNECTION = |
|
50 |
* ============================== |
|
51 |
*/ |
|
52 |
||
53 |
/* |
|
54 |
* The connection structure contains the common information/flags/ref needed. |
|
55 |
* Implementation will keep the connection struct, the layers (with their |
|
56 |
* respective data for event i.e. tcp_t if event was tcp_input) all in one |
|
57 |
* contiguous memory location. |
|
58 |
*/ |
|
59 |
||
60 |
/* Conn Flags */ |
|
5240 | 61 |
/* Unused 0x00020000 */ |
62 |
/* Unused 0x00040000 */ |
|
741
40027a3621ac
PSARC 2005/082 Yosemite: UDP Performance Enhancement
masputra
parents:
409
diff
changeset
|
63 |
#define IPCL_FULLY_BOUND 0x00080000 /* Bound to correct squeue */ |
40027a3621ac
PSARC 2005/082 Yosemite: UDP Performance Enhancement
masputra
parents:
409
diff
changeset
|
64 |
#define IPCL_CHECK_POLICY 0x00100000 /* Needs policy checking */ |
40027a3621ac
PSARC 2005/082 Yosemite: UDP Performance Enhancement
masputra
parents:
409
diff
changeset
|
65 |
#define IPCL_SOCKET 0x00200000 /* Sockfs connection */ |
40027a3621ac
PSARC 2005/082 Yosemite: UDP Performance Enhancement
masputra
parents:
409
diff
changeset
|
66 |
#define IPCL_ACCEPTOR 0x00400000 /* Sockfs priv acceptor */ |
0 | 67 |
#define IPCL_CL_LISTENER 0x00800000 /* Cluster listener */ |
741
40027a3621ac
PSARC 2005/082 Yosemite: UDP Performance Enhancement
masputra
parents:
409
diff
changeset
|
68 |
#define IPCL_EAGER 0x01000000 /* Incoming connection */ |
5240 | 69 |
/* Unused 0x02000000 */ |
70 |
#define IPCL_TCP6 0x04000000 /* AF_INET6 TCP */ |
|
71 |
#define IPCL_TCP4 0x08000000 /* IPv4 packet format TCP */ |
|
72 |
/* Unused 0x10000000 */ |
|
73 |
/* Unused 0x20000000 */ |
|
741
40027a3621ac
PSARC 2005/082 Yosemite: UDP Performance Enhancement
masputra
parents:
409
diff
changeset
|
74 |
#define IPCL_CONNECTED 0x40000000 /* Conn in connected table */ |
40027a3621ac
PSARC 2005/082 Yosemite: UDP Performance Enhancement
masputra
parents:
409
diff
changeset
|
75 |
#define IPCL_BOUND 0x80000000 /* Conn in bind table */ |
0 | 76 |
|
77 |
/* Flags identifying the type of conn */ |
|
5240 | 78 |
#define IPCL_TCPCONN 0x00000001 /* From tcp_conn_cache */ |
79 |
#define IPCL_SCTPCONN 0x00000002 /* From sctp_conn_cache */ |
|
80 |
#define IPCL_IPCCONN 0x00000004 /* From ip_conn_cache */ |
|
81 |
#define IPCL_UDPCONN 0x00000008 /* From udp_conn_cache */ |
|
82 |
#define IPCL_RAWIPCONN 0x00000010 /* From rawip_conn_cache */ |
|
83 |
#define IPCL_RTSCONN 0x00000020 /* From rts_conn_cache */ |
|
84 |
#define IPCL_ISV6 0x00000040 /* AF_INET6 */ |
|
85 |
#define IPCL_IPTUN 0x00000080 /* Has "tun" plumbed above it */ |
|
8348
4137e18bfaf0
PSARC 2007/587 Volo -- Low Latency Socket Framework
Yu Xiangning<Eric.Yu@Sun.COM>
parents:
8275
diff
changeset
|
86 |
#define IPCL_NONSTR 0x00001000 /* A non-STREAMS socket */ |
4137e18bfaf0
PSARC 2007/587 Volo -- Low Latency Socket Framework
Yu Xiangning<Eric.Yu@Sun.COM>
parents:
8275
diff
changeset
|
87 |
#define IPCL_IN_SQUEUE 0x10000000 /* Waiting squeue to finish */ |
0 | 88 |
|
89 |
/* Conn Masks */ |
|
90 |
#define IPCL_TCP (IPCL_TCP4|IPCL_TCP6) |
|
5240 | 91 |
#define IPCL_REMOVED 0x00000100 |
92 |
#define IPCL_REUSED 0x00000200 |
|
0 | 93 |
|
5240 | 94 |
/* The packet format is IPv4; could be an AF_INET or AF_INET6 socket */ |
0 | 95 |
#define IPCL_IS_TCP4(connp) \ |
96 |
(((connp)->conn_flags & IPCL_TCP4)) |
|
97 |
||
5240 | 98 |
/* Connected AF_INET with no IPsec policy */ |
0 | 99 |
#define IPCL_IS_TCP4_CONNECTED_NO_POLICY(connp) \ |
100 |
(((connp)->conn_flags & \ |
|
101 |
(IPCL_TCP4|IPCL_CONNECTED|IPCL_CHECK_POLICY|IPCL_TCP6)) \ |
|
102 |
== (IPCL_TCP4|IPCL_CONNECTED)) |
|
103 |
||
104 |
#define IPCL_IS_CONNECTED(connp) \ |
|
105 |
((connp)->conn_flags & IPCL_CONNECTED) |
|
106 |
||
107 |
#define IPCL_IS_BOUND(connp) \ |
|
108 |
((connp)->conn_flags & IPCL_BOUND) |
|
109 |
||
5240 | 110 |
/* AF_INET TCP that is bound */ |
0 | 111 |
#define IPCL_IS_TCP4_BOUND(connp) \ |
112 |
(((connp)->conn_flags & \ |
|
113 |
(IPCL_TCP4|IPCL_BOUND|IPCL_TCP6)) == \ |
|
114 |
(IPCL_TCP4|IPCL_BOUND)) |
|
115 |
||
116 |
#define IPCL_IS_FULLY_BOUND(connp) \ |
|
117 |
((connp)->conn_flags & IPCL_FULLY_BOUND) |
|
118 |
||
5240 | 119 |
/* |
120 |
* Can't use conn_protocol since we need to tell difference |
|
121 |
* between a real TCP socket and a SOCK_RAW, IPPROTO_TCP. |
|
122 |
*/ |
|
0 | 123 |
#define IPCL_IS_TCP(connp) \ |
5240 | 124 |
((connp)->conn_flags & IPCL_TCPCONN) |
125 |
||
126 |
#define IPCL_IS_SCTP(connp) \ |
|
127 |
((connp)->conn_flags & IPCL_SCTPCONN) |
|
0 | 128 |
|
741
40027a3621ac
PSARC 2005/082 Yosemite: UDP Performance Enhancement
masputra
parents:
409
diff
changeset
|
129 |
#define IPCL_IS_UDP(connp) \ |
5240 | 130 |
((connp)->conn_flags & IPCL_UDPCONN) |
131 |
||
132 |
#define IPCL_IS_RAWIP(connp) \ |
|
133 |
((connp)->conn_flags & IPCL_RAWIPCONN) |
|
741
40027a3621ac
PSARC 2005/082 Yosemite: UDP Performance Enhancement
masputra
parents:
409
diff
changeset
|
134 |
|
5240 | 135 |
#define IPCL_IS_RTS(connp) \ |
136 |
((connp)->conn_flags & IPCL_RTSCONN) |
|
137 |
||
138 |
/* FIXME: Isn't it sufficient to check IPCL_IPTUN? */ |
|
0 | 139 |
#define IPCL_IS_IPTUN(connp) \ |
3055 | 140 |
(((connp)->conn_ulp == IPPROTO_ENCAP || \ |
141 |
(connp)->conn_ulp == IPPROTO_IPV6) && \ |
|
142 |
((connp)->conn_flags & IPCL_IPTUN)) |
|
0 | 143 |
|
8348
4137e18bfaf0
PSARC 2007/587 Volo -- Low Latency Socket Framework
Yu Xiangning<Eric.Yu@Sun.COM>
parents:
8275
diff
changeset
|
144 |
#define IPCL_IS_NONSTR(connp) ((connp)->conn_flags & IPCL_NONSTR) |
4137e18bfaf0
PSARC 2007/587 Volo -- Low Latency Socket Framework
Yu Xiangning<Eric.Yu@Sun.COM>
parents:
8275
diff
changeset
|
145 |
|
0 | 146 |
typedef struct connf_s connf_t; |
3448 | 147 |
|
0 | 148 |
typedef struct |
149 |
{ |
|
150 |
int ctb_depth; |
|
5023
e0c678e511a7
6203568 accumulating number of threads behind rw_lock in ire_walk_ill_tables IRB_REFRELE
carlsonj
parents:
4972
diff
changeset
|
151 |
#define CONN_STACK_DEPTH 15 |
e0c678e511a7
6203568 accumulating number of threads behind rw_lock in ire_walk_ill_tables IRB_REFRELE
carlsonj
parents:
4972
diff
changeset
|
152 |
pc_t ctb_stack[CONN_STACK_DEPTH]; |
0 | 153 |
} conn_trace_t; |
154 |
||
8348
4137e18bfaf0
PSARC 2007/587 Volo -- Low Latency Socket Framework
Yu Xiangning<Eric.Yu@Sun.COM>
parents:
8275
diff
changeset
|
155 |
typedef struct ip_helper_minor_info_s { |
4137e18bfaf0
PSARC 2007/587 Volo -- Low Latency Socket Framework
Yu Xiangning<Eric.Yu@Sun.COM>
parents:
8275
diff
changeset
|
156 |
dev_t ip_minfo_dev; /* Device */ |
4137e18bfaf0
PSARC 2007/587 Volo -- Low Latency Socket Framework
Yu Xiangning<Eric.Yu@Sun.COM>
parents:
8275
diff
changeset
|
157 |
vmem_t *ip_minfo_arena; /* Arena */ |
4137e18bfaf0
PSARC 2007/587 Volo -- Low Latency Socket Framework
Yu Xiangning<Eric.Yu@Sun.COM>
parents:
8275
diff
changeset
|
158 |
} ip_helper_minfo_t; |
4137e18bfaf0
PSARC 2007/587 Volo -- Low Latency Socket Framework
Yu Xiangning<Eric.Yu@Sun.COM>
parents:
8275
diff
changeset
|
159 |
|
4137e18bfaf0
PSARC 2007/587 Volo -- Low Latency Socket Framework
Yu Xiangning<Eric.Yu@Sun.COM>
parents:
8275
diff
changeset
|
160 |
/* |
4137e18bfaf0
PSARC 2007/587 Volo -- Low Latency Socket Framework
Yu Xiangning<Eric.Yu@Sun.COM>
parents:
8275
diff
changeset
|
161 |
* ip helper stream info |
4137e18bfaf0
PSARC 2007/587 Volo -- Low Latency Socket Framework
Yu Xiangning<Eric.Yu@Sun.COM>
parents:
8275
diff
changeset
|
162 |
*/ |
4137e18bfaf0
PSARC 2007/587 Volo -- Low Latency Socket Framework
Yu Xiangning<Eric.Yu@Sun.COM>
parents:
8275
diff
changeset
|
163 |
typedef struct ip_helper_stream_info_s { |
8444
af8f67c55009
6787918 system panics if ip_create_helper_stream() is interrupted
Rao Shoaib <Rao.Shoaib@Sun.COM>
parents:
8348
diff
changeset
|
164 |
ldi_handle_t iphs_handle; |
af8f67c55009
6787918 system panics if ip_create_helper_stream() is interrupted
Rao Shoaib <Rao.Shoaib@Sun.COM>
parents:
8348
diff
changeset
|
165 |
queue_t *iphs_rq; |
af8f67c55009
6787918 system panics if ip_create_helper_stream() is interrupted
Rao Shoaib <Rao.Shoaib@Sun.COM>
parents:
8348
diff
changeset
|
166 |
queue_t *iphs_wq; |
af8f67c55009
6787918 system panics if ip_create_helper_stream() is interrupted
Rao Shoaib <Rao.Shoaib@Sun.COM>
parents:
8348
diff
changeset
|
167 |
ip_helper_minfo_t *iphs_minfo; |
8348
4137e18bfaf0
PSARC 2007/587 Volo -- Low Latency Socket Framework
Yu Xiangning<Eric.Yu@Sun.COM>
parents:
8275
diff
changeset
|
168 |
} ip_helper_stream_info_t; |
4137e18bfaf0
PSARC 2007/587 Volo -- Low Latency Socket Framework
Yu Xiangning<Eric.Yu@Sun.COM>
parents:
8275
diff
changeset
|
169 |
|
5240 | 170 |
/* |
171 |
* The initial fields in the conn_t are setup by the kmem_cache constructor, |
|
172 |
* and are preserved when it is freed. Fields after that are bzero'ed when |
|
173 |
* the conn_t is freed. |
|
174 |
*/ |
|
0 | 175 |
struct conn_s { |
176 |
kmutex_t conn_lock; |
|
177 |
uint32_t conn_ref; /* Reference counter */ |
|
5240 | 178 |
uint32_t conn_flags; /* Conn Flags */ |
179 |
||
180 |
||
181 |
union { |
|
182 |
tcp_t *cp_tcp; /* Pointer to the tcp struct */ |
|
183 |
struct udp_s *cp_udp; /* Pointer to the udp struct */ |
|
184 |
struct icmp_s *cp_icmp; /* Pointer to rawip struct */ |
|
185 |
struct rts_s *cp_rts; /* Pointer to rts struct */ |
|
186 |
void *cp_priv; |
|
187 |
} conn_proto_priv; |
|
188 |
#define conn_tcp conn_proto_priv.cp_tcp |
|
189 |
#define conn_udp conn_proto_priv.cp_udp |
|
190 |
#define conn_icmp conn_proto_priv.cp_icmp |
|
191 |
#define conn_rts conn_proto_priv.cp_rts |
|
192 |
#define conn_priv conn_proto_priv.cp_priv |
|
193 |
||
194 |
kcondvar_t conn_cv; |
|
195 |
uint8_t conn_ulp; /* protocol type */ |
|
196 |
||
197 |
edesc_rpf conn_recv; /* Pointer to recv routine */ |
|
198 |
||
199 |
/* Fields after this are bzero'ed when the conn_t is freed. */ |
|
200 |
||
201 |
squeue_t *conn_sqp; /* Squeue for processing */ |
|
0 | 202 |
uint_t conn_state_flags; /* IP state flags */ |
5240 | 203 |
#define conn_start_clr conn_state_flags |
204 |
||
0 | 205 |
ire_t *conn_ire_cache; /* outbound ire cache */ |
206 |
unsigned int |
|
207 |
conn_on_sqp : 1, /* Conn is being processed */ |
|
208 |
conn_dontroute : 1, /* SO_DONTROUTE state */ |
|
209 |
conn_loopback : 1, /* SO_LOOPBACK state */ |
|
210 |
conn_broadcast : 1, /* SO_BROADCAST state */ |
|
1676 | 211 |
|
0 | 212 |
conn_reuseaddr : 1, /* SO_REUSEADDR state */ |
213 |
conn_multicast_loop : 1, /* IP_MULTICAST_LOOP */ |
|
214 |
conn_multi_router : 1, /* Wants all multicast pkts */ |
|
215 |
conn_draining : 1, /* ip_wsrv running */ |
|
1676 | 216 |
|
0 | 217 |
conn_did_putbq : 1, /* ip_wput did a putbq */ |
218 |
conn_unspec_src : 1, /* IP_UNSPEC_SRC */ |
|
219 |
conn_policy_cached : 1, /* Is policy cached/latched ? */ |
|
220 |
conn_in_enforce_policy : 1, /* Enforce Policy on inbound */ |
|
1676 | 221 |
|
0 | 222 |
conn_out_enforce_policy : 1, /* Enforce Policy on outbound */ |
223 |
conn_af_isv6 : 1, /* ip address family ver 6 */ |
|
224 |
conn_pkt_isv6 : 1, /* ip packet format ver 6 */ |
|
3318 | 225 |
conn_ip_recvpktinfo : 1, /* IPV*_RECVPKTINFO option */ |
1676 | 226 |
|
0 | 227 |
conn_ipv6_recvhoplimit : 1, /* IPV6_RECVHOPLIMIT option */ |
228 |
conn_ipv6_recvhopopts : 1, /* IPV6_RECVHOPOPTS option */ |
|
229 |
conn_ipv6_recvdstopts : 1, /* IPV6_RECVDSTOPTS option */ |
|
230 |
conn_ipv6_recvrthdr : 1, /* IPV6_RECVRTHDR option */ |
|
1676 | 231 |
|
0 | 232 |
conn_ipv6_recvrtdstopts : 1, /* IPV6_RECVRTHDRDSTOPTS */ |
233 |
conn_ipv6_v6only : 1, /* IPV6_V6ONLY */ |
|
234 |
conn_ipv6_recvtclass : 1, /* IPV6_RECVTCLASS */ |
|
235 |
conn_ipv6_recvpathmtu : 1, /* IPV6_RECVPATHMTU */ |
|
1676 | 236 |
|
0 | 237 |
conn_pathmtu_valid : 1, /* The cached mtu is valid. */ |
238 |
conn_ipv6_dontfrag : 1, /* IPV6_DONTFRAG */ |
|
239 |
conn_fully_bound : 1, /* Fully bound connection */ |
|
240 |
conn_recvif : 1, /* IP_RECVIF option */ |
|
1676 | 241 |
|
0 | 242 |
conn_recvslla : 1, /* IP_RECVSLLA option */ |
243 |
conn_mdt_ok : 1, /* MDT is permitted */ |
|
1095 | 244 |
conn_nexthop_set : 1, |
8275
7c223a798022
PSARC/2006/357 Crossbow - Network Virtualization and Resource Management
Eric Cheng
parents:
5815
diff
changeset
|
245 |
conn_allzones : 1; /* SO_ALLZONES */ |
3115 | 246 |
|
8275
7c223a798022
PSARC/2006/357 Crossbow - Network Virtualization and Resource Management
Eric Cheng
parents:
5815
diff
changeset
|
247 |
unsigned int |
3115 | 248 |
conn_lso_ok : 1; /* LSO is usable */ |
0 | 249 |
|
8275
7c223a798022
PSARC/2006/357 Crossbow - Network Virtualization and Resource Management
Eric Cheng
parents:
5815
diff
changeset
|
250 |
squeue_t *conn_initial_sqp; /* Squeue at open time */ |
7c223a798022
PSARC/2006/357 Crossbow - Network Virtualization and Resource Management
Eric Cheng
parents:
5815
diff
changeset
|
251 |
squeue_t *conn_final_sqp; /* Squeue after connect */ |
0 | 252 |
ill_t *conn_nofailover_ill; /* Failover ill */ |
5381
6bff17151099
PSARC/2007/565 IP_XMIT_IF removal and IP_BOUND_IF rationalization
meem
parents:
5240
diff
changeset
|
253 |
ill_t *conn_dhcpinit_ill; /* IP_DHCPINIT_IF */ |
0 | 254 |
ipsec_latch_t *conn_latch; /* latched state */ |
255 |
ill_t *conn_outgoing_ill; /* IP{,V6}_BOUND_IF */ |
|
256 |
edesc_spf conn_send; /* Pointer to send routine */ |
|
257 |
queue_t *conn_rq; /* Read queue */ |
|
258 |
queue_t *conn_wq; /* Write queue */ |
|
259 |
dev_t conn_dev; /* Minor number */ |
|
5815
837c8cd4d6b6
6507173 Sockets should allocate minor numbers from higher order arena
gt145670
parents:
5455
diff
changeset
|
260 |
vmem_t *conn_minor_arena; /* Minor arena */ |
8348
4137e18bfaf0
PSARC 2007/587 Volo -- Low Latency Socket Framework
Yu Xiangning<Eric.Yu@Sun.COM>
parents:
8275
diff
changeset
|
261 |
ip_helper_stream_info_t *conn_helper_info; |
0 | 262 |
|
263 |
cred_t *conn_cred; /* Credentials */ |
|
264 |
connf_t *conn_g_fanout; /* Global Hash bucket head */ |
|
265 |
struct conn_s *conn_g_next; /* Global Hash chain next */ |
|
266 |
struct conn_s *conn_g_prev; /* Global Hash chain prev */ |
|
267 |
struct ipsec_policy_head_s *conn_policy; /* Configured policy */ |
|
268 |
in6_addr_t conn_bound_source_v6; |
|
269 |
#define conn_bound_source V4_PART_OF_V6(conn_bound_source_v6) |
|
270 |
||
271 |
connf_t *conn_fanout; /* Hash bucket we're part of */ |
|
272 |
struct conn_s *conn_next; /* Hash chain next */ |
|
273 |
struct conn_s *conn_prev; /* Hash chain prev */ |
|
274 |
struct { |
|
275 |
in6_addr_t connua_laddr; /* Local address */ |
|
276 |
in6_addr_t connua_faddr; /* Remote address */ |
|
277 |
} connua_v6addr; |
|
278 |
#define conn_src V4_PART_OF_V6(connua_v6addr.connua_laddr) |
|
279 |
#define conn_rem V4_PART_OF_V6(connua_v6addr.connua_faddr) |
|
280 |
#define conn_srcv6 connua_v6addr.connua_laddr |
|
281 |
#define conn_remv6 connua_v6addr.connua_faddr |
|
282 |
union { |
|
283 |
/* Used for classifier match performance */ |
|
284 |
uint32_t conn_ports2; |
|
285 |
struct { |
|
286 |
in_port_t tcpu_fport; /* Remote port */ |
|
287 |
in_port_t tcpu_lport; /* Local port */ |
|
288 |
} tcpu_ports; |
|
289 |
} u_port; |
|
290 |
#define conn_fport u_port.tcpu_ports.tcpu_fport |
|
291 |
#define conn_lport u_port.tcpu_ports.tcpu_lport |
|
292 |
#define conn_ports u_port.conn_ports2 |
|
293 |
#define conn_upq conn_rq |
|
294 |
uint8_t conn_unused_byte; |
|
295 |
||
296 |
uint_t conn_proto; /* SO_PROTOTYPE state */ |
|
297 |
ill_t *conn_incoming_ill; /* IP{,V6}_BOUND_IF */ |
|
298 |
ill_t *conn_outgoing_pill; /* IP{,V6}_BOUND_PIF */ |
|
299 |
ill_t *conn_oper_pending_ill; /* pending shared ioctl */ |
|
300 |
||
301 |
ilg_t *conn_ilg; /* Group memberships */ |
|
302 |
int conn_ilg_allocated; /* Number allocated */ |
|
303 |
int conn_ilg_inuse; /* Number currently used */ |
|
304 |
int conn_ilg_walker_cnt; /* No of ilg walkers */ |
|
305 |
/* XXXX get rid of this, once ilg_delete_all is fixed */ |
|
306 |
kcondvar_t conn_refcv; |
|
307 |
||
308 |
struct ipif_s *conn_multicast_ipif; /* IP_MULTICAST_IF */ |
|
309 |
ill_t *conn_multicast_ill; /* IPV6_MULTICAST_IF */ |
|
310 |
int conn_orig_bound_ifindex; /* BOUND_IF before MOVE */ |
|
311 |
int conn_orig_multicast_ifindex; |
|
312 |
/* IPv6 MC IF before MOVE */ |
|
8275
7c223a798022
PSARC/2006/357 Crossbow - Network Virtualization and Resource Management
Eric Cheng
parents:
5815
diff
changeset
|
313 |
struct conn_s *conn_drain_next; /* Next conn in drain list */ |
7c223a798022
PSARC/2006/357 Crossbow - Network Virtualization and Resource Management
Eric Cheng
parents:
5815
diff
changeset
|
314 |
struct conn_s *conn_drain_prev; /* Prev conn in drain list */ |
0 | 315 |
idl_t *conn_idl; /* Ptr to the drain list head */ |
316 |
mblk_t *conn_ipsec_opt_mp; /* ipsec option mblk */ |
|
317 |
uint32_t conn_src_preferences; /* prefs for src addr select */ |
|
318 |
/* mtuinfo from IPV6_PACKET_TOO_BIG conditional on conn_pathmtu_valid */ |
|
319 |
struct ip6_mtuinfo mtuinfo; |
|
320 |
zoneid_t conn_zoneid; /* zone connection is in */ |
|
1095 | 321 |
in6_addr_t conn_nexthop_v6; /* nexthop IP address */ |
5455 | 322 |
uchar_t conn_broadcast_ttl; /* IP_BROADCAST_TTL */ |
1095 | 323 |
#define conn_nexthop_v4 V4_PART_OF_V6(conn_nexthop_v6) |
1676 | 324 |
cred_t *conn_peercred; /* Peer credentials, if any */ |
325 |
||
8348
4137e18bfaf0
PSARC 2007/587 Volo -- Low Latency Socket Framework
Yu Xiangning<Eric.Yu@Sun.COM>
parents:
8275
diff
changeset
|
326 |
kcondvar_t conn_sq_cv; /* For non-STREAMS socket IO */ |
4137e18bfaf0
PSARC 2007/587 Volo -- Low Latency Socket Framework
Yu Xiangning<Eric.Yu@Sun.COM>
parents:
8275
diff
changeset
|
327 |
kthread_t *conn_sq_caller; /* Caller of squeue sync ops */ |
4137e18bfaf0
PSARC 2007/587 Volo -- Low Latency Socket Framework
Yu Xiangning<Eric.Yu@Sun.COM>
parents:
8275
diff
changeset
|
328 |
sock_upcalls_t *conn_upcalls; /* Upcalls to sockfs */ |
4137e18bfaf0
PSARC 2007/587 Volo -- Low Latency Socket Framework
Yu Xiangning<Eric.Yu@Sun.COM>
parents:
8275
diff
changeset
|
329 |
sock_upper_handle_t conn_upper_handle; /* Upper handle: sonode * */ |
4137e18bfaf0
PSARC 2007/587 Volo -- Low Latency Socket Framework
Yu Xiangning<Eric.Yu@Sun.COM>
parents:
8275
diff
changeset
|
330 |
|
1676 | 331 |
unsigned int |
332 |
conn_ulp_labeled : 1, /* ULP label is synced */ |
|
333 |
conn_mlp_type : 2, /* mlp_type_t; tsol/tndb.h */ |
|
334 |
conn_anon_mlp : 1, /* user wants anon MLP */ |
|
335 |
||
336 |
conn_anon_port : 1, /* user bound anonymously */ |
|
337 |
conn_mac_exempt : 1, /* unlabeled with loose MAC */ |
|
338 |
conn_spare : 26; |
|
8348
4137e18bfaf0
PSARC 2007/587 Volo -- Low Latency Socket Framework
Yu Xiangning<Eric.Yu@Sun.COM>
parents:
8275
diff
changeset
|
339 |
|
4137e18bfaf0
PSARC 2007/587 Volo -- Low Latency Socket Framework
Yu Xiangning<Eric.Yu@Sun.COM>
parents:
8275
diff
changeset
|
340 |
boolean_t conn_flow_cntrld; |
3448 | 341 |
netstack_t *conn_netstack; /* Corresponds to a netstack_hold */ |
0 | 342 |
#ifdef CONN_DEBUG |
343 |
#define CONN_TRACE_MAX 10 |
|
344 |
int conn_trace_last; /* ndx of last used tracebuf */ |
|
345 |
conn_trace_t conn_trace_buf[CONN_TRACE_MAX]; |
|
346 |
#endif |
|
347 |
}; |
|
348 |
||
1676 | 349 |
#define CONN_CRED(connp) ((connp)->conn_peercred == NULL ? \ |
350 |
(connp)->conn_cred : (connp)->conn_peercred) |
|
351 |
#define BEST_CRED(mp, connp) ((DB_CRED(mp) != NULL && \ |
|
352 |
crgetlabel(DB_CRED(mp)) != NULL) ? DB_CRED(mp) : CONN_CRED(connp)) |
|
353 |
||
0 | 354 |
/* |
355 |
* connf_t - connection fanout data. |
|
356 |
* |
|
357 |
* The hash tables and their linkage (conn_t.{hashnextp, hashprevp} are |
|
358 |
* protected by the per-bucket lock. Each conn_t inserted in the list |
|
359 |
* points back at the connf_t that heads the bucket. |
|
360 |
*/ |
|
361 |
struct connf_s { |
|
362 |
struct conn_s *connf_head; |
|
363 |
kmutex_t connf_lock; |
|
364 |
}; |
|
365 |
||
366 |
#define CONN_INC_REF(connp) { \ |
|
3104
fba3fdffbc25
6265494 assertion failed: sqp != NULL, file: ../../common/inet/squeue.c, line: 715
jprakash
parents:
3055
diff
changeset
|
367 |
mutex_enter(&(connp)->conn_lock); \ |
0 | 368 |
DTRACE_PROBE1(conn__inc__ref, conn_t *, connp); \ |
369 |
ASSERT(conn_trace_ref(connp)); \ |
|
370 |
(connp)->conn_ref++; \ |
|
371 |
ASSERT((connp)->conn_ref != 0); \ |
|
372 |
mutex_exit(&(connp)->conn_lock); \ |
|
373 |
} |
|
374 |
||
375 |
#define CONN_INC_REF_LOCKED(connp) { \ |
|
376 |
DTRACE_PROBE1(conn__inc__ref, conn_t *, connp); \ |
|
377 |
ASSERT(MUTEX_HELD(&(connp)->conn_lock)); \ |
|
378 |
ASSERT(conn_trace_ref(connp)); \ |
|
379 |
(connp)->conn_ref++; \ |
|
380 |
ASSERT((connp)->conn_ref != 0); \ |
|
381 |
} |
|
382 |
||
383 |
#define CONN_DEC_REF(connp) { \ |
|
3104
fba3fdffbc25
6265494 assertion failed: sqp != NULL, file: ../../common/inet/squeue.c, line: 715
jprakash
parents:
3055
diff
changeset
|
384 |
mutex_enter(&(connp)->conn_lock); \ |
0 | 385 |
DTRACE_PROBE1(conn__dec__ref, conn_t *, connp); \ |
3104
fba3fdffbc25
6265494 assertion failed: sqp != NULL, file: ../../common/inet/squeue.c, line: 715
jprakash
parents:
3055
diff
changeset
|
386 |
/* \ |
fba3fdffbc25
6265494 assertion failed: sqp != NULL, file: ../../common/inet/squeue.c, line: 715
jprakash
parents:
3055
diff
changeset
|
387 |
* The squeue framework always does a CONN_DEC_REF after return \ |
fba3fdffbc25
6265494 assertion failed: sqp != NULL, file: ../../common/inet/squeue.c, line: 715
jprakash
parents:
3055
diff
changeset
|
388 |
* from TCP. Hence the refcnt must be at least 2 if conn_on_sqp \ |
fba3fdffbc25
6265494 assertion failed: sqp != NULL, file: ../../common/inet/squeue.c, line: 715
jprakash
parents:
3055
diff
changeset
|
389 |
* is B_TRUE and conn_ref is being decremented. This is to \ |
fba3fdffbc25
6265494 assertion failed: sqp != NULL, file: ../../common/inet/squeue.c, line: 715
jprakash
parents:
3055
diff
changeset
|
390 |
* account for the mblk being currently processed. \ |
fba3fdffbc25
6265494 assertion failed: sqp != NULL, file: ../../common/inet/squeue.c, line: 715
jprakash
parents:
3055
diff
changeset
|
391 |
*/ \ |
fba3fdffbc25
6265494 assertion failed: sqp != NULL, file: ../../common/inet/squeue.c, line: 715
jprakash
parents:
3055
diff
changeset
|
392 |
if ((connp)->conn_ref <= 0 || \ |
fba3fdffbc25
6265494 assertion failed: sqp != NULL, file: ../../common/inet/squeue.c, line: 715
jprakash
parents:
3055
diff
changeset
|
393 |
((connp)->conn_ref == 1 && (connp)->conn_on_sqp)) \ |
0 | 394 |
cmn_err(CE_PANIC, "CONN_DEC_REF: connp(%p) has ref " \ |
395 |
"= %d\n", (void *)(connp), (connp)->conn_ref); \ |
|
396 |
ASSERT(conn_untrace_ref(connp)); \ |
|
397 |
(connp)->conn_ref--; \ |
|
398 |
if ((connp)->conn_ref == 0) { \ |
|
399 |
/* Refcnt can't increase again, safe to drop lock */ \ |
|
400 |
mutex_exit(&(connp)->conn_lock); \ |
|
401 |
ipcl_conn_destroy(connp); \ |
|
402 |
} else { \ |
|
403 |
cv_broadcast(&(connp)->conn_cv); \ |
|
404 |
mutex_exit(&(connp)->conn_lock); \ |
|
405 |
} \ |
|
406 |
} |
|
407 |
||
2263
fd48046384d0
PSARC 2006/073 PF_ROUTE: Include interface name with RTM_NEWADDR/RTM_DELADDR
sommerfe
parents:
1676
diff
changeset
|
408 |
/* |
fd48046384d0
PSARC 2006/073 PF_ROUTE: Include interface name with RTM_NEWADDR/RTM_DELADDR
sommerfe
parents:
1676
diff
changeset
|
409 |
* For use with subsystems within ip which use ALL_ZONES as a wildcard |
fd48046384d0
PSARC 2006/073 PF_ROUTE: Include interface name with RTM_NEWADDR/RTM_DELADDR
sommerfe
parents:
1676
diff
changeset
|
410 |
*/ |
fd48046384d0
PSARC 2006/073 PF_ROUTE: Include interface name with RTM_NEWADDR/RTM_DELADDR
sommerfe
parents:
1676
diff
changeset
|
411 |
#define IPCL_ZONEID(connp) \ |
fd48046384d0
PSARC 2006/073 PF_ROUTE: Include interface name with RTM_NEWADDR/RTM_DELADDR
sommerfe
parents:
1676
diff
changeset
|
412 |
((connp)->conn_allzones ? ALL_ZONES : (connp)->conn_zoneid) |
fd48046384d0
PSARC 2006/073 PF_ROUTE: Include interface name with RTM_NEWADDR/RTM_DELADDR
sommerfe
parents:
1676
diff
changeset
|
413 |
|
fd48046384d0
PSARC 2006/073 PF_ROUTE: Include interface name with RTM_NEWADDR/RTM_DELADDR
sommerfe
parents:
1676
diff
changeset
|
414 |
/* |
fd48046384d0
PSARC 2006/073 PF_ROUTE: Include interface name with RTM_NEWADDR/RTM_DELADDR
sommerfe
parents:
1676
diff
changeset
|
415 |
* For matching between a conn_t and a zoneid. |
fd48046384d0
PSARC 2006/073 PF_ROUTE: Include interface name with RTM_NEWADDR/RTM_DELADDR
sommerfe
parents:
1676
diff
changeset
|
416 |
*/ |
fd48046384d0
PSARC 2006/073 PF_ROUTE: Include interface name with RTM_NEWADDR/RTM_DELADDR
sommerfe
parents:
1676
diff
changeset
|
417 |
#define IPCL_ZONE_MATCH(connp, zoneid) \ |
fd48046384d0
PSARC 2006/073 PF_ROUTE: Include interface name with RTM_NEWADDR/RTM_DELADDR
sommerfe
parents:
1676
diff
changeset
|
418 |
(((connp)->conn_allzones) || \ |
fd48046384d0
PSARC 2006/073 PF_ROUTE: Include interface name with RTM_NEWADDR/RTM_DELADDR
sommerfe
parents:
1676
diff
changeset
|
419 |
((zoneid) == ALL_ZONES) || \ |
fd48046384d0
PSARC 2006/073 PF_ROUTE: Include interface name with RTM_NEWADDR/RTM_DELADDR
sommerfe
parents:
1676
diff
changeset
|
420 |
(connp)->conn_zoneid == (zoneid)) |
fd48046384d0
PSARC 2006/073 PF_ROUTE: Include interface name with RTM_NEWADDR/RTM_DELADDR
sommerfe
parents:
1676
diff
changeset
|
421 |
|
fd48046384d0
PSARC 2006/073 PF_ROUTE: Include interface name with RTM_NEWADDR/RTM_DELADDR
sommerfe
parents:
1676
diff
changeset
|
422 |
|
0 | 423 |
#define _IPCL_V4_MATCH(v6addr, v4addr) \ |
424 |
(V4_PART_OF_V6((v6addr)) == (v4addr) && IN6_IS_ADDR_V4MAPPED(&(v6addr))) |
|
425 |
||
426 |
#define _IPCL_V4_MATCH_ANY(addr) \ |
|
427 |
(IN6_IS_ADDR_V4MAPPED_ANY(&(addr)) || IN6_IS_ADDR_UNSPECIFIED(&(addr))) |
|
428 |
||
2263
fd48046384d0
PSARC 2006/073 PF_ROUTE: Include interface name with RTM_NEWADDR/RTM_DELADDR
sommerfe
parents:
1676
diff
changeset
|
429 |
|
0 | 430 |
/* |
431 |
* IPCL_PROTO_MATCH() only matches conns with the specified zoneid, while |
|
432 |
* IPCL_PROTO_MATCH_V6() can match other conns in the multicast case, see |
|
433 |
* ip_fanout_proto(). |
|
434 |
*/ |
|
435 |
#define IPCL_PROTO_MATCH(connp, protocol, ipha, ill, \ |
|
436 |
fanout_flags, zoneid) \ |
|
437 |
((((connp)->conn_src == INADDR_ANY) || \ |
|
438 |
(((connp)->conn_src == ((ipha)->ipha_dst)) && \ |
|
2263
fd48046384d0
PSARC 2006/073 PF_ROUTE: Include interface name with RTM_NEWADDR/RTM_DELADDR
sommerfe
parents:
1676
diff
changeset
|
439 |
(((connp)->conn_rem == INADDR_ANY) || \ |
0 | 440 |
((connp)->conn_rem == ((ipha)->ipha_src))))) && \ |
2263
fd48046384d0
PSARC 2006/073 PF_ROUTE: Include interface name with RTM_NEWADDR/RTM_DELADDR
sommerfe
parents:
1676
diff
changeset
|
441 |
IPCL_ZONE_MATCH(connp, zoneid) && \ |
fd48046384d0
PSARC 2006/073 PF_ROUTE: Include interface name with RTM_NEWADDR/RTM_DELADDR
sommerfe
parents:
1676
diff
changeset
|
442 |
(conn_wantpacket((connp), (ill), (ipha), (fanout_flags), \ |
fd48046384d0
PSARC 2006/073 PF_ROUTE: Include interface name with RTM_NEWADDR/RTM_DELADDR
sommerfe
parents:
1676
diff
changeset
|
443 |
(zoneid)) || ((protocol) == IPPROTO_PIM) || \ |
fd48046384d0
PSARC 2006/073 PF_ROUTE: Include interface name with RTM_NEWADDR/RTM_DELADDR
sommerfe
parents:
1676
diff
changeset
|
444 |
((protocol) == IPPROTO_RSVP))) |
0 | 445 |
|
446 |
#define IPCL_PROTO_MATCH_V6(connp, protocol, ip6h, ill, \ |
|
447 |
fanout_flags, zoneid) \ |
|
448 |
((IN6_IS_ADDR_UNSPECIFIED(&(connp)->conn_srcv6) || \ |
|
449 |
(IN6_ARE_ADDR_EQUAL(&(connp)->conn_srcv6, &((ip6h)->ip6_dst)) && \ |
|
450 |
(IN6_IS_ADDR_UNSPECIFIED(&(connp)->conn_remv6) || \ |
|
451 |
IN6_ARE_ADDR_EQUAL(&(connp)->conn_remv6, &((ip6h)->ip6_src))))) && \ |
|
452 |
(conn_wantpacket_v6((connp), (ill), (ip6h), \ |
|
453 |
(fanout_flags), (zoneid)) || ((protocol) == IPPROTO_RSVP))) |
|
454 |
||
3448 | 455 |
#define IPCL_CONN_HASH(src, ports, ipst) \ |
0 | 456 |
((unsigned)(ntohl((src)) ^ ((ports) >> 24) ^ ((ports) >> 16) ^ \ |
3448 | 457 |
((ports) >> 8) ^ (ports)) % (ipst)->ips_ipcl_conn_fanout_size) |
0 | 458 |
|
3448 | 459 |
#define IPCL_CONN_HASH_V6(src, ports, ipst) \ |
460 |
IPCL_CONN_HASH(V4_PART_OF_V6((src)), (ports), (ipst)) |
|
0 | 461 |
|
462 |
#define IPCL_CONN_MATCH(connp, proto, src, dst, ports) \ |
|
463 |
((connp)->conn_ulp == (proto) && \ |
|
464 |
(connp)->conn_ports == (ports) && \ |
|
465 |
_IPCL_V4_MATCH((connp)->conn_remv6, (src)) && \ |
|
466 |
_IPCL_V4_MATCH((connp)->conn_srcv6, (dst)) && \ |
|
467 |
!(connp)->conn_ipv6_v6only) |
|
468 |
||
469 |
#define IPCL_CONN_MATCH_V6(connp, proto, src, dst, ports) \ |
|
470 |
((connp)->conn_ulp == (proto) && \ |
|
471 |
(connp)->conn_ports == (ports) && \ |
|
472 |
IN6_ARE_ADDR_EQUAL(&(connp)->conn_remv6, &(src)) && \ |
|
473 |
IN6_ARE_ADDR_EQUAL(&(connp)->conn_srcv6, &(dst))) |
|
474 |
||
475 |
#define IPCL_CONN_INIT(connp, protocol, src, rem, ports) { \ |
|
476 |
(connp)->conn_ulp = protocol; \ |
|
477 |
IN6_IPADDR_TO_V4MAPPED(src, &(connp)->conn_srcv6); \ |
|
478 |
IN6_IPADDR_TO_V4MAPPED(rem, &(connp)->conn_remv6); \ |
|
479 |
(connp)->conn_ports = ports; \ |
|
480 |
} |
|
481 |
||
482 |
#define IPCL_CONN_INIT_V6(connp, protocol, src, rem, ports) { \ |
|
483 |
(connp)->conn_ulp = protocol; \ |
|
484 |
(connp)->conn_srcv6 = src; \ |
|
485 |
(connp)->conn_remv6 = rem; \ |
|
486 |
(connp)->conn_ports = ports; \ |
|
487 |
} |
|
488 |
||
1503
9c3595b79c0d
6376992 IP Classifier hash function for UDP is broken, causing poor UDP performance when using many ports
ericheng
parents:
1216
diff
changeset
|
489 |
#define IPCL_PORT_HASH(port, size) \ |
9c3595b79c0d
6376992 IP Classifier hash function for UDP is broken, causing poor UDP performance when using many ports
ericheng
parents:
1216
diff
changeset
|
490 |
((((port) >> 8) ^ (port)) & ((size) - 1)) |
9c3595b79c0d
6376992 IP Classifier hash function for UDP is broken, causing poor UDP performance when using many ports
ericheng
parents:
1216
diff
changeset
|
491 |
|
3448 | 492 |
#define IPCL_BIND_HASH(lport, ipst) \ |
493 |
((unsigned)(((lport) >> 8) ^ (lport)) % \ |
|
494 |
(ipst)->ips_ipcl_bind_fanout_size) |
|
0 | 495 |
|
496 |
#define IPCL_BIND_MATCH(connp, proto, laddr, lport) \ |
|
497 |
((connp)->conn_ulp == (proto) && \ |
|
498 |
(connp)->conn_lport == (lport) && \ |
|
499 |
(_IPCL_V4_MATCH_ANY((connp)->conn_srcv6) || \ |
|
500 |
_IPCL_V4_MATCH((connp)->conn_srcv6, (laddr))) && \ |
|
501 |
!(connp)->conn_ipv6_v6only) |
|
502 |
||
503 |
#define IPCL_BIND_MATCH_V6(connp, proto, laddr, lport) \ |
|
504 |
((connp)->conn_ulp == (proto) && \ |
|
505 |
(connp)->conn_lport == (lport) && \ |
|
506 |
(IN6_ARE_ADDR_EQUAL(&(connp)->conn_srcv6, &(laddr)) || \ |
|
507 |
IN6_IS_ADDR_UNSPECIFIED(&(connp)->conn_srcv6))) |
|
508 |
||
509 |
#define IPCL_UDP_MATCH(connp, lport, laddr, fport, faddr) \ |
|
510 |
(((connp)->conn_lport == (lport)) && \ |
|
511 |
((_IPCL_V4_MATCH_ANY((connp)->conn_srcv6) || \ |
|
512 |
(_IPCL_V4_MATCH((connp)->conn_srcv6, (laddr)) && \ |
|
513 |
(_IPCL_V4_MATCH_ANY((connp)->conn_remv6) || \ |
|
514 |
(_IPCL_V4_MATCH((connp)->conn_remv6, (faddr)) && \ |
|
515 |
(connp)->conn_fport == (fport)))))) && \ |
|
516 |
!(connp)->conn_ipv6_v6only) |
|
517 |
||
518 |
#define IPCL_UDP_MATCH_V6(connp, lport, laddr, fport, faddr) \ |
|
519 |
(((connp)->conn_lport == (lport)) && \ |
|
520 |
(IN6_IS_ADDR_UNSPECIFIED(&(connp)->conn_srcv6) || \ |
|
521 |
(IN6_ARE_ADDR_EQUAL(&(connp)->conn_srcv6, &(laddr)) && \ |
|
522 |
(IN6_IS_ADDR_UNSPECIFIED(&(connp)->conn_remv6) || \ |
|
523 |
(IN6_ARE_ADDR_EQUAL(&(connp)->conn_remv6, &(faddr)) && \ |
|
524 |
(connp)->conn_fport == (fport)))))) |
|
525 |
||
526 |
#define IPCL_TCP_EAGER_INIT(connp, protocol, src, rem, ports) { \ |
|
527 |
(connp)->conn_flags |= (IPCL_TCP4|IPCL_EAGER); \ |
|
528 |
IN6_IPADDR_TO_V4MAPPED(src, &(connp)->conn_srcv6); \ |
|
529 |
IN6_IPADDR_TO_V4MAPPED(rem, &(connp)->conn_remv6); \ |
|
530 |
(connp)->conn_ports = ports; \ |
|
531 |
(connp)->conn_send = ip_output; \ |
|
532 |
(connp)->conn_sqp = IP_SQUEUE_GET(lbolt); \ |
|
8275
7c223a798022
PSARC/2006/357 Crossbow - Network Virtualization and Resource Management
Eric Cheng
parents:
5815
diff
changeset
|
533 |
(connp)->conn_initial_sqp = (connp)->conn_sqp; \ |
0 | 534 |
} |
535 |
||
536 |
#define IPCL_TCP_EAGER_INIT_V6(connp, protocol, src, rem, ports) { \ |
|
5240 | 537 |
(connp)->conn_flags |= (IPCL_TCP6|IPCL_EAGER|IPCL_ISV6); \ |
0 | 538 |
(connp)->conn_srcv6 = src; \ |
539 |
(connp)->conn_remv6 = rem; \ |
|
540 |
(connp)->conn_ports = ports; \ |
|
541 |
(connp)->conn_send = ip_output_v6; \ |
|
542 |
(connp)->conn_sqp = IP_SQUEUE_GET(lbolt); \ |
|
8275
7c223a798022
PSARC/2006/357 Crossbow - Network Virtualization and Resource Management
Eric Cheng
parents:
5815
diff
changeset
|
543 |
(connp)->conn_initial_sqp = (connp)->conn_sqp; \ |
0 | 544 |
} |
545 |
||
3448 | 546 |
#define IPCL_UDP_HASH(lport, ipst) \ |
547 |
IPCL_PORT_HASH(lport, (ipst)->ips_ipcl_udp_fanout_size) |
|
0 | 548 |
|
549 |
#define CONN_G_HASH_SIZE 1024 |
|
550 |
||
551 |
/* Raw socket hash function. */ |
|
3448 | 552 |
#define IPCL_RAW_HASH(lport, ipst) \ |
553 |
IPCL_PORT_HASH(lport, (ipst)->ips_ipcl_raw_fanout_size) |
|
0 | 554 |
|
409
22012dc8ea5b
6294727 SCTP raw socket bind() failed for ports which are mutliples of 256
kcpoon
parents:
0
diff
changeset
|
555 |
/* |
22012dc8ea5b
6294727 SCTP raw socket bind() failed for ports which are mutliples of 256
kcpoon
parents:
0
diff
changeset
|
556 |
* This is similar to IPCL_BIND_MATCH except that the local port check |
22012dc8ea5b
6294727 SCTP raw socket bind() failed for ports which are mutliples of 256
kcpoon
parents:
0
diff
changeset
|
557 |
* is changed to a wildcard port check. |
22012dc8ea5b
6294727 SCTP raw socket bind() failed for ports which are mutliples of 256
kcpoon
parents:
0
diff
changeset
|
558 |
*/ |
22012dc8ea5b
6294727 SCTP raw socket bind() failed for ports which are mutliples of 256
kcpoon
parents:
0
diff
changeset
|
559 |
#define IPCL_RAW_MATCH(connp, proto, laddr) \ |
22012dc8ea5b
6294727 SCTP raw socket bind() failed for ports which are mutliples of 256
kcpoon
parents:
0
diff
changeset
|
560 |
((connp)->conn_ulp == (proto) && \ |
22012dc8ea5b
6294727 SCTP raw socket bind() failed for ports which are mutliples of 256
kcpoon
parents:
0
diff
changeset
|
561 |
(connp)->conn_lport == 0 && \ |
22012dc8ea5b
6294727 SCTP raw socket bind() failed for ports which are mutliples of 256
kcpoon
parents:
0
diff
changeset
|
562 |
(_IPCL_V4_MATCH_ANY((connp)->conn_srcv6) || \ |
22012dc8ea5b
6294727 SCTP raw socket bind() failed for ports which are mutliples of 256
kcpoon
parents:
0
diff
changeset
|
563 |
_IPCL_V4_MATCH((connp)->conn_srcv6, (laddr)))) |
22012dc8ea5b
6294727 SCTP raw socket bind() failed for ports which are mutliples of 256
kcpoon
parents:
0
diff
changeset
|
564 |
|
22012dc8ea5b
6294727 SCTP raw socket bind() failed for ports which are mutliples of 256
kcpoon
parents:
0
diff
changeset
|
565 |
#define IPCL_RAW_MATCH_V6(connp, proto, laddr) \ |
22012dc8ea5b
6294727 SCTP raw socket bind() failed for ports which are mutliples of 256
kcpoon
parents:
0
diff
changeset
|
566 |
((connp)->conn_ulp == (proto) && \ |
22012dc8ea5b
6294727 SCTP raw socket bind() failed for ports which are mutliples of 256
kcpoon
parents:
0
diff
changeset
|
567 |
(connp)->conn_lport == 0 && \ |
22012dc8ea5b
6294727 SCTP raw socket bind() failed for ports which are mutliples of 256
kcpoon
parents:
0
diff
changeset
|
568 |
(IN6_IS_ADDR_UNSPECIFIED(&(connp)->conn_srcv6) || \ |
22012dc8ea5b
6294727 SCTP raw socket bind() failed for ports which are mutliples of 256
kcpoon
parents:
0
diff
changeset
|
569 |
IN6_ARE_ADDR_EQUAL(&(connp)->conn_srcv6, &(laddr)))) |
22012dc8ea5b
6294727 SCTP raw socket bind() failed for ports which are mutliples of 256
kcpoon
parents:
0
diff
changeset
|
570 |
|
0 | 571 |
/* Function prototypes */ |
3448 | 572 |
extern void ipcl_g_init(void); |
573 |
extern void ipcl_init(ip_stack_t *); |
|
574 |
extern void ipcl_g_destroy(void); |
|
575 |
extern void ipcl_destroy(ip_stack_t *); |
|
576 |
extern conn_t *ipcl_conn_create(uint32_t, int, netstack_t *); |
|
0 | 577 |
extern void ipcl_conn_destroy(conn_t *); |
578 |
||
579 |
void ipcl_hash_insert_wildcard(connf_t *, conn_t *); |
|
580 |
void ipcl_hash_remove(conn_t *); |
|
581 |
void ipcl_hash_remove_locked(conn_t *connp, connf_t *connfp); |
|
582 |
||
583 |
extern int ipcl_bind_insert(conn_t *, uint8_t, ipaddr_t, uint16_t); |
|
584 |
extern int ipcl_bind_insert_v6(conn_t *, uint8_t, const in6_addr_t *, |
|
585 |
uint16_t); |
|
586 |
extern int ipcl_conn_insert(conn_t *, uint8_t, ipaddr_t, ipaddr_t, |
|
587 |
uint32_t); |
|
588 |
extern int ipcl_conn_insert_v6(conn_t *, uint8_t, const in6_addr_t *, |
|
589 |
const in6_addr_t *, uint32_t, uint_t); |
|
741
40027a3621ac
PSARC 2005/082 Yosemite: UDP Performance Enhancement
masputra
parents:
409
diff
changeset
|
590 |
extern conn_t *ipcl_get_next_conn(connf_t *, conn_t *, uint32_t); |
0 | 591 |
|
592 |
void ipcl_proto_insert(conn_t *, uint8_t); |
|
593 |
void ipcl_proto_insert_v6(conn_t *, uint8_t); |
|
3448 | 594 |
conn_t *ipcl_classify_v4(mblk_t *, uint8_t, uint_t, zoneid_t, ip_stack_t *); |
595 |
conn_t *ipcl_classify_v6(mblk_t *, uint8_t, uint_t, zoneid_t, ip_stack_t *); |
|
596 |
conn_t *ipcl_classify(mblk_t *, zoneid_t, ip_stack_t *); |
|
597 |
conn_t *ipcl_classify_raw(mblk_t *, uint8_t, zoneid_t, uint32_t, ipha_t *, |
|
598 |
ip_stack_t *); |
|
0 | 599 |
void ipcl_globalhash_insert(conn_t *); |
600 |
void ipcl_globalhash_remove(conn_t *); |
|
3448 | 601 |
void ipcl_walk(pfv_t, void *, ip_stack_t *); |
602 |
conn_t *ipcl_tcp_lookup_reversed_ipv4(ipha_t *, tcph_t *, int, ip_stack_t *); |
|
603 |
conn_t *ipcl_tcp_lookup_reversed_ipv6(ip6_t *, tcpha_t *, int, uint_t, |
|
604 |
ip_stack_t *); |
|
605 |
conn_t *ipcl_lookup_listener_v4(uint16_t, ipaddr_t, zoneid_t, ip_stack_t *); |
|
606 |
conn_t *ipcl_lookup_listener_v6(uint16_t, in6_addr_t *, uint_t, zoneid_t, |
|
607 |
ip_stack_t *); |
|
0 | 608 |
int conn_trace_ref(conn_t *); |
609 |
int conn_untrace_ref(conn_t *); |
|
5240 | 610 |
void ipcl_conn_cleanup(conn_t *); |
3448 | 611 |
conn_t *ipcl_conn_tcp_lookup_reversed_ipv4(conn_t *, ipha_t *, tcph_t *, |
612 |
ip_stack_t *); |
|
613 |
conn_t *ipcl_conn_tcp_lookup_reversed_ipv6(conn_t *, ip6_t *, tcph_t *, |
|
614 |
ip_stack_t *); |
|
8348
4137e18bfaf0
PSARC 2007/587 Volo -- Low Latency Socket Framework
Yu Xiangning<Eric.Yu@Sun.COM>
parents:
8275
diff
changeset
|
615 |
|
4137e18bfaf0
PSARC 2007/587 Volo -- Low Latency Socket Framework
Yu Xiangning<Eric.Yu@Sun.COM>
parents:
8275
diff
changeset
|
616 |
extern int ip_create_helper_stream(conn_t *connp, ldi_ident_t li); |
4137e18bfaf0
PSARC 2007/587 Volo -- Low Latency Socket Framework
Yu Xiangning<Eric.Yu@Sun.COM>
parents:
8275
diff
changeset
|
617 |
extern void ip_close_helper_stream(conn_t *connp); |
4137e18bfaf0
PSARC 2007/587 Volo -- Low Latency Socket Framework
Yu Xiangning<Eric.Yu@Sun.COM>
parents:
8275
diff
changeset
|
618 |
|
4137e18bfaf0
PSARC 2007/587 Volo -- Low Latency Socket Framework
Yu Xiangning<Eric.Yu@Sun.COM>
parents:
8275
diff
changeset
|
619 |
extern int ip_get_options(conn_t *, int, int, void *, t_uscalar_t *, cred_t *); |
4137e18bfaf0
PSARC 2007/587 Volo -- Low Latency Socket Framework
Yu Xiangning<Eric.Yu@Sun.COM>
parents:
8275
diff
changeset
|
620 |
extern int ip_set_options(conn_t *, int, int, const void *, t_uscalar_t, |
4137e18bfaf0
PSARC 2007/587 Volo -- Low Latency Socket Framework
Yu Xiangning<Eric.Yu@Sun.COM>
parents:
8275
diff
changeset
|
621 |
cred_t *); |
4137e18bfaf0
PSARC 2007/587 Volo -- Low Latency Socket Framework
Yu Xiangning<Eric.Yu@Sun.COM>
parents:
8275
diff
changeset
|
622 |
|
0 | 623 |
#ifdef __cplusplus |
624 |
} |
|
625 |
#endif |
|
626 |
||
627 |
#endif /* _INET_IPCLASSIFIER_H */ |