Beispiel #1
0
/*
 * ccp_input - process a received CCP packet.
 */
static void
ccp_input(
    int unit,
    u_char *p,
    int len)
{
    fsm *f = &ccp_fsm[unit];
    int oldstate;

    /*
     * Check for a terminate-request so we can print a message.
     */
    oldstate = f->state;
    fsm_input(f, p, len);
    if (oldstate == OPENED && p[0] == TERMREQ && f->state != OPENED)
        notice("Compression disabled by peer.");

    /*
     * If we get a terminate-ack and we're not asking for compression,
     * close CCP.
     */
    if (oldstate == REQSENT && p[0] == TERMACK
            && !ANY_COMPRESS(ccp_gotoptions[unit]))
        ccp_close(unit, "No compression negotiated");
}
Beispiel #2
0
/*
 * ccp_input - process a received CCP packet.
 */
void
ccp_input(PPP_IF_VAR_T *pPppIf, u_char *p, int len)
{
    fsm *f = &pPppIf->ccp_fsm;
    int oldstate;

    /*
     * Check for a terminate-request so we can print a message.
     */
    oldstate = f->state;
    fsm_input(f, p, len);
    if (oldstate == OPENED && p[0] == TERMREQ && f->state != OPENED){
	syslog(SYS_LOG_NOTICE, "Compression disabled by peer.");
	diag_printf("Compression disabled by peer.\n");
#ifdef MPPE
	if (pPppIf->ccp_wantoptions.mppe) {
 	    diag_printf("MPPE disabled, closing LCP\n");
 	    lcp_close(pPppIf);
 	}
#endif /* MPPE */
	}
    /*
     * If we get a terminate-ack and we're not asking for compression,
     * close CCP.
     */
    if (oldstate == REQSENT && p[0] == TERMACK
	&& !ANY_COMPRESS(f->pPppIf->ccp_gotoptions))
	ccp_close(pPppIf);
}
Beispiel #3
0
/*
 * ccp_open - CCP is allowed to come up.
 */
static void
ccp_open(
    int unit)
{
    fsm *f = &ccp_fsm[unit];

    if (f->state != OPENED)
        ccp_flags_set(unit, 1, 0);

    /*
     * Find out which compressors the kernel supports before
     * deciding whether to open in silent mode.
     */
    ccp_resetci(f);
    if (!ANY_COMPRESS(ccp_gotoptions[unit]))
        f->flags |= OPT_SILENT;

    fsm_open(f);
}
Beispiel #4
0
/*
 * ccp_open - CCP is allowed to come up.
 */
void
ccp_open(PPP_IF_VAR_T *pPppIf)
{
	diag_printf("\n<ccp_open>\n");
    fsm *f = &pPppIf->ccp_fsm;

    if (f->state != OPENED)
		ccp_flags_set(&pPppIf->pSc->sc_flags,1, 0);

    /*
     * Find out which compressors the kernel supports before
     * deciding whether to open in silent mode.
     */
    ccp_resetci(f);
    if (!ANY_COMPRESS(f->pPppIf->ccp_gotoptions))
	f->flags |= OPT_SILENT;

	{ //Added by Eddy
		int ipmode = 0;
		CFG_get(CFG_WAN_IP_MODE, &ipmode);
		if (ipmode == PPPOEMODE)
			f->flags |= OPT_SILENT;
	#ifdef	CONFIG_PPTP_PPPOE	
	  //Added by Haitao
	  	int pptp_wanif = 0;
	    CFG_get(CFG_PTP_WANIF, &pptp_wanif);
	    if(ipmode == PPTPMODE && pptp_wanif == 2 && !strcmp(pPppIf->pppname,"ppp0"))//for pptp over pppoe use ppp
			f->flags |= OPT_SILENT;
	#endif	
	#ifdef	CONFIG_L2TP_OVER_PPPOE	
	  int l2tp_wanif = 0;
	  CFG_get(CFG_L2T_WANIF, &l2tp_wanif);
	  if((ipmode == L2TPMODE) && (l2tp_wanif == 2) && (!strcmp(pPppIf->pppname,"ppp0")))//for l2tp over pppoe use ppp
	    f->flags |= OPT_SILENT;
	#endif	
	}

    fsm_open(f);
}