Print this page
12976 system panics with error in IP module
Reviewed by: Andy Fiddaman <andy@omniosce.org>
Reviewed by: Paul Winder <p.winder@me.com>
| Split |
Close |
| Expand all |
| Collapse all |
--- old/usr/src/uts/common/sys/socket_proto.h
+++ new/usr/src/uts/common/sys/socket_proto.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
|
↓ open down ↓ |
13 lines elided |
↑ open up ↑ |
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21 /*
22 22 * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
23 23 * Copyright 2019 OmniOS Community Edition (OmniOSce) Association.
24 + * Copyright 2020 Joyent, Inc.
24 25 */
25 26
26 27 #ifndef _SYS_SOCKET_PROTO_H_
27 28 #define _SYS_SOCKET_PROTO_H_
28 29
29 30 #ifdef __cplusplus
30 31 extern "C" {
31 32 #endif
32 33
33 34 #include <sys/socket.h>
34 35 #include <sys/stream.h>
35 36 #include <sys/vnode.h>
36 37
37 38 /*
38 39 * Generation count
39 40 */
40 41 typedef uint64_t sock_connid_t;
41 42
42 43 #define SOCK_CONNID_INIT(id) { \
43 44 (id) = 0; \
44 45 }
45 46 #define SOCK_CONNID_BUMP(id) (++(id))
46 47 #define SOCK_CONNID_LT(id1, id2) ((int64_t)((id1)-(id2)) < 0)
47 48
48 49 /* Socket protocol properties */
49 50 struct sock_proto_props {
50 51 uint_t sopp_flags; /* options to set */
51 52 ushort_t sopp_wroff; /* write offset */
52 53 ssize_t sopp_txhiwat; /* tx hi water mark */
53 54 ssize_t sopp_txlowat; /* tx lo water mark */
54 55 ssize_t sopp_rxhiwat; /* recv high water mark */
55 56 ssize_t sopp_rxlowat; /* recv low water mark */
56 57 ssize_t sopp_maxblk; /* maximum message block size */
57 58 ssize_t sopp_maxpsz; /* maximum packet size */
58 59 ssize_t sopp_minpsz; /* minimum packet size */
59 60 ushort_t sopp_tail; /* space available at the end */
60 61 uint_t sopp_zcopyflag; /* zero copy flag */
61 62 boolean_t sopp_oobinline; /* OOB inline */
62 63 uint_t sopp_rcvtimer; /* delayed recv notification (time) */
63 64 uint32_t sopp_rcvthresh; /* delayed recv notification (bytes) */
64 65 socklen_t sopp_maxaddrlen; /* maximum size of protocol address */
65 66 boolean_t sopp_loopback; /* loopback connection */
66 67 };
67 68
68 69 /* flags to determine which socket options are set */
69 70 #define SOCKOPT_WROFF 0x0001 /* set write offset */
70 71 #define SOCKOPT_RCVHIWAT 0x0002 /* set read side high water */
71 72 #define SOCKOPT_RCVLOWAT 0x0004 /* set read side high water */
72 73 #define SOCKOPT_MAXBLK 0x0008 /* set maximum message block size */
73 74 #define SOCKOPT_TAIL 0x0010 /* set the extra allocated space */
74 75 #define SOCKOPT_ZCOPY 0x0020 /* set/unset zero copy for sendfile */
75 76 #define SOCKOPT_MAXPSZ 0x0040 /* set maxpsz for protocols */
76 77 #define SOCKOPT_OOBINLINE 0x0080 /* set oob inline processing */
77 78 #define SOCKOPT_RCVTIMER 0x0100
78 79 #define SOCKOPT_RCVTHRESH 0x0200
79 80 #define SOCKOPT_MAXADDRLEN 0x0400 /* set max address length */
80 81 #define SOCKOPT_MINPSZ 0x0800 /* set minpsz for protocols */
81 82 #define SOCKOPT_LOOPBACK 0x1000 /* set loopback */
82 83
83 84 #define IS_SO_OOB_INLINE(so) ((so)->so_proto_props.sopp_oobinline)
84 85
85 86 #ifdef _KERNEL
86 87
87 88 struct T_capability_ack;
88 89
89 90 typedef struct sock_upcalls_s sock_upcalls_t;
90 91 typedef struct sock_downcalls_s sock_downcalls_t;
91 92
92 93 /*
93 94 * Upcall and downcall handle for sockfs and transport layer.
94 95 */
95 96 typedef struct __sock_upper_handle *sock_upper_handle_t;
96 97 typedef struct __sock_lower_handle *sock_lower_handle_t;
97 98
98 99 struct sock_downcalls_s {
99 100 void (*sd_activate)(sock_lower_handle_t, sock_upper_handle_t,
100 101 sock_upcalls_t *, int, cred_t *);
101 102 int (*sd_accept)(sock_lower_handle_t, sock_lower_handle_t,
102 103 sock_upper_handle_t, cred_t *);
103 104 int (*sd_bind)(sock_lower_handle_t, struct sockaddr *, socklen_t,
104 105 cred_t *);
105 106 int (*sd_listen)(sock_lower_handle_t, int, cred_t *);
106 107 int (*sd_connect)(sock_lower_handle_t, const struct sockaddr *,
107 108 socklen_t, sock_connid_t *, cred_t *);
108 109 int (*sd_getpeername)(sock_lower_handle_t, struct sockaddr *,
109 110 socklen_t *, cred_t *);
110 111 int (*sd_getsockname)(sock_lower_handle_t, struct sockaddr *,
111 112 socklen_t *, cred_t *);
112 113 int (*sd_getsockopt)(sock_lower_handle_t, int, int, void *,
113 114 socklen_t *, cred_t *);
114 115 int (*sd_setsockopt)(sock_lower_handle_t, int, int, const void *,
115 116 socklen_t, cred_t *);
116 117 int (*sd_send)(sock_lower_handle_t, mblk_t *, struct nmsghdr *,
117 118 cred_t *);
118 119 int (*sd_send_uio)(sock_lower_handle_t, uio_t *, struct nmsghdr *,
119 120 cred_t *);
120 121 int (*sd_recv_uio)(sock_lower_handle_t, uio_t *, struct nmsghdr *,
121 122 cred_t *);
122 123 short (*sd_poll)(sock_lower_handle_t, short, int, cred_t *);
123 124 int (*sd_shutdown)(sock_lower_handle_t, int, cred_t *);
124 125 void (*sd_clr_flowctrl)(sock_lower_handle_t);
125 126 int (*sd_ioctl)(sock_lower_handle_t, int, intptr_t, int,
126 127 int32_t *, cred_t *);
127 128 int (*sd_close)(sock_lower_handle_t, int, cred_t *);
128 129 };
129 130
130 131 typedef sock_lower_handle_t (*so_proto_create_func_t)(int, int, int,
131 132 sock_downcalls_t **, uint_t *, int *, int, cred_t *);
132 133
133 134 typedef struct sock_quiesce_arg {
134 135 mblk_t *soqa_exdata_mp;
135 136 mblk_t *soqa_urgmark_mp;
136 137 } sock_quiesce_arg_t;
137 138 typedef mblk_t *(*so_proto_quiesced_cb_t)(sock_upper_handle_t,
138 139 sock_quiesce_arg_t *, struct T_capability_ack *, struct sockaddr *,
139 140 socklen_t, struct sockaddr *, socklen_t, short);
140 141 typedef int (*so_proto_fallback_func_t)(sock_lower_handle_t, queue_t *,
141 142 boolean_t, so_proto_quiesced_cb_t, sock_quiesce_arg_t *);
142 143
143 144 /*
144 145 * These functions return EOPNOTSUPP and are intended for the sockfs
145 146 * developer that doesn't wish to supply stubs for every function themselves.
146 147 */
147 148 extern int sock_accept_notsupp(sock_lower_handle_t, sock_lower_handle_t,
148 149 sock_upper_handle_t, cred_t *);
149 150 extern int sock_bind_notsupp(sock_lower_handle_t, struct sockaddr *,
150 151 socklen_t, cred_t *);
151 152 extern int sock_listen_notsupp(sock_lower_handle_t, int, cred_t *);
152 153 extern int sock_connect_notsupp(sock_lower_handle_t,
153 154 const struct sockaddr *, socklen_t, sock_connid_t *, cred_t *);
154 155 extern int sock_getpeername_notsupp(sock_lower_handle_t, struct sockaddr *,
155 156 socklen_t *, cred_t *);
156 157 extern int sock_getsockname_notsupp(sock_lower_handle_t, struct sockaddr *,
157 158 socklen_t *, cred_t *);
158 159 extern int sock_getsockopt_notsupp(sock_lower_handle_t, int, int, void *,
159 160 socklen_t *, cred_t *);
160 161 extern int sock_setsockopt_notsupp(sock_lower_handle_t, int, int,
161 162 const void *, socklen_t, cred_t *);
162 163 extern int sock_send_notsupp(sock_lower_handle_t, mblk_t *,
163 164 struct nmsghdr *, cred_t *);
164 165 extern int sock_send_uio_notsupp(sock_lower_handle_t, uio_t *,
165 166 struct nmsghdr *, cred_t *);
166 167 extern int sock_recv_uio_notsupp(sock_lower_handle_t, uio_t *,
167 168 struct nmsghdr *, cred_t *);
168 169 extern short sock_poll_notsupp(sock_lower_handle_t, short, int, cred_t *);
169 170 extern int sock_shutdown_notsupp(sock_lower_handle_t, int, cred_t *);
170 171 extern void sock_clr_flowctrl_notsupp(sock_lower_handle_t);
171 172 extern int sock_ioctl_notsupp(sock_lower_handle_t, int, intptr_t, int,
172 173 int32_t *, cred_t *);
173 174 extern int sock_close_notsupp(sock_lower_handle_t, int, cred_t *);
174 175
175 176 /*
176 177 * Upcalls and related information
177 178 */
178 179
179 180 /*
180 181 * su_opctl() actions
181 182 */
182 183 typedef enum sock_opctl_action {
183 184 SOCK_OPCTL_ENAB_ACCEPT = 0,
184 185 SOCK_OPCTL_SHUT_SEND,
185 186 SOCK_OPCTL_SHUT_RECV
186 187 } sock_opctl_action_t;
187 188
188 189 struct sock_upcalls_s {
189 190 sock_upper_handle_t (*su_newconn)(sock_upper_handle_t,
190 191 sock_lower_handle_t, sock_downcalls_t *, cred_t *, pid_t,
191 192 sock_upcalls_t **);
192 193 void (*su_connected)(sock_upper_handle_t, sock_connid_t, cred_t *,
193 194 pid_t);
194 195 int (*su_disconnected)(sock_upper_handle_t, sock_connid_t, int);
|
↓ open down ↓ |
161 lines elided |
↑ open up ↑ |
195 196 void (*su_opctl)(sock_upper_handle_t, sock_opctl_action_t,
196 197 uintptr_t);
197 198 ssize_t (*su_recv)(sock_upper_handle_t, mblk_t *, size_t, int,
198 199 int *, boolean_t *);
199 200 void (*su_set_proto_props)(sock_upper_handle_t,
200 201 struct sock_proto_props *);
201 202 void (*su_txq_full)(sock_upper_handle_t, boolean_t);
202 203 void (*su_signal_oob)(sock_upper_handle_t, ssize_t);
203 204 void (*su_zcopy_notify)(sock_upper_handle_t);
204 205 void (*su_set_error)(sock_upper_handle_t, int);
206 + /*
207 + * NOTE: This function frees upper handle items. Caller cannot
208 + * rely on them after this upcall.
209 + */
205 210 void (*su_closed)(sock_upper_handle_t);
211 + /*
212 + * NOTE: This function MUST be implemented without using lower-level
213 + * downcalls or accesses. This allows callers to ensure su_closed()
214 + * upcalls can happen indepdently or concurrently.
215 + */
206 216 vnode_t *(*su_get_vnode)(sock_upper_handle_t);
207 217 };
208 218
209 219 #define SOCK_UC_VERSION sizeof (sock_upcalls_t)
210 220 #define SOCK_DC_VERSION sizeof (sock_downcalls_t)
211 221
212 222 #define SOCKET_RECVHIWATER (48 * 1024)
213 223 #define SOCKET_RECVLOWATER 1024
214 224
215 225 #define SOCKET_NO_RCVTIMER 0
216 226 #define SOCKET_TIMER_INTERVAL 50
217 227
218 228 #endif /* _KERNEL */
219 229
220 230 #ifdef __cplusplus
221 231 }
222 232 #endif
223 233
224 234 #endif /* _SYS_SOCKET_PROTO_H_ */
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX