ip_lookup.c revision 1.1 1 1.1 christos /* $NetBSD: ip_lookup.c,v 1.1 2012/03/23 20:36:57 christos Exp $ */
2 1.1 christos
3 1.1 christos /*
4 1.1 christos * Copyright (C) 2010 by Darren Reed.
5 1.1 christos *
6 1.1 christos * See the IPFILTER.LICENCE file for details on licencing.
7 1.1 christos */
8 1.1 christos #if defined(KERNEL) || defined(_KERNEL)
9 1.1 christos # undef KERNEL
10 1.1 christos # undef _KERNEL
11 1.1 christos # define KERNEL 1
12 1.1 christos # define _KERNEL 1
13 1.1 christos #endif
14 1.1 christos #if defined(__osf__)
15 1.1 christos # define _PROTO_NET_H_
16 1.1 christos #endif
17 1.1 christos #include <sys/param.h>
18 1.1 christos #include <sys/errno.h>
19 1.1 christos #include <sys/types.h>
20 1.1 christos #include <sys/time.h>
21 1.1 christos #include <sys/file.h>
22 1.1 christos #if __FreeBSD_version >= 220000 && defined(_KERNEL)
23 1.1 christos # include <sys/fcntl.h>
24 1.1 christos # include <sys/filio.h>
25 1.1 christos #else
26 1.1 christos # include <sys/ioctl.h>
27 1.1 christos #endif
28 1.1 christos #if !defined(_KERNEL)
29 1.1 christos # include <stdio.h>
30 1.1 christos # include <string.h>
31 1.1 christos # include <stdlib.h>
32 1.1 christos # define _KERNEL
33 1.1 christos # ifdef __OpenBSD__
34 1.1 christos struct file;
35 1.1 christos # endif
36 1.1 christos # include <sys/uio.h>
37 1.1 christos # undef _KERNEL
38 1.1 christos #endif
39 1.1 christos #include <sys/socket.h>
40 1.1 christos #include <net/if.h>
41 1.1 christos #if defined(__FreeBSD__)
42 1.1 christos # include <sys/cdefs.h>
43 1.1 christos # include <sys/proc.h>
44 1.1 christos #endif
45 1.1 christos #if defined(_KERNEL)
46 1.1 christos # include <sys/systm.h>
47 1.1 christos # if !defined(__SVR4) && !defined(__svr4__)
48 1.1 christos # include <sys/mbuf.h>
49 1.1 christos # endif
50 1.1 christos #else
51 1.1 christos # include "ipf.h"
52 1.1 christos #endif
53 1.1 christos #include <netinet/in.h>
54 1.1 christos
55 1.1 christos #include "netinet/ip_compat.h"
56 1.1 christos #include "netinet/ip_fil.h"
57 1.1 christos #include "netinet/ip_lookup.h"
58 1.1 christos #include "netinet/ip_pool.h"
59 1.1 christos #include "netinet/ip_htable.h"
60 1.1 christos #include "netinet/ip_dstlist.h"
61 1.1 christos /* END OF INCLUDES */
62 1.1 christos
63 1.1 christos #if !defined(lint)
64 1.1 christos static const char rcsid[] = "@(#)Id";
65 1.1 christos #endif
66 1.1 christos
67 1.1 christos /*
68 1.1 christos * In this file, ip_pool.c, ip_htable.c and ip_dstlist.c, you will find the
69 1.1 christos * range for unit is [-1,IPL_LOGMAX]. The -1 is considered to be a valid number
70 1.1 christos * and represents a "wildcard" or "all" units (IPL_LOGALL). The reason for not
71 1.1 christos * starting the numbering at 0 is because the numbers [0,IPL_LOGMAX] correspond
72 1.1 christos * to the minor device number for their respective device. Thus where there is
73 1.1 christos * array indexing on the unit, +1 is used to map [-1.IPL_LOGMAX] to
74 1.1 christos * [0.POOL_LOOKUP_MAX].
75 1.1 christos */
76 1.1 christos static int ipf_lookup_addnode __P((ipf_main_softc_t *, caddr_t, int));
77 1.1 christos static int ipf_lookup_delnode __P((ipf_main_softc_t *, caddr_t, int));
78 1.1 christos static int ipf_lookup_addtable __P((ipf_main_softc_t *, caddr_t));
79 1.1 christos static int ipf_lookup_deltable __P((ipf_main_softc_t *, caddr_t));
80 1.1 christos static int ipf_lookup_stats __P((ipf_main_softc_t *, caddr_t));
81 1.1 christos static int ipf_lookup_flush __P((ipf_main_softc_t *, caddr_t));
82 1.1 christos static int ipf_lookup_iterate __P((ipf_main_softc_t *, void *, int, void *));
83 1.1 christos static int ipf_lookup_deltok __P((ipf_main_softc_t *, void *, int, void *));
84 1.1 christos
85 1.1 christos #define MAX_BACKENDS 3
86 1.1 christos static ipf_lookup_t *backends[MAX_BACKENDS] = {
87 1.1 christos &ipf_pool_backend,
88 1.1 christos &ipf_htable_backend,
89 1.1 christos &ipf_dstlist_backend
90 1.1 christos };
91 1.1 christos
92 1.1 christos
93 1.1 christos typedef struct ipf_lookup_softc_s {
94 1.1 christos void *ipf_back[MAX_BACKENDS];
95 1.1 christos } ipf_lookup_softc_t;
96 1.1 christos
97 1.1 christos
98 1.1 christos /* ------------------------------------------------------------------------ */
99 1.1 christos /* Function: ipf_lookup_init */
100 1.1 christos /* Returns: int - 0 = success, else error */
101 1.1 christos /* Parameters: softc(I) - pointer to soft context main structure */
102 1.1 christos /* */
103 1.1 christos /* Initialise all of the subcomponents of the lookup infrstructure. */
104 1.1 christos /* ------------------------------------------------------------------------ */
105 1.1 christos void *
106 1.1 christos ipf_lookup_soft_create(softc)
107 1.1 christos ipf_main_softc_t *softc;
108 1.1 christos {
109 1.1 christos ipf_lookup_softc_t *softl;
110 1.1 christos ipf_lookup_t **l;
111 1.1 christos int i;
112 1.1 christos
113 1.1 christos KMALLOC(softl, ipf_lookup_softc_t *);
114 1.1 christos if (softl == NULL)
115 1.1 christos return NULL;
116 1.1 christos
117 1.1 christos bzero((char *)softl, sizeof(*softl));
118 1.1 christos
119 1.1 christos for (i = 0, l = backends; i < MAX_BACKENDS; i++, l++) {
120 1.1 christos softl->ipf_back[i] = (*(*l)->ipfl_create)(softc);
121 1.1 christos if (softl->ipf_back[i] == NULL) {
122 1.1 christos ipf_lookup_soft_destroy(softc, softl);
123 1.1 christos return NULL;
124 1.1 christos }
125 1.1 christos }
126 1.1 christos
127 1.1 christos return softl;
128 1.1 christos }
129 1.1 christos
130 1.1 christos
131 1.1 christos /* ------------------------------------------------------------------------ */
132 1.1 christos /* Function: ipf_lookup_soft_init */
133 1.1 christos /* Returns: int - 0 = success, else error */
134 1.1 christos /* Parameters: softc(I) - pointer to soft context main structure */
135 1.1 christos /* arg(I) - pointer to local context to use */
136 1.1 christos /* */
137 1.1 christos /* Initialise all of the subcomponents of the lookup infrstructure. */
138 1.1 christos /* ------------------------------------------------------------------------ */
139 1.1 christos int
140 1.1 christos ipf_lookup_soft_init(softc, arg)
141 1.1 christos ipf_main_softc_t *softc;
142 1.1 christos void *arg;
143 1.1 christos {
144 1.1 christos ipf_lookup_softc_t *softl = (ipf_lookup_softc_t *)arg;
145 1.1 christos int err = 0;
146 1.1 christos int i;
147 1.1 christos
148 1.1 christos for (i = 0; i < MAX_BACKENDS; i++) {
149 1.1 christos err = (*backends[i]->ipfl_init)(softc, softl->ipf_back[i]);
150 1.1 christos if (err != 0)
151 1.1 christos break;
152 1.1 christos }
153 1.1 christos
154 1.1 christos return err;
155 1.1 christos }
156 1.1 christos
157 1.1 christos
158 1.1 christos /* ------------------------------------------------------------------------ */
159 1.1 christos /* Function: ipf_lookup_soft_fini */
160 1.1 christos /* Returns: int - 0 = success, else error */
161 1.1 christos /* Parameters: softc(I) - pointer to soft context main structure */
162 1.1 christos /* arg(I) - pointer to local context to use */
163 1.1 christos /* */
164 1.1 christos /* Call the fini function in each backend to cleanup all allocated data. */
165 1.1 christos /* ------------------------------------------------------------------------ */
166 1.1 christos int
167 1.1 christos ipf_lookup_soft_fini(softc, arg)
168 1.1 christos ipf_main_softc_t *softc;
169 1.1 christos void *arg;
170 1.1 christos {
171 1.1 christos ipf_lookup_softc_t *softl = (ipf_lookup_softc_t *)arg;
172 1.1 christos int i;
173 1.1 christos
174 1.1 christos for (i = 0; i < MAX_BACKENDS; i++) {
175 1.1 christos if (softl->ipf_back[i] != NULL)
176 1.1 christos (*backends[i]->ipfl_fini)(softc,
177 1.1 christos softl->ipf_back[i]);
178 1.1 christos }
179 1.1 christos
180 1.1 christos return 0;
181 1.1 christos }
182 1.1 christos
183 1.1 christos
184 1.1 christos /* ------------------------------------------------------------------------ */
185 1.1 christos /* Function: ipf_lookup_expire */
186 1.1 christos /* Returns: Nil */
187 1.1 christos /* Parameters: softc(I) - pointer to soft context main structure */
188 1.1 christos /* */
189 1.1 christos /* Step through each of the backends and call their expire functions, */
190 1.1 christos /* allowing them to delete any lifetime limited data. */
191 1.1 christos /* ------------------------------------------------------------------------ */
192 1.1 christos void
193 1.1 christos ipf_lookup_expire(softc)
194 1.1 christos ipf_main_softc_t *softc;
195 1.1 christos {
196 1.1 christos ipf_lookup_softc_t *softl = softc->ipf_lookup_soft;
197 1.1 christos int i;
198 1.1 christos
199 1.1 christos WRITE_ENTER(&softc->ipf_poolrw);
200 1.1 christos for (i = 0; i < MAX_BACKENDS; i++)
201 1.1 christos (*backends[i]->ipfl_expire)(softc, softl->ipf_back[i]);
202 1.1 christos RWLOCK_EXIT(&softc->ipf_poolrw);
203 1.1 christos }
204 1.1 christos
205 1.1 christos
206 1.1 christos /* ------------------------------------------------------------------------ */
207 1.1 christos /* Function: ipf_lookup_softc_destroy */
208 1.1 christos /* Returns: int - 0 = success, else error */
209 1.1 christos /* Parameters: softc(I) - pointer to soft context main structure */
210 1.1 christos /* arg(I) - pointer to local context to use */
211 1.1 christos /* */
212 1.1 christos /* Free up all pool related memory that has been allocated whilst IPFilter */
213 1.1 christos /* has been running. Also, do any other deinitialisation required such */
214 1.1 christos /* ipf_lookup_init() can be called again, safely. */
215 1.1 christos /* ------------------------------------------------------------------------ */
216 1.1 christos void
217 1.1 christos ipf_lookup_soft_destroy(softc, arg)
218 1.1 christos ipf_main_softc_t *softc;
219 1.1 christos void *arg;
220 1.1 christos {
221 1.1 christos ipf_lookup_softc_t *softl = (ipf_lookup_softc_t *)arg;
222 1.1 christos int i;
223 1.1 christos
224 1.1 christos for (i = 0; i < MAX_BACKENDS; i++) {
225 1.1 christos if (softl->ipf_back[i] != NULL)
226 1.1 christos (*backends[i]->ipfl_destroy)(softc,
227 1.1 christos softl->ipf_back[i]);
228 1.1 christos }
229 1.1 christos
230 1.1 christos KFREE(softl);
231 1.1 christos }
232 1.1 christos
233 1.1 christos
234 1.1 christos /* ------------------------------------------------------------------------ */
235 1.1 christos /* Function: ipf_lookup_ioctl */
236 1.1 christos /* Returns: int - 0 = success, else error */
237 1.1 christos /* Parameters: softc(I) - pointer to soft context main structure */
238 1.1 christos /* arg(I) - pointer to local context to use */
239 1.1 christos /* data(IO) - pointer to ioctl data to be copied to/from user */
240 1.1 christos /* space. */
241 1.1 christos /* cmd(I) - ioctl command number */
242 1.1 christos /* mode(I) - file mode bits used with open */
243 1.1 christos /* uid(I) - uid of process doing ioctl */
244 1.1 christos /* ctx(I) - pointer that represents context for uid */
245 1.1 christos /* */
246 1.1 christos /* Handle ioctl commands sent to the ioctl device. For the most part, this */
247 1.1 christos /* involves just calling another function to handle the specifics of each */
248 1.1 christos /* command. */
249 1.1 christos /* ------------------------------------------------------------------------ */
250 1.1 christos int
251 1.1 christos ipf_lookup_ioctl(softc, data, cmd, mode, uid, ctx)
252 1.1 christos ipf_main_softc_t *softc;
253 1.1 christos caddr_t data;
254 1.1 christos ioctlcmd_t cmd;
255 1.1 christos int mode, uid;
256 1.1 christos void *ctx;
257 1.1 christos {
258 1.1 christos int err;
259 1.1 christos SPL_INT(s);
260 1.1 christos
261 1.1 christos mode = mode; /* LINT */
262 1.1 christos
263 1.1 christos SPL_NET(s);
264 1.1 christos
265 1.1 christos switch (cmd)
266 1.1 christos {
267 1.1 christos case SIOCLOOKUPADDNODE :
268 1.1 christos case SIOCLOOKUPADDNODEW :
269 1.1 christos WRITE_ENTER(&softc->ipf_poolrw);
270 1.1 christos err = ipf_lookup_addnode(softc, data, uid);
271 1.1 christos RWLOCK_EXIT(&softc->ipf_poolrw);
272 1.1 christos break;
273 1.1 christos
274 1.1 christos case SIOCLOOKUPDELNODE :
275 1.1 christos case SIOCLOOKUPDELNODEW :
276 1.1 christos WRITE_ENTER(&softc->ipf_poolrw);
277 1.1 christos err = ipf_lookup_delnode(softc, data, uid);
278 1.1 christos RWLOCK_EXIT(&softc->ipf_poolrw);
279 1.1 christos break;
280 1.1 christos
281 1.1 christos case SIOCLOOKUPADDTABLE :
282 1.1 christos WRITE_ENTER(&softc->ipf_poolrw);
283 1.1 christos err = ipf_lookup_addtable(softc, data);
284 1.1 christos RWLOCK_EXIT(&softc->ipf_poolrw);
285 1.1 christos break;
286 1.1 christos
287 1.1 christos case SIOCLOOKUPDELTABLE :
288 1.1 christos WRITE_ENTER(&softc->ipf_poolrw);
289 1.1 christos err = ipf_lookup_deltable(softc, data);
290 1.1 christos RWLOCK_EXIT(&softc->ipf_poolrw);
291 1.1 christos break;
292 1.1 christos
293 1.1 christos case SIOCLOOKUPSTAT :
294 1.1 christos case SIOCLOOKUPSTATW :
295 1.1 christos WRITE_ENTER(&softc->ipf_poolrw);
296 1.1 christos err = ipf_lookup_stats(softc, data);
297 1.1 christos RWLOCK_EXIT(&softc->ipf_poolrw);
298 1.1 christos break;
299 1.1 christos
300 1.1 christos case SIOCLOOKUPFLUSH :
301 1.1 christos WRITE_ENTER(&softc->ipf_poolrw);
302 1.1 christos err = ipf_lookup_flush(softc, data);
303 1.1 christos RWLOCK_EXIT(&softc->ipf_poolrw);
304 1.1 christos break;
305 1.1 christos
306 1.1 christos case SIOCLOOKUPITER :
307 1.1 christos err = ipf_lookup_iterate(softc, data, uid, ctx);
308 1.1 christos break;
309 1.1 christos
310 1.1 christos case SIOCIPFDELTOK :
311 1.1 christos err = ipf_lookup_deltok(softc, data, uid, ctx);
312 1.1 christos break;
313 1.1 christos
314 1.1 christos default :
315 1.1 christos IPFERROR(50001);
316 1.1 christos err = EINVAL;
317 1.1 christos break;
318 1.1 christos }
319 1.1 christos SPL_X(s);
320 1.1 christos return err;
321 1.1 christos }
322 1.1 christos
323 1.1 christos
324 1.1 christos /* ------------------------------------------------------------------------ */
325 1.1 christos /* Function: ipf_lookup_addnode */
326 1.1 christos /* Returns: int - 0 = success, else error */
327 1.1 christos /* Parameters: softc(I) - pointer to soft context main structure */
328 1.1 christos /* data(I) - pointer to data from ioctl call */
329 1.1 christos /* */
330 1.1 christos /* Add a new data node to a lookup structure. First, check to see if the */
331 1.1 christos /* parent structure refered to by name exists and if it does, then go on to */
332 1.1 christos /* add a node to it. */
333 1.1 christos /* ------------------------------------------------------------------------ */
334 1.1 christos static int
335 1.1 christos ipf_lookup_addnode(softc, data, uid)
336 1.1 christos ipf_main_softc_t *softc;
337 1.1 christos caddr_t data;
338 1.1 christos int uid;
339 1.1 christos {
340 1.1 christos ipf_lookup_softc_t *softl = softc->ipf_lookup_soft;
341 1.1 christos iplookupop_t op;
342 1.1 christos ipf_lookup_t **l;
343 1.1 christos int err;
344 1.1 christos int i;
345 1.1 christos
346 1.1 christos err = BCOPYIN(data, &op, sizeof(op));
347 1.1 christos if (err != 0) {
348 1.1 christos IPFERROR(50002);
349 1.1 christos return EFAULT;
350 1.1 christos }
351 1.1 christos
352 1.1 christos if ((op.iplo_unit < 0 || op.iplo_unit > IPL_LOGMAX) &&
353 1.1 christos (op.iplo_unit != IPLT_ALL)) {
354 1.1 christos IPFERROR(50003);
355 1.1 christos return EINVAL;
356 1.1 christos }
357 1.1 christos
358 1.1 christos op.iplo_name[sizeof(op.iplo_name) - 1] = '\0';
359 1.1 christos
360 1.1 christos for (i = 0, l = backends; i < MAX_BACKENDS; i++, l++) {
361 1.1 christos if (op.iplo_type == (*l)->ipfl_type) {
362 1.1 christos err = (*(*l)->ipfl_node_add)(softc,
363 1.1 christos softl->ipf_back[i],
364 1.1 christos &op, uid);
365 1.1 christos break;
366 1.1 christos }
367 1.1 christos }
368 1.1 christos
369 1.1 christos if (i == MAX_BACKENDS) {
370 1.1 christos IPFERROR(50012);
371 1.1 christos err = EINVAL;
372 1.1 christos }
373 1.1 christos
374 1.1 christos return err;
375 1.1 christos }
376 1.1 christos
377 1.1 christos
378 1.1 christos /* ------------------------------------------------------------------------ */
379 1.1 christos /* Function: ipf_lookup_delnode */
380 1.1 christos /* Returns: int - 0 = success, else error */
381 1.1 christos /* Parameters: softc(I) - pointer to soft context main structure */
382 1.1 christos /* data(I) - pointer to data from ioctl call */
383 1.1 christos /* */
384 1.1 christos /* Delete a node from a lookup table by first looking for the table it is */
385 1.1 christos /* in and then deleting the entry that gets found. */
386 1.1 christos /* ------------------------------------------------------------------------ */
387 1.1 christos static int
388 1.1 christos ipf_lookup_delnode(softc, data, uid)
389 1.1 christos ipf_main_softc_t *softc;
390 1.1 christos caddr_t data;
391 1.1 christos int uid;
392 1.1 christos {
393 1.1 christos ipf_lookup_softc_t *softl = softc->ipf_lookup_soft;
394 1.1 christos iplookupop_t op;
395 1.1 christos ipf_lookup_t **l;
396 1.1 christos int err;
397 1.1 christos int i;
398 1.1 christos
399 1.1 christos err = BCOPYIN(data, &op, sizeof(op));
400 1.1 christos if (err != 0) {
401 1.1 christos IPFERROR(50042);
402 1.1 christos return EFAULT;
403 1.1 christos }
404 1.1 christos
405 1.1 christos if ((op.iplo_unit < 0 || op.iplo_unit > IPL_LOGMAX) &&
406 1.1 christos (op.iplo_unit != IPLT_ALL)) {
407 1.1 christos IPFERROR(50013);
408 1.1 christos return EINVAL;
409 1.1 christos }
410 1.1 christos
411 1.1 christos op.iplo_name[sizeof(op.iplo_name) - 1] = '\0';
412 1.1 christos
413 1.1 christos for (i = 0, l = backends; i < MAX_BACKENDS; i++, l++) {
414 1.1 christos if (op.iplo_type == (*l)->ipfl_type) {
415 1.1 christos err = (*(*l)->ipfl_node_del)(softc, softl->ipf_back[i],
416 1.1 christos &op, uid);
417 1.1 christos break;
418 1.1 christos }
419 1.1 christos }
420 1.1 christos
421 1.1 christos if (i == MAX_BACKENDS) {
422 1.1 christos IPFERROR(50021);
423 1.1 christos err = EINVAL;
424 1.1 christos }
425 1.1 christos return err;
426 1.1 christos }
427 1.1 christos
428 1.1 christos
429 1.1 christos /* ------------------------------------------------------------------------ */
430 1.1 christos /* Function: ipf_lookup_addtable */
431 1.1 christos /* Returns: int - 0 = success, else error */
432 1.1 christos /* Parameters: softc(I) - pointer to soft context main structure */
433 1.1 christos /* data(I) - pointer to data from ioctl call */
434 1.1 christos /* */
435 1.1 christos /* Create a new lookup table, if one doesn't already exist using the name */
436 1.1 christos /* for this one. */
437 1.1 christos /* ------------------------------------------------------------------------ */
438 1.1 christos static int
439 1.1 christos ipf_lookup_addtable(softc, data)
440 1.1 christos ipf_main_softc_t *softc;
441 1.1 christos caddr_t data;
442 1.1 christos {
443 1.1 christos ipf_lookup_softc_t *softl = softc->ipf_lookup_soft;
444 1.1 christos iplookupop_t op;
445 1.1 christos ipf_lookup_t **l;
446 1.1 christos int err, i;
447 1.1 christos
448 1.1 christos err = BCOPYIN(data, &op, sizeof(op));
449 1.1 christos if (err != 0) {
450 1.1 christos IPFERROR(50022);
451 1.1 christos return EFAULT;
452 1.1 christos }
453 1.1 christos
454 1.1 christos if ((op.iplo_unit < 0 || op.iplo_unit > IPL_LOGMAX) &&
455 1.1 christos (op.iplo_unit != IPLT_ALL)) {
456 1.1 christos IPFERROR(50023);
457 1.1 christos return EINVAL;
458 1.1 christos }
459 1.1 christos
460 1.1 christos op.iplo_name[sizeof(op.iplo_name) - 1] = '\0';
461 1.1 christos
462 1.1 christos for (i = 0, l = backends; i < MAX_BACKENDS; i++, l++) {
463 1.1 christos if (op.iplo_type == (*l)->ipfl_type) {
464 1.1 christos err = (*(*l)->ipfl_table_add)(softc,
465 1.1 christos softl->ipf_back[i],
466 1.1 christos &op);
467 1.1 christos break;
468 1.1 christos }
469 1.1 christos }
470 1.1 christos
471 1.1 christos if (i == MAX_BACKENDS) {
472 1.1 christos IPFERROR(50026);
473 1.1 christos err = EINVAL;
474 1.1 christos }
475 1.1 christos
476 1.1 christos /*
477 1.1 christos * For anonymous pools, copy back the operation struct because in the
478 1.1 christos * case of success it will contain the new table's name.
479 1.1 christos */
480 1.1 christos if ((err == 0) && ((op.iplo_arg & LOOKUP_ANON) != 0)) {
481 1.1 christos err = BCOPYOUT(&op, data, sizeof(op));
482 1.1 christos if (err != 0) {
483 1.1 christos IPFERROR(50027);
484 1.1 christos err = EFAULT;
485 1.1 christos }
486 1.1 christos }
487 1.1 christos
488 1.1 christos return err;
489 1.1 christos }
490 1.1 christos
491 1.1 christos
492 1.1 christos /* ------------------------------------------------------------------------ */
493 1.1 christos /* Function: ipf_lookup_deltable */
494 1.1 christos /* Returns: int - 0 = success, else error */
495 1.1 christos /* Parameters: softc(I) - pointer to soft context main structure */
496 1.1 christos /* data(I) - pointer to data from ioctl call */
497 1.1 christos /* */
498 1.1 christos /* Decodes ioctl request to remove a particular hash table or pool and */
499 1.1 christos /* calls the relevant function to do the cleanup. */
500 1.1 christos /* ------------------------------------------------------------------------ */
501 1.1 christos static int
502 1.1 christos ipf_lookup_deltable(softc, data)
503 1.1 christos ipf_main_softc_t *softc;
504 1.1 christos caddr_t data;
505 1.1 christos {
506 1.1 christos ipf_lookup_softc_t *softl = softc->ipf_lookup_soft;
507 1.1 christos iplookupop_t op;
508 1.1 christos ipf_lookup_t **l;
509 1.1 christos int err, i;
510 1.1 christos
511 1.1 christos err = BCOPYIN(data, &op, sizeof(op));
512 1.1 christos if (err != 0) {
513 1.1 christos IPFERROR(50028);
514 1.1 christos return EFAULT;
515 1.1 christos }
516 1.1 christos
517 1.1 christos if ((op.iplo_unit < 0 || op.iplo_unit > IPL_LOGMAX) &&
518 1.1 christos (op.iplo_unit != IPLT_ALL)) {
519 1.1 christos IPFERROR(50029);
520 1.1 christos return EINVAL;
521 1.1 christos }
522 1.1 christos
523 1.1 christos op.iplo_name[sizeof(op.iplo_name) - 1] = '\0';
524 1.1 christos
525 1.1 christos for (i = 0, l = backends; i < MAX_BACKENDS; i++, l++) {
526 1.1 christos if (op.iplo_type == (*l)->ipfl_type) {
527 1.1 christos err = (*(*l)->ipfl_table_del)(softc,
528 1.1 christos softl->ipf_back[i],
529 1.1 christos &op);
530 1.1 christos break;
531 1.1 christos }
532 1.1 christos }
533 1.1 christos
534 1.1 christos if (i == MAX_BACKENDS) {
535 1.1 christos IPFERROR(50030);
536 1.1 christos err = EINVAL;
537 1.1 christos }
538 1.1 christos return err;
539 1.1 christos }
540 1.1 christos
541 1.1 christos
542 1.1 christos /* ------------------------------------------------------------------------ */
543 1.1 christos /* Function: ipf_lookup_stats */
544 1.1 christos /* Returns: int - 0 = success, else error */
545 1.1 christos /* Parameters: softc(I) - pointer to soft context main structure */
546 1.1 christos /* data(I) - pointer to data from ioctl call */
547 1.1 christos /* */
548 1.1 christos /* Copy statistical information from inside the kernel back to user space. */
549 1.1 christos /* ------------------------------------------------------------------------ */
550 1.1 christos static int
551 1.1 christos ipf_lookup_stats(softc, data)
552 1.1 christos ipf_main_softc_t *softc;
553 1.1 christos caddr_t data;
554 1.1 christos {
555 1.1 christos ipf_lookup_softc_t *softl = softc->ipf_lookup_soft;
556 1.1 christos iplookupop_t op;
557 1.1 christos ipf_lookup_t **l;
558 1.1 christos int err;
559 1.1 christos int i;
560 1.1 christos
561 1.1 christos err = BCOPYIN(data, &op, sizeof(op));
562 1.1 christos if (err != 0) {
563 1.1 christos IPFERROR(50031);
564 1.1 christos return EFAULT;
565 1.1 christos }
566 1.1 christos
567 1.1 christos if ((op.iplo_unit < 0 || op.iplo_unit > IPL_LOGMAX) &&
568 1.1 christos (op.iplo_unit != IPLT_ALL)) {
569 1.1 christos IPFERROR(50032);
570 1.1 christos return EINVAL;
571 1.1 christos }
572 1.1 christos
573 1.1 christos for (i = 0, l = backends; i < MAX_BACKENDS; i++, l++) {
574 1.1 christos if (op.iplo_type == (*l)->ipfl_type) {
575 1.1 christos err = (*(*l)->ipfl_stats_get)(softc,
576 1.1 christos softl->ipf_back[i],
577 1.1 christos &op);
578 1.1 christos break;
579 1.1 christos }
580 1.1 christos }
581 1.1 christos
582 1.1 christos if (i == MAX_BACKENDS) {
583 1.1 christos IPFERROR(50033);
584 1.1 christos err = EINVAL;
585 1.1 christos }
586 1.1 christos
587 1.1 christos return err;
588 1.1 christos }
589 1.1 christos
590 1.1 christos
591 1.1 christos /* ------------------------------------------------------------------------ */
592 1.1 christos /* Function: ipf_lookup_flush */
593 1.1 christos /* Returns: int - 0 = success, else error */
594 1.1 christos /* Parameters: softc(I) - pointer to soft context main structure */
595 1.1 christos /* data(I) - pointer to data from ioctl call */
596 1.1 christos /* */
597 1.1 christos /* A flush is called when we want to flush all the nodes from a particular */
598 1.1 christos /* entry in the hash table/pool or want to remove all groups from those. */
599 1.1 christos /* ------------------------------------------------------------------------ */
600 1.1 christos static int
601 1.1 christos ipf_lookup_flush(softc, data)
602 1.1 christos ipf_main_softc_t *softc;
603 1.1 christos caddr_t data;
604 1.1 christos {
605 1.1 christos ipf_lookup_softc_t *softl = softc->ipf_lookup_soft;
606 1.1 christos int err, unit, num, type, i;
607 1.1 christos iplookupflush_t flush;
608 1.1 christos ipf_lookup_t **l;
609 1.1 christos
610 1.1 christos err = BCOPYIN(data, &flush, sizeof(flush));
611 1.1 christos if (err != 0) {
612 1.1 christos IPFERROR(50034);
613 1.1 christos return EFAULT;
614 1.1 christos }
615 1.1 christos
616 1.1 christos unit = flush.iplf_unit;
617 1.1 christos if ((unit < 0 || unit > IPL_LOGMAX) && (unit != IPLT_ALL)) {
618 1.1 christos IPFERROR(50035);
619 1.1 christos return EINVAL;
620 1.1 christos }
621 1.1 christos
622 1.1 christos flush.iplf_name[sizeof(flush.iplf_name) - 1] = '\0';
623 1.1 christos
624 1.1 christos type = flush.iplf_type;
625 1.1 christos IPFERROR(50036);
626 1.1 christos err = EINVAL;
627 1.1 christos num = 0;
628 1.1 christos
629 1.1 christos for (i = 0, l = backends; i < MAX_BACKENDS; i++, l++) {
630 1.1 christos if (type == (*l)->ipfl_type || type == IPLT_ALL) {
631 1.1 christos err = 0;
632 1.1 christos num += (*(*l)->ipfl_flush)(softc,
633 1.1 christos softl->ipf_back[i],
634 1.1 christos &flush);
635 1.1 christos }
636 1.1 christos }
637 1.1 christos
638 1.1 christos if (err == 0) {
639 1.1 christos flush.iplf_count = num;
640 1.1 christos err = BCOPYOUT(&flush, data, sizeof(flush));
641 1.1 christos if (err != 0) {
642 1.1 christos IPFERROR(50037);
643 1.1 christos err = EFAULT;
644 1.1 christos }
645 1.1 christos }
646 1.1 christos return err;
647 1.1 christos }
648 1.1 christos
649 1.1 christos
650 1.1 christos /* ------------------------------------------------------------------------ */
651 1.1 christos /* Function: ipf_lookup_delref */
652 1.1 christos /* Returns: void */
653 1.1 christos /* Parameters: softc(I) - pointer to soft context main structure */
654 1.1 christos /* type(I) - table type to operate on */
655 1.1 christos /* ptr(I) - pointer to object to remove reference for */
656 1.1 christos /* */
657 1.1 christos /* This function organises calling the correct deref function for a given */
658 1.1 christos /* type of object being passed into it. */
659 1.1 christos /* ------------------------------------------------------------------------ */
660 1.1 christos void
661 1.1 christos ipf_lookup_deref(softc, type, ptr)
662 1.1 christos ipf_main_softc_t *softc;
663 1.1 christos int type;
664 1.1 christos void *ptr;
665 1.1 christos {
666 1.1 christos ipf_lookup_softc_t *softl = softc->ipf_lookup_soft;
667 1.1 christos int i;
668 1.1 christos
669 1.1 christos if (ptr == NULL)
670 1.1 christos return;
671 1.1 christos
672 1.1 christos for (i = 0; i < MAX_BACKENDS; i++) {
673 1.1 christos if (type == backends[i]->ipfl_type) {
674 1.1 christos WRITE_ENTER(&softc->ipf_poolrw);
675 1.1 christos (*backends[i]->ipfl_table_deref)(softc,
676 1.1 christos softl->ipf_back[i],
677 1.1 christos ptr);
678 1.1 christos RWLOCK_EXIT(&softc->ipf_poolrw);
679 1.1 christos break;
680 1.1 christos }
681 1.1 christos }
682 1.1 christos }
683 1.1 christos
684 1.1 christos
685 1.1 christos /* ------------------------------------------------------------------------ */
686 1.1 christos /* Function: ipf_lookup_iterate */
687 1.1 christos /* Returns: int - 0 = success, else error */
688 1.1 christos /* Parameters: softc(I) - pointer to soft context main structure */
689 1.1 christos /* data(I) - pointer to data from ioctl call */
690 1.1 christos /* uid(I) - uid of caller */
691 1.1 christos /* ctx(I) - pointer to give the uid context */
692 1.1 christos /* */
693 1.1 christos /* Decodes ioctl request to step through either hash tables or pools. */
694 1.1 christos /* ------------------------------------------------------------------------ */
695 1.1 christos static int
696 1.1 christos ipf_lookup_iterate(softc, data, uid, ctx)
697 1.1 christos ipf_main_softc_t *softc;
698 1.1 christos void *data;
699 1.1 christos int uid;
700 1.1 christos void *ctx;
701 1.1 christos {
702 1.1 christos ipf_lookup_softc_t *softl = softc->ipf_lookup_soft;
703 1.1 christos ipflookupiter_t iter;
704 1.1 christos ipftoken_t *token;
705 1.1 christos int err, i;
706 1.1 christos SPL_INT(s);
707 1.1 christos
708 1.1 christos err = ipf_inobj(softc, data, NULL, &iter, IPFOBJ_LOOKUPITER);
709 1.1 christos if (err != 0)
710 1.1 christos return err;
711 1.1 christos
712 1.1 christos if (iter.ili_unit < IPL_LOGALL && iter.ili_unit > IPL_LOGMAX) {
713 1.1 christos IPFERROR(50038);
714 1.1 christos return EINVAL;
715 1.1 christos }
716 1.1 christos
717 1.1 christos if (iter.ili_ival != IPFGENITER_LOOKUP) {
718 1.1 christos IPFERROR(50039);
719 1.1 christos return EINVAL;
720 1.1 christos }
721 1.1 christos
722 1.1 christos SPL_SCHED(s);
723 1.1 christos token = ipf_token_find(softc, iter.ili_key, uid, ctx);
724 1.1 christos if (token == NULL) {
725 1.1 christos SPL_X(s);
726 1.1 christos IPFERROR(50040);
727 1.1 christos return ESRCH;
728 1.1 christos }
729 1.1 christos
730 1.1 christos for (i = 0; i < MAX_BACKENDS; i++) {
731 1.1 christos if (iter.ili_type == backends[i]->ipfl_type) {
732 1.1 christos err = (*backends[i]->ipfl_iter_next)(softc,
733 1.1 christos softl->ipf_back[i],
734 1.1 christos token, &iter);
735 1.1 christos break;
736 1.1 christos }
737 1.1 christos }
738 1.1 christos SPL_X(s);
739 1.1 christos
740 1.1 christos if (i == MAX_BACKENDS) {
741 1.1 christos IPFERROR(50041);
742 1.1 christos err = EINVAL;
743 1.1 christos }
744 1.1 christos
745 1.1 christos WRITE_ENTER(&softc->ipf_tokens);
746 1.1 christos ipf_token_deref(softc, token);
747 1.1 christos RWLOCK_EXIT(&softc->ipf_tokens);
748 1.1 christos
749 1.1 christos return err;
750 1.1 christos }
751 1.1 christos
752 1.1 christos
753 1.1 christos /* ------------------------------------------------------------------------ */
754 1.1 christos /* Function: ipf_lookup_iterderef */
755 1.1 christos /* Returns: void */
756 1.1 christos /* Parameters: softc(I) - pointer to soft context main structure */
757 1.1 christos /* type(I) - backend type to iterate through */
758 1.1 christos /* data(I) - pointer to data from ioctl call */
759 1.1 christos /* */
760 1.1 christos /* Decodes ioctl request to remove a particular hash table or pool and */
761 1.1 christos /* calls the relevant function to do the cleanup. */
762 1.1 christos /* Because each of the backend types has a different data structure, */
763 1.1 christos /* iteration is limited to one type at a time (i.e. it is not permitted to */
764 1.1 christos /* go on from pool types to hash types as part of the "get next".) */
765 1.1 christos /* ------------------------------------------------------------------------ */
766 1.1 christos void
767 1.1 christos ipf_lookup_iterderef(softc, type, data)
768 1.1 christos ipf_main_softc_t *softc;
769 1.1 christos u_32_t type;
770 1.1 christos void *data;
771 1.1 christos {
772 1.1 christos ipf_lookup_softc_t *softl = softc->ipf_lookup_soft;
773 1.1 christos struct iplookupiterkey *lkey;
774 1.1 christos iplookupiterkey_t key;
775 1.1 christos int i;
776 1.1 christos
777 1.1 christos key.ilik_key = type;
778 1.1 christos lkey = &key.ilik_unstr;
779 1.1 christos
780 1.1 christos if (lkey->ilik_ival != IPFGENITER_LOOKUP)
781 1.1 christos return;
782 1.1 christos
783 1.1 christos WRITE_ENTER(&softc->ipf_poolrw);
784 1.1 christos
785 1.1 christos for (i = 0; i < MAX_BACKENDS; i++) {
786 1.1 christos if (type == backends[i]->ipfl_type) {
787 1.1 christos (*backends[i]->ipfl_iter_deref)(softc,
788 1.1 christos softl->ipf_back[i],
789 1.1 christos lkey->ilik_otype,
790 1.1 christos lkey->ilik_unit,
791 1.1 christos data);
792 1.1 christos break;
793 1.1 christos }
794 1.1 christos }
795 1.1 christos RWLOCK_EXIT(&softc->ipf_poolrw);
796 1.1 christos }
797 1.1 christos
798 1.1 christos
799 1.1 christos /* ------------------------------------------------------------------------ */
800 1.1 christos /* Function: ipf_lookup_deltok */
801 1.1 christos /* Returns: int - 0 = success, else error */
802 1.1 christos /* Parameters: softc(I) - pointer to soft context main structure */
803 1.1 christos /* data(I) - pointer to data from ioctl call */
804 1.1 christos /* uid(I) - uid of caller */
805 1.1 christos /* ctx(I) - pointer to give the uid context */
806 1.1 christos /* */
807 1.1 christos /* Deletes the token identified by the combination of (type,uid,ctx) */
808 1.1 christos /* "key" is a combination of the table type, iterator type and the unit for */
809 1.1 christos /* which the token was being used. */
810 1.1 christos /* ------------------------------------------------------------------------ */
811 1.1 christos int
812 1.1 christos ipf_lookup_deltok(softc, data, uid, ctx)
813 1.1 christos ipf_main_softc_t *softc;
814 1.1 christos void *data;
815 1.1 christos int uid;
816 1.1 christos void *ctx;
817 1.1 christos {
818 1.1 christos int error, key;
819 1.1 christos SPL_INT(s);
820 1.1 christos
821 1.1 christos SPL_SCHED(s);
822 1.1 christos error = BCOPYIN(data, &key, sizeof(key));
823 1.1 christos if (error == 0)
824 1.1 christos error = ipf_token_del(softc, key, uid, ctx);
825 1.1 christos SPL_X(s);
826 1.1 christos return error;
827 1.1 christos }
828 1.1 christos
829 1.1 christos
830 1.1 christos /* ------------------------------------------------------------------------ */
831 1.1 christos /* Function: ipf_lookup_res_num */
832 1.1 christos /* Returns: void * - NULL = failure, else success. */
833 1.1 christos /* Parameters: softc(I) - pointer to soft context main structure */
834 1.1 christos /* unit(I) - device for which this is for */
835 1.1 christos /* type(I) - type of lookup these parameters are for. */
836 1.1 christos /* number(I) - table number to use when searching */
837 1.1 christos /* funcptr(IO) - pointer to pointer for storing IP address */
838 1.1 christos /* searching function. */
839 1.1 christos /* */
840 1.1 christos /* Search for the "table" number passed in amongst those configured for */
841 1.1 christos /* that particular type. If the type is recognised then the function to */
842 1.1 christos /* call to do the IP address search will be change, regardless of whether */
843 1.1 christos /* or not the "table" number exists. */
844 1.1 christos /* ------------------------------------------------------------------------ */
845 1.1 christos void *
846 1.1 christos ipf_lookup_res_num(softc, unit, type, number, funcptr)
847 1.1 christos ipf_main_softc_t *softc;
848 1.1 christos int unit;
849 1.1 christos u_int type;
850 1.1 christos u_int number;
851 1.1 christos lookupfunc_t *funcptr;
852 1.1 christos {
853 1.1 christos char name[FR_GROUPLEN];
854 1.1 christos
855 1.1 christos #if defined(SNPRINTF) && defined(_KERNEL)
856 1.1 christos SNPRINTF(name, sizeof(name), "%u", number);
857 1.1 christos #else
858 1.1 christos (void) sprintf(name, "%u", number);
859 1.1 christos #endif
860 1.1 christos
861 1.1 christos return ipf_lookup_res_name(softc, unit, type, name, funcptr);
862 1.1 christos }
863 1.1 christos
864 1.1 christos
865 1.1 christos /* ------------------------------------------------------------------------ */
866 1.1 christos /* Function: ipf_lookup_res_name */
867 1.1 christos /* Returns: void * - NULL = failure, else success. */
868 1.1 christos /* Parameters: softc(I) - pointer to soft context main structure */
869 1.1 christos /* unit(I) - device for which this is for */
870 1.1 christos /* type(I) - type of lookup these parameters are for. */
871 1.1 christos /* name(I) - table name to use when searching */
872 1.1 christos /* funcptr(IO) - pointer to pointer for storing IP address */
873 1.1 christos /* searching function. */
874 1.1 christos /* */
875 1.1 christos /* Search for the "table" number passed in amongst those configured for */
876 1.1 christos /* that particular type. If the type is recognised then the function to */
877 1.1 christos /* call to do the IP address search will be change, regardless of whether */
878 1.1 christos /* or not the "table" number exists. */
879 1.1 christos /* ------------------------------------------------------------------------ */
880 1.1 christos void *
881 1.1 christos ipf_lookup_res_name(softc, unit, type, name, funcptr)
882 1.1 christos ipf_main_softc_t *softc;
883 1.1 christos int unit;
884 1.1 christos u_int type;
885 1.1 christos char *name;
886 1.1 christos lookupfunc_t *funcptr;
887 1.1 christos {
888 1.1 christos ipf_lookup_softc_t *softl = softc->ipf_lookup_soft;
889 1.1 christos ipf_lookup_t **l;
890 1.1 christos void *ptr = NULL;
891 1.1 christos int i;
892 1.1 christos
893 1.1 christos READ_ENTER(&softc->ipf_poolrw);
894 1.1 christos
895 1.1 christos for (i = 0, l = backends; i < MAX_BACKENDS; i++, l++) {
896 1.1 christos if (type == (*l)->ipfl_type) {
897 1.1 christos ptr = (*(*l)->ipfl_select_add_ref)(softl->ipf_back[i],
898 1.1 christos unit, name);
899 1.1 christos if (ptr != NULL && funcptr != NULL) {
900 1.1 christos *funcptr = (*l)->ipfl_addr_find;
901 1.1 christos }
902 1.1 christos break;
903 1.1 christos }
904 1.1 christos }
905 1.1 christos
906 1.1 christos if (i == MAX_BACKENDS) {
907 1.1 christos ptr = NULL;
908 1.1 christos if (funcptr != NULL)
909 1.1 christos *funcptr = NULL;
910 1.1 christos }
911 1.1 christos
912 1.1 christos RWLOCK_EXIT(&softc->ipf_poolrw);
913 1.1 christos
914 1.1 christos return ptr;
915 1.1 christos }
916 1.1 christos
917 1.1 christos
918 1.1 christos /* ------------------------------------------------------------------------ */
919 1.1 christos /* Function: ipf_lookup_find_htable */
920 1.1 christos /* Returns: void * - NULL = failure, else success. */
921 1.1 christos /* Parameters: softc(I) - pointer to soft context main structure */
922 1.1 christos /* unit(I) - device for which this is for */
923 1.1 christos /* name(I) - table name to use when searching */
924 1.1 christos /* */
925 1.1 christos /* To support the group-map feature, where a hash table maps address */
926 1.1 christos /* networks to rule group numbers, we need to expose a function that uses */
927 1.1 christos /* only the hash table backend. */
928 1.1 christos /* ------------------------------------------------------------------------ */
929 1.1 christos void *
930 1.1 christos ipf_lookup_find_htable(softc, unit, name)
931 1.1 christos ipf_main_softc_t *softc;
932 1.1 christos int unit;
933 1.1 christos char *name;
934 1.1 christos {
935 1.1 christos ipf_lookup_softc_t *softl = softc->ipf_lookup_soft;
936 1.1 christos ipf_lookup_t **l;
937 1.1 christos void *tab = NULL;
938 1.1 christos int i;
939 1.1 christos
940 1.1 christos READ_ENTER(&softc->ipf_poolrw);
941 1.1 christos
942 1.1 christos for (i = 0, l = backends; i < MAX_BACKENDS; i++, l++)
943 1.1 christos if (IPLT_HASH == (*l)->ipfl_type) {
944 1.1 christos tab = ipf_htable_find(softl->ipf_back[i], unit, name);
945 1.1 christos break;
946 1.1 christos }
947 1.1 christos
948 1.1 christos RWLOCK_EXIT(&softc->ipf_poolrw);
949 1.1 christos
950 1.1 christos return tab;
951 1.1 christos }
952 1.1 christos
953 1.1 christos
954 1.1 christos /* ------------------------------------------------------------------------ */
955 1.1 christos /* Function: ipf_lookup_sync */
956 1.1 christos /* Returns: void */
957 1.1 christos /* Parameters: softc(I) - pointer to soft context main structure */
958 1.1 christos /* */
959 1.1 christos /* This function is the interface that the machine dependent sync functions */
960 1.1 christos /* call when a network interface name change occurs. It then calls the sync */
961 1.1 christos /* functions of the lookup implementations - if they have one. */
962 1.1 christos /* ------------------------------------------------------------------------ */
963 1.1 christos /*ARGSUSED*/
964 1.1 christos void
965 1.1 christos ipf_lookup_sync(softc, ifp)
966 1.1 christos ipf_main_softc_t *softc;
967 1.1 christos void *ifp;
968 1.1 christos {
969 1.1 christos ipf_lookup_softc_t *softl = softc->ipf_lookup_soft;
970 1.1 christos ipf_lookup_t **l;
971 1.1 christos int i;
972 1.1 christos
973 1.1 christos READ_ENTER(&softc->ipf_poolrw);
974 1.1 christos
975 1.1 christos for (i = 0, l = backends; i < MAX_BACKENDS; i++, l++)
976 1.1 christos if ((*l)->ipfl_sync != NULL)
977 1.1 christos (*(*l)->ipfl_sync)(softc, softl->ipf_back[i]);
978 1.1 christos
979 1.1 christos RWLOCK_EXIT(&softc->ipf_poolrw);
980 1.1 christos }
981 1.1 christos
982 1.1 christos
983 1.1 christos #ifndef _KERNEL
984 1.1 christos void
985 1.1 christos ipf_lookup_dump(softc, arg)
986 1.1 christos ipf_main_softc_t *softc;
987 1.1 christos void *arg;
988 1.1 christos {
989 1.1 christos ipf_lookup_softc_t *softl = softc->ipf_lookup_soft;
990 1.1 christos ipf_lookup_t **l;
991 1.1 christos int i;
992 1.1 christos
993 1.1 christos for (i = 0, l = backends; i < MAX_BACKENDS; i++, l++)
994 1.1 christos if (IPLT_POOL == (*l)->ipfl_type) {
995 1.1 christos ipf_pool_dump(softc, softl->ipf_back[i]);
996 1.1 christos break;
997 1.1 christos }
998 1.1 christos
999 1.1 christos for (i = 0, l = backends; i < MAX_BACKENDS; i++, l++)
1000 1.1 christos if (IPLT_HASH == (*l)->ipfl_type) {
1001 1.1 christos ipf_htable_dump(softc, softl->ipf_back[i]);
1002 1.1 christos break;
1003 1.1 christos }
1004 1.1 christos }
1005 1.1 christos #endif
1006