3 .\" Copyright (c) 2000 Alfred Perlstein
5 .\" All rights reserved.
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that the following conditions
10 .\" 1. Redistributions of source code must retain the above copyright
11 .\" notice, this list of conditions and the following disclaimer.
12 .\" 2. Redistributions in binary form must reproduce the above copyright
13 .\" notice, this list of conditions and the following disclaimer in the
14 .\" documentation and/or other materials provided with the distribution.
16 .\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
17 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 .\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 .\" $FreeBSD: src/share/man/man9/accept_filter.9,v 1.13 2004/06/16 08:33:57 ru Exp $
36 .Nm accept_filt_generic_mod_event ,
38 .Nd filter incoming connections
40 .Fd #define ACCEPT_FILTER_MOD
46 .In netinet/accept_filter.h
48 .Fn accept_filt_add "struct accept_filter *filt"
50 .Fn accept_filt_del "char *name"
52 .Fn accept_filt_generic_mod_event "module_t mod" "int event" "void *data"
53 .Ft struct accept_filter *
54 .Fn accept_filt_get "char *name"
56 Accept filters allow an application to request
57 that the kernel pre-process incoming connections.
58 This manual page describes the kernel interface for accept filters.
59 User applications request accept filters via the
61 system call, passing in an
65 .Sh IMPLEMENTATION NOTES
66 A module that wants to be an accept filter
68 .Vt "struct accept_filter"
71 struct accept_filter {
73 void (*accf_callback)(struct socket *so, void *arg, int waitflag);
74 void * (*accf_create)(struct socket *so, char *arg);
75 void (*accf_destroy)(struct socket *so);
76 SLIST_ENTRY(accept_filter) accf_next; /* next on the list */
80 The module should register it with the function
82 passing a pointer to a
83 .Vt "struct accept_filter" ,
87 The accept filters currently provided with
92 are implemented as pseudo-devices, but an accept filter may use any
93 supported means of initializing and registering itself at system startup
94 or later, including the module framework if supported
95 by the running kernel.
98 .Vt "struct accept_filter"
100 .Bl -tag -width ".Va accf_callback"
103 this is how it will be accessed from userland.
105 The callback that the kernel will do
106 once the connection is established.
107 It is the same as a socket upcall
108 and will be called when the connection is established
109 and whenever new data arrives on the socket,
110 unless the callback modifies the socket's flags.
114 installs the filter onto
117 Called whenever the user removes the accept filter on the socket.
123 passed the same string used in
124 .Va accept_filter.accf_name
125 during registration with
126 .Fn accept_filt_add ,
127 the kernel will then disallow and further userland use of the filter.
131 function is used internally to locate which accept filter to use via the
136 .Fn accept_filt_generic_mod_event
137 function can be used by accept filters which are loadable kernel modules
138 to add and delete themselves.
145 The accept filter mechanism was introduced in
149 by Coyote Point Systems, Inc. and appeared in
152 This manual page was written by
154 .An Alfred Perlstein ,
157 .An Jeroen Ruigrok van der Werven .
159 The accept filter concept was pioneered by
162 and refined to be a loadable module system by
163 .An Alfred Perlstein .