Deleted Added
full compact
if_pflog.c (130613) if_pflog.c (130933)
1/* $FreeBSD: head/sys/contrib/pf/net/if_pflog.c 130613 2004-06-16 23:24:02Z mlaier $ */
1/* $FreeBSD: head/sys/contrib/pf/net/if_pflog.c 130933 2004-06-22 20:13:25Z brooks $ */
2/* $OpenBSD: if_pflog.c,v 1.11 2003/12/31 11:18:25 cedric Exp $ */
3/*
4 * The authors of this code are John Ioannidis (ji@tla.org),
5 * Angelos D. Keromytis (kermit@csd.uch.gr) and
6 * Niels Provos (provos@physnet.uni-hamburg.de).
7 *
8 * This code was written by John Ioannidis for BSD/OS in Athens, Greece,
9 * in November 1995.
10 *
11 * Ported to OpenBSD and NetBSD, with additional transforms, in December 1996,
12 * by Angelos D. Keromytis.
13 *
14 * Additional transforms and features in 1997 and 1998 by Angelos D. Keromytis
15 * and Niels Provos.
16 *
17 * Copyright (C) 1995, 1996, 1997, 1998 by John Ioannidis, Angelos D. Keromytis
18 * and Niels Provos.
19 * Copyright (c) 2001, Angelos D. Keromytis, Niels Provos.
20 *
21 * Permission to use, copy, and modify this software with or without fee
22 * is hereby granted, provided that this entire notice is included in
23 * all copies of any software which is or includes a copy or
24 * modification of this software.
25 * You may use this code under the GNU public license if you so wish. Please
26 * contribute changes back to the authors under this freer than GPL license
27 * so that we may further the use of strong encryption without limitations to
28 * all.
29 *
30 * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR
31 * IMPLIED WARRANTY. IN PARTICULAR, NONE OF THE AUTHORS MAKES ANY
32 * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE
33 * MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR
34 * PURPOSE.
35 */
36
37#ifdef __FreeBSD__
38#include "opt_inet.h"
39#include "opt_inet6.h"
40#endif
41
42#ifndef __FreeBSD__
43#include "bpfilter.h"
44#include "pflog.h"
45#elif __FreeBSD__ >= 5
46#include "opt_bpf.h"
47#include "opt_pf.h"
48#define NBPFILTER DEV_BPF
49#define NPFLOG DEV_PFLOG
50#endif
51
52#include <sys/param.h>
53#include <sys/systm.h>
54#include <sys/mbuf.h>
55#include <sys/socket.h>
56#ifdef __FreeBSD__
57#include <sys/kernel.h>
58#include <sys/malloc.h>
59#include <sys/module.h>
60#include <sys/sockio.h>
61#else
62#include <sys/ioctl.h>
63#endif
64
65#include <net/if.h>
2/* $OpenBSD: if_pflog.c,v 1.11 2003/12/31 11:18:25 cedric Exp $ */
3/*
4 * The authors of this code are John Ioannidis (ji@tla.org),
5 * Angelos D. Keromytis (kermit@csd.uch.gr) and
6 * Niels Provos (provos@physnet.uni-hamburg.de).
7 *
8 * This code was written by John Ioannidis for BSD/OS in Athens, Greece,
9 * in November 1995.
10 *
11 * Ported to OpenBSD and NetBSD, with additional transforms, in December 1996,
12 * by Angelos D. Keromytis.
13 *
14 * Additional transforms and features in 1997 and 1998 by Angelos D. Keromytis
15 * and Niels Provos.
16 *
17 * Copyright (C) 1995, 1996, 1997, 1998 by John Ioannidis, Angelos D. Keromytis
18 * and Niels Provos.
19 * Copyright (c) 2001, Angelos D. Keromytis, Niels Provos.
20 *
21 * Permission to use, copy, and modify this software with or without fee
22 * is hereby granted, provided that this entire notice is included in
23 * all copies of any software which is or includes a copy or
24 * modification of this software.
25 * You may use this code under the GNU public license if you so wish. Please
26 * contribute changes back to the authors under this freer than GPL license
27 * so that we may further the use of strong encryption without limitations to
28 * all.
29 *
30 * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR
31 * IMPLIED WARRANTY. IN PARTICULAR, NONE OF THE AUTHORS MAKES ANY
32 * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE
33 * MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR
34 * PURPOSE.
35 */
36
37#ifdef __FreeBSD__
38#include "opt_inet.h"
39#include "opt_inet6.h"
40#endif
41
42#ifndef __FreeBSD__
43#include "bpfilter.h"
44#include "pflog.h"
45#elif __FreeBSD__ >= 5
46#include "opt_bpf.h"
47#include "opt_pf.h"
48#define NBPFILTER DEV_BPF
49#define NPFLOG DEV_PFLOG
50#endif
51
52#include <sys/param.h>
53#include <sys/systm.h>
54#include <sys/mbuf.h>
55#include <sys/socket.h>
56#ifdef __FreeBSD__
57#include <sys/kernel.h>
58#include <sys/malloc.h>
59#include <sys/module.h>
60#include <sys/sockio.h>
61#else
62#include <sys/ioctl.h>
63#endif
64
65#include <net/if.h>
66#if defined(__FreeBSD__)
67#include <net/if_clone.h>
68#endif
66#include <net/if_types.h>
67#include <net/route.h>
68#include <net/bpf.h>
69
70#ifdef INET
71#include <netinet/in.h>
72#include <netinet/in_var.h>
73#include <netinet/in_systm.h>
74#include <netinet/ip.h>
75#endif
76
77#ifdef __FreeBSD__
78#include <machine/in_cksum.h>
79#endif
80
81#ifdef INET6
82#ifndef INET
83#include <netinet/in.h>
84#endif
85#include <netinet6/nd6.h>
86#endif /* INET6 */
87
88#include <net/pfvar.h>
89#include <net/if_pflog.h>
90
91#ifdef __FreeBSD__
92#define PFLOGNAME "pflog"
93#endif
94
95#define PFLOGMTU (32768 + MHLEN + MLEN)
96
97#ifdef PFLOGDEBUG
98#define DPRINTF(x) do { if (pflogdebug) printf x ; } while (0)
99#else
100#define DPRINTF(x)
101#endif
102
103#ifndef __FreeBSD__
104struct pflog_softc pflogif[NPFLOG];
105#endif
106
107#ifdef __FreeBSD__
108static void pflog_clone_destroy(struct ifnet *);
109static int pflog_clone_create(struct if_clone *, int);
110#else
111void pflogattach(int);
112#endif
113int pflogoutput(struct ifnet *, struct mbuf *, struct sockaddr *,
114 struct rtentry *);
115int pflogioctl(struct ifnet *, u_long, caddr_t);
116void pflogrtrequest(int, struct rtentry *, struct sockaddr *);
117void pflogstart(struct ifnet *);
118
119#ifndef __FreeBSD__
120extern int ifqmaxlen;
121#endif
122
123#ifdef __FreeBSD__
124static MALLOC_DEFINE(M_PFLOG, PFLOGNAME, "Packet Filter Logging Interface");
125static LIST_HEAD(pflog_list, pflog_softc) pflog_list;
69#include <net/if_types.h>
70#include <net/route.h>
71#include <net/bpf.h>
72
73#ifdef INET
74#include <netinet/in.h>
75#include <netinet/in_var.h>
76#include <netinet/in_systm.h>
77#include <netinet/ip.h>
78#endif
79
80#ifdef __FreeBSD__
81#include <machine/in_cksum.h>
82#endif
83
84#ifdef INET6
85#ifndef INET
86#include <netinet/in.h>
87#endif
88#include <netinet6/nd6.h>
89#endif /* INET6 */
90
91#include <net/pfvar.h>
92#include <net/if_pflog.h>
93
94#ifdef __FreeBSD__
95#define PFLOGNAME "pflog"
96#endif
97
98#define PFLOGMTU (32768 + MHLEN + MLEN)
99
100#ifdef PFLOGDEBUG
101#define DPRINTF(x) do { if (pflogdebug) printf x ; } while (0)
102#else
103#define DPRINTF(x)
104#endif
105
106#ifndef __FreeBSD__
107struct pflog_softc pflogif[NPFLOG];
108#endif
109
110#ifdef __FreeBSD__
111static void pflog_clone_destroy(struct ifnet *);
112static int pflog_clone_create(struct if_clone *, int);
113#else
114void pflogattach(int);
115#endif
116int pflogoutput(struct ifnet *, struct mbuf *, struct sockaddr *,
117 struct rtentry *);
118int pflogioctl(struct ifnet *, u_long, caddr_t);
119void pflogrtrequest(int, struct rtentry *, struct sockaddr *);
120void pflogstart(struct ifnet *);
121
122#ifndef __FreeBSD__
123extern int ifqmaxlen;
124#endif
125
126#ifdef __FreeBSD__
127static MALLOC_DEFINE(M_PFLOG, PFLOGNAME, "Packet Filter Logging Interface");
128static LIST_HEAD(pflog_list, pflog_softc) pflog_list;
126struct if_clone pflog_cloner = IF_CLONE_INITIALIZER(PFLOGNAME,
127 pflog_clone_create, pflog_clone_destroy, 1, IF_MAXUNIT);
129IFC_SIMPLE_DECLARE(pflog, 1);
128
129static void
130pflog_clone_destroy(struct ifnet *ifp)
131{
132 struct pflog_softc *sc;
133
134 sc = ifp->if_softc;
135
136 /*
137 * Does we really need this?
138 */
139 IF_DRAIN(&ifp->if_snd);
140
141 bpfdetach(ifp);
142 if_detach(ifp);
143 LIST_REMOVE(sc, sc_next);
144 free(sc, M_PFLOG);
145}
146
147static int
148pflog_clone_create(struct if_clone *ifc, int unit)
149{
150 struct pflog_softc *sc;
151
152 MALLOC(sc, struct pflog_softc *, sizeof(*sc), M_PFLOG, M_WAITOK|M_ZERO);
153
154 if_initname(&sc->sc_if, ifc->ifc_name, unit);
155 sc->sc_if.if_mtu = PFLOGMTU;
156 sc->sc_if.if_ioctl = pflogioctl;
157 sc->sc_if.if_output = pflogoutput;
158 sc->sc_if.if_start = pflogstart;
159 sc->sc_if.if_type = IFT_PFLOG;
160 sc->sc_if.if_snd.ifq_maxlen = ifqmaxlen;
161 sc->sc_if.if_hdrlen = PFLOG_HDRLEN;
162 sc->sc_if.if_softc = sc;
163 if_attach(&sc->sc_if);
164
165 LIST_INSERT_HEAD(&pflog_list, sc, sc_next);
166#if NBPFILTER > 0
167 bpfattach(&sc->sc_if, DLT_PFLOG, PFLOG_HDRLEN);
168#endif
169
170 return (0);
171}
172#else /* !__FreeBSD__ */
173void
174pflogattach(int npflog)
175{
176 struct ifnet *ifp;
177 int i;
178
179 bzero(pflogif, sizeof(pflogif));
180
181 for (i = 0; i < NPFLOG; i++) {
182 ifp = &pflogif[i].sc_if;
183 snprintf(ifp->if_xname, sizeof ifp->if_xname, "pflog%d", i);
184 ifp->if_softc = &pflogif[i];
185 ifp->if_mtu = PFLOGMTU;
186 ifp->if_ioctl = pflogioctl;
187 ifp->if_output = pflogoutput;
188 ifp->if_start = pflogstart;
189 ifp->if_type = IFT_PFLOG;
190 ifp->if_snd.ifq_maxlen = ifqmaxlen;
191 ifp->if_hdrlen = PFLOG_HDRLEN;
192 if_attach(ifp);
193 if_alloc_sadl(ifp);
194
195#if NBPFILTER > 0
196 bpfattach(&pflogif[i].sc_if.if_bpf, ifp, DLT_PFLOG,
197 PFLOG_HDRLEN);
198#endif
199 }
200}
201#endif /* __FreeBSD__ */
202
203/*
204 * Start output on the pflog interface.
205 */
206void
207pflogstart(struct ifnet *ifp)
208{
209 struct mbuf *m;
210#ifndef __FreeBSD__
211 int s;
212#endif
213
214 for (;;) {
215#ifdef __FreeBSD__
216 IF_LOCK(&ifp->if_snd);
217 _IF_DROP(&ifp->if_snd);
218 _IF_DEQUEUE(&ifp->if_snd, m);
219 if (m == NULL) {
220 IF_UNLOCK(&ifp->if_snd);
221 return;
222 }
223 else
224 m_freem(m);
225 IF_UNLOCK(&ifp->if_snd);
226#else
227 s = splimp();
228 IF_DROP(&ifp->if_snd);
229 IF_DEQUEUE(&ifp->if_snd, m);
230 splx(s);
231 if (m == NULL)
232 return;
233 else
234 m_freem(m);
235#endif
236 }
237}
238
239int
240pflogoutput(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst,
241 struct rtentry *rt)
242{
243 m_freem(m);
244 return (0);
245}
246
247/* ARGSUSED */
248void
249pflogrtrequest(int cmd, struct rtentry *rt, struct sockaddr *sa)
250{
251 if (rt)
252 rt->rt_rmx.rmx_mtu = PFLOGMTU;
253}
254
255/* ARGSUSED */
256int
257pflogioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
258{
259 switch (cmd) {
260 case SIOCSIFADDR:
261 case SIOCAIFADDR:
262 case SIOCSIFDSTADDR:
263 case SIOCSIFFLAGS:
264 if (ifp->if_flags & IFF_UP)
265 ifp->if_flags |= IFF_RUNNING;
266 else
267 ifp->if_flags &= ~IFF_RUNNING;
268 break;
269 default:
270 return (EINVAL);
271 }
272
273 return (0);
274}
275
276int
277pflog_packet(struct pfi_kif *kif, struct mbuf *m, sa_family_t af, u_int8_t dir,
278 u_int8_t reason, struct pf_rule *rm, struct pf_rule *am,
279 struct pf_ruleset *ruleset)
280{
281#if NBPFILTER > 0
282 struct ifnet *ifn;
283 struct pfloghdr hdr;
284#ifndef __FreeBSD__
285 struct mbuf m1;
286#endif
287
288 if (kif == NULL || m == NULL || rm == NULL)
289 return (-1);
290
291 bzero(&hdr, sizeof(hdr));
292 hdr.length = PFLOG_REAL_HDRLEN;
293 hdr.af = af;
294 hdr.action = rm->action;
295 hdr.reason = reason;
296 memcpy(hdr.ifname, kif->pfik_name, sizeof(hdr.ifname));
297
298 if (am == NULL) {
299 hdr.rulenr = htonl(rm->nr);
300 hdr.subrulenr = -1;
301 } else {
302 hdr.rulenr = htonl(am->nr);
303 hdr.subrulenr = htonl(rm->nr);
304 if (ruleset != NULL)
305 memcpy(hdr.ruleset, ruleset->name,
306 sizeof(hdr.ruleset));
307
308
309 }
310 hdr.dir = dir;
311
312#ifdef INET
313 if (af == AF_INET && dir == PF_OUT) {
314 struct ip *ip;
315
316 ip = mtod(m, struct ip *);
317 ip->ip_sum = 0;
318 ip->ip_sum = in_cksum(m, ip->ip_hl << 2);
319 }
320#endif /* INET */
321
322#ifndef __FreeBSD__
323 m1.m_next = m;
324 m1.m_len = PFLOG_HDRLEN;
325 m1.m_data = (char *) &hdr;
326#endif
327
328#ifdef __FreeBSD__
329 KASSERT((!LIST_EMPTY(&pflog_list)), ("pflog: no interface"));
330 ifn = &LIST_FIRST(&pflog_list)->sc_if;
331 BPF_MTAP2(ifn, &hdr, sizeof(hdr), m);
332#else
333 ifn = &(pflogif[0].sc_if);
334
335 if (ifn->if_bpf)
336 bpf_mtap(ifn->if_bpf, &m1);
337#endif
338#endif
339
340 return (0);
341}
342
343#ifdef __FreeBSD__
344static int
345pflog_modevent(module_t mod, int type, void *data)
346{
347 int error = 0;
348
349 switch (type) {
350 case MOD_LOAD:
351 LIST_INIT(&pflog_list);
352 if_clone_attach(&pflog_cloner);
353 break;
354
355 case MOD_UNLOAD:
356 if_clone_detach(&pflog_cloner);
357 while (!LIST_EMPTY(&pflog_list))
358 pflog_clone_destroy(
359 &LIST_FIRST(&pflog_list)->sc_if);
360 break;
361
362 default:
363 error = EINVAL;
364 break;
365 }
366
367 return error;
368}
369
370static moduledata_t pflog_mod = {
371 "pflog",
372 pflog_modevent,
373 0
374};
375
376#define PFLOG_MODVER 1
377
378DECLARE_MODULE(pflog, pflog_mod, SI_SUB_PSEUDO, SI_ORDER_ANY);
379MODULE_VERSION(pflog, PFLOG_MODVER);
380#endif /* __FreeBSD__ */
130
131static void
132pflog_clone_destroy(struct ifnet *ifp)
133{
134 struct pflog_softc *sc;
135
136 sc = ifp->if_softc;
137
138 /*
139 * Does we really need this?
140 */
141 IF_DRAIN(&ifp->if_snd);
142
143 bpfdetach(ifp);
144 if_detach(ifp);
145 LIST_REMOVE(sc, sc_next);
146 free(sc, M_PFLOG);
147}
148
149static int
150pflog_clone_create(struct if_clone *ifc, int unit)
151{
152 struct pflog_softc *sc;
153
154 MALLOC(sc, struct pflog_softc *, sizeof(*sc), M_PFLOG, M_WAITOK|M_ZERO);
155
156 if_initname(&sc->sc_if, ifc->ifc_name, unit);
157 sc->sc_if.if_mtu = PFLOGMTU;
158 sc->sc_if.if_ioctl = pflogioctl;
159 sc->sc_if.if_output = pflogoutput;
160 sc->sc_if.if_start = pflogstart;
161 sc->sc_if.if_type = IFT_PFLOG;
162 sc->sc_if.if_snd.ifq_maxlen = ifqmaxlen;
163 sc->sc_if.if_hdrlen = PFLOG_HDRLEN;
164 sc->sc_if.if_softc = sc;
165 if_attach(&sc->sc_if);
166
167 LIST_INSERT_HEAD(&pflog_list, sc, sc_next);
168#if NBPFILTER > 0
169 bpfattach(&sc->sc_if, DLT_PFLOG, PFLOG_HDRLEN);
170#endif
171
172 return (0);
173}
174#else /* !__FreeBSD__ */
175void
176pflogattach(int npflog)
177{
178 struct ifnet *ifp;
179 int i;
180
181 bzero(pflogif, sizeof(pflogif));
182
183 for (i = 0; i < NPFLOG; i++) {
184 ifp = &pflogif[i].sc_if;
185 snprintf(ifp->if_xname, sizeof ifp->if_xname, "pflog%d", i);
186 ifp->if_softc = &pflogif[i];
187 ifp->if_mtu = PFLOGMTU;
188 ifp->if_ioctl = pflogioctl;
189 ifp->if_output = pflogoutput;
190 ifp->if_start = pflogstart;
191 ifp->if_type = IFT_PFLOG;
192 ifp->if_snd.ifq_maxlen = ifqmaxlen;
193 ifp->if_hdrlen = PFLOG_HDRLEN;
194 if_attach(ifp);
195 if_alloc_sadl(ifp);
196
197#if NBPFILTER > 0
198 bpfattach(&pflogif[i].sc_if.if_bpf, ifp, DLT_PFLOG,
199 PFLOG_HDRLEN);
200#endif
201 }
202}
203#endif /* __FreeBSD__ */
204
205/*
206 * Start output on the pflog interface.
207 */
208void
209pflogstart(struct ifnet *ifp)
210{
211 struct mbuf *m;
212#ifndef __FreeBSD__
213 int s;
214#endif
215
216 for (;;) {
217#ifdef __FreeBSD__
218 IF_LOCK(&ifp->if_snd);
219 _IF_DROP(&ifp->if_snd);
220 _IF_DEQUEUE(&ifp->if_snd, m);
221 if (m == NULL) {
222 IF_UNLOCK(&ifp->if_snd);
223 return;
224 }
225 else
226 m_freem(m);
227 IF_UNLOCK(&ifp->if_snd);
228#else
229 s = splimp();
230 IF_DROP(&ifp->if_snd);
231 IF_DEQUEUE(&ifp->if_snd, m);
232 splx(s);
233 if (m == NULL)
234 return;
235 else
236 m_freem(m);
237#endif
238 }
239}
240
241int
242pflogoutput(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst,
243 struct rtentry *rt)
244{
245 m_freem(m);
246 return (0);
247}
248
249/* ARGSUSED */
250void
251pflogrtrequest(int cmd, struct rtentry *rt, struct sockaddr *sa)
252{
253 if (rt)
254 rt->rt_rmx.rmx_mtu = PFLOGMTU;
255}
256
257/* ARGSUSED */
258int
259pflogioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
260{
261 switch (cmd) {
262 case SIOCSIFADDR:
263 case SIOCAIFADDR:
264 case SIOCSIFDSTADDR:
265 case SIOCSIFFLAGS:
266 if (ifp->if_flags & IFF_UP)
267 ifp->if_flags |= IFF_RUNNING;
268 else
269 ifp->if_flags &= ~IFF_RUNNING;
270 break;
271 default:
272 return (EINVAL);
273 }
274
275 return (0);
276}
277
278int
279pflog_packet(struct pfi_kif *kif, struct mbuf *m, sa_family_t af, u_int8_t dir,
280 u_int8_t reason, struct pf_rule *rm, struct pf_rule *am,
281 struct pf_ruleset *ruleset)
282{
283#if NBPFILTER > 0
284 struct ifnet *ifn;
285 struct pfloghdr hdr;
286#ifndef __FreeBSD__
287 struct mbuf m1;
288#endif
289
290 if (kif == NULL || m == NULL || rm == NULL)
291 return (-1);
292
293 bzero(&hdr, sizeof(hdr));
294 hdr.length = PFLOG_REAL_HDRLEN;
295 hdr.af = af;
296 hdr.action = rm->action;
297 hdr.reason = reason;
298 memcpy(hdr.ifname, kif->pfik_name, sizeof(hdr.ifname));
299
300 if (am == NULL) {
301 hdr.rulenr = htonl(rm->nr);
302 hdr.subrulenr = -1;
303 } else {
304 hdr.rulenr = htonl(am->nr);
305 hdr.subrulenr = htonl(rm->nr);
306 if (ruleset != NULL)
307 memcpy(hdr.ruleset, ruleset->name,
308 sizeof(hdr.ruleset));
309
310
311 }
312 hdr.dir = dir;
313
314#ifdef INET
315 if (af == AF_INET && dir == PF_OUT) {
316 struct ip *ip;
317
318 ip = mtod(m, struct ip *);
319 ip->ip_sum = 0;
320 ip->ip_sum = in_cksum(m, ip->ip_hl << 2);
321 }
322#endif /* INET */
323
324#ifndef __FreeBSD__
325 m1.m_next = m;
326 m1.m_len = PFLOG_HDRLEN;
327 m1.m_data = (char *) &hdr;
328#endif
329
330#ifdef __FreeBSD__
331 KASSERT((!LIST_EMPTY(&pflog_list)), ("pflog: no interface"));
332 ifn = &LIST_FIRST(&pflog_list)->sc_if;
333 BPF_MTAP2(ifn, &hdr, sizeof(hdr), m);
334#else
335 ifn = &(pflogif[0].sc_if);
336
337 if (ifn->if_bpf)
338 bpf_mtap(ifn->if_bpf, &m1);
339#endif
340#endif
341
342 return (0);
343}
344
345#ifdef __FreeBSD__
346static int
347pflog_modevent(module_t mod, int type, void *data)
348{
349 int error = 0;
350
351 switch (type) {
352 case MOD_LOAD:
353 LIST_INIT(&pflog_list);
354 if_clone_attach(&pflog_cloner);
355 break;
356
357 case MOD_UNLOAD:
358 if_clone_detach(&pflog_cloner);
359 while (!LIST_EMPTY(&pflog_list))
360 pflog_clone_destroy(
361 &LIST_FIRST(&pflog_list)->sc_if);
362 break;
363
364 default:
365 error = EINVAL;
366 break;
367 }
368
369 return error;
370}
371
372static moduledata_t pflog_mod = {
373 "pflog",
374 pflog_modevent,
375 0
376};
377
378#define PFLOG_MODVER 1
379
380DECLARE_MODULE(pflog, pflog_mod, SI_SUB_PSEUDO, SI_ORDER_ANY);
381MODULE_VERSION(pflog, PFLOG_MODVER);
382#endif /* __FreeBSD__ */