示例#1
0
文件: wps.c 项目: danathughes/esp-idf
void app_main()
{
    /* Initialize NVS — it is used to store PHY calibration data */
    esp_err_t ret = nvs_flash_init();
    if (ret == ESP_ERR_NVS_NO_FREE_PAGES) {
        ESP_ERROR_CHECK(nvs_flash_erase());
        ret = nvs_flash_init();
    }
    ESP_ERROR_CHECK( ret );

    start_wps();
}
示例#2
0
int active_daemons(void)
{
	unsigned char line[100],intf[100]={0},conf_name[30]={"\0"};
	
	int i=0;
	if( !mib_all.wlan[0].legacy_flash_settings.wlanDisabled ) {
#ifdef RTK_WPS_BRIDGE_HACK //mark_wps
		if( !mib_all.wlan[0].legacy_flash_settings.wscDisable )
			start_wps();
#endif	
		if(is_8021x_mode(&mib_all.wlan[0].legacy_flash_settings)){
			//generate config
			sprintf(conf_name,"/var/auth-%s.conf",mib_all.wlan[0].name);
			if( generate_auth_conf(&mib_all.wlan[0].legacy_flash_settings,conf_name,0) < 0 )
				return -1;							
			strcat(intf," ");
			strcat(intf,mib_all.wlan[0].name);
			sprintf(line,"auth %s br0 auth /var/auth-%s.conf",mib_all.wlan[0].name,mib_all.wlan[0].name);
			system(line);
		}
			
		//for(i=1;i<MAX_WLAN_AP_INTF-1;i++){
		for( i=1; i< (get_vap_num()+1); i++){
			if( !mib_all.wlan[i].legacy_flash_settings.wlanDisabled ) {
				if(is_8021x_mode(&mib_all.wlan[i].legacy_flash_settings)){
				//generate config
				sprintf(conf_name,"/var/auth-%s.conf",mib_all.wlan[i].name);
				if( generate_auth_conf(&mib_all.wlan[i].legacy_flash_settings,conf_name,0) < 0 )
					return -1;
				strcat(intf," ");
				strcat(intf,mib_all.wlan[i].name);
				sprintf(line,"auth %s br0 auth /var/auth-%s.conf",mib_all.wlan[i].name,mib_all.wlan[i].name);
				system(line);
				}
			}
		}
		if( strlen(intf) > 0 ) {				
			sprintf(line,"iwcontrol%s",intf);
			system(line);
		}

	}

	return 0;
}
示例#3
0
文件: udhcpc.c 项目: hajuuk/R7000
/*
 * bound: This argument is used when udhcpc moves from an unbound, to
 * a bound state. All of the paramaters are set in enviromental
 * variables, The script should configure the interface, and set any
 * other relavent parameters (default gateway, dns server, etc).
*/
static int
bound_lan(void)
{
	char *lan_ifname = safe_getenv("interface");
	char *value;
	int flags;
	unsigned long addr, netmask;
	struct in_addr in_addr, in_netmask;

	if ((value = getenv("ip")))
		nvram_set("lan_ipaddr", value);
	if ((value = getenv("subnet")))
		nvram_set("lan_netmask", value);
	if ((value = getenv("router")))
		nvram_set("lan_gateway", value);
	if ((value = getenv("lease")))
		expires_lan(lan_ifname, atoi(value));

	/* Check if we do need to do ifconfig */
	if (ifconfig_get(lan_ifname, &flags, &addr, &netmask) == 0) {
		inet_aton(nvram_safe_get("lan_ipaddr"), &in_addr);
		inet_aton(nvram_safe_get("lan_netmask"), &in_netmask);
		if ((flags & IFUP) && addr == in_addr.s_addr && netmask == in_netmask.s_addr)
			goto done;
	}

	ifconfig(lan_ifname, IFUP, nvram_safe_get("lan_ipaddr"),
		nvram_safe_get("lan_netmask"));

	lan_up(lan_ifname);

#ifdef __CONFIG_WPS__
	start_wps();
#endif

done:
	dprintf("done\n");
	return 0;
}