コード例 #1
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
		);
}
コード例 #2
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;
}