Ejemplo n.º 1
0
int main(int argc, char **argv)
{
    int fd, rv;
    char buf[BUFSIZE];

    strcpy(listtype, argv[1]);
    if (get_url_info())
    {
        printf("error during get_url_info()\n");
        return 0;
    }

    memset(buf, 0, sizeof(buf));

    /* open a netlink connection to get packet from kernel */
    fd = netlink_open_connection(NULL);

    while (1)
    {
        rv = recv(fd, buf, sizeof(buf), 0);
        if ( rv >= 0)
        {
#ifdef UFD_DEBUG
            printf("pkt received\n");
#endif
            nfq_handle_packet(h, buf, rv);
            memset(buf, 0, sizeof(buf));
        }
        else
        {
            nfq_close(h);
#ifdef UFD_DEBUG
            printf("nfq close done\n");
#endif
            fd = netlink_open_connection(NULL);
#ifdef UFD_DEBUG
            printf("need to rebind to netfilter queue 0\n");
#endif
        }
    }
#ifdef UFD_DEBUG
    printf("unbinding from queue 0\n");
#endif
    nfq_destroy_queue(qh);
    nfq_close(h);

    return 0;
}
Ejemplo n.º 2
0
int main(int argc, char **argv)
{
	int fd, rv;
	char buf[BUFSIZE]; 

	strcpy(listtype, argv[1]);
	if (get_url_info())
	{
	   printf("error during get_url_info()\n");
	   return 0;
	}

	memset(buf, 0, sizeof(buf));
#if defined(AEI_VDSL_CUSTOMER_NCS)
    signal(SIGINT, SIG_IGN);
#endif
#if defined (DMP_CAPTIVEPORTAL_1)
	cmsMsg_init(EID_URLFILTERD, &msgHandle);
	cmsLog_init(EID_URLFILTERD);
	
	AEI_getCaptiveURLandIPAddr(capURLFile, captiveURL, captiveIPAddr, &flagCaptiveURL);
#if defined(AEI_VDSL_TR098_QWEST)
	AEI_getCaptiveURLandIPAddr(oneTimeCapURLFile, oneTimeRedirectURL, oneTimeRedirectIPAdress, &flagOneTimeRedirect);
#endif        

#if defined(AEI_VDSL_CAPTIVE_PAGES)
	char lan_ip[16] = "\0";
    AEI_get_lan_ip(lan_ip);
    memset(GlbRedirectUrl, 0, sizeof(GlbRedirectUrl));
    sprintf(GlbRedirectUrl, "%s/captiveportal_pageblocked.html", lan_ip);
#endif
	AEI_getCaptiveAllowList();	
#if defined(AEI_VDSL_CUSTOMER_CENTURYLINK)
        AEI_getCaptiveAllowDomain();
#endif
#endif

#if defined(AEI_VDSL_CUSTOMER_WEBACTIVELOG_SWITCH)
	AEI_getWebActiveInfo();
#endif
	/* open a netlink connection to get packet from kernel */
	fd = netlink_open_connection(NULL);

	while (1)
	{
		rv = recv(fd, buf, sizeof(buf), 0);
		if ( rv >= 0) 
		{
#ifdef UFD_DEBUG
		   printf("pkt received\n");
#endif
		   nfq_handle_packet(h, buf, rv);
		   memset(buf, 0, sizeof(buf));
		}
		else
		{
		   nfq_close(h);
#ifdef UFD_DEBUG
		   printf("nfq close done\n");
#endif
		   fd = netlink_open_connection(NULL);
#ifdef UFD_DEBUG
		   printf("need to rebind to netfilter queue 0\n");
#endif
		}
	}
#ifdef UFD_DEBUG
        printf("unbinding from queue 0\n");
#endif
	nfq_destroy_queue(qh);
	nfq_close(h);

	return 0;
}