diff options
author | peter <peter@FreeBSD.org> | 1998-03-21 10:11:54 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 1998-03-21 10:11:54 +0000 |
commit | c3255d453d5de10e30556f3333695cf46ff608c6 (patch) | |
tree | 456b6f9d1dc026b74410390d2d40f4e7a007558f /sys/netinet/mlf_ipl.c | |
parent | 7a56344e6a21f069b204a2d12d165387b09258f2 (diff) | |
download | FreeBSD-src-c3255d453d5de10e30556f3333695cf46ff608c6.zip FreeBSD-src-c3255d453d5de10e30556f3333695cf46ff608c6.tar.gz |
Import kernel parts of ipfilter v3.2.3
Diffstat (limited to 'sys/netinet/mlf_ipl.c')
-rw-r--r-- | sys/netinet/mlf_ipl.c | 52 |
1 files changed, 33 insertions, 19 deletions
diff --git a/sys/netinet/mlf_ipl.c b/sys/netinet/mlf_ipl.c index 3a8ee90..d6601ba 100644 --- a/sys/netinet/mlf_ipl.c +++ b/sys/netinet/mlf_ipl.c @@ -135,6 +135,10 @@ SYSCTL_INT(_net_inet_ipf, OID_AUTO, fr_defaultauthage, CTLFLAG_RW, &fr_defaultauthage, 0, ""); #endif +#ifdef DEVFS +void *ipf_devfs[IPL_LOGMAX + 1]; +#endif + #if !defined(__FreeBSD_version) || (__FreeBSD_version < 220000) int ipl_major = 0; @@ -156,6 +160,7 @@ static struct cdevsw ipl_cdevsw = { static int iplaction __P((struct lkm_table *, int)); +static void ipl_drvinit __P((void *)); static int iplaction(lkmtp, cmd) @@ -188,13 +193,27 @@ int cmd; args->lkm_offset = i; /* slot in cdevsw[] */ #endif printf("IP Filter: loaded into slot %d\n", ipl_major); - return if_ipl_load(lkmtp, cmd); + err = if_ipl_load(lkmtp, cmd); + if (!err) + ipl_drvinit((void *)NULL); + return err; break; case LKM_E_UNLOAD : err = if_ipl_unload(lkmtp, cmd); - if (!err) + if (!err) { printf("IP Filter: unloaded from slot %d\n", ipl_major); +# ifdef DEVFS + if (ipf_devfs[IPL_LOGIPF]) + devfs_remove_dev(ipf_devfs[IPL_LOGIPF]); + if (ipf_devfs[IPL_LOGNAT]) + devfs_remove_dev(ipf_devfs[IPL_LOGNAT]); + if (ipf_devfs[IPL_LOGSTATE]) + devfs_remove_dev(ipf_devfs[IPL_LOGSTATE]); + if (ipf_devfs[IPL_LOGAUTH]) + devfs_remove_dev(ipf_devfs[IPL_LOGAUTH]); +# endif + } return err; case LKM_E_STAT : break; @@ -326,42 +345,37 @@ int cmd, ver; { DISPATCH(lkmtp, cmd, ver, iplaction, iplaction, iplaction); } -# else - -#ifdef DEVFS -static void *ipf_devfs_token[IPL_LOGMAX + 1]; -#endif +# endif static ipl_devsw_installed = 0; static void ipl_drvinit __P((void *unused)) { dev_t dev; -#ifdef DEVFS - void **tp = ipf_devfs_token; -#endif +# ifdef DEVFS + void **tp = ipf_devfs; +# endif if (!ipl_devsw_installed ) { dev = makedev(CDEV_MAJOR, 0); cdevsw_add(&dev, &ipl_cdevsw, NULL); ipl_devsw_installed = 1; -#ifdef DEVFS +# ifdef DEVFS tp[IPL_LOGIPF] = devfs_add_devswf(&ipl_cdevsw, IPL_LOGIPF, - DV_CHR, 0, 0, 0600, - "ipf", IPL_LOGIPF); + DV_CHR, 0, 0, 0600, "ipf"); tp[IPL_LOGNAT] = devfs_add_devswf(&ipl_cdevsw, IPL_LOGNAT, - DV_CHR, 0, 0, 0600, - "ipnat", IPL_LOGNAT); + DV_CHR, 0, 0, 0600, "ipnat"); tp[IPL_LOGSTATE] = devfs_add_devswf(&ipl_cdevsw, IPL_LOGSTATE, DV_CHR, 0, 0, 0600, - "ipstate", IPL_LOGSTATE); + "ipstate"); tp[IPL_LOGAUTH] = devfs_add_devswf(&ipl_cdevsw, IPL_LOGAUTH, - DV_CHR, 0, 0, 0600, - "ipstate", IPL_LOGAUTH); -#endif + DV_CHR, 0, 0, 0600, + "ipauth"); +# endif } } +# ifdef IPFILTER_LKM SYSINIT(ipldev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,ipl_drvinit,NULL) # endif /* IPFILTER_LKM */ #endif /* _FreeBSD_version */ |