summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ppp/lqr.c
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>1999-05-09 20:02:29 +0000
committerbrian <brian@FreeBSD.org>1999-05-09 20:02:29 +0000
commit00d71de444cebd8e8fb9f1a6f538b0e25756fcbd (patch)
tree35a86aa77f33435584f120d89d51596207ec30c1 /usr.sbin/ppp/lqr.c
parent81c1d3f4c6f3f0dcb719616e43e48c3b8d72888e (diff)
downloadFreeBSD-src-00d71de444cebd8e8fb9f1a6f538b0e25756fcbd.zip
FreeBSD-src-00d71de444cebd8e8fb9f1a6f538b0e25756fcbd.tar.gz
Deal with the fact that as we now mbuf_Read the fsm
header in fsm_Input() we often end up with a NULL mbuf. Deal with a possible NULL mbuf being passed into mbuf_Prepend(). Adjust some spacing to make things more consistent.
Diffstat (limited to 'usr.sbin/ppp/lqr.c')
-rw-r--r--usr.sbin/ppp/lqr.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/usr.sbin/ppp/lqr.c b/usr.sbin/ppp/lqr.c
index 36966b1..4fa696e 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.32 1999/03/29 08:21:28 brian Exp $
+ * $Id: lqr.c,v 1.33 1999/05/08 11:07:02 brian Exp $
*
* o LQR based on RFC1333
*
@@ -78,17 +78,17 @@ SendEchoReq(struct lcp *lcp)
(u_char *)&echo, sizeof echo);
}
-void
-lqr_RecvEcho(struct fsm *fp, struct mbuf * bp)
+struct mbuf *
+lqr_RecvEcho(struct fsm *fp, struct mbuf *bp)
{
struct hdlc *hdlc = &link2physical(fp->link)->hdlc;
- struct echolqr *lqr;
+ struct echolqr lqr;
u_int32_t seq;
- if (mbuf_Length(bp) == sizeof(struct echolqr)) {
- lqr = (struct echolqr *) MBUF_CTOP(bp);
- if (ntohl(lqr->signature) == SIGNATURE) {
- seq = ntohl(lqr->sequence);
+ if (mbuf_Length(bp) == sizeof lqr) {
+ mbuf_Read(bp, &lqr, sizeof lqr);
+ if (ntohl(lqr.signature) == SIGNATURE) {
+ seq = ntohl(lqr.sequence);
/* careful not to update lqm.echo.seq_recv with older values */
if ((hdlc->lqm.echo.seq_recv > (u_int32_t)0 - 5 && seq < 5) ||
(hdlc->lqm.echo.seq_recv <= (u_int32_t)0 - 5 &&
@@ -96,14 +96,15 @@ lqr_RecvEcho(struct fsm *fp, struct mbuf * bp)
hdlc->lqm.echo.seq_recv = seq;
} else
log_Printf(LogWARN, "lqr_RecvEcho: Got sig 0x%08lx, not 0x%08lx !\n",
- (u_long)ntohl(lqr->signature), (u_long)SIGNATURE);
+ (u_long)ntohl(lqr.signature), (u_long)SIGNATURE);
} else
log_Printf(LogWARN, "lqr_RecvEcho: Got packet size %d, expecting %ld !\n",
mbuf_Length(bp), (long)sizeof(struct echolqr));
+ return bp;
}
void
-lqr_ChangeOrder(struct lqrdata * src, struct lqrdata * dst)
+lqr_ChangeOrder(struct lqrdata *src, struct lqrdata *dst)
{
u_int32_t *sp, *dp;
int n;
OpenPOWER on IntegriCloud