summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrian <brian@cvs.openbsd.org>1999-06-08 11:59:01 +0000
committerbrian <brian@cvs.openbsd.org>1999-06-08 11:59:01 +0000
commitd4a8f4260d83ee084cdaff28e8ea46276dc90d38 (patch)
tree1133d2f4c1f9b90ee9414d8239984d816601de08
parent5c1dec9826c0993ebd71372931533d665212669d (diff)
Don't IPCP TLD if we're already doing it. This prevents
recursion by doing something like ``down'' or ``quit all'' in ppp.linkdown.
-rw-r--r--usr.sbin/ppp/ppp/ipcp.c42
1 files changed, 23 insertions, 19 deletions
diff --git a/usr.sbin/ppp/ppp/ipcp.c b/usr.sbin/ppp/ppp/ipcp.c
index c8fbc35501e..701cd21a86b 100644
--- a/usr.sbin/ppp/ppp/ipcp.c
+++ b/usr.sbin/ppp/ppp/ipcp.c
@@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: ipcp.c,v 1.15 1999/06/02 15:58:40 brian Exp $
+ * $Id: ipcp.c,v 1.16 1999/06/08 11:59:00 brian Exp $
*
* TODO:
* o Support IPADDRS properly
@@ -709,29 +709,33 @@ static void
IpcpLayerDown(struct fsm *fp)
{
/* About to come down */
+ static int recursing;
struct ipcp *ipcp = fsm2ipcp(fp);
const char *s;
- if (ipcp->fsm.bundle->iface->in_addrs)
- s = inet_ntoa(ipcp->fsm.bundle->iface->in_addr[0].ifa);
- else
- s = "Interface configuration error !";
- log_Printf(LogIPCP, "%s: LayerDown: %s\n", fp->link->name, s);
+ if (!recursing++) {
+ if (ipcp->fsm.bundle->iface->in_addrs)
+ s = inet_ntoa(ipcp->fsm.bundle->iface->in_addr[0].ifa);
+ else
+ s = "Interface configuration error !";
+ log_Printf(LogIPCP, "%s: LayerDown: %s\n", fp->link->name, s);
- /*
- * XXX this stuff should really live in the FSM. Our config should
- * associate executable sections in files with events.
- */
- if (system_Select(fp->bundle, s, LINKDOWNFILE, NULL, NULL) < 0) {
- if (bundle_GetLabel(fp->bundle)) {
- if (system_Select(fp->bundle, bundle_GetLabel(fp->bundle),
- LINKDOWNFILE, NULL, NULL) < 0)
- system_Select(fp->bundle, "MYADDR", LINKDOWNFILE, NULL, NULL);
- } else
- system_Select(fp->bundle, "MYADDR", LINKDOWNFILE, NULL, NULL);
- }
+ /*
+ * XXX this stuff should really live in the FSM. Our config should
+ * associate executable sections in files with events.
+ */
+ if (system_Select(fp->bundle, s, LINKDOWNFILE, NULL, NULL) < 0) {
+ if (bundle_GetLabel(fp->bundle)) {
+ if (system_Select(fp->bundle, bundle_GetLabel(fp->bundle),
+ LINKDOWNFILE, NULL, NULL) < 0)
+ system_Select(fp->bundle, "MYADDR", LINKDOWNFILE, NULL, NULL);
+ } else
+ system_Select(fp->bundle, "MYADDR", LINKDOWNFILE, NULL, NULL);
+ }
- ipcp_Setup(ipcp, INADDR_NONE);
+ ipcp_Setup(ipcp, INADDR_NONE);
+ }
+ recursing--;
}
int