]> git.ozlabs.org Git - ppp.git/blobdiff - pppd/ccp.c
ccp_nakci(), ccp_reqci(): If refusing MPPE stateful mode, log an error
[ppp.git] / pppd / ccp.c
index cdfb2cf6324762ee779cd5921461d9803df57dfb..6be16b85f11dc4558831a0230832e986e56b245b 100644 (file)
@@ -33,7 +33,7 @@
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-#define RCSID  "$Id: ccp.c,v 1.43 2002/12/24 00:34:13 fcusack Exp $"
+#define RCSID  "$Id: ccp.c,v 1.45 2003/04/25 09:41:58 fcusack Exp $"
 
 #include <stdlib.h>
 #include <string.h>
@@ -916,11 +916,13 @@ ccp_nakci(f, p, len)
         * Fail if we aren't willing to use his suggestion.
         */
        MPPE_CI_TO_OPTS(&p[2], try.mppe);
-       if ((try.mppe & MPPE_OPT_STATEFUL) && refuse_mppe_stateful)
+       if ((try.mppe & MPPE_OPT_STATEFUL) && refuse_mppe_stateful) {
+           error("Refusing MPPE stateful mode offered by peer");
            try.mppe = 0;
-       else if ((go->mppe & try.mppe) != try.mppe)
+       } else if (((go->mppe | MPPE_OPT_STATEFUL) & try.mppe) != try.mppe) {
            /* Peer must have set options we didn't request (suggest) */
            try.mppe = 0;
+       }
 
        if (!try.mppe) {
            error("MPPE required but peer negotiation failed");
@@ -1124,17 +1126,16 @@ ccp_reqci(f, p, lenp, dont_nak)
 
                /* Check state opt */
                if (ho->mppe & MPPE_OPT_STATEFUL) {
+                   /*
+                    * We can Nak and request stateless, but it's a
+                    * lot easier to just assume the peer will request
+                    * it if he can do it; stateful mode is bad over
+                    * the Internet -- which is where we expect MPPE.
+                    */
                   if (refuse_mppe_stateful) {
-                       /*
-                        * We can Nak and request stateless, but it's a
-                        * lot easier to just assume the peer will request
-                        * it if he can do it; stateful mode is bad over
-                        * the Internet -- which is where we expect MPPE.
-                        */
+                       error("Refusing MPPE stateful mode offered by peer");
                        newret = CONFREJ;
                        break;
-                   } else {
-                       newret = CONFNAK;
                    }
                }