diff --git a/src/netif/ppp/auth.c b/src/netif/ppp/auth.c index 09acdee5..44c254aa 100644 --- a/src/netif/ppp/auth.c +++ b/src/netif/ppp/auth.c @@ -203,12 +203,14 @@ int (*allowed_address_hook) __P((u_int32_t addr)) = NULL; void (*multilink_join_hook) __P((void)) = NULL; #endif +#if PPP_NOTIFY /* A notifier for when the peer has authenticated itself, and we are proceeding to the network phase. */ struct notifier *auth_up_notifier = NULL; /* A notifier for when the link goes down. */ struct notifier *link_down_notifier = NULL; +#endif /* PPP_NOTIFY */ /* * Option variables. @@ -567,7 +569,9 @@ 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(); @@ -603,18 +607,24 @@ 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)(); } @@ -630,7 +640,9 @@ 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) { @@ -647,6 +659,10 @@ link_terminated(unit) lcp_lowerdown(0); +#if PPP_NOTIFY + new_phase(PHASE_DEAD); +#endif /* PPP_NOTIFY */ + #if 0 /* * Delete pid files before disestablishing ppp. Otherwise it @@ -702,12 +718,16 @@ void link_down(unit) int unit; { +#if PPP_NOTIFY notify(link_down_notifier, 0); +#endif /* #if PPP_NOTIFY */ 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 */ @@ -796,7 +816,9 @@ link_established(unit) } #endif /* UNUSED */ +#if PPP_NOTIFY new_phase(PHASE_AUTHENTICATE); +#endif /* PPP_NOTIFY */ auth = 0; #if EAP_SUPPORT if (go->neg_eap) { @@ -860,6 +882,7 @@ network_phase(unit) notice("peer from calling number %q authorized", remote_number); #endif /* UNUSED */ +#if PPP_NOTIFY /* * If the peer had to authenticate, notify it now. */ @@ -876,13 +899,16 @@ network_phase(unit) ) { notify(auth_up_notifier, 0); } +#endif /* PPP_NOTIFY */ #if CBCP_SUPPORT /* * 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; } @@ -914,7 +940,9 @@ start_networks(unit) int mppe_required; #endif /* MPPE */ +#if PPP_NOTIFY new_phase(PHASE_NETWORK); +#endif /* PPP_NOTIFY */ #ifdef HAVE_MULTILINK if (multilink) { @@ -1165,7 +1193,9 @@ 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) @@ -1211,8 +1241,10 @@ np_down(unit, proto) UNTIMEOUT(connect_time_expired, NULL); #ifdef MAXOCTETS UNTIMEOUT(check_maxoctets, NULL); -#endif +#endif +#if PPP_NOTIFY new_phase(PHASE_NETWORK); +#endif /* PPP_NOTIFY */ } } diff --git a/src/netif/ppp/ipcp.c b/src/netif/ppp/ipcp.c index 89ec6c4a..0e2eb857 100644 --- a/src/netif/ppp/ipcp.c +++ b/src/netif/ppp/ipcp.c @@ -84,9 +84,11 @@ void (*ip_down_hook) __P((void)) = NULL; /* Hook for a plugin to choose the remote IP address */ void (*ip_choose_hook) __P((u_int32_t *)) = NULL; +#if PPP_NOTIFY /* Notifiers for when IPCP goes up and down */ struct notifier *ip_up_notifier = NULL; struct notifier *ip_down_notifier = NULL; +#endif /* PPP_NOTIFY */ /* local vars */ static int default_route_set[NUM_PPP]; /* Have set up a default route */ @@ -1961,7 +1963,9 @@ ipcp_up(f) np_up(f->unit, PPP_IP); ipcp_is_up = 1; +#if PPP_NOTIFY notify(ip_up_notifier, 0); +#endif /* PPP_NOTIFY */ if (ip_up_hook) ip_up_hook(); } @@ -1983,7 +1987,9 @@ ipcp_down(f) /* XXX more correct: we must get the stats before running the notifiers, * at least for the radius plugin */ update_link_stats(f->unit); +#if PPP_NOTIFY notify(ip_down_notifier, 0); +#endif /* PPP_NOTIFY */ if (ip_down_hook) ip_down_hook(); if (ipcp_is_up) { diff --git a/src/netif/ppp/lcp.c b/src/netif/ppp/lcp.c index 21090ae3..442d08ad 100644 --- a/src/netif/ppp/lcp.c +++ b/src/netif/ppp/lcp.c @@ -427,8 +427,10 @@ 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); diff --git a/src/netif/ppp/ppp.c b/src/netif/ppp/ppp.c index 584770ff..7cf76c34 100644 --- a/src/netif/ppp/ppp.c +++ b/src/netif/ppp/ppp.c @@ -1016,6 +1016,7 @@ old_ppp_recv_config(unit, mru, accm, pcomp, accomp) } #endif +#if 0 /* * new_phase - signal the start of a new phase of pppd's operation. */ @@ -1028,6 +1029,7 @@ new_phase(p) (*new_phase_hook)(p); notify(phasechange, p); } +#endif #if 0 /* @@ -1658,6 +1660,7 @@ reap_kids() } #endif /* UNUSED */ +#if 0 /* UNUSED */ /* * add_notifier - add a new function to be called when something happens. */ @@ -1699,7 +1702,9 @@ remove_notifier(notif, func, arg) } } } +#endif /* UNUSED */ +#if 0 /* * notify - call a set of functions registered with add_notifier. */ @@ -1715,6 +1720,7 @@ notify(notif, val) (*np->func)(np->arg, val); } } +#endif #if 0 /* UNUSED */ /* diff --git a/src/netif/ppp/pppd.h b/src/netif/ppp/pppd.h index 6a5825e7..4d33a7a9 100644 --- a/src/netif/ppp/pppd.h +++ b/src/netif/ppp/pppd.h @@ -201,6 +201,7 @@ struct epdisc { #define EPD_MAGIC 4 #define EPD_PHONENUM 5 +#if 0 /* UNUSED */ typedef void (*notify_func) __P((void *, int)); struct notifier { @@ -208,6 +209,7 @@ struct notifier { notify_func func; void *arg; }; +#endif /* UNUSED */ /* * Global variables. @@ -262,12 +264,14 @@ extern struct notifier *pidchange; /* for notifications of pid changing */ extern struct notifier *phasechange; /* for notifications of phase changes */ extern struct notifier *exitnotify; /* for notification that we're exiting */ extern struct notifier *sigreceived; /* notification of received signal */ + +#if PPP_NOTIFY extern struct notifier *ip_up_notifier; /* IPCP has come up */ extern struct notifier *ip_down_notifier; /* IPCP has gone down */ -#if 0 /* UNUSED */ extern struct notifier *auth_up_notifier; /* peer has authenticated */ -#endif /* UNUSED */ extern struct notifier *link_down_notifier; /* link has gone down */ +#endif /* PPP_NOTIFY */ + extern struct notifier *fork_notifier; /* we are a new child process */ /* Values for do_callback and doing_callback */ @@ -526,10 +530,12 @@ void update_link_stats __P((int)); /* Get stats at link termination */ void script_setenv __P((char *, char *, int)); /* set script env var */ void script_unsetenv __P((char *)); /* unset script env var */ #endif /* UNUSED */ -void new_phase __P((int)); /* signal start of new phase */ +//void new_phase __P((int)); /* signal start of new phase */ +#if 0 /* UNUSED */ void add_notifier __P((struct notifier **, notify_func, void *)); void remove_notifier __P((struct notifier **, notify_func, void *)); void notify __P((struct notifier *, int)); +#endif /* UNUSED */ int ppp_send_config __P((int, int, u_int32_t, int, int)); int ppp_recv_config __P((int, int, u_int32_t, int, int)); //void remove_pidfiles __P((void)); diff --git a/src/netif/ppp/pppmy.c b/src/netif/ppp/pppmy.c index 2ddb7739..4d757746 100644 --- a/src/netif/ppp/pppmy.c +++ b/src/netif/ppp/pppmy.c @@ -1437,3 +1437,12 @@ const char * protocol_name(int proto) { return NULL; } #endif /* PPP_PROTOCOLNAME */ + +#if PPP_NOTIFY +/* + * new_phase - signal the start of a new phase of pppd's operation. + */ +void new_phase(int p) { + +} +#endif /* PPP_NOTIFY */ diff --git a/src/netif/ppp/pppmy.h b/src/netif/ppp/pppmy.h index c71899ac..44999734 100644 --- a/src/netif/ppp/pppmy.h +++ b/src/netif/ppp/pppmy.h @@ -135,9 +135,12 @@ int pppOverEthernetOpen(struct netif *ethif, const char *service_name, const cha void pppInProcOverEthernet(int pd, struct pbuf *pb); - #if PPP_PROTOCOLNAME const char * protocol_name(int proto); #endif /* PPP_PROTOCOLNAME */ +#if PPP_NOTIFY +void new_phase(int p); +#endif /* PPP_NOTIFY */ + #endif /* PPPMY_H_ */