Exemplo n.º 1
0
void start_chilli(void)
{
	int ret = 0;
	char ssid[128];

	stop_chilli();		//ensure that its stopped

	if (!strlen(nvram_safe_get("chilli_interface")))
		nvram_set("chilli_interface", get_wdev());
	if (!strlen(nvram_safe_get("hotss_interface")))
		nvram_set("hotss_interface", get_wdev());
	main_config();
	
#ifdef HAVE_HOTSPOT

	if (nvram_match("chilli_enable", "1")
	    && nvram_match("chilli_def_enable", "0")
	    && !nvram_match("hotss_enable", "1")) {
		nvram_unset("chilli_def_enable");
		nvram_set("chilli_enable", "0");
		return;
	}

	if (!nvram_match("chilli_enable", "1")
	    && !nvram_match("hotss_enable", "1")) {
		nvram_unset("chilli_def_enable");
		return;
	}

	if (nvram_match("hotss_enable", "1")) {
		stop_cron();
		if (!nvram_match("chilli_enable", "1")) {
			nvram_set("chilli_enable", "1");	// to get care of firewall, network, etc.
			nvram_set("chilli_def_enable", "0");
		}
		if (!nvram_match("hotss_preconfig", "1")) {
			nvram_set("hotss_preconfig", "1");
			sprintf(ssid, "HotSpotSystem.com-%s_%s",
				nvram_get("hotss_operatorid"),
				nvram_get("hotss_locationid"));
			nvram_set("wl0_ssid", ssid);
			nvram_set("time_zone", "+00");
			nvram_set("daylight_time", "1");
		}
		hotspotsys_config();
		start_cron();
	} else if (nvram_match("chilli_enable", "1")) {
		nvram_unset("chilli_def_enable");
		chilli_config();
	}
#else
	if (!nvram_match("chilli_enable", "1"))
		return;

	chilli_config();

#endif

	ret = killall("chilli", SIGTERM);
	ret = killall("chilli", SIGKILL);
	if (f_exists("/tmp/chilli/hotss.conf")) {
		ret = eval("chilli", "-c", "/tmp/chilli/hotss.conf");
		dd_syslog(LOG_INFO,
			  "hotspotsystem : chilli daemon successfully started\n");
	} else {
		ret = eval("chilli", "-c", "/tmp/chilli/chilli.conf");
		dd_syslog(LOG_INFO,
			  "chilli : chilli daemon successfully started\n");
	}
#ifdef HAVE_TIEXTRA1
	start_mchilli();
#endif

	cprintf("done\n");
	return;
}
Exemplo n.º 2
0
void start_chilli(void)
{
	int ret = 0;
	char ssid[128];

if ((nvram_match("usb_enable", "1")
	&& nvram_match("usb_storage", "1")
	&& nvram_match("usb_automnt", "1")
	&& nvram_match("usb_mntpoint", "jffs"))
	|| (nvram_match("enable_jffs2", "1")
	&& nvram_match("jffs_mounted", "1")
	&& nvram_match("sys_enable_jffs2", "1")))
		jffs = 1;

	stop_chilli();		//ensure that its stopped

	if (!strlen(nvram_safe_get("chilli_interface")))
		nvram_set("chilli_interface", get_wdev());
	if (!strlen(nvram_safe_get("hotss_interface")))
		nvram_set("hotss_interface", get_wdev());
	main_config();

#ifdef HAVE_HOTSPOT

	if (nvram_match("chilli_enable", "1")
	    && nvram_match("chilli_def_enable", "0")
	    && !nvram_match("hotss_enable", "1")) {
		nvram_unset("chilli_def_enable");
		nvram_set("chilli_enable", "0");
		return;
	}

	if (!nvram_match("chilli_enable", "1")
	    && !nvram_match("hotss_enable", "1")) {
		nvram_unset("chilli_def_enable");
		return;
	}

	if (nvram_match("hotss_enable", "1")) {
		stop_cron();
		if (!nvram_match("chilli_enable", "1")) {
			nvram_set("chilli_enable", "1");	// to get care of firewall, network, etc.
			nvram_set("chilli_def_enable", "0");
		}
		if (!nvram_match("hotss_preconfig", "1")) {
			nvram_set("hotss_preconfig", "1");
			sprintf(ssid, "HotSpotSystem.com-%s_%s", nvram_get("hotss_operatorid"), nvram_get("hotss_locationid"));
			nvram_set("wl0_ssid", ssid);
			nvram_set("time_zone", "+00");
			nvram_set("daylight_time", "1");
		}
		hotspotsys_config();
		start_cron();
	} else if (nvram_match("chilli_enable", "1")) {
		nvram_unset("chilli_def_enable");
		chilli_config();
	}
#else
	if (!nvram_match("chilli_enable", "1"))
		return;

	chilli_config();

#endif

	ret = killall("chilli", SIGTERM);
	ret = killall("chilli", SIGKILL);
	if (f_exists("/tmp/chilli/hotss.conf")) {
#ifdef HAVE_COOVA_CHILLI
		putenv("CHILLISTATEDIR=/var/run/chilli1");
		mkdir("/var/run/chilli1", 0700);
		ret = eval("chilli", "--statedir=/var/run/chilli1",
			"--pidfile=/var/run/chilli1/chilli.pid",
			"-c", "/tmp/chilli/hotss.conf");
#else
		ret = eval("chilli", "-c", "/tmp/chilli/hotss.conf");
#endif
		dd_syslog(LOG_INFO, "hotspotsystem : chilli daemon successfully started\n");
	} else {
#ifdef HAVE_COOVA_CHILLI
		putenv("CHILLISTATEDIR=/var/run/chilli1");
		mkdir("/var/run/chilli1", 0700);
		ret = eval("chilli", "--statedir=/var/run/chilli1",
			"--pidfile=/var/run/chilli1/chilli.pid",
			"-c", "/tmp/chilli/chilli.conf");
#else
		ret = eval("chilli", "-c", "/tmp/chilli/chilli.conf");
#endif
		dd_syslog(LOG_INFO, "chilli : chilli daemon successfully started\n");
	}
#ifdef HAVE_TIEXTRA1
	start_mchilli();
#endif

	cprintf("done\n");
	return;
}