diff options
author | brian <brian@cvs.openbsd.org> | 2001-07-26 11:36:52 +0000 |
---|---|---|
committer | brian <brian@cvs.openbsd.org> | 2001-07-26 11:36:52 +0000 |
commit | 18c0d13f42e79b4d3e7db8c3e4672d49a3fe86f7 (patch) | |
tree | 7d1ddc9eed77937a7880c1f7f177b0ebd6c33e01 /usr.sbin/ppp | |
parent | 4bec80ddfc12efdc1c824d4a123b120ebb3ff587 (diff) |
Handle peer REQ/NAKs of >1500 byte MRUs when we have no preference.
Diffstat (limited to 'usr.sbin/ppp')
-rw-r--r-- | usr.sbin/ppp/ppp/command.c | 4 | ||||
-rw-r--r-- | usr.sbin/ppp/ppp/lcp.c | 28 |
2 files changed, 18 insertions, 14 deletions
diff --git a/usr.sbin/ppp/ppp/command.c b/usr.sbin/ppp/ppp/command.c index dafdd2c8628..b34dd5c8c20 100644 --- a/usr.sbin/ppp/ppp/command.c +++ b/usr.sbin/ppp/ppp/command.c @@ -25,7 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $OpenBSD: command.c,v 1.64 2001/07/09 07:05:03 deraadt Exp $ + * $OpenBSD: command.c,v 1.65 2001/07/26 11:36:51 brian Exp $ */ #include <sys/param.h> @@ -1735,7 +1735,7 @@ SetVariable(struct cmdargs const *arg) } if (long_val == 0) - *change = DEF_MRU; + *change = 0; else if (long_val < MIN_MRU) { log_Printf(LogWARN, "MRU %ld: too small - min %d\n", long_val, MIN_MRU); return 1; diff --git a/usr.sbin/ppp/ppp/lcp.c b/usr.sbin/ppp/ppp/lcp.c index 62e4c1ac710..ece41d67c48 100644 --- a/usr.sbin/ppp/ppp/lcp.c +++ b/usr.sbin/ppp/ppp/lcp.c @@ -25,7 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $OpenBSD: lcp.c,v 1.28 2001/07/17 01:07:00 brian Exp $ + * $OpenBSD: lcp.c,v 1.29 2001/07/26 11:36:51 brian Exp $ */ #include <sys/param.h> @@ -177,8 +177,12 @@ lcp_ReportStatus(struct cmdargs const *arg) (u_long)lcp->want_magic, lcp->want_mrru, lcp->want_shortseq ? "on" : "off", lcp->my_reject); - prompt_Printf(arg->prompt, "\n Defaults: MRU = %d (max %d), ", - lcp->cfg.mru, lcp->cfg.max_mru); + if (lcp->cfg.mru) + prompt_Printf(arg->prompt, "\n Defaults: MRU = %d (max %d), ", + lcp->cfg.mru, lcp->cfg.max_mru); + else + prompt_Printf(arg->prompt, "\n Defaults: MRU = any (max %d), ", + lcp->cfg.max_mru); if (lcp->cfg.mtu) prompt_Printf(arg->prompt, "MTU = %d (max %d), ", lcp->cfg.mtu, lcp->cfg.max_mtu); @@ -246,7 +250,7 @@ lcp_Init(struct lcp *lcp, struct bundle *bundle, struct link *l, fsm_Init(&lcp->fsm, "LCP", PROTO_LCP, mincode, LCP_MAXCODE, LogLCP, bundle, l, parent, &lcp_Callbacks, lcp_TimerNames); - lcp->cfg.mru = DEF_MRU; + lcp->cfg.mru = 0; lcp->cfg.max_mru = MAX_MRU; lcp->cfg.mtu = 0; lcp->cfg.max_mtu = MAX_MTU; @@ -289,7 +293,8 @@ lcp_Setup(struct lcp *lcp, int openmode) lcp->his_callback.opmask = 0; lcp->his_shortseq = 0; - lcp->want_mru = lcp->cfg.mru; + if ((lcp->want_mru = lcp->cfg.mru) == 0) + lcp->want_mru = DEF_MRU; lcp->want_mrru = lcp->fsm.bundle->ncp.mp.cfg.mrru; lcp->want_shortseq = IsEnabled(lcp->fsm.bundle->ncp.mp.cfg.shortseq) ? 1 : 0; lcp->want_acfcomp = IsEnabled(lcp->cfg.acfcomp) ? 1 : 0; @@ -695,29 +700,26 @@ LcpDecodeConfig(struct fsm *fp, u_char *cp, int plen, int mode_type, maxmtu = p ? physical_DeviceMTU(p) : 0; if (lcp->cfg.max_mtu && (!maxmtu || maxmtu > lcp->cfg.max_mtu)) maxmtu = lcp->cfg.max_mtu; - if ((wantmtu = lcp->cfg.mtu) == 0 && (wantmtu = maxmtu) == 0) - wantmtu = DEF_MRU; + wantmtu = lcp->cfg.mtu; if (maxmtu && wantmtu > maxmtu) { log_Printf(LogWARN, "%s: Reducing configured MTU from %u to %u\n", fp->link->name, wantmtu, maxmtu); wantmtu = maxmtu; } - if (wantmtu < MIN_MRU) - wantmtu = MIN_MRU; if (maxmtu && mru > maxmtu) { lcp->his_mru = maxmtu; memcpy(dec->nakend, cp, 2); ua_htons(&lcp->his_mru, dec->nakend + 2); dec->nakend += 4; - } else if (mru < wantmtu) { + } else if (wantmtu && mru < wantmtu) { /* Push him up to MTU or MIN_MRU */ lcp->his_mru = wantmtu; memcpy(dec->nakend, cp, 2); ua_htons(&lcp->his_mru, dec->nakend + 2); dec->nakend += 4; } else { - lcp->his_mru = wantmtu; + lcp->his_mru = mru; memcpy(dec->ackend, cp, 4); dec->ackend += 4; } @@ -728,8 +730,10 @@ LcpDecodeConfig(struct fsm *fp, u_char *cp, int plen, int mode_type, maxmru = lcp->cfg.max_mru; wantmru = lcp->cfg.mru > maxmru ? maxmru : lcp->cfg.mru; - if (mru > wantmru) + if (wantmru && mru > wantmru) lcp->want_mru = wantmru; + else if (mru > maxmru) + lcp->want_mru = maxmru; else if (mru < MIN_MRU) lcp->want_mru = MIN_MRU; else |