]> git.ozlabs.org Git - ppp.git/commitdiff
Merge pull request #145 from sthibaul/ipv6cp-accept-remote
authorPaul Mackerras <paulus@ozlabs.org>
Fri, 7 Aug 2020 00:44:01 +0000 (10:44 +1000)
committerGitHub <noreply@github.com>
Fri, 7 Aug 2020 00:44:01 +0000 (10:44 +1000)
Add ipv6cp-accept-remote option

pppd/chap_ms.c
pppd/plugins/rp-pppoe/pppoe-discovery.c
pppd/pppd.8

index 1de50428fa4d5636c514957734dd1840c1fc76e5..ffb6bd13c1ef45bc4956db1ee6bf494576444df0 100644 (file)
@@ -423,6 +423,8 @@ chapms2_check_success(int id, unsigned char *msg, int len)
        len -= MS_AUTH_RESPONSE_LENGTH;
        if ((len >= 3) && !strncmp((char *)msg, " M=", 3)) {
                msg += 3; /* Eat the delimiter */
+       } else  if ((len >= 2) && !strncmp((char *)msg, "M=", 2)) {
+               msg += 2; /* Eat the delimiter */
        } else if (len) {
                /* Packet has extra text which does not begin " M=" */
                error("MS-CHAPv2 Success packet is badly formed.");
index f19c6d8b58318203430401ab641236be82d24c4e..1a243fe4cb26d1120f9c244ce396bd0f6329ebb9 100644 (file)
@@ -328,14 +328,10 @@ void
 parseForHostUniq(UINT16_t type, UINT16_t len, unsigned char *data,
                 void *extra)
 {
-    int *val = (int *) extra;
-    if (type == TAG_HOST_UNIQ && len == sizeof(pid_t)) {
-       pid_t tmp;
-       memcpy(&tmp, data, len);
-       if (tmp == getpid()) {
-           *val = 1;
-       }
-    }
+    PPPoETag *tag = extra;
+
+    if (type == TAG_HOST_UNIQ && len == ntohs(tag->length))
+       tag->length = memcmp(data, tag->payload, len);
 }
 
 /**********************************************************************
@@ -352,7 +348,7 @@ parseForHostUniq(UINT16_t type, UINT16_t len, unsigned char *data,
 int
 packetIsForMe(PPPoEConnection *conn, PPPoEPacket *packet)
 {
-    int forMe = 0;
+    PPPoETag hostUniq = conn->hostUniq;
 
     /* If packet is not directed to our MAC address, forget it */
     if (memcmp(packet->ethHdr.h_dest, conn->myEth, ETH_ALEN)) return 0;
@@ -360,8 +356,8 @@ packetIsForMe(PPPoEConnection *conn, PPPoEPacket *packet)
     /* If we're not using the Host-Unique tag, then accept the packet */
     if (!conn->hostUniq.length) return 1;
 
-    parsePacket(packet, parseForHostUniq, &forMe);
-    return forMe;
+    parsePacket(packet, parseForHostUniq, &hostUniq);
+    return !hostUniq.length;
 }
 
 /**********************************************************************
index 53b1c12e419882a5fed175ae48a2f631c5467e9a..1cf0f67db62b181f584903a52eafd8b3aafa45fe 100644 (file)
@@ -1092,6 +1092,10 @@ When operating as an EAP SRP\-SHA1 client, attempt to use the pseudonym
 stored in ~/.ppp_pseudonym first as the identity, and save in this
 file any pseudonym offered by the peer during authentication.
 .TP
+.B stop\-bits \fIn
+Set the number of stop bits for the serial port. Valid values are 1 or 2.
+The default value is 1.
+.TP
 .B sync
 Use synchronous HDLC serial encoding instead of asynchronous.
 The device used by pppd with this option must have sync support.