]> git.ozlabs.org Git - ppp.git/blobdiff - pppd/ccp.c
Updated Solaris-related READMEs for the current code.
[ppp.git] / pppd / ccp.c
index 40bf77f7a7a7d89d14e92c4a20745521b3e0822b..54fc743e2a702fdc68051d2f25335c185ff6186f 100644 (file)
@@ -25,7 +25,7 @@
  * OR MODIFICATIONS.
  */
 
-#define RCSID  "$Id: ccp.c,v 1.35 2002/05/21 17:26:49 dfs Exp $"
+#define RCSID  "$Id: ccp.c,v 1.39 2002/09/01 12:00:15 dfs Exp $"
 
 #include <stdlib.h>
 #include <string.h>
@@ -37,7 +37,7 @@
 
 #ifdef MPPE
 #include "chap_ms.h"   /* mppe_xxxx_key */
-#include "lcp.h"       /* lcp_close() */
+#include "lcp.h"       /* lcp_close(), lcp_fsm */
 #endif
 
 static const char rcsid[] = RCSID;
@@ -453,7 +453,7 @@ ccp_input(unit, p, len)
        notice("Compression disabled by peer.");
 #ifdef MPPE
        if (ccp_gotoptions[unit].mppe) {
-           notice("MPPE disabled, closing LCP");
+           error("MPPE disabled, closing LCP");
            lcp_close(unit, "MPPE disabled by peer");
        }
 #endif
@@ -512,8 +512,10 @@ ccp_protrej(unit)
     fsm_lowerdown(&ccp_fsm[unit]);
 
 #ifdef MPPE
-    if (ccp_gotoptions[unit].mppe)
+    if (ccp_gotoptions[unit].mppe) {
+       error("MPPE required but peer negotiation failed");
        lcp_close(unit, "MPPE required but peer negotiation failed");
+    }
 #endif
 
 }
@@ -899,8 +901,10 @@ ccp_nakci(f, p, len)
            /* Peer must have set options we didn't request (suggest) */
            try.mppe = 0;
 
-       if (!try.mppe)
+       if (!try.mppe) {
+           error("MPPE required but peer negotiation failed");
            lcp_close(f->unit, "MPPE required but peer negotiation failed");
+       }
     }
 #endif /* MPPE */
     if (go->deflate && len >= CILEN_DEFLATE
@@ -977,6 +981,7 @@ ccp_rejci(f, p, len)
 #ifdef MPPE
     if (go->mppe && len >= CILEN_MPPE
        && p[0] == CI_MPPE && p[1] == CILEN_MPPE) {
+       error("MPPE required but peer refused");
        lcp_close(f->unit, "MPPE required but peer refused");
        p += CILEN_MPPE;
        len -= CILEN_MPPE;
@@ -1314,8 +1319,10 @@ ccp_reqci(f, p, lenp, dont_nak)
            *lenp = retp - p0;
     }
 #ifdef MPPE
-    if (ret == CONFREJ && ao->mppe && !seen_ci_mppe)
+    if (ret == CONFREJ && ao->mppe && !seen_ci_mppe) {
+       error("MPPE required but peer negotiation failed");
        lcp_close(f->unit, "MPPE required but peer negotiation failed");
+    }
 #endif
     return ret;
 }
@@ -1414,7 +1421,7 @@ ccp_up(f)
     if (go->mppe) {
        BZERO(mppe_recv_key, MPPE_MAX_KEY_LEN);
        BZERO(mppe_send_key, MPPE_MAX_KEY_LEN);
-       start_networks(f->unit);                /* Bring up IP et al */
+       continue_networks(f->unit);             /* Bring up IP et al */
     }
 #endif
 }
@@ -1431,8 +1438,14 @@ ccp_down(f)
     ccp_localstate[f->unit] = 0;
     ccp_flags_set(f->unit, 1, 0);
 #ifdef MPPE
-    if (ccp_gotoptions[f->unit].mppe)
-       lcp_close(f->unit, "MPPE disabled");
+    if (ccp_gotoptions[f->unit].mppe) {
+       ccp_gotoptions[f->unit].mppe = 0;
+       if (lcp_fsm[f->unit].state == OPENED) {
+           /* If LCP is not already going down, make sure it does. */
+           error("MPPE disabled");
+           lcp_close(f->unit, "MPPE disabled");
+       }
+    }
 #endif
 }