summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ppp
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>2002-05-14 00:59:28 +0000
committerbrian <brian@FreeBSD.org>2002-05-14 00:59:28 +0000
commitdef93d7c3cfceda2aaf677946198b281b9787a20 (patch)
treeb075fa34fedbc81897e572abb9660a753341925d /usr.sbin/ppp
parenta10b57ba71436bf6decc5f2145b924efa1d53d3e (diff)
downloadFreeBSD-src-def93d7c3cfceda2aaf677946198b281b9787a20.zip
FreeBSD-src-def93d7c3cfceda2aaf677946198b281b9787a20.tar.gz
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
Diffstat (limited to 'usr.sbin/ppp')
-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 bb26877..3e2ca1b 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 */
OpenPOWER on IntegriCloud