Esempio n. 1
0
int restart_dhcpd(std::vector<std::string> & parameters, std::string & response)
{
	int error = 0;
	
	error += stop_dhcpd(parameters, response);
	
	if (!error)
		error += start_dhcpd(parameters, response);
	
	if (!error)
		response = "DHCPD Restart Successful";
	
	return error;
}
Esempio n. 2
0
void sta_start_being_ap()
{
	PROFILES profile;
	pid_t pid;
	char *nas_cmd[]={"nas", "/tmp/nas.conf", NULL};

	//printf("set as a AP");
	/* Become an AP with SSID = Shared Name */
	memset(&profile, 0, sizeof(profile));
	profile.mode = STATION_MODE_AP;
	strcpy(profile.ssid, nvram_safe_get("wl0_ssid")); 

	//printf("ssid: %s\n", profile->ssid);
     	stainfo_g.mode = profile.mode;
	stainfo_g.chan = profile.chan;
	strncpy(stainfo_g.ssid, profile.ssid, 32);
	stainfo_g.rate = profile.rate;
	stainfo_g.wep = profile.wep;
	stainfo_g.wepkeylen = profile.wepkeylen;
	stainfo_g.wepkeyactive = profile.wepkeyactive;
	stainfo_g.sharedkeyauth = profile.sharedkeyauth;
	stainfo_g.brgmacclone = profile.brgmacclone;
	stainfo_g.preamble = profile.preamble;	

	if (nvram_match("wl_wdsmode_x", "1")) nvram_set("wl0_mode", "wds");
	else nvram_set("wl0_mode", "ap");
	//eval("wlconf", "eth2", "up");
	eval("wlconfig", "eth2");
	eval("killall", "nas");
	_eval(nas_cmd, NULL, 0, &pid);

	stop_dhcpd();

	if (!is_dhcpd_exist()) 
	{
		printf("start your own dhcp server\n");
		start_dhcpd();
	}
	sta_state = STA_STATE_BEING_AP;
	sta_status_report(sta_state, 0);
}