Пример #1
0
void condor_sockaddr::set_protocol(condor_protocol proto) {
	switch(proto) {
		case CP_IPV4: set_ipv4(); break;
		case CP_IPV6: set_ipv6(); break;
		default: ASSERT(0); break;
	}
}
Пример #2
0
void condor_sockaddr::convert_to_ipv6() {
	// only ipv4 addressn can be converted
	if (!is_ipv4())
		return;
	in6_addr addr = to_ipv6_address();
	unsigned short port = get_port();
	clear();
	set_ipv6();
	set_port(port);
	v6.sin6_addr = addr;
}
Пример #3
0
IpAddress::IpAddress(struct ndpi_in6_addr *_ipv6) {
  ip_key = 0;
  set_ipv6(_ipv6);
  addr.privateIP = false;
  compute_key();
}
int setinit(int argc, char** argv)
{
	int i, cmdRet=-1;
	int intValue=0, intValue1=0;
	char cmdBuffer[100], tmpBuff[512];
	char *token=NULL, *savestr1=NULL;
	char tmp_args[16];
	char Ip[32], Mask[32], Gateway[32];
	char strPID[32];
	int pid = 0;
	int wlan_support = 0;
	int index; 
	int old_wlan_idx;
	int repeater_enable1=0;
	int repeater_enable2=0;
	int reinit=1;


#ifdef AEI_WECB
    if( (!strcmp(argv[2], "aei")) && (!strcmp(argv[3], "mac"))) {
#ifdef AEI_CTL_BRIDGE
        init_mac();
#endif
		up_mib_value();
		RunSystemCmd(REINIT_FILE, "echo", "1", NULL_STR);
		RunSystemCmd("/var/sys_op", "echo", "1", NULL_STR);
		RunSystemCmd("/proc/sys/net/ipv4/ip_forward", "echo", "0", NULL_STR);
		RunSystemCmd(PROC_BR_IGMPPROXY, "echo", "0", NULL_STR);
		/*cleanup hardware tables*/
		RunSystemCmd(HW_NAT_FILE, "echo", "2", NULL_STR);	/*bridge mode*/
		
		RunSystemCmd("/proc/br_wlanblock", "echo","0",NULL_STR);

		RunSystemCmd(NULL_FILE, "iptables", "-F", NULL_STR);
		RunSystemCmd(NULL_FILE, "iptables", "-F", "-t", "nat",  NULL_STR);
		RunSystemCmd(NULL_FILE, "iptables", "-A", "INPUT", "-j", "ACCEPT", NULL_STR);
		RunSystemCmd(NULL_FILE, "rm", "-f", "/var/eth1_ip", NULL_STR);
		RunSystemCmd(NULL_FILE, "rm", "-f", "/var/ntp_run", NULL_STR);

		//set kthreadd high priority for performance
		RunSystemCmd(NULL_FILE, "renice -20 2", NULL_STR);
		//set ksoftirqd high priority for performance
		RunSystemCmd(NULL_FILE, "renice -20 3", NULL_STR);
		//set boa high priority
		if(isFileExist(WEBS_PID_FILE)){
			pid=getPid_fromFile(WEBS_PID_FILE);
			if(pid != 0){
				sprintf(strPID, "%d", pid);
				RunSystemCmd(NULL_FILE, "renice", "-20", strPID, NULL_STR);
			}
		}

		RunSystemCmd("/proc/custom_Passthru", "echo", (intValue & 0x1)?"1":"0", NULL_STR);
		/*enable igmp snooping*/
		/*igmp snooping is independent with igmp proxy*/
#ifdef AEI_IGMPV3
		RunSystemCmd(PROC_BR_IGMPVERSION, "echo", "3", NULL_STR);
#else
		RunSystemCmd(PROC_BR_IGMPVERSION, "echo", "2", NULL_STR);
#endif
		RunSystemCmd(PROC_BR_IGMPSNOOP, "echo", "1", NULL_STR);
#if defined(AEI_DISABLE_IGMP_QUERY) || defined(AEI_CONTROL_IGMP_QUERY)
		RunSystemCmd(PROC_BR_IGMPQUERY, "echo", "0", NULL_STR);
#else
		RunSystemCmd(PROC_BR_IGMPQUERY, "echo", "1", NULL_STR);
#endif
		RunSystemCmd(PROC_BR_MLDSNOOP, "echo", "1", NULL_STR);
		RunSystemCmd(PROC_BR_MLDQUERY, "echo", "1", NULL_STR);
		/*increase routing cache rebuild count from 4 to 2048*/
		RunSystemCmd(RT_CACHE_REBUILD_COUNT, "echo", "2048", NULL_STR);
		return 0;
    }
#endif

//step 1: 802.1x client support
#ifdef CONFIG_RTL_802_1X_CLIENT_SUPPORT
	if((isFileExist(RS_USER_CERT_5G)==0) && (isFileExist(RS_ROOT_CERT_5G)==0) &&  (isFileExist(RS_USER_CERT_2G)==0) && (isFileExist(RS_ROOT_CERT_2G)==0)){
		RunSystemCmd(NULL_FILE, "rsCert","-rd", NULL_STR);
	}
#endif
	printf("Init Start...\n");

//step 2		
	num_wlan_interface=get_interfaces_list(5, "wlan", NULL, wlan_interface, sizeof(wlan_interface));
	num_wlan_virtual_interface=get_interfaces_list(9, "wlan", "-va", wlan_virtual_interface, sizeof(wlan_virtual_interface));
	
/*currently, we just support init gw/ap all */	
	
//		clean_process(BRIDGE_MODE,0,1, 1, "br0", wlan_interface, "eth1");
	RunSystemCmd(HW_NAT_FILE, "echo", "2", NULL_STR);	/*bridge mode*/
	RunSystemCmd(NULL_FILE, "killall", "-9", "reload", NULL_STR);


	/*init wlan interface*/
//ifconfig rootap down && flash set_mib
		for(i=0;i<NUM_WLAN_INTERFACE;i++)
		{
			int wlan_disable = 1;
			unsigned char wlan_name[10];
			memset(wlan_name,0x00,sizeof(wlan_name));
			int j;
			for(j=0; j<NUM_VWLAN; j++){
				sprintf(wlan_name, "wlan%d-va%d",i, j);
				RunSystemCmd(NULL_FILE, "ifconfig", wlan_name, "down", NULL_STR);
			}
			sprintf(wlan_name, "wlan%d",i);
			apmib_save_wlanIdx();
			if(SetWlan_idx(wlan_name))
			{			
				apmib_get( MIB_WLAN_WLAN_DISABLED, (void *)&wlan_disable);	  
				if(wlan_disable == 1)
				{
					RunSystemCmd(NULL_FILE, "ifconfig", wlan_name, "down", NULL_STR);
					RunSystemCmd(NULL_FILE, "iwpriv", wlan_name, "radio_off", NULL_STR);					
				}
				else
				{
						
					RunSystemCmd(NULL_FILE, "ifconfig", wlan_name, "down", NULL_STR);
					cmdRet=RunSystemCmd(NULL_FILE, "flash", "set_mib", wlan_name, NULL_STR);
			
					if(cmdRet != 0)
					{
						printf("init %s failed!\n", wlan_name);
						continue;
					}

				}
			}
			apmib_recov_wlanIdx();
		}
		

//ifconfig vap down && flash set_mib
	if(wlan_interface[0]){				
		if(wlan_virtual_interface[0]){
			token=NULL;
			savestr1=NULL;
			sprintf(tmpBuff, "%s", wlan_virtual_interface);
			token = strtok_r(tmpBuff," ", &savestr1);
			do{
				if (token == NULL){
					break;
				}else{
					RunSystemCmd(NULL_FILE, "ifconfig", token, "down", NULL_STR);
					RunSystemCmd(NULL_FILE, "flash", "set_mib", token, NULL_STR);/*set virtual wlan iface*/
				}
				token = strtok_r(NULL, " ", &savestr1);
			}while(token !=NULL);
		}
	}	
///////////////////////////////////////////////////////////	
			//set_br_interface(tmpBuff);
	sprintf(tmpBuff, "%s %s", wlan_interface, wlan_virtual_interface);
	setbridge(tmpBuff);//ifconfig wlanx up or not

	sprintf(br_interface, "%s", "br0");
	start_wlanapp(1);

	system("reload -k /var/wlsch.conf &");

#if defined(CONFIG_IPV6)
	set_ipv6(BRIDGE_MODE);
#endif
	return 0;
}