moved new_phase() to our own implementation, re-enabled new_phase() support

This commit is contained in:
Sylvain Rochet 2012-06-02 15:00:18 +02:00
parent 6727c43441
commit 4158222e86
5 changed files with 8 additions and 32 deletions

View File

@ -569,9 +569,7 @@ void start_link(unit)
char *msg; char *msg;
status = EXIT_NEGOTIATION_FAILED; status = EXIT_NEGOTIATION_FAILED;
#if PPP_NOTIFY
new_phase(PHASE_SERIALCONN); new_phase(PHASE_SERIALCONN);
#endif /* PPP_NOTIFY */
hungup = 0; hungup = 0;
devfd = the_channel->connect(); devfd = the_channel->connect();
@ -607,24 +605,18 @@ void start_link(unit)
notice("Starting negotiation on %s", ppp_devnam); notice("Starting negotiation on %s", ppp_devnam);
add_fd(fd_ppp); add_fd(fd_ppp);
#if PPP_NOTIFY
new_phase(PHASE_ESTABLISH); new_phase(PHASE_ESTABLISH);
#endif /* PPP_NOTIFY */
lcp_lowerup(0); lcp_lowerup(0);
return; return;
disconnect: disconnect:
#if PPP_NOTIFY
new_phase(PHASE_DISCONNECT); new_phase(PHASE_DISCONNECT);
#endif /* PPP_NOTIFY */
if (the_channel->disconnect) if (the_channel->disconnect)
the_channel->disconnect(); the_channel->disconnect();
fail: fail:
#if PPP_NOTIFY
new_phase(PHASE_DEAD); new_phase(PHASE_DEAD);
#endif /* PPP_NOTIFY */
if (the_channel->cleanup) if (the_channel->cleanup)
(*the_channel->cleanup)(); (*the_channel->cleanup)();
} }
@ -640,9 +632,7 @@ link_terminated(unit)
{ {
if (phase == PHASE_DEAD || phase == PHASE_MASTER) if (phase == PHASE_DEAD || phase == PHASE_MASTER)
return; return;
#if PPP_NOTIFY
new_phase(PHASE_DISCONNECT); new_phase(PHASE_DISCONNECT);
#endif /* PPP_NOTIFY */
#if 0 /* UNUSED */ #if 0 /* UNUSED */
if (pap_logout_hook) { if (pap_logout_hook) {
@ -659,9 +649,7 @@ link_terminated(unit)
lcp_lowerdown(0); lcp_lowerdown(0);
#if PPP_NOTIFY
new_phase(PHASE_DEAD); new_phase(PHASE_DEAD);
#endif /* PPP_NOTIFY */
#if 0 #if 0
/* /*
@ -724,10 +712,8 @@ link_down(unit)
if (!doing_multilink) { if (!doing_multilink) {
upper_layers_down(unit); upper_layers_down(unit);
#if PPP_NOTIFY
if (phase != PHASE_DEAD && phase != PHASE_MASTER) if (phase != PHASE_DEAD && phase != PHASE_MASTER)
new_phase(PHASE_ESTABLISH); new_phase(PHASE_ESTABLISH);
#endif /* PPP_NOTIFY */
} }
/* XXX if doing_multilink, should do something to stop /* XXX if doing_multilink, should do something to stop
network-layer traffic on the link */ network-layer traffic on the link */
@ -816,9 +802,7 @@ link_established(unit)
} }
#endif /* UNUSED */ #endif /* UNUSED */
#if PPP_NOTIFY
new_phase(PHASE_AUTHENTICATE); new_phase(PHASE_AUTHENTICATE);
#endif /* PPP_NOTIFY */
auth = 0; auth = 0;
#if EAP_SUPPORT #if EAP_SUPPORT
if (go->neg_eap) { if (go->neg_eap) {
@ -906,9 +890,7 @@ network_phase(unit)
* If we negotiated callback, do it now. * If we negotiated callback, do it now.
*/ */
if (go->neg_cbcp) { if (go->neg_cbcp) {
#if PPP_NOTIFY
new_phase(PHASE_CALLBACK); new_phase(PHASE_CALLBACK);
#endif /* PPP_NOTIFY */
(*cbcp_protent.open)(unit); (*cbcp_protent.open)(unit);
return; return;
} }
@ -940,9 +922,7 @@ start_networks(unit)
int mppe_required; int mppe_required;
#endif /* MPPE */ #endif /* MPPE */
#if PPP_NOTIFY
new_phase(PHASE_NETWORK); new_phase(PHASE_NETWORK);
#endif /* PPP_NOTIFY */
#ifdef HAVE_MULTILINK #ifdef HAVE_MULTILINK
if (multilink) { if (multilink) {
@ -1193,9 +1173,7 @@ np_up(unit, proto)
*/ */
status = EXIT_OK; status = EXIT_OK;
unsuccess = 0; unsuccess = 0;
#if PPP_NOTIFY
new_phase(PHASE_RUNNING); new_phase(PHASE_RUNNING);
#endif /* PPP_NOTIFY */
#if 0 /* UNUSED */ #if 0 /* UNUSED */
if (idle_time_hook != 0) if (idle_time_hook != 0)
@ -1242,9 +1220,7 @@ np_down(unit, proto)
#ifdef MAXOCTETS #ifdef MAXOCTETS
UNTIMEOUT(check_maxoctets, NULL); UNTIMEOUT(check_maxoctets, NULL);
#endif #endif
#if PPP_NOTIFY
new_phase(PHASE_NETWORK); new_phase(PHASE_NETWORK);
#endif /* PPP_NOTIFY */
} }
} }

View File

@ -427,10 +427,8 @@ lcp_close(unit, reason)
fsm *f = &lcp_fsm[unit]; fsm *f = &lcp_fsm[unit];
int oldstate; int oldstate;
#if PPP_NOTIFY
if (phase != PHASE_DEAD && phase != PHASE_MASTER) if (phase != PHASE_DEAD && phase != PHASE_MASTER)
new_phase(PHASE_TERMINATE); new_phase(PHASE_TERMINATE);
#endif /* PPP_NOTIFY */
if (f->flags & DELAYED_UP) { if (f->flags & DELAYED_UP) {
UNTIMEOUT(lcp_delayed_up, f); UNTIMEOUT(lcp_delayed_up, f);

View File

@ -167,7 +167,7 @@ static int fd_loop; /* fd for getting demand-dial packets */
int fd_devnull; /* fd for /dev/null */ int fd_devnull; /* fd for /dev/null */
int devfd = -1; /* fd of underlying device */ int devfd = -1; /* fd of underlying device */
int fd_ppp = -1; /* fd for talking PPP */ int fd_ppp = -1; /* fd for talking PPP */
int phase; /* where the link is at */ //int phase; /* where the link is at */
int kill_link; int kill_link;
int asked_to_quit; int asked_to_quit;
int open_ccp_flag; int open_ccp_flag;

View File

@ -23,6 +23,9 @@
#include "netif/ppp_oe.h" #include "netif/ppp_oe.h"
#endif /* PPPOE_SUPPORT */ #endif /* PPPOE_SUPPORT */
/* FIXME: add a phase per PPP session */
int phase; /* where the link is at */
/* PPP packet parser states. Current state indicates operation yet to be /* PPP packet parser states. Current state indicates operation yet to be
* completed. */ * completed. */
typedef enum { typedef enum {
@ -1438,11 +1441,12 @@ const char * protocol_name(int proto) {
} }
#endif /* PPP_PROTOCOLNAME */ #endif /* PPP_PROTOCOLNAME */
#if PPP_NOTIFY
/* /*
* new_phase - signal the start of a new phase of pppd's operation. * new_phase - signal the start of a new phase of pppd's operation.
*/ */
void new_phase(int p) { void new_phase(int p) {
phase = p;
} #if PPP_NOTIFY
/* The one willing notify support should add here the code to be notified of phase changes */
#endif /* PPP_NOTIFY */ #endif /* PPP_NOTIFY */
}

View File

@ -139,8 +139,6 @@ void pppInProcOverEthernet(int pd, struct pbuf *pb);
const char * protocol_name(int proto); const char * protocol_name(int proto);
#endif /* PPP_PROTOCOLNAME */ #endif /* PPP_PROTOCOLNAME */
#if PPP_NOTIFY
void new_phase(int p); void new_phase(int p);
#endif /* PPP_NOTIFY */
#endif /* PPPMY_H_ */ #endif /* PPPMY_H_ */