]> git.ozlabs.org Git - ppp.git/blobdiff - pppd/lcp.c
Accept the endpoint discriminator from the peer unless the
[ppp.git] / pppd / lcp.c
index 3092b5ada9f2a0a0939d3a52380950a204d125a5..cfaef7a0bd4339c8172c5b1a7c717ca85aed69f1 100644 (file)
@@ -17,7 +17,7 @@
  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  */
 
-#define RCSID  "$Id: lcp.c,v 1.49 2000/04/04 07:06:50 paulus Exp $";
+#define RCSID  "$Id: lcp.c,v 1.55 2000/04/29 12:32:09 paulus Exp $"
 
 /*
  * TODO:
@@ -41,11 +41,11 @@ static const char rcsid[] = RCSID;
 int    lcp_echo_interval = 0;  /* Interval between LCP echo-requests */
 int    lcp_echo_fails = 0;     /* Tolerance to unanswered echo-requests */
 bool   lax_recv = 0;           /* accept control chars in asyncmap */
+bool   noendpoint = 0;         /* don't send/accept endpoint discriminator */
 
 static int setescape __P((char **));
 
 #ifdef HAVE_MULTILINK
-bool   noendpoint = 0;         /* don't send/accept endpoint discriminator */
 static int setendpoint __P((char **));
 #endif /* HAVE_MULTILINK */
 
@@ -96,7 +96,7 @@ static option_t lcp_option_list[] = {
       "Set passive mode", 1 },
     { "silent", o_bool, &lcp_wantoptions[0].silent,
       "Set silent mode", 1 },
-    { "escape", o_special, setescape,
+    { "escape", o_special, (void *)setescape,
       "List of character codes to escape on transmission" },
     { "lcp-echo-failure", o_int, &lcp_echo_fails,
       "Set number of consecutive echo failures to indicate link failure" },
@@ -118,15 +118,15 @@ static option_t lcp_option_list[] = {
       0, &lcp_wantoptions[0].neg_mrru },
     { "mpshortseq", o_bool, &lcp_wantoptions[0].neg_ssnhf,
       "Use short sequence numbers in multilink headers",
-      OPT_A2COPY, &lcp_allowoptions[0].neg_ssnhf },
+      OPT_A2COPY | 1, &lcp_allowoptions[0].neg_ssnhf },
     { "nompshortseq", o_bool, &lcp_wantoptions[0].neg_ssnhf,
       "Don't use short sequence numbers in multilink headers",
       OPT_A2COPY, &lcp_allowoptions[0].neg_ssnhf },
     { "endpoint", o_special, setendpoint,
       "Endpoint discriminator for multilink" },
+#endif /* HAVE_MULTILINK */
     { "noendpoint", o_bool, &noendpoint,
       "Don't send or accept multilink endpoint discriminator", 1 },
-#endif /* HAVE_MULTILINK */
     {NULL}
 };
 
@@ -136,7 +136,7 @@ lcp_options lcp_wantoptions[NUM_PPP];       /* Options that we want to request */
 lcp_options lcp_gotoptions[NUM_PPP];   /* Options that peer ack'd */
 lcp_options lcp_allowoptions[NUM_PPP]; /* Options we allow peer to request */
 lcp_options lcp_hisoptions[NUM_PPP];   /* Options that we ack'd */
-u_int32_t xmit_accm[NUM_PPP][8];               /* extended transmit ACCM */
+u_int32_t xmit_accm[NUM_PPP][8];       /* extended transmit ACCM */
 
 static int lcp_echos_pending = 0;      /* Number of outstanding echo msgs */
 static int lcp_echo_number   = 0;      /* ID number of next echo frame */
@@ -323,9 +323,7 @@ lcp_init(unit)
 #ifdef CBCP_SUPPORT
     ao->neg_cbcp = 1;
 #endif
-#ifdef HAVE_MULTILINK
     ao->neg_endpoint = 1;
-#endif
 
     BZERO(xmit_accm[unit], sizeof(xmit_accm[0]));
     xmit_accm[unit][3] = 0x60000000;
@@ -558,6 +556,7 @@ lcp_resetci(f)
 {
     lcp_options *wo = &lcp_wantoptions[f->unit];
     lcp_options *go = &lcp_gotoptions[f->unit];
+    lcp_options *ao = &lcp_allowoptions[f->unit];
 
     wo->magicnumber = magic();
     wo->numloops = 0;
@@ -567,6 +566,8 @@ lcp_resetci(f)
        go->neg_ssnhf = 0;
        go->neg_endpoint = 0;
     }
+    if (noendpoint)
+       ao->neg_endpoint = 0;
     peer_mru[f->unit] = PPP_MRU;
     auth_reset(f->unit);
 }
@@ -1640,7 +1641,7 @@ lcp_reqci(f, inp, lenp, reject_if_disagree)
            break;
 
        case CI_EPDISC:
-           if (!ao->neg_endpoint || !multilink ||
+           if (!ao->neg_endpoint ||
                cilen < CILEN_CHAR ||
                cilen > CILEN_CHAR + MAX_ENDP_LEN) {
                orc = CONFREJ;
@@ -1955,6 +1956,7 @@ lcp_printpkt(p, plen, printer, arg)
                }
                break;
            case CI_EPDISC:
+#ifdef HAVE_MULTILINK
                if (olen >= CILEN_CHAR) {
                    struct epdisc epd;
                    p += 2;
@@ -1968,6 +1970,9 @@ lcp_printpkt(p, plen, printer, arg)
                    }
                    printer(arg, "endpoint [%s]", epdisc_to_str(&epd));
                }
+#else
+               printer(arg, "endpoint");
+#endif
                break;
            }
            while (p < optend) {
@@ -1982,7 +1987,7 @@ lcp_printpkt(p, plen, printer, arg)
     case TERMREQ:
        if (len > 0 && *p >= ' ' && *p < 0x7f) {
            printer(arg, " ");
-           print_string(p, len, printer, arg);
+           print_string((char *)p, len, printer, arg);
            p += len;
            len = 0;
        }