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

View File

@ -427,10 +427,8 @@ lcp_close(unit, reason)
fsm *f = &lcp_fsm[unit];
int oldstate;
#if PPP_NOTIFY
if (phase != PHASE_DEAD && phase != PHASE_MASTER)
new_phase(PHASE_TERMINATE);
#endif /* PPP_NOTIFY */
if (f->flags & DELAYED_UP) {
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 devfd = -1; /* fd of underlying device */
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 asked_to_quit;
int open_ccp_flag;

View File

@ -23,6 +23,9 @@
#include "netif/ppp_oe.h"
#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
* completed. */
typedef enum {
@ -1438,11 +1441,12 @@ const char * protocol_name(int proto) {
}
#endif /* PPP_PROTOCOLNAME */
#if PPP_NOTIFY
/*
* new_phase - signal the start of a new phase of pppd's operation.
*/
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 */
}

View File

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