aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorBrian Somers <brian@FreeBSD.org>2002-05-14 00:59:28 +0000
committerBrian Somers <brian@FreeBSD.org>2002-05-14 00:59:28 +0000
commita43e859d63045b899215c742e3a6538c521d0f11 (patch)
treeb075fa34fedbc81897e572abb9660a753341925d /usr.sbin
parentddd36f9facc3a776056bb354bb9b13dcf3d9ccf5 (diff)
downloadsrc-a43e859d63045b899215c742e3a6538c521d0f11.tar.gz
src-a43e859d63045b899215c742e3a6538c521d0f11.zip
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
Notes
Notes: svn path=/head/; revision=96552
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/ppp/mp.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/usr.sbin/ppp/mp.c b/usr.sbin/ppp/mp.c
index bb26877029a8..3e2ca1b5d537 100644
--- a/usr.sbin/ppp/mp.c
+++ b/usr.sbin/ppp/mp.c
@@ -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 */