Deleted Added
full compact
mlf_ipl.c (31183) mlf_ipl.c (34739)
1/*
2 * Copyright (C) 1993-1997 by Darren Reed.
3 *
4 * Redistribution and use in source and binary forms are permitted
5 * provided that this notice is preserved and due credit is given
6 * to the original author and the contributors.
7 */
8/*

--- 121 unchanged lines hidden (view full) ---

130SYSCTL_INT(_net_inet_ipf, OID_AUTO, fr_authsize, CTLFLAG_RD,
131 &fr_authsize, 0, "");
132SYSCTL_INT(_net_inet_ipf, OID_AUTO, fr_authused, CTLFLAG_RD,
133 &fr_authused, 0, "");
134SYSCTL_INT(_net_inet_ipf, OID_AUTO, fr_defaultauthage, CTLFLAG_RW,
135 &fr_defaultauthage, 0, "");
136#endif
137
1/*
2 * Copyright (C) 1993-1997 by Darren Reed.
3 *
4 * Redistribution and use in source and binary forms are permitted
5 * provided that this notice is preserved and due credit is given
6 * to the original author and the contributors.
7 */
8/*

--- 121 unchanged lines hidden (view full) ---

130SYSCTL_INT(_net_inet_ipf, OID_AUTO, fr_authsize, CTLFLAG_RD,
131 &fr_authsize, 0, "");
132SYSCTL_INT(_net_inet_ipf, OID_AUTO, fr_authused, CTLFLAG_RD,
133 &fr_authused, 0, "");
134SYSCTL_INT(_net_inet_ipf, OID_AUTO, fr_defaultauthage, CTLFLAG_RW,
135 &fr_defaultauthage, 0, "");
136#endif
137
138#ifdef DEVFS
139void *ipf_devfs[IPL_LOGMAX + 1];
140#endif
141
138#if !defined(__FreeBSD_version) || (__FreeBSD_version < 220000)
139int ipl_major = 0;
140
141MOD_DEV(IPL_VERSION, LM_DT_CHAR, -1, &ipldevsw);
142
143extern struct cdevsw cdevsw[];
144extern int vd_unuseddev __P((void));
145extern int nchrdev;

--- 5 unchanged lines hidden (view full) ---

151 iplioctl, nostop, noreset, nodevtotty,
152 noselect, nommap, nostrategy, "ipl",
153 NULL, -1
154};
155#endif
156
157
158static int iplaction __P((struct lkm_table *, int));
142#if !defined(__FreeBSD_version) || (__FreeBSD_version < 220000)
143int ipl_major = 0;
144
145MOD_DEV(IPL_VERSION, LM_DT_CHAR, -1, &ipldevsw);
146
147extern struct cdevsw cdevsw[];
148extern int vd_unuseddev __P((void));
149extern int nchrdev;

--- 5 unchanged lines hidden (view full) ---

155 iplioctl, nostop, noreset, nodevtotty,
156 noselect, nommap, nostrategy, "ipl",
157 NULL, -1
158};
159#endif
160
161
162static int iplaction __P((struct lkm_table *, int));
163static void ipl_drvinit __P((void *));
159
160
161static int iplaction(lkmtp, cmd)
162struct lkm_table *lkmtp;
163int cmd;
164{
165#if !defined(__FreeBSD_version) || (__FreeBSD_version < 220000)
166 int i = ipl_major;

--- 16 unchanged lines hidden (view full) ---

183 printf("IP Filter: No free cdevsw slots\n");
184 return ENODEV;
185 }
186
187 ipl_major = i;
188 args->lkm_offset = i; /* slot in cdevsw[] */
189#endif
190 printf("IP Filter: loaded into slot %d\n", ipl_major);
164
165
166static int iplaction(lkmtp, cmd)
167struct lkm_table *lkmtp;
168int cmd;
169{
170#if !defined(__FreeBSD_version) || (__FreeBSD_version < 220000)
171 int i = ipl_major;

--- 16 unchanged lines hidden (view full) ---

188 printf("IP Filter: No free cdevsw slots\n");
189 return ENODEV;
190 }
191
192 ipl_major = i;
193 args->lkm_offset = i; /* slot in cdevsw[] */
194#endif
195 printf("IP Filter: loaded into slot %d\n", ipl_major);
191 return if_ipl_load(lkmtp, cmd);
196 err = if_ipl_load(lkmtp, cmd);
197 if (!err)
198 ipl_drvinit((void *)NULL);
199 return err;
192 break;
193 case LKM_E_UNLOAD :
194 err = if_ipl_unload(lkmtp, cmd);
200 break;
201 case LKM_E_UNLOAD :
202 err = if_ipl_unload(lkmtp, cmd);
195 if (!err)
203 if (!err) {
196 printf("IP Filter: unloaded from slot %d\n",
197 ipl_major);
204 printf("IP Filter: unloaded from slot %d\n",
205 ipl_major);
206# ifdef DEVFS
207 if (ipf_devfs[IPL_LOGIPF])
208 devfs_remove_dev(ipf_devfs[IPL_LOGIPF]);
209 if (ipf_devfs[IPL_LOGNAT])
210 devfs_remove_dev(ipf_devfs[IPL_LOGNAT]);
211 if (ipf_devfs[IPL_LOGSTATE])
212 devfs_remove_dev(ipf_devfs[IPL_LOGSTATE]);
213 if (ipf_devfs[IPL_LOGAUTH])
214 devfs_remove_dev(ipf_devfs[IPL_LOGAUTH]);
215# endif
216 }
198 return err;
199 case LKM_E_STAT :
200 break;
201 default:
202 err = EIO;
203 break;
204 }
205 return 0;

--- 115 unchanged lines hidden (view full) ---

321
322
323int if_ipl(lkmtp, cmd, ver)
324struct lkm_table *lkmtp;
325int cmd, ver;
326{
327 DISPATCH(lkmtp, cmd, ver, iplaction, iplaction, iplaction);
328}
217 return err;
218 case LKM_E_STAT :
219 break;
220 default:
221 err = EIO;
222 break;
223 }
224 return 0;

--- 115 unchanged lines hidden (view full) ---

340
341
342int if_ipl(lkmtp, cmd, ver)
343struct lkm_table *lkmtp;
344int cmd, ver;
345{
346 DISPATCH(lkmtp, cmd, ver, iplaction, iplaction, iplaction);
347}
329# else
330
331#ifdef DEVFS
332static void *ipf_devfs_token[IPL_LOGMAX + 1];
333#endif
348# endif
334static ipl_devsw_installed = 0;
335
336static void ipl_drvinit __P((void *unused))
337{
338 dev_t dev;
349static ipl_devsw_installed = 0;
350
351static void ipl_drvinit __P((void *unused))
352{
353 dev_t dev;
339#ifdef DEVFS
340 void **tp = ipf_devfs_token;
341#endif
354# ifdef DEVFS
355 void **tp = ipf_devfs;
356# endif
342
343 if (!ipl_devsw_installed ) {
344 dev = makedev(CDEV_MAJOR, 0);
345 cdevsw_add(&dev, &ipl_cdevsw, NULL);
346 ipl_devsw_installed = 1;
347
357
358 if (!ipl_devsw_installed ) {
359 dev = makedev(CDEV_MAJOR, 0);
360 cdevsw_add(&dev, &ipl_cdevsw, NULL);
361 ipl_devsw_installed = 1;
362
348#ifdef DEVFS
363# ifdef DEVFS
349 tp[IPL_LOGIPF] = devfs_add_devswf(&ipl_cdevsw, IPL_LOGIPF,
364 tp[IPL_LOGIPF] = devfs_add_devswf(&ipl_cdevsw, IPL_LOGIPF,
350 DV_CHR, 0, 0, 0600,
351 "ipf", IPL_LOGIPF);
365 DV_CHR, 0, 0, 0600, "ipf");
352 tp[IPL_LOGNAT] = devfs_add_devswf(&ipl_cdevsw, IPL_LOGNAT,
366 tp[IPL_LOGNAT] = devfs_add_devswf(&ipl_cdevsw, IPL_LOGNAT,
353 DV_CHR, 0, 0, 0600,
354 "ipnat", IPL_LOGNAT);
367 DV_CHR, 0, 0, 0600, "ipnat");
355 tp[IPL_LOGSTATE] = devfs_add_devswf(&ipl_cdevsw, IPL_LOGSTATE,
356 DV_CHR, 0, 0, 0600,
368 tp[IPL_LOGSTATE] = devfs_add_devswf(&ipl_cdevsw, IPL_LOGSTATE,
369 DV_CHR, 0, 0, 0600,
357 "ipstate", IPL_LOGSTATE);
370 "ipstate");
358 tp[IPL_LOGAUTH] = devfs_add_devswf(&ipl_cdevsw, IPL_LOGAUTH,
371 tp[IPL_LOGAUTH] = devfs_add_devswf(&ipl_cdevsw, IPL_LOGAUTH,
359 DV_CHR, 0, 0, 0600,
360 "ipstate", IPL_LOGAUTH);
361#endif
372 DV_CHR, 0, 0, 0600,
373 "ipauth");
374# endif
362 }
363}
364
375 }
376}
377
378# ifdef IPFILTER_LKM
365SYSINIT(ipldev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,ipl_drvinit,NULL)
366# endif /* IPFILTER_LKM */
367#endif /* _FreeBSD_version */
379SYSINIT(ipldev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,ipl_drvinit,NULL)
380# endif /* IPFILTER_LKM */
381#endif /* _FreeBSD_version */