summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ppp/lqr.c
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>1999-06-02 15:59:09 +0000
committerbrian <brian@FreeBSD.org>1999-06-02 15:59:09 +0000
commit424e32a4e7c02e7d5783e442834efc3956b3c9b9 (patch)
tree0b2a42f17bd7f967733eaf5f44d7a14ad8da23fb /usr.sbin/ppp/lqr.c
parentf45463e353039436955b563e295ed6eabeab0a6c (diff)
downloadFreeBSD-src-424e32a4e7c02e7d5783e442834efc3956b3c9b9.zip
FreeBSD-src-424e32a4e7c02e7d5783e442834efc3956b3c9b9.tar.gz
o Alter the mbuf type as it's processed by different layers.
o Show more information about missing MP fragments in ``show mp''. o Do away with mbuf_Log(). It was showing mbuf stats twice on receipt of LCP/CCP/IPCP packets.... ???!!? o Pre-allocate a bit extra when creating LQR packets to avoid having to allocate another mbuf in mbuf_Prepend().
Diffstat (limited to 'usr.sbin/ppp/lqr.c')
-rw-r--r--usr.sbin/ppp/lqr.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/usr.sbin/ppp/lqr.c b/usr.sbin/ppp/lqr.c
index 31e40e3..541021b 100644
--- a/usr.sbin/ppp/lqr.c
+++ b/usr.sbin/ppp/lqr.c
@@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: lqr.c,v 1.34 1999/05/09 20:02:23 brian Exp $
+ * $Id: lqr.c,v 1.35 1999/05/14 09:36:06 brian Exp $
*
* o LQR based on RFC1333
*
@@ -75,7 +75,7 @@ SendEchoReq(struct lcp *lcp)
echo.signature = htonl(SIGNATURE);
echo.sequence = htonl(hdlc->lqm.echo.seq_sent);
fsm_Output(&lcp->fsm, CODE_ECHOREQ, hdlc->lqm.echo.seq_sent++,
- (u_char *)&echo, sizeof echo);
+ (u_char *)&echo, sizeof echo, MB_ECHOOUT);
}
struct mbuf *
@@ -132,8 +132,13 @@ static void
SendLqrData(struct lcp *lcp)
{
struct mbuf *bp;
+ int extra;
- bp = mbuf_Alloc(sizeof(struct lqrdata), MB_LQR);
+ extra = proto_WrapperOctets(lcp, PROTO_LQR) +
+ acf_WrapperOctets(lcp, PROTO_LQR);
+ bp = mbuf_Alloc(sizeof(struct lqrdata) + extra, MB_LQROUT);
+ bp->cnt -= extra;
+ bp->offset += extra;
link_PushPacket(lcp->fsm.link, bp, lcp->fsm.bundle, PRI_LINK, PROTO_LQR);
}
@@ -383,7 +388,7 @@ lqr_LayerPush(struct bundle *b, struct link *l, struct mbuf *bp,
p->hdlc.lqm.OutPackets++;
if (*proto == PROTO_LQR) {
- /* Overwrite the entire packet */
+ /* Overwrite the entire packet (created in SendLqrData()) */
struct lqrdata lqr;
lqr.MagicNumber = p->link.lcp.want_magic;
@@ -414,9 +419,21 @@ lqr_LayerPush(struct bundle *b, struct link *l, struct mbuf *bp,
return bp;
}
+static struct mbuf *
+lqr_LayerPull(struct bundle *b, struct link *l, struct mbuf *bp, u_short *proto)
+{
+ /*
+ * We mark the packet as ours but don't do anything 'till it's dispatched
+ * to lqr_Input()
+ */
+ if (*proto == PROTO_LQR)
+ mbuf_SetType(bp, MB_LQRIN);
+ return bp;
+}
+
/*
* Statistics for pulled packets are recorded either in hdlc_PullPacket()
* or sync_PullPacket()
*/
-struct layer lqrlayer = { LAYER_LQR, "lqr", lqr_LayerPush, NULL };
+struct layer lqrlayer = { LAYER_LQR, "lqr", lqr_LayerPush, lqr_LayerPull };
OpenPOWER on IntegriCloud