]> git.ozlabs.org Git - ppp.git/commitdiff
pppd: Accept IPCP ConfAck packets containing MS-WINS options
authorBertram Felgenhauer <bertram.felgenhauer@googlemail.com>
Thu, 2 Jan 2014 04:20:35 +0000 (15:20 +1100)
committerPaul Mackerras <paulus@samba.org>
Thu, 2 Jan 2014 04:20:35 +0000 (15:20 +1100)
Since last week I'm seeing IPCP negotiations going like this (and
eventually failing) when connecting to my ISP:

Jul 11 20:03:25 * pppd[4833]: sent [IPCP ConfReq id=0x2 <addr 0.0.0.0> <ms-dns1
0.0.0.0> <ms-dns2 0.0.0.0>]
Jul 11 20:03:26 * pppd[4833]: sent [IPCP ConfReq id=0x2 <addr 0.0.0.0> <ms-dns1
0.0.0.0> <ms-dns2 0.0.0.0>]
Jul 11 20:03:26 * pppd[4833]: rcvd [IPCP ConfNak id=0x2 <addr 10.167.246.198>
<ms-dns1 213.162.69.1> <ms-dns2 213.162.69.169> <ms-wins 124.6.168.55> <ms-wins
17.17.17.17>]
Jul 11 20:03:26 * pppd[4833]: sent [IPCP ConfReq id=0x3 <addr 10.167.246.198>
<ms-dns1 213.162.69.1> <ms-dns2 213.162.69.169> <ms-wins 124.6.168.55> <ms-wins
17.17.17.17>]
Jul 11 20:03:26 * pppd[4833]: rcvd [IPCP ConfAck id=0x3 <addr 10.167.246.198>
<ms-dns1 213.162.69.1> <ms-dns2 213.162.69.169> <ms-wins 124.6.168.55> <ms-wins
17.17.17.17>]
Jul 11 20:03:27 * pppd[4833]: sent [IPCP ConfReq id=0x3 <addr 10.167.246.198>
<ms-dns1 213.162.69.1> <ms-dns2 213.162.69.169> <ms-wins 124.6.168.55> <ms-wins
17.17.17.17>]
...

with the last two lines repeating until the IPCP error limit is
reached. As you can see, the peer added two extra fields in the
ConfNak reply. This is allowed, and indeed the following sent
ConfReq packet reflects this. However, when the ConfAck packet
is received, pppd discards it as invalid, because of the ms-wins
fields.

This fixes it.

Signed-off-by: Paul Mackerras <paulus@samba.org>
pppd/ipcp.c

index 12bcc61be737f9d50b3ac3a6292f6c3c74d93b71..e9738fe4d894dd9291317412e4a8a93d331db19c 100644 (file)
@@ -962,6 +962,21 @@ ipcp_ackci(f, p, len)
            goto bad; \
     }
 
+#define ACKCIWINS(opt, addr) \
+    if (addr) { \
+       u_int32_t l; \
+       if ((len -= CILEN_ADDR) < 0) \
+           goto bad; \
+       GETCHAR(citype, p); \
+       GETCHAR(cilen, p); \
+       if (cilen != CILEN_ADDR || citype != opt) \
+           goto bad; \
+       GETLONG(l, p); \
+       cilong = htonl(l); \
+       if (addr != cilong) \
+           goto bad; \
+    }
+
     ACKCIADDRS(CI_ADDRS, !go->neg_addr && go->old_addrs, go->ouraddr,
               go->hisaddr);
 
@@ -974,6 +989,10 @@ ipcp_ackci(f, p, len)
 
     ACKCIDNS(CI_MS_DNS2, go->req_dns2, go->dnsaddr[1]);
 
+    ACKCIWINS(CI_MS_WINS1, go->winsaddr[0]);
+
+    ACKCIWINS(CI_MS_WINS2, go->winsaddr[1]);
+
     /*
      * If there are any remaining CIs, then this packet is bad.
      */