Exemple #1
0
/** This function is called on authentication succeed */
void
ppp_auth_ok(npppd_ppp *_this)
{
	if (npppd_ppp_bind_iface(_this->pppd, _this) != 0) {
		ppp_log(_this, LOG_WARNING, "No interface binding.");
		ppp_stop(_this, NULL);

		return;
	}
	if (_this->realm != NULL) {
		npppd_ppp_get_username_for_auth(_this->pppd, _this,
		    _this->username, _this->username);
		if (!npppd_check_calling_number(_this->pppd, _this)) {
			ppp_log(_this, LOG_ALERT,
			    "logtype=TUNNELDENY user=\"%s\" "
			    "reason=\"Calling number check is failed\"",
			    _this->username);
			    /* XXX */
			ppp_stop(_this, NULL);
			return;
		}
	}
	if (_this->peer_auth != 0) {
		/* Limit the number of connections per the user */
		if (!npppd_check_user_max_session(_this->pppd, _this)) {
			ppp_log(_this, LOG_WARNING,
			    "user %s exceeds user-max-session limit",
			    _this->username);
			ppp_stop(_this, NULL);

			return;
		}
		PPP_ASSERT(_this->realm != NULL);
	}

	if (!npppd_ppp_iface_is_ready(_this->pppd, _this)) {
		ppp_log(_this, LOG_WARNING,
		    "interface '%s' is not ready.",
		    npppd_ppp_get_iface_name(_this->pppd, _this));
		ppp_stop(_this, NULL);

		return;
	}
	if (_this->proxy_authen_resp != NULL) {
		free(_this->proxy_authen_resp);
		_this->proxy_authen_resp = NULL;
	}

	fsm_lowerup(&_this->ipcp.fsm);
	fsm_open(&_this->ipcp.fsm);
#ifdef	USE_NPPPD_MPPE
	if (MPPE_MUST_NEGO(_this)) {
		fsm_lowerup(&_this->ccp.fsm);
		fsm_open(&_this->ccp.fsm);
	}
#endif

	return;
}
/*
 * fsm_open - Link is allowed to come up.
 */
void fsm_open(fsm *f) {
    switch( f->state ){
    case PPP_FSM_INITIAL:
	f->state = PPP_FSM_STARTING;
	if( f->callbacks->starting )
	    (*f->callbacks->starting)(f);
	break;

    case PPP_FSM_CLOSED:
	if( f->flags & OPT_SILENT )
	    f->state = PPP_FSM_STOPPED;
	else {
	    /* Send an initial configure-request */
	    fsm_sconfreq(f, 0);
	    f->state = PPP_FSM_REQSENT;
	}
	break;

    case PPP_FSM_CLOSING:
	f->state = PPP_FSM_STOPPING;
	/* fall through */
	/* no break */
    case PPP_FSM_STOPPED:
    case PPP_FSM_OPENED:
	if( f->flags & OPT_RESTART ){
	    fsm_lowerdown(f);
	    fsm_lowerup(f);
	}
	break;
    default:
	break;
    }
}
Exemple #3
0
/*
 * lcp_lowerup - The lower layer is up.
 */
void
lcp_lowerup(
    int unit)
{
    lcp_options *wo = &lcp_wantoptions[unit];

    /*
     * Don't use A/C or protocol compression on transmission,
     * but accept A/C and protocol compressed packets
     * if we are going to ask for A/C and protocol compression.
     */
    ppp_set_xaccm(unit, xmit_accm[unit]);
    ppp_send_config(unit, PPP_MRU, 0xffffffff, 0, 0);
    ppp_recv_config(unit, PPP_MRU, (lax_recv? 0: 0xffffffff),
		    wo->neg_pcompression, wo->neg_accompression);
    peer_mru[unit] = PPP_MRU;
    lcp_allowoptions[unit].asyncmap = xmit_accm[unit][0];

    fsm_lowerup(&lcp_fsm[unit]);
}
Exemple #4
0
/*
 * fsm_open - Link is allowed to come up.
 */
void
fsm_open(fsm *f)
{
  int oldState = f->state;

  LWIP_UNUSED_ARG(oldState);

  switch( f->state ) {
    case LS_INITIAL:
      f->state = LS_STARTING;
      if( f->callbacks->starting ) {
        (*f->callbacks->starting)(f);
      }
      break;

    case LS_CLOSED:
      if( f->flags & OPT_SILENT ) {
        f->state = LS_STOPPED;
      } else {
        /* Send an initial configure-request */
        fsm_sconfreq(f, 0);
        f->state = LS_REQSENT;
      }
      break;
  
    case LS_CLOSING:
      f->state = LS_STOPPING;
      /* fall through */
    case LS_STOPPED:
    case LS_OPENED:
      if( f->flags & OPT_RESTART ) {
        fsm_lowerdown(f);
        fsm_lowerup(f);
      }
      break;
  }

  FSMDEBUG(LOG_INFO, ("%s: open state %d (%s) -> %d (%s)\n",
      PROTO_NAME(f), oldState, ppperr_strerr[oldState], f->state, ppperr_strerr[f->state]));
}
Exemple #5
0
/*
 * ipcp_lowerup - The lower layer is up.
 */
static void
ipcp_lowerup(
    int unit)
{
    fsm_lowerup(&ipcp_fsm[unit]);
}
Exemple #6
0
/*
 * acscp_lowerup - The lower layer is up.
 */
static void
acscp_lowerup(int unit)
{
    fsm_lowerup(&acscp_fsm[unit]);
}
Exemple #7
0
/**
 * This function is called when HDLC as LCP's lower layer is up.
 */
void
lcp_lowerup(lcp *_this)
{
	fsm_lowerup(&_this->fsm);
	fsm_open(&_this->fsm);
}
Exemple #8
0
/*
 * ccp_lowerup - we may now transmit CCP packets.
 */
static void
ccp_lowerup(
    int unit)
{
    fsm_lowerup(&ccp_fsm[unit]);
}
Exemple #9
0
static void
ccp_lowerup (void)
{
	fsm_lowerup(&ccp_fsm);
	}
Exemple #10
0
/*
 * ccp_lowerup - we may now transmit CCP packets.
 */
void
ccp_lowerup(PPP_IF_VAR_T *pPppIf)
{
    fsm_lowerup(&pPppIf->ccp_fsm);
}