Date: Tue, 17 Jul 2001 02:10:13 +0100 From: Brian Somers <brian@Awfulhak.org> To: "Antoine Beaupre (LMC)" <Antoine.Beaupre@ericsson.ca> Cc: Brian Somers <brian@Awfulhak.org>, freebsd-stable@FreeBSD.ORG Subject: Re: Problem with user-pppoe after upgrade, fixed Message-ID: <200107170110.f6H1ADm61116@hak.lan.Awfulhak.org> In-Reply-To: Message from "Antoine Beaupre (LMC)" <Antoine.Beaupre@ericsson.ca> of "Mon, 16 Jul 2001 16:36:35 EDT." <3B535053.2010606@lmc.ericsson.se>
index | next in thread | previous in thread | raw e-mail
> Brian Somers wrote:
>
> > Hi,
> >
> > Let me make sure I've got things straight. You've upgraded to
> > -stable and removed any ``set mtu'' or ``set mru'' lines that you've
> > got in your ppp.conf.
>
>
> Yep. And everything is *fine* now. ppp is connecting properly and
> running fine. The bad logs I sent the url about were generated after
> adding the bad lines "set m[rt]u 1500".
Ah, ok. That's a relief :)
> > If this is the case, then I'm not sure what's happening. The only
> > way I can reproduce what you're seeing in your log is if I add ``set
> > mtu 1500'' to the configuration - which is incorrect (you can't force
> > the link to have a 1500 byte mtu as it's physically invalid).
>
>
> Then nothing is happening. Switching to 1492 solved the problem.
>
> The problem was: before the upgrade, I already had m[rt]u set to 1500
> and ppp was working fine. Upgrading made ppp stop working. Switching to
> set m[tr]u 1492 or removing the lines solves the problem.
In theory, 1492 is the maximum (PPPoE ends up with 8 bytes of
overhead before it's stuffed into an Ethernet frame). It would be
interesting to know if the old code was actually agreeing on 1500.
If it was, then you should have either been seeing connections hang
from time to time or else your network was allowing you to write 1508
byte payloads to the Ethernet.
FreeBSD prevents the network interface from having an MTU of more
than 1500, stopping any normal programs from abusing the hardware
limts. I don't think any such limits are there for the PPPoE case
though, so perhaps certain hardware setups will allow more than 1500
bytes. I'm reasonably sure about this -- but I haven't actually
proven anything here. I've had test setups that were writing 1502
byte packets ('till the recent MPPE MTU fix) and working 100% fine
while other people running the same software have had unreliable
connections.
> What might have confused you, however, was Neal, that has a similar
> problem and that crossposted to -stable and -questions. His problem is
> that ppp failed to connect after upgrade even *without* any set m[tr]u
> lines in his config file...
It'd be good to have a look at his LCP log too :)
> Does ppp "know" the limit of the physical layer? If so, shouldn't it
> "force" the m[tr]u to 1492?
Yes, it now knows that 1492 is the maximum, however if you set the
mtu to 1500 it'll assume you know what you're doing and use that
value instead.
Thinking a bit more about this, I can't think of any (good) reason
that it should do this. I've just committed the attached patch to
-current and will MFC in a week.
> Thanks,
>
> A.
Cheers.
> --
> Antoine Beaupré
> Jambala TCM team
> Ericsson Canada inc.
> mailto:antoine.beaupre@ericsson.ca
--
Brian <brian@freebsd-services.com> <brian@Awfulhak.org>
http://www.freebsd-services.com/ <brian@[uk.]FreeBSD.org>
Don't _EVER_ lose your sense of humour ! <brian@[uk.]OpenBSD.org>
diff -r -N -u --exclude=CVS --exclude=*.o --exclude=*.gz --exclude=*.orig --exclude=*.cat* --exclude=ppp --exclude=*.cat* --exclude=.??* 1/lcp.c 2/lcp.c
--- 1/lcp.c Mon Jul 16 23:14:53 2001
+++ 2/lcp.c Tue Jul 17 01:59:34 2001
@@ -276,7 +276,6 @@
lcp_Setup(struct lcp *lcp, int openmode)
{
struct physical *p = link2physical(lcp->fsm.link);
- int phmtu = p ? physical_DeviceMTU(p) : 0;
lcp->fsm.open_mode = openmode;
@@ -291,8 +290,6 @@
lcp->his_shortseq = 0;
lcp->want_mru = lcp->cfg.mru;
- if (phmtu && lcp->want_mru > phmtu)
- lcp->want_mru = phmtu;
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;
@@ -376,6 +373,7 @@
struct lcp_opt *o;
struct mp *mp;
u_int16_t proto;
+ u_short maxmru;
if (!p) {
log_Printf(LogERROR, "%s: LcpSendConfigReq: Not a physical link !\n",
@@ -397,7 +395,15 @@
}
}
- if (!REJECTED(lcp, TY_MRU)) {
+ maxmru = p ? physical_DeviceMTU(p) : 0;
+ if (lcp->cfg.max_mru && (!maxmru || maxmru > lcp->cfg.max_mru))
+ maxmru = lcp->cfg.max_mru;
+ if (maxmru && lcp->want_mru > maxmru) {
+ log_Printf(LogWARN, "%s: Reducing configured MRU from %u to %u\n",
+ fp->link->name, lcp->want_mru, maxmru);
+ lcp->want_mru = maxmru;
+ }
+ if (!REJECTED(lcp, TY_MRU) || lcp->want_mru < DEF_MRU) {
ua_htons(&lcp->want_mru, o->data);
INC_LCP_OPT(TY_MRU, 4, o);
}
@@ -604,7 +610,7 @@
struct lcp *lcp = fsm2lcp(fp);
int type, length, sz, pos, op, callback_req, mru_req;
u_int32_t magic, accmap;
- u_short mru, phmtu, proto;
+ u_short mru, phmtu, maxmtu, maxmru, wantmtu, wantmru, proto;
struct lqrreq *req;
char request[20], desc[22];
struct mp *mp;
@@ -686,35 +692,45 @@
switch (mode_type) {
case MODE_REQ:
- phmtu = p ? physical_DeviceMTU(p) : 0;
- if (phmtu && mru > phmtu) {
- lcp->his_mru = lcp->cfg.mtu ? lcp->cfg.mtu : phmtu;
- memcpy(dec->nakend, cp, 2);
- ua_htons(&lcp->his_mru, dec->nakend + 2);
- dec->nakend += 4;
- } if (mru > lcp->cfg.max_mtu) {
- lcp->his_mru = lcp->cfg.mtu ? lcp->cfg.mtu : lcp->cfg.max_mtu;
+ 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;
+ 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 < MIN_MRU || mru < lcp->cfg.mtu) {
+ } else if (mru < wantmtu) {
/* Push him up to MTU or MIN_MRU */
- lcp->his_mru = mru < lcp->cfg.mtu ? lcp->cfg.mtu : 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 = lcp->cfg.mtu ? lcp->cfg.mtu : mru;
+ lcp->his_mru = wantmtu;
memcpy(dec->ackend, cp, 4);
dec->ackend += 4;
}
break;
case MODE_NAK:
- if (mru > lcp->cfg.max_mru) {
- lcp->want_mru = lcp->cfg.max_mru;
- if (p && lcp->want_mru > physical_DeviceMTU(p))
- lcp->want_mru = physical_DeviceMTU(p);
- } else if (mru < MIN_MRU)
+ maxmru = p ? physical_DeviceMTU(p) : 0;
+ if (lcp->cfg.max_mru && (!maxmru || maxmru > lcp->cfg.max_mru))
+ maxmru = lcp->cfg.max_mru;
+ wantmru = lcp->cfg.mru > maxmru ? maxmru : lcp->cfg.mru;
+
+ if (mru > wantmru)
+ lcp->want_mru = wantmru;
+ else if (mru < MIN_MRU)
lcp->want_mru = MIN_MRU;
else
lcp->want_mru = mru;
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200107170110.f6H1ADm61116>
