summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>2001-07-28 11:32:08 +0000
committerbrian <brian@FreeBSD.org>2001-07-28 11:32:08 +0000
commit933d065af2139670a009454cfec34923cd3d4756 (patch)
treea455f9c7d7b9b8665276f19ba569deb726871107 /usr.sbin
parent48796793e600a7b4fdc1ba1f263ff0a61c0aa2b1 (diff)
downloadFreeBSD-src-933d065af2139670a009454cfec34923cd3d4756.zip
FreeBSD-src-933d065af2139670a009454cfec34923cd3d4756.tar.gz
If the peer sends a REQ without the IPADDR option, only reject it
once. If they repeat the request (again without the IPADDR option) ACK it. I've had reports that some ppp implementations will not assign themselves an IP number. This should negotiate with such things. MFC after: 3 days
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/ppp/ipcp.c21
-rw-r--r--usr.sbin/ppp/ipcp.h1
2 files changed, 16 insertions, 6 deletions
diff --git a/usr.sbin/ppp/ipcp.c b/usr.sbin/ppp/ipcp.c
index dfec478..031b9b0 100644
--- a/usr.sbin/ppp/ipcp.c
+++ b/usr.sbin/ppp/ipcp.c
@@ -659,7 +659,7 @@ ipcp_Setup(struct ipcp *ipcp, u_int32_t mask)
}
ipcp->heis1172 = 0;
-
+ ipcp->peer_req = 0;
ipcp->peer_ip = ipcp->cfg.peer_range.ipaddr;
ipcp->peer_compproto = 0;
@@ -915,6 +915,7 @@ IpcpLayerStart(struct fsm *fp)
throughput_start(&ipcp->throughput, "IPCP throughput",
Enabled(fp->bundle, OPT_THROUGHPUT));
fp->more.reqs = fp->more.naks = fp->more.rejs = ipcp->cfg.fsm.maxreq * 3;
+ ipcp->peer_req = 0;
}
static void
@@ -1139,14 +1140,13 @@ IpcpDecodeConfig(struct fsm *fp, u_char *cp, int plen, int mode_type,
{
/* Deal with incoming PROTO_IPCP */
struct ipcp *ipcp = fsm2ipcp(fp);
- int type, length, gotdnsnak, ipaddr_req;
+ int type, length, gotdnsnak;
u_int32_t compproto;
struct compreq *pcomp;
struct in_addr ipaddr, dstipaddr, have_ip;
char tbuff[100], tbuff2[100];
gotdnsnak = 0;
- ipaddr_req = 0;
while (plen >= sizeof(struct fsmconfig)) {
type = *cp;
@@ -1166,7 +1166,7 @@ IpcpDecodeConfig(struct fsm *fp, u_char *cp, int plen, int mode_type,
switch (mode_type) {
case MODE_REQ:
- ipaddr_req = 1;
+ ipcp->peer_req = 1;
ipcp_ValidateReq(ipcp, ipaddr, dec);
break;
@@ -1414,8 +1414,17 @@ IpcpDecodeConfig(struct fsm *fp, u_char *cp, int plen, int mode_type,
}
if (mode_type != MODE_NOP) {
- if (mode_type == MODE_REQ && !ipaddr_req) {
- /* We *REQUIRE* that the peer requests an IP address */
+ if (mode_type == MODE_REQ && !ipcp->peer_req) {
+ if (dec->rejend == dec->rej && dec->nakend == dec->nak) {
+ /*
+ * Pretend the peer has requested an IP.
+ * We do this to ensure that we only send one NAK if the only
+ * reason for the NAK is because the peer isn't sending a
+ * TY_IPADDR REQ. This stops us from repeatedly trying to tell
+ * the peer that we have to have an IP address on their end.
+ */
+ ipcp->peer_req = 1;
+ }
ipaddr.s_addr = INADDR_ANY;
ipcp_ValidateReq(ipcp, ipaddr, dec);
}
diff --git a/usr.sbin/ppp/ipcp.h b/usr.sbin/ppp/ipcp.h
index 83350a4..0da818d 100644
--- a/usr.sbin/ppp/ipcp.h
+++ b/usr.sbin/ppp/ipcp.h
@@ -108,6 +108,7 @@ struct ipcp {
unsigned heis1172 : 1; /* True if he is speaking rfc1172 */
+ unsigned peer_req : 1; /* Any TY_IPADDR REQs from the peer ? */
struct in_addr peer_ip; /* IP address he's willing to use */
u_int32_t peer_compproto; /* VJ params he's willing to use */
OpenPOWER on IntegriCloud