Example #1
0
/*
 * IP6 initialization: fill in IP6 protocol switch table.
 * All protocols not implemented in kernel go to raw IP6 protocol handler.
 */
void
ip6_init()
{
	struct ip6protosw *pr;
	int i;
	struct timeval tv;

#if DIAGNOSTIC
	if (sizeof(struct protosw) != sizeof(struct ip6protosw))
		panic("sizeof(protosw) != sizeof(ip6protosw)");
#endif
	pr = (struct ip6protosw *)pffindproto(PF_INET6, IPPROTO_RAW, SOCK_RAW);
	if (pr == 0)
		panic("ip6_init");
	for (i = 0; i < IPPROTO_MAX; i++)
		ip6_protox[i] = pr;
	for (pr = (struct ip6protosw*)inet6domain.dom_protosw; pr; pr = pr->pr_next) {
		if(!((unsigned int)pr->pr_domain)) continue;    /* If uninitialized, skip */
		if (pr->pr_domain->dom_family == PF_INET6 &&
		    pr->pr_protocol && pr->pr_protocol != IPPROTO_RAW) {
			ip6_protox[pr->pr_protocol] = pr;
		}
	}

	ip6intrq.ifq_maxlen = ip6qmaxlen;
#ifndef __APPLE__
	register_netisr(NETISR_IPV6, ip6intr);
#endif
	nd6_init();
	frag6_init();
	icmp6_init();
	/*
	 * in many cases, random() here does NOT return random number
	 * as initialization during bootstrap time occur in fixed order.
	 */
	microtime(&tv);
	ip6_flow_seq = random() ^ tv.tv_usec;
	microtime(&tv);
	ip6_desync_factor = (random() ^ tv.tv_usec) % MAX_TEMP_DESYNC_FACTOR;
	timeout(ip6_init2, (caddr_t)0, 2 * hz);
}
Example #2
0
void usb_register_netisr()
{
	register_netisr(NETISR_USB, usbintr);
	return;
}
Example #3
0
int DOT1X_Start(void)
{
	NDIS_802_11_AUTHENTICATION_MODE     AuthMode = Ndis802_11AuthModeMax;
	int                             IEEE8021X=0;
	char str[20],ifName[20];
	char *pEnd;
	int value = 0;
	int i=0;
	bool need_trigger=FALSE;
	bool any_if_up=FALSE;
	int flag;

	if(interfaces.rtapd != NULL)
	{
		DBGPRINT(RT_DEBUG_ERROR,"DOT1X_Start already run\n");
		return;
        }

	CFG_get_str(CFG_WLN_BssidNum, str);
    	value = strtol(str, &pEnd, 10);
		
	for(i=0 ; i <value ; i++)
	{
		memset(ifName,0x00,20);
		sprintf(ifName, "ra%d", i);
		if(netif_flag_get(ifName, &flag) && (flag&IFF_UP))
		{
			DBGPRINT(RT_DEBUG_ERROR,"%s is up ! \n",ifName);	
			any_if_up = TRUE;
		}
	}

	if(any_if_up == FALSE)
		return;
				

	
    	int ioctl_sock = socket(PF_INET, SOCK_DGRAM, 0);

	if (ioctl_sock < 0)
    	{
	    DBGPRINT(RT_DEBUG_ERROR,"Could not init ioctl socket \n");	
	    return;
    	}

	for(i=0 ; i <value ; i++)
	{
		AuthMode = Ndis802_11AuthModeOpen;
		IEEE8021X = 0;
		if((RT_ioctl(ioctl_sock, RT_PRIV_IOCTL, &AuthMode, sizeof(AuthMode), 0, i, OID_802_11_AUTHENTICATION_MODE)) != 0)
		{
			DBGPRINT(RT_DEBUG_ERROR,"ioctl failed for OID_802_11_AUTHENTICATION_MODE\n");
			return ;
		}

		if((RT_ioctl(ioctl_sock, RT_PRIV_IOCTL, &IEEE8021X, sizeof(IEEE8021X), 0, i, OID_802_11_SET_IEEE8021X)) != 0)
		{
			DBGPRINT(RT_DEBUG_ERROR,"ioctl failed for OID_802_11_SET_IEEE8021X\n");
			return ;
		}

		DBGPRINT(RT_DEBUG_ERROR,"AuthMode=%d, IEEE8021X=%d\n", AuthMode, IEEE8021X);
		if(AuthMode == Ndis802_11AuthModeWPA 
		|| AuthMode == Ndis802_11AuthModeWPA2 
		|| AuthMode == Ndis802_11AuthModeWPA1WPA2
		|| IEEE8021X == 1)
		{
			need_trigger = TRUE;
		}

	}
	close(ioctl_sock);
	register_netisr(NETISR_1X,dot1xintr);
	if(need_trigger == TRUE)
	{
		Dot_Running=TRUE;
                DBGPRINT(RT_DEBUG_ERROR,"Start DOT1X_Start.....(stack size=%d)\n",STACK_SIZE);
	    	cyg_thread_create(5,
	                       Cyg_DOT1X,
	                       0,
	                       "dot1x_daemon",
	                       Dot1x_main_stack,
	                       sizeof(Dot1x_main_stack),
	                       &dot1x_thread,
	                       &dot1x_thread_struct);

		cyg_thread_resume( dot1x_thread );
                cyg_thread_delay(100);
		return 0;
	}
	else
	{
		DBGPRINT(RT_DEBUG_ERROR,"Don't need trigger the 1x Daemon\n");
	}
}