コード例 #1
0
ファイル: mlfk_ipl.c プロジェクト: VargMon/netbsd-cvs-mirror
static int
ipf_modload(void)
{
	char *defpass, *c, *str;
	int i, j, error;

	RWLOCK_INIT(&ipf_global, "ipf filter load/unload mutex");
	RWLOCK_INIT(&ipf_mutex, "ipf filter rwlock");
	RWLOCK_INIT(&ipf_frcache, "ipf cache rwlock");

	error = ipfattach();
	if (error) {
		RW_DESTROY(&ipf_global);
		RW_DESTROY(&ipf_mutex);
		RW_DESTROY(&ipf_frcache);
		return error;
	}

	for (i = 0; i < IPL_LOGSIZE; i++)
		ipf_devs[i] = NULL;

	for (i = 0; (str = ipf_devfiles[i]); i++) {
		c = NULL;
		for(j = strlen(str); j > 0; j--)
			if (str[j] == '/') {
				c = str + j + 1;
				break;
			}
		if (!c)
			c = str;
		ipf_devs[i] = make_dev(&ipl_cdevsw, i, 0, 0, 0600, c);
	}

	error = ipf_pfil_hook();
	if (error != 0)
		return error;
	ipf_event_reg();

	if (FR_ISPASS(fr_pass))
		defpass = "******";
	else if (FR_ISBLOCK(fr_pass))
		defpass = "******";
	else
		defpass = "******";

	printf("%s initialized.  Default = %s all, Logging = %s%s\n",
		ipfilter_version, defpass,
#ifdef IPFILTER_LOG
		"enabled",
#else
		"disabled",
#endif
#ifdef IPFILTER_COMPILED
		" (COMPILED)"
#else
		""
#endif
		);
	return 0;
}
コード例 #2
0
static int
if_ipl_lkmload(struct lkm_table *lkmtp, int cmd)
{
	const char *defpass;
	int error;

	if (lkmexists(lkmtp))
		return (EEXIST);

	error = ipfattach();
	if (error == 0) {
		if (FR_ISPASS(fr_pass))
			defpass = "******";
		else if (FR_ISBLOCK(fr_pass))
			defpass = "******";
		else
			defpass = "******";

		printf("%s initialized.  Default = %s all, Logging = %s%s\n",
		    ipfilter_version, defpass,
#ifdef IPFILTER_LOG
		    "enabled",
#else
		    "disabled",
#endif
#ifdef IPFILTER_COMPILED
		    " (COMPILED)"
#else
		    ""
#endif
		);

		fr_running = 1;
	}

	return (error);
}
コード例 #3
0
ファイル: mlfk_ipl.c プロジェクト: 2asoft/freebsd
static void
vnet_ipf_init(void)
{
	char *defpass;
	int error;

	if (ipf_create_all(&V_ipfmain) == NULL)
		return;

	error = ipfattach(&V_ipfmain);
	if (error) {
		ipf_destroy_all(&V_ipfmain);
		return;
	}

	if (FR_ISPASS(V_ipfmain.ipf_pass))
		defpass = "******";
	else if (FR_ISBLOCK(V_ipfmain.ipf_pass))
		defpass = "******";
	else
		defpass = "******";

	if (IS_DEFAULT_VNET(curvnet))
	    printf("%s initialized.  Default = %s all, Logging = %s%s\n",
		ipfilter_version, defpass,
#ifdef IPFILTER_LOG
		"enabled",
#else
		"disabled",
#endif
#ifdef IPFILTER_COMPILED
		" (COMPILED)"
#else
		""
#endif
		);
}
コード例 #4
0
ファイル: mlfk_ipl.c プロジェクト: coyizumi/cs111
static int
ipf_modload()
{
	char *defpass, *c, *str;
	int i, j, error;

	if (ipf_load_all() != 0)
		return EIO;

	if (ipf_create_all(&ipfmain) == NULL)
		return EIO;

	if (ipf_fbsd_sysctl_create(&ipfmain) != 0)
		return EIO;

	error = ipfattach(&ipfmain);
	if (error)
		return error;

	for (i = 0; i < IPL_LOGSIZE; i++)
		ipf_devs[i] = NULL;

	for (i = 0; (str = ipf_devfiles[i]); i++) {
		c = NULL;
		for(j = strlen(str); j > 0; j--)
			if (str[j] == '/') {
				c = str + j + 1;
				break;
			}
		if (!c)
			c = str;
		ipf_devs[i] = make_dev(&ipf_cdevsw, i, 0, 0, 0600, "%s", c);
	}

	error = ipf_pfil_hook();
	if (error != 0)
		return error;
	ipf_event_reg();

	if (FR_ISPASS(ipfmain.ipf_pass))
		defpass = "******";
	else if (FR_ISBLOCK(ipfmain.ipf_pass))
		defpass = "******";
	else
		defpass = "******";

	printf("%s initialized.  Default = %s all, Logging = %s%s\n",
		ipfilter_version, defpass,
#ifdef IPFILTER_LOG
		"enabled",
#else
		"disabled",
#endif
#ifdef IPFILTER_COMPILED
		" (COMPILED)"
#else
		""
#endif
		);
	return 0;
}