From f9a9a183bf50c2df5584a87f4b24dc28f6efc198 Mon Sep 17 00:00:00 2001 From: brian Date: Thu, 18 Oct 2001 08:47:56 +0000 Subject: When the peer fails to specify an MRU and a 1500 byte MRU is not allowed either because of the transport or configuration, send a MRU NAK only once, then allow the negotiations to proceed. rfc1661 says that 1500 should always be allowed and rfc2516 says that 1492 is the maximum for PPPoE. This changes ppp so that it only weakly suggests 1492, then goes with the default (leaving the problem in the hands of the peer WRT how they set their MTU). MFC after: 1 week --- usr.sbin/ppp/lcp.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'usr.sbin/ppp/lcp.c') diff --git a/usr.sbin/ppp/lcp.c b/usr.sbin/ppp/lcp.c index 4b9dfd9..e75ee72 100644 --- a/usr.sbin/ppp/lcp.c +++ b/usr.sbin/ppp/lcp.c @@ -297,6 +297,7 @@ lcp_Setup(struct lcp *lcp, int openmode) lcp->his_authtype = 0; lcp->his_callback.opmask = 0; lcp->his_shortseq = 0; + lcp->mru_req = 0; if ((lcp->want_mru = lcp->cfg.mru) == 0) lcp->want_mru = DEF_MRU; @@ -554,6 +555,7 @@ LcpLayerStart(struct fsm *fp) log_Printf(LogLCP, "%s: LayerStart\n", fp->link->name); lcp->LcpFailedMagic = 0; fp->more.reqs = fp->more.naks = fp->more.rejs = lcp->cfg.fsm.maxreq * 3; + lcp->mru_req = 0; } static void @@ -618,7 +620,7 @@ LcpDecodeConfig(struct fsm *fp, u_char *cp, int plen, int mode_type, { /* Deal with incoming PROTO_LCP */ struct lcp *lcp = fsm2lcp(fp); - int type, length, sz, pos, op, callback_req, mru_req; + int type, length, sz, pos, op, callback_req; u_int32_t magic, accmap; u_short mru, phmtu, maxmtu, maxmru, wantmtu, wantmru, proto; struct lqrreq *req; @@ -626,7 +628,7 @@ LcpDecodeConfig(struct fsm *fp, u_char *cp, int plen, int mode_type, struct mp *mp; struct physical *p = link2physical(fp->link); - sz = op = callback_req = mru_req = 0; + sz = op = callback_req = 0; while (plen >= sizeof(struct fsmconfig)) { type = *cp; @@ -696,7 +698,7 @@ LcpDecodeConfig(struct fsm *fp, u_char *cp, int plen, int mode_type, break; case TY_MRU: - mru_req = 1; + lcp->mru_req = 1; ua_ntohs(cp + 2, &mru); log_Printf(LogLCP, "%s %d\n", request, mru); @@ -1274,7 +1276,7 @@ reqreject: dec->nakend[-1] = 2; /* XXX: Silly ! */ } } - if (mode_type == MODE_REQ && !mru_req) { + if (mode_type == MODE_REQ && !lcp->mru_req) { mru = DEF_MRU; phmtu = p ? physical_DeviceMTU(p) : 0; if (phmtu && mru > phmtu) @@ -1288,6 +1290,7 @@ reqreject: *dec->nakend++ = 4; ua_htons(&lcp->his_mru, dec->nakend); dec->nakend += 2; + lcp->mru_req = 1; /* Don't keep NAK'ing this */ } } if (dec->rejend != dec->rej) { -- cgit v1.1