summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>1998-05-23 17:05:28 +0000
committerbrian <brian@FreeBSD.org>1998-05-23 17:05:28 +0000
commit3d5a66dff7468559eb0f226477cfed7891ba121f (patch)
tree4e1e53fa349d3a250d5f4fee8e5bbcbd9ab82f78 /usr.sbin
parentdd6254f96c0780e31e7e5b2d7b8c2a4e9a69caf1 (diff)
downloadFreeBSD-src-3d5a66dff7468559eb0f226477cfed7891ba121f.zip
FreeBSD-src-3d5a66dff7468559eb0f226477cfed7891ba121f.tar.gz
o Make sure we adjust our min seq and process any outstanding queued
incoming fragments when a link goes down. o Don't use the minimum sequence numbers of links that aren't open. o Understand sequence number wrapping when determining the minimum sequence number. o Add & adjust a few comments.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/ppp/bundle.c18
-rw-r--r--usr.sbin/ppp/link.h4
-rw-r--r--usr.sbin/ppp/mp.c33
-rw-r--r--usr.sbin/ppp/mp.h3
4 files changed, 46 insertions, 12 deletions
diff --git a/usr.sbin/ppp/bundle.c b/usr.sbin/ppp/bundle.c
index 60ba2f3..1af9b9f 100644
--- a/usr.sbin/ppp/bundle.c
+++ b/usr.sbin/ppp/bundle.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: bundle.c,v 1.1.2.89 1998/05/21 01:13:19 brian Exp $
+ * $Id: bundle.c,v 1.2 1998/05/21 21:44:08 brian Exp $
*/
#include <sys/types.h>
@@ -336,7 +336,8 @@ bundle_LayerDown(void *v, struct fsm *fp)
/*
* The given FSM has been told to come down.
* If it's our last NCP, stop the idle timer.
- * If it's an LCP and we're in multilink mode, adjust our tun speed.
+ * If it's an LCP and we're in multilink mode, adjust our tun
+ * speed and make sure our minimum sequence number is adjusted.
*/
struct bundle *bundle = (struct bundle *)v;
@@ -345,14 +346,25 @@ bundle_LayerDown(void *v, struct fsm *fp)
bundle_StopIdleTimer(bundle);
else if (fp->proto == PROTO_LCP && bundle->ncp.mp.active) {
struct datalink *dl;
+ struct datalink *lost;
bundle->ifp.Speed = 0;
+ lost = NULL;
for (dl = bundle->links; dl; dl = dl->next)
- if (fp != &dl->physical->link.lcp.fsm && dl->state == DATALINK_OPEN)
+ if (fp == &dl->physical->link.lcp.fsm)
+ lost = dl;
+ else if (dl->state == DATALINK_OPEN)
bundle->ifp.Speed += modem_Speed(dl->physical);
+
if (bundle->ifp.Speed)
/* Don't configure down to a speed of 0 */
tun_configure(bundle, bundle->ncp.mp.link.lcp.his_mru);
+
+ if (lost)
+ mp_LinkLost(&bundle->ncp.mp, lost);
+ else
+ log_Printf(LogERROR, "Oops, lost an unrecognised datalink (%s) !\n",
+ fp->link->name);
}
}
diff --git a/usr.sbin/ppp/link.h b/usr.sbin/ppp/link.h
index 5186b00..b03c292 100644
--- a/usr.sbin/ppp/link.h
+++ b/usr.sbin/ppp/link.h
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: link.h,v 1.1.2.11 1998/04/24 19:15:26 brian Exp $
+ * $Id: link.h,v 1.2 1998/05/21 21:46:14 brian Exp $
*
*/
@@ -39,7 +39,7 @@ struct prompt;
struct link {
int type; /* _LINK type */
- const char *name; /* unique id per link type */
+ const char *name; /* Points to datalink::name */
int len; /* full size of parent struct */
struct pppThroughput throughput; /* Link throughput statistics */
struct mqueue Queue[LINK_QUEUES]; /* Our output queue of mbufs */
diff --git a/usr.sbin/ppp/mp.c b/usr.sbin/ppp/mp.c
index 1ed6846..4532f6e 100644
--- a/usr.sbin/ppp/mp.c
+++ b/usr.sbin/ppp/mp.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: mp.c,v 1.2 1998/05/21 21:47:05 brian Exp $
+ * $Id: mp.c,v 1.3 1998/05/23 13:38:09 brian Exp $
*/
#include <sys/types.h>
@@ -323,13 +323,23 @@ mp_Input(struct mp *mp, struct mbuf *m, struct physical *p)
struct mbuf *q, *last;
int32_t seq;
- if (mp_ReadHeader(mp, m, &mh) == 0) {
+ /*
+ * When `m' and `p' are NULL, it means our oldest link has gone down.
+ * We want to determine a new min, and process any intermediate stuff
+ * as normal
+ */
+
+ if (m && mp_ReadHeader(mp, m, &mh) == 0) {
mbuf_Free(m);
return;
}
- seq = p->dl->mp.seq;
- p->dl->mp.seq = mh.seq;
+ if (p) {
+ seq = p->dl->mp.seq;
+ p->dl->mp.seq = mh.seq;
+ } else
+ seq = mp->seq.min_in;
+
if (mp->seq.min_in == seq) {
/*
* We've received new data on the link that has our min (oldest) seq.
@@ -337,9 +347,11 @@ mp_Input(struct mp *mp, struct mbuf *m, struct physical *p)
*/
struct datalink *dl;
- mp->seq.min_in = p->dl->mp.seq;
+ mp->seq.min_in = (u_int32_t)-1;
for (dl = mp->bundle->links; dl; dl = dl->next)
- if (mp->seq.min_in > dl->mp.seq)
+ if (dl->state == DATALINK_OPEN &&
+ (mp->seq.min_in == -1 ||
+ isbefore(mp->local_is12bit, dl->mp.seq, mp->seq.min_in)))
mp->seq.min_in = dl->mp.seq;
}
@@ -544,6 +556,7 @@ mp_FillQueues(struct bundle *bundle)
thislink = nlinks = 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) {
if (thislink == mp->out.link)
fdl = dl;
@@ -991,3 +1004,11 @@ mpserver_Close(struct mpserver *s)
s->fd = -1;
}
}
+
+void
+mp_LinkLost(struct mp *mp, struct datalink *dl)
+{
+ if (mp->seq.min_in == dl->mp.seq)
+ /* We've lost the link that's holding everything up ! */
+ mp_Input(mp, NULL, NULL);
+}
diff --git a/usr.sbin/ppp/mp.h b/usr.sbin/ppp/mp.h
index 4f91365..1ca7a2f 100644
--- a/usr.sbin/ppp/mp.h
+++ b/usr.sbin/ppp/mp.h
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: mp.h,v 1.1.2.12 1998/05/03 22:13:13 brian Exp $
+ * $Id: mp.h,v 1.2 1998/05/21 21:47:08 brian Exp $
*/
struct mbuf;
@@ -132,3 +132,4 @@ extern int mp_SetDatalinkWeight(struct cmdargs const *);
extern int mp_ShowStatus(struct cmdargs const *);
extern const char *mp_Enddisc(u_char, const char *, int);
extern int mp_SetEnddisc(struct cmdargs const *);
+extern void mp_LinkLost(struct mp *, struct datalink *);
OpenPOWER on IntegriCloud