Esempio n. 1
0
File: ccp.c Progetto: rtemss/rtems
/*
 * ccp_protrej - peer doesn't talk CCP.
 */
static void
ccp_protrej(
    int unit)
{
    ccp_flags_set(unit, 0, 0);
    fsm_lowerdown(&ccp_fsm[unit]);
}
/*
 * 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;
    }
}
Esempio n. 3
0
static void
ppp_down_others(npppd_ppp *_this)
{
	fsm_lowerdown(&_this->ccp.fsm);
	fsm_lowerdown(&_this->ipcp.fsm);

	npppd_release_ip(_this->pppd, _this);
	if (AUTH_IS_PAP(_this))
		pap_stop(&_this->pap);
	if (AUTH_IS_CHAP(_this))
		chap_stop(&_this->chap);
#ifdef USE_NPPPD_EAP_RADIUS
	if (AUTH_IS_EAP(_this))
		eap_stop(&_this->eap);
#endif
	evtimer_del(&_this->idle_event);
}
Esempio n. 4
0
/**
 * This function will be called the LCP is terminated.
 * (On entering STOPPED or  CLOSED state)
 */
void
ppp_lcp_finished(npppd_ppp *_this)
{
	PPP_ASSERT(_this != NULL);

	ppp_down_others(_this);

	fsm_lowerdown(&_this->lcp.fsm);
	ppp_stop0(_this);
}
Esempio n. 5
0
/*
 * ccp_lowerdown - we may not transmit CCP packets.
 */
void
ccp_lowerdown(PPP_IF_VAR_T *pPppIf)
{
    fsm_lowerdown(&pPppIf->ccp_fsm);
#ifdef MPPE
    if (pPppIf->ccp_wantoptions.mppe) {
 	diag_printf("MPPE required but peer negotiation failed\n");
 	lcp_close(pPppIf);
     }
#endif
}
Esempio n. 6
0
/**
 * Destroy the npppd_ppp instance.  Don't use this function after calling
 * the ppp_start, please use ppp_stop() instead.
 */
void
ppp_destroy(void *ctx)
{
	npppd_ppp *_this = ctx;

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

	/*
	 * Down/stop the protocols again to make sure they are stopped
	 * even if ppp_stop is done.  They might be change their state
	 * by receiving packets from the peer.
	 */
	fsm_lowerdown(&_this->ccp.fsm);
	fsm_lowerdown(&_this->ipcp.fsm);
	pap_stop(&_this->pap);
	chap_stop(&_this->chap);

	if (_this->outpacket_buf != NULL)
		free(_this->outpacket_buf);

	free(_this);
}
Esempio n. 7
0
/**
 * This function will be called by the physical layer when it is down.
 * <p>
 * Use this function only on such conditions that the physical layer cannot
 * input or output PPP frames.  Use {@link ::ppp_stop()} instead if we can
 * disconnect PPP gently.</p>
 */
void
ppp_phy_downed(npppd_ppp *_this)
{
	PPP_ASSERT(_this != NULL);

	ppp_down_others(_this);
	fsm_lowerdown(&_this->lcp.fsm);
	fsm_close(&_this->lcp.fsm, NULL);

#ifdef USE_NPPPD_RADIUS
	ppp_set_radius_terminate_cause(_this,
	    RADIUS_TERMNATE_CAUSE_LOST_CARRIER);
#endif
	ppp_stop0(_this);
}
Esempio n. 8
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]));
}
Esempio n. 9
0
/*
 * ipcp_protrej - A Protocol-Reject was received for IPCP.
 *
 * Pretend the lower layer went down, so we shut up.
 */
static void
ipcp_protrej(
    int unit)
{
    fsm_lowerdown(&ipcp_fsm[unit]);
}
Esempio n. 10
0
File: acscp.c Progetto: TARRANUM/ppp
/*
 * acscp_lowerdown - The lower layer is down.
 */
static void
acscp_lowerdown(int unit)
{
    fsm_lowerdown(&acscp_fsm[unit]);
}
Esempio n. 11
0
File: ccp.c Progetto: rtemss/rtems
/*
 * ccp_lowerdown - we may not transmit CCP packets.
 */
static void
ccp_lowerdown(
    int unit)
{
    fsm_lowerdown(&ccp_fsm[unit]);
}
Esempio n. 12
0
static void
ccp_lowerdown (void)
{
	fsm_lowerdown(&ccp_fsm);
	}
Esempio n. 13
0
static void
ccp_protrej (void)
{
	fsm_lowerdown(&ccp_fsm);
	}
Esempio n. 14
0
File: lcp.c Progetto: AoLaD/rtems
/*
 * lcp_lowerdown - The lower layer is down.
 */
void
lcp_lowerdown(
    int unit)
{
    fsm_lowerdown(&lcp_fsm[unit]);
}