summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ppp/fsm.c
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>1999-12-20 20:29:47 +0000
committerbrian <brian@FreeBSD.org>1999-12-20 20:29:47 +0000
commit86f30d4f38c1b3bdc30e15482e3d749c9ad5f159 (patch)
tree4d30f99ffa1bad71c98e63316d2825aa89c6d082 /usr.sbin/ppp/fsm.c
parent885c27b720bff004eb536dcaab0c32778e82457e (diff)
downloadFreeBSD-src-86f30d4f38c1b3bdc30e15482e3d749c9ad5f159.zip
FreeBSD-src-86f30d4f38c1b3bdc30e15482e3d749c9ad5f159.tar.gz
Cosmetic: Make struct mbuf more like kernel mbufs.
Diffstat (limited to 'usr.sbin/ppp/fsm.c')
-rw-r--r--usr.sbin/ppp/fsm.c96
1 files changed, 48 insertions, 48 deletions
diff --git a/usr.sbin/ppp/fsm.c b/usr.sbin/ppp/fsm.c
index 2e2a2ea..8d97445 100644
--- a/usr.sbin/ppp/fsm.c
+++ b/usr.sbin/ppp/fsm.c
@@ -201,7 +201,7 @@ fsm_Output(struct fsm *fp, u_int code, u_int id, u_char *ptr, int count,
lh.code = code;
lh.id = id;
lh.length = htons(plen);
- bp = mbuf_Alloc(plen, mtype);
+ bp = m_get(plen, mtype);
memcpy(MBUF_CTOP(bp), &lh, sizeof(struct fsmheader));
if (count)
memcpy(MBUF_CTOP(bp) + sizeof(struct fsmheader), ptr, count);
@@ -454,12 +454,12 @@ FsmRecvConfigReq(struct fsm *fp, struct fsmheader *lhp, struct mbuf *bp)
int plen, flen;
int ackaction = 0;
- plen = mbuf_Length(bp);
+ plen = m_length(bp);
flen = ntohs(lhp->length) - sizeof *lhp;
if (plen < flen) {
log_Printf(LogWARN, "%s: FsmRecvConfigReq: plen (%d) < flen (%d)\n",
fp->link->name, plen, flen);
- mbuf_Free(bp);
+ m_freem(bp);
return;
}
@@ -471,28 +471,28 @@ FsmRecvConfigReq(struct fsm *fp, struct fsmheader *lhp, struct mbuf *bp)
* ccp_SetOpenMode() leaves us in initial if we're disabling
* & denying everything.
*/
- bp = mbuf_Prepend(bp, lhp, sizeof *lhp, 2);
+ bp = m_prepend(bp, lhp, sizeof *lhp, 2);
bp = proto_Prepend(bp, fp->proto, 0, 0);
- bp = mbuf_Contiguous(bp);
- lcp_SendProtoRej(&fp->link->lcp, MBUF_CTOP(bp), bp->cnt);
- mbuf_Free(bp);
+ bp = m_pullup(bp);
+ lcp_SendProtoRej(&fp->link->lcp, MBUF_CTOP(bp), bp->m_len);
+ m_freem(bp);
return;
}
/* Drop through */
case ST_STARTING:
log_Printf(fp->LogLevel, "%s: Oops, RCR in %s.\n",
fp->link->name, State2Nam(fp->state));
- mbuf_Free(bp);
+ m_freem(bp);
return;
case ST_CLOSED:
(*fp->fn->SendTerminateAck)(fp, lhp->id);
- mbuf_Free(bp);
+ m_freem(bp);
return;
case ST_CLOSING:
log_Printf(fp->LogLevel, "%s: Error: Got ConfigReq while state = %s\n",
fp->link->name, State2Nam(fp->state));
case ST_STOPPING:
- mbuf_Free(bp);
+ m_freem(bp);
return;
case ST_OPENED:
(*fp->fn->LayerDown)(fp);
@@ -500,7 +500,7 @@ FsmRecvConfigReq(struct fsm *fp, struct fsmheader *lhp, struct mbuf *bp)
break;
}
- bp = mbuf_Contiguous(bp);
+ bp = m_pullup(bp);
dec.ackend = dec.ack;
dec.nakend = dec.nak;
dec.rejend = dec.rej;
@@ -570,7 +570,7 @@ FsmRecvConfigReq(struct fsm *fp, struct fsmheader *lhp, struct mbuf *bp)
NewState(fp, ST_REQSENT);
break;
}
- mbuf_Free(bp);
+ m_freem(bp);
if (dec.rejend != dec.rej && --fp->more.rejs <= 0) {
log_Printf(LogPHASE, "%s: Too many %s REJs sent - abandoning negotiation\n",
@@ -624,7 +624,7 @@ FsmRecvConfigAck(struct fsm *fp, struct fsmheader *lhp, struct mbuf *bp)
(*fp->parent->LayerDown)(fp->parent->object, fp);
break;
}
- mbuf_Free(bp);
+ m_freem(bp);
}
static void
@@ -634,10 +634,10 @@ FsmRecvConfigNak(struct fsm *fp, struct fsmheader *lhp, struct mbuf *bp)
struct fsm_decode dec;
int plen, flen;
- plen = mbuf_Length(bp);
+ plen = m_length(bp);
flen = ntohs(lhp->length) - sizeof *lhp;
if (plen < flen) {
- mbuf_Free(bp);
+ m_freem(bp);
return;
}
@@ -649,20 +649,20 @@ FsmRecvConfigNak(struct fsm *fp, struct fsmheader *lhp, struct mbuf *bp)
case ST_STARTING:
log_Printf(fp->LogLevel, "%s: Oops, RCN in %s.\n",
fp->link->name, State2Nam(fp->state));
- mbuf_Free(bp);
+ m_freem(bp);
return;
case ST_CLOSED:
case ST_STOPPED:
(*fp->fn->SendTerminateAck)(fp, lhp->id);
- mbuf_Free(bp);
+ m_freem(bp);
return;
case ST_CLOSING:
case ST_STOPPING:
- mbuf_Free(bp);
+ m_freem(bp);
return;
}
- bp = mbuf_Contiguous(bp);
+ bp = m_pullup(bp);
dec.ackend = dec.ack;
dec.nakend = dec.nak;
dec.rejend = dec.rej;
@@ -688,7 +688,7 @@ FsmRecvConfigNak(struct fsm *fp, struct fsmheader *lhp, struct mbuf *bp)
break;
}
- mbuf_Free(bp);
+ m_freem(bp);
}
static void
@@ -724,7 +724,7 @@ FsmRecvTermReq(struct fsm *fp, struct fsmheader *lhp, struct mbuf *bp)
/* A delayed ST_STOPPED is now scheduled */
break;
}
- mbuf_Free(bp);
+ m_freem(bp);
}
static void
@@ -752,7 +752,7 @@ FsmRecvTermAck(struct fsm *fp, struct fsmheader *lhp, struct mbuf *bp)
(*fp->parent->LayerDown)(fp->parent->object, fp);
break;
}
- mbuf_Free(bp);
+ m_freem(bp);
}
static void
@@ -762,10 +762,10 @@ FsmRecvConfigRej(struct fsm *fp, struct fsmheader *lhp, struct mbuf *bp)
struct fsm_decode dec;
int plen, flen;
- plen = mbuf_Length(bp);
+ plen = m_length(bp);
flen = ntohs(lhp->length) - sizeof *lhp;
if (plen < flen) {
- mbuf_Free(bp);
+ m_freem(bp);
return;
}
@@ -777,20 +777,20 @@ FsmRecvConfigRej(struct fsm *fp, struct fsmheader *lhp, struct mbuf *bp)
case ST_STARTING:
log_Printf(fp->LogLevel, "%s: Oops, RCJ in %s.\n",
fp->link->name, State2Nam(fp->state));
- mbuf_Free(bp);
+ m_freem(bp);
return;
case ST_CLOSED:
case ST_STOPPED:
(*fp->fn->SendTerminateAck)(fp, lhp->id);
- mbuf_Free(bp);
+ m_freem(bp);
return;
case ST_CLOSING:
case ST_STOPPING:
- mbuf_Free(bp);
+ m_freem(bp);
return;
}
- bp = mbuf_Contiguous(bp);
+ bp = m_pullup(bp);
dec.ackend = dec.ack;
dec.nakend = dec.nak;
dec.rejend = dec.rej;
@@ -815,13 +815,13 @@ FsmRecvConfigRej(struct fsm *fp, struct fsmheader *lhp, struct mbuf *bp)
NewState(fp, ST_REQSENT);
break;
}
- mbuf_Free(bp);
+ m_freem(bp);
}
static void
FsmRecvCodeRej(struct fsm *fp, struct fsmheader *lhp, struct mbuf *bp)
{
- mbuf_Free(bp);
+ m_freem(bp);
}
static void
@@ -830,8 +830,8 @@ FsmRecvProtoRej(struct fsm *fp, struct fsmheader *lhp, struct mbuf *bp)
struct physical *p = link2physical(fp->link);
u_short proto;
- if (mbuf_Length(bp) < 2) {
- mbuf_Free(bp);
+ if (m_length(bp) < 2) {
+ m_freem(bp);
return;
}
bp = mbuf_Read(bp, &proto, 2);
@@ -883,7 +883,7 @@ FsmRecvProtoRej(struct fsm *fp, struct fsmheader *lhp, struct mbuf *bp)
}
break;
}
- mbuf_Free(bp);
+ m_freem(bp);
}
static void
@@ -893,8 +893,8 @@ FsmRecvEchoReq(struct fsm *fp, struct fsmheader *lhp, struct mbuf *bp)
u_char *cp;
u_int32_t magic;
- bp = mbuf_Contiguous(bp);
- mbuf_SetType(bp, MB_ECHOIN);
+ bp = m_pullup(bp);
+ m_settype(bp, MB_ECHOIN);
if (lcp && ntohs(lhp->length) - sizeof *lhp >= 4) {
cp = MBUF_CTOP(bp);
@@ -911,7 +911,7 @@ FsmRecvEchoReq(struct fsm *fp, struct fsmheader *lhp, struct mbuf *bp)
ntohs(lhp->length) - sizeof *lhp, MB_ECHOOUT);
}
}
- mbuf_Free(bp);
+ m_freem(bp);
}
static void
@@ -920,25 +920,25 @@ FsmRecvEchoRep(struct fsm *fp, struct fsmheader *lhp, struct mbuf *bp)
if (fsm2lcp(fp))
bp = lqr_RecvEcho(fp, bp);
- mbuf_Free(bp);
+ m_freem(bp);
}
static void
FsmRecvDiscReq(struct fsm *fp, struct fsmheader *lhp, struct mbuf *bp)
{
- mbuf_Free(bp);
+ m_freem(bp);
}
static void
FsmRecvIdent(struct fsm *fp, struct fsmheader *lhp, struct mbuf *bp)
{
- mbuf_Free(bp);
+ m_freem(bp);
}
static void
FsmRecvTimeRemain(struct fsm *fp, struct fsmheader *lhp, struct mbuf *bp)
{
- mbuf_Free(bp);
+ m_freem(bp);
}
static void
@@ -952,14 +952,14 @@ FsmRecvResetReq(struct fsm *fp, struct fsmheader *lhp, struct mbuf *bp)
*/
link_SequenceQueue(fp->link);
fsm_Output(fp, CODE_RESETACK, lhp->id, NULL, 0, MB_CCPOUT);
- mbuf_Free(bp);
+ m_freem(bp);
}
static void
FsmRecvResetAck(struct fsm *fp, struct fsmheader *lhp, struct mbuf *bp)
{
(*fp->fn->RecvResetAck)(fp, lhp->id);
- mbuf_Free(bp);
+ m_freem(bp);
}
void
@@ -969,9 +969,9 @@ fsm_Input(struct fsm *fp, struct mbuf *bp)
struct fsmheader lh;
const struct fsmcodedesc *codep;
- len = mbuf_Length(bp);
+ len = m_length(bp);
if (len < sizeof(struct fsmheader)) {
- mbuf_Free(bp);
+ m_freem(bp);
return;
}
bp = mbuf_Read(bp, &lh, sizeof lh);
@@ -988,10 +988,10 @@ fsm_Input(struct fsm *fp, struct mbuf *bp)
*/
static u_char id;
- bp = mbuf_Prepend(bp, &lh, sizeof lh, 0);
- bp = mbuf_Contiguous(bp);
- fsm_Output(fp, CODE_CODEREJ, id++, MBUF_CTOP(bp), bp->cnt, MB_UNKNOWN);
- mbuf_Free(bp);
+ bp = m_prepend(bp, &lh, sizeof lh, 0);
+ bp = m_pullup(bp);
+ fsm_Output(fp, CODE_CODEREJ, id++, MBUF_CTOP(bp), bp->m_len, MB_UNKNOWN);
+ m_freem(bp);
return;
}
OpenPOWER on IntegriCloud