Print this page
Mismerge datafilt.c
OS-4213 lxbrand should be able to set TCP_DEFER_ACCEPT after other socket operations
| Split |
Close |
| Expand all |
| Collapse all |
--- old/usr/src/uts/common/inet/sockmods/datafilt.c
+++ new/usr/src/uts/common/inet/sockmods/datafilt.c
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
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) 2012, OmniTI Computer Consulting, Inc. All rights reserved.
23 23 */
24 24
25 25 #include <sys/kmem.h>
26 26 #include <sys/systm.h>
27 27 #include <sys/stropts.h>
28 28 #include <sys/strsun.h>
29 29 #include <sys/socketvar.h>
30 30 #include <sys/sockfilter.h>
31 31 #include <sys/note.h>
32 32 #include <sys/taskq.h>
33 33
34 34 static struct modlmisc dataf_modlmisc = {
35 35 &mod_miscops,
36 36 "Kernel data-ready socket filter"
37 37 };
38 38
39 39 static struct modlinkage dataf_modlinkage = {
40 40 MODREV_1,
41 41 &dataf_modlmisc,
42 42 NULL
43 43 };
44 44
45 45 #define DATAFILT_MODULE "datafilt"
46 46
47 47 /* ARGSUSED */
48 48 sof_rval_t
49 49 dataf_attach_passive_cb(sof_handle_t handle, sof_handle_t ph,
50 50 void *parg, struct sockaddr *laddr, socklen_t laddrlen,
51 51 struct sockaddr *faddr, socklen_t faddrlen, void **cookiep)
52 52 {
53 53 return (SOF_RVAL_DEFER);
54 54 }
55 55
56 56 void
57 57 dataf_detach_cb(sof_handle_t handle, void *cookie, cred_t *cr)
58 58 {
59 59 _NOTE(ARGUNUSED(handle, cookie, cr));
60 60 }
61 61
62 62 /*
63 63 * Called for each incoming segment.
64 64 */
65 65 mblk_t *
66 66 dataf_data_in_cb(sof_handle_t handle, void *cookie, mblk_t *mp, int flags,
67 67 size_t *lenp)
68 68 {
69 69 _NOTE(ARGUNUSED(cookie, flags, lenp));
70 70
71 71 if (mp != NULL && MBLKL(mp) > 0)
72 72 sof_newconn_ready(handle);
73 73
74 74 return (mp);
75 75 }
76 76
77 77 sof_ops_t dataf_ops = {
|
↓ open down ↓ |
77 lines elided |
↑ open up ↑ |
78 78 .sofop_attach_passive = dataf_attach_passive_cb,
79 79 .sofop_detach = dataf_detach_cb,
80 80 .sofop_data_in = dataf_data_in_cb
81 81 };
82 82
83 83 int
84 84 _init(void)
85 85 {
86 86 int error;
87 87
88 - if ((error = sof_register(SOF_VERSION, DATAFILT_MODULE, &dataf_ops, 0))
89 - != 0)
88 + /*
89 + * This module is safe to attach even after some preliminary socket
90 + * setup calls have taken place. See the comment for SOF_ATT_SAFE.
91 + */
92 + error = sof_register(SOF_VERSION, DATAFILT_MODULE, &dataf_ops,
93 + SOF_ATT_SAFE);
94 + if (error != 0)
90 95 return (error);
91 96 if ((error = mod_install(&dataf_modlinkage)) != 0)
92 97 (void) sof_unregister(DATAFILT_MODULE);
93 98
94 99 return (error);
95 100 }
96 101
97 102 int
98 103 _fini(void)
99 104 {
100 105 int error;
101 106
102 107 if ((error = sof_unregister(DATAFILT_MODULE)) != 0)
103 108 return (error);
104 109
105 110 return (mod_remove(&dataf_modlinkage));
106 111 }
107 112
108 113 int
109 114 _info(struct modinfo *modinfop)
110 115 {
111 116 return (mod_info(&dataf_modlinkage, modinfop));
112 117 }
|
↓ open down ↓ |
13 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX