Calculate the number of open links properly when deciding on whether to

just send PROTO_IP packets when we've got only one link up in multi-link
mode.

Problem noted by:	Adrian Close <adrian@fernhilltec.com.au>
MFC after:		1 week
This commit is contained in:
Brian Somers 2002-05-14 00:59:28 +00:00
parent ddd36f9fac
commit a43e859d63
1 changed files with 10 additions and 11 deletions

View File

@ -668,12 +668,12 @@ mp_FillPhysicalQueues(struct bundle *bundle)
struct mp *mp = &bundle->ncp.mp;
struct datalink *dl, *fdl;
size_t total, add, len;
int thislink, nlinks;
int thislink, nlinks, nopenlinks, sendasip;
u_int32_t begin, end;
struct mbuf *m, *mo;
struct link *bestlink;
thislink = nlinks = 0;
thislink = nlinks = nopenlinks = 0;
for (fdl = NULL, dl = bundle->links; dl; dl = dl->next) {
/* Include non-open links here as mp->out.link will stay more correct */
if (!fdl) {
@ -683,6 +683,8 @@ mp_FillPhysicalQueues(struct bundle *bundle)
thislink++;
}
nlinks++;
if (dl->state == DATALINK_OPEN)
nopenlinks++;
}
if (!fdl) {
@ -714,7 +716,6 @@ mp_FillPhysicalQueues(struct bundle *bundle)
}
if (!mp_QueueLen(mp)) {
struct datalink *other;
int mrutoosmall;
/*
@ -724,12 +725,10 @@ mp_FillPhysicalQueues(struct bundle *bundle)
* in the outbound traffic going out as PROTO_IP or PROTO_IPV6 rather
* than PROTO_MP.
*/
for (other = dl->next; other; other = other->next)
if (other->state == DATALINK_OPEN)
break;
mrutoosmall = 0;
if (!other) {
sendasip = nopenlinks < 2;
if (sendasip) {
if (dl->physical->link.lcp.his_mru < mp->peer_mrru) {
/*
* Actually, forget it. This test is done against the MRRU rather
@ -738,20 +737,20 @@ mp_FillPhysicalQueues(struct bundle *bundle)
* too likely to upset some ppp implementations.
*/
mrutoosmall = 1;
other = dl;
sendasip = 0;
}
}
bestlink = other ? &mp->link : &dl->physical->link;
bestlink = sendasip ? &dl->physical->link : &mp->link;
if (!ncp_PushPacket(&bundle->ncp, &mp->out.af, bestlink))
break; /* Nothing else to send */
if (mrutoosmall)
log_Printf(LogDEBUG, "Don't send data as PROTO_IP, MRU < MRRU\n");
else if (!other)
else if (sendasip)
log_Printf(LogDEBUG, "Sending data as PROTO_IP, not PROTO_MP\n");
if (!other) {
if (sendasip) {
add = link_QueueLen(&dl->physical->link);
if (add) {
/* this link has got stuff already queued. Let it continue */