From: Paul Mackerras Date: Wed, 26 Apr 1995 04:15:48 +0000 (+0000) Subject: Updates from Charlie Wick X-Git-Tag: RELEASE_2_3_6~768 X-Git-Url: http://git.ozlabs.org/?p=ppp.git;a=commitdiff_plain;h=952716007e665afd7d07a0af71fb45b6327403da Updates from Charlie Wick --- diff --git a/aix4/Makefile b/aix4/Makefile index 8c72052..0018ff5 100644 --- a/aix4/Makefile +++ b/aix4/Makefile @@ -2,7 +2,7 @@ # Makefile for AIX 4.1 # # -# $Id: Makefile,v 1.1 1994/12/05 00:29:21 paulus Exp $ +# $Id: Makefile,v 1.2 1995/04/26 04:15:48 paulus Exp $ # #ifndef DRIVERS DRIVERS=/usr/lib/drivers @@ -10,7 +10,7 @@ DRIVERS=/usr/lib/drivers CC=xlc IFLAGS = -I.. -DFLAGS = -D_KERNEL -DINET -DPPP_VD -DNUM_PPP=5 -DDEBUGS -DPPP_STATS -DVJC +DFLAGS = -D_KERNEL -DINET -DPPP_VD -DNUM_PPP=5 -DDEBUGS -DPPP_STATS -DVJC -D__aix4__ CFLAGS = $(DFLAGS) $(IFLAGS) KIMP = -bI:/lib/pse.exp -bI:/lib/kernex.exp -bI:/lib/syscalls.exp diff --git a/aix4/ppp_async.c b/aix4/ppp_async.c index 1cef454..d079e3f 100644 --- a/aix4/ppp_async.c +++ b/aix4/ppp_async.c @@ -5,7 +5,7 @@ fcstab and some ideas nicked from if_ppp.c from cmu. See copyright notice in if_ppp.h and NOTES - $Id: ppp_async.c,v 1.2 1994/12/05 00:54:58 paulus Exp $ + $Id: ppp_async.c,v 1.3 1995/04/26 04:15:48 paulus Exp $ */ #include @@ -244,7 +244,18 @@ ppp_async_wput(q, mp) int x, flags; switch (mp->b_datap->db_type) { - + + case M_CTL: + switch (*(u_char *)mp->b_rptr) { + case IF_GET_CSTATS: + /* trap this and remove it */ + freemsg(mp); + break; + default: + putnext(q, mp); + } + break; + case M_FLUSH : if (*mp->b_rptr & FLUSHW) flushq(q, FLUSHDATA); diff --git a/aix4/ppp_comp.c b/aix4/ppp_comp.c index 181eebb..8ce4030 100644 --- a/aix4/ppp_comp.c +++ b/aix4/ppp_comp.c @@ -24,7 +24,7 @@ * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, * OR MODIFICATIONS. * - * $Id: ppp_comp.c,v 1.2 1994/12/05 00:55:24 paulus Exp $ + * $Id: ppp_comp.c,v 1.3 1995/04/26 04:15:48 paulus Exp $ */ #include @@ -168,10 +168,35 @@ ppp_comp_wput(q, mp) int error, len, proto, state; struct ppp_option_data *odp; struct compressor **comp; + struct ppp_comp_stats *pcp; cp = (struct ppp_comp_state *) q->q_ptr; switch (mp->b_datap->db_type) { + case M_CTL: + switch (*(u_char *) mp->b_rptr) { + case IF_GET_CSTATS: + freemsg(mp); + mp = allocb(sizeof(struct ppp_comp_stats) + sizeof(u_long), + BPRI_HI); + if (mp != NULL) { + *(u_char *) mp->b_wptr = IF_CSTATS; + mp->b_wptr += sizeof(u_long); /* should be enough alignment */ + pcp = (struct ppp_comp_stats *) mp->b_wptr; + mp->b_wptr += sizeof(struct ppp_comp_stats); + bzero(pcp, sizeof(struct ppp_comp_stats)); + if (cp->xstate != NULL) + (*cp->xcomp->comp_stat)(cp->xstate, &pcp->c); + if (cp->rstate != NULL) + (*cp->rcomp->decomp_stat)(cp->rstate, &pcp->d); + qreply(q, mp); + } + break; + default: + putnext(q, mp); + } + break; + case M_DATA: /* first find out what the protocol is */ if (mp->b_wptr - mp->b_rptr >= PPP_HDRLEN diff --git a/aix4/ppp_if.c b/aix4/ppp_if.c index 87ecefa..4690aa4 100644 --- a/aix4/ppp_if.c +++ b/aix4/ppp_if.c @@ -90,6 +90,7 @@ struct ppp_if_info { #endif #ifdef PPP_STATS struct pppstat pii_stats; + struct ppp_comp_stats pii_cstats; #endif }; @@ -620,7 +621,6 @@ ppp_if_rput(q, mp) queue_t *q; register mblk_t *mp; { - register u_char c; register PII *p; switch (mp->b_datap->db_type) { @@ -638,8 +638,7 @@ ppp_if_rput(q, mp) case M_CTL: p = (PII *) q->q_ptr; if (p != NULL) { - c = *(u_char *) mp->b_rptr; - switch (c) { + switch (*(u_char *) mp->b_rptr) { case IF_INPUT_ERROR : p->pii_ifnet.if_ierrors++; INCR(ppp_ierrors); @@ -652,9 +651,16 @@ ppp_if_rput(q, mp) DLOG("ppp_if: output error inc to %d\n", p->pii_ifnet.if_oerrors); break; - } + case IF_CSTATS: + bcopy(mp->b_rptr + sizeof(u_long), &p->pii_cstats, + sizeof(struct ppp_comp_stats)); + freemsg(mp); + break; + default: + putnext(q, mp); /* send it up to pppd */ + break; + } } - putnext(q, mp); /* send it up to pppd */ break; default: @@ -678,6 +684,7 @@ ppp_if_rsrv(q) int len, xlen, count, s, pklen; u_char *rptr; int address, control; + int dlen; p = (PII *) q->q_ptr; @@ -697,6 +704,7 @@ ppp_if_rsrv(q) } len = msgdsize(mp); + dlen = len - PPP_HDRLEN; #ifdef PPP_STATS p->pii_stats.ppp_ibytes += len; #endif @@ -751,6 +759,7 @@ ppp_if_rsrv(q) freemsg(mp); continue; } + dlen = len - xlen + hlen; cp = mvjc->b_rptr; cp[0] = address; cp[1] = control; @@ -761,7 +770,6 @@ ppp_if_rsrv(q) mvjc->b_cont = mp; mp->b_rptr += xlen; m0 = mp = mvjc; - len += PPP_HDRLEN + hlen; break; case PPP_VJC_UNCOMP : @@ -834,8 +842,10 @@ ppp_if_rsrv(q) continue; } len = MHLEN; + mb1->m_pkthdr.rcvif = &(p->pii_ifnet); + mb1->m_pkthdr.len = dlen; mbtail = mb2 = mb1; - pklen = 0; + mb1->m_len = 0; rptr = mp->b_rptr + PPP_HDRLEN; xlen = mp->b_wptr - rptr; @@ -866,7 +876,6 @@ ppp_if_rsrv(q) rptr += count; len -= count; xlen -= count; - pklen += count; mb2->m_len += count; } @@ -896,9 +905,6 @@ ppp_if_rsrv(q) } else { */ - ifp = &p->pii_ifnet; - mb1->m_pkthdr.len = pklen; - mb1->m_pkthdr.rcvif = ifp; find_input_type(0x0800, mb1, ifp, 0); } } /* end while */ @@ -1046,6 +1052,7 @@ ppp_ioctl(ifp, cmd, data) struct ppp_stats *psp; struct ppp_comp_stats *pcp; PII *p; + queue_t *q; int error = 0; switch (cmd) { @@ -1108,15 +1115,28 @@ ppp_ioctl(ifp, cmd, data) case SIOCGPPPCSTATS: p = &pii[ifp->if_unit]; + bzero(&p->pii_cstats, sizeof(struct ppp_comp_stats)); + + /* Make a message to send on the interface's write stream */ + q = p->pii_writeq; + if (q != NULL) { + putctl1(q, M_CTL, IF_GET_CSTATS); + /* + * We assume the message gets passed along immediately, so + * by the time the putctl1 returns, the request has been + * processed, the values returned and p->pii_cstats has + * been updated. If not, we just get zeroes. + */ + } pcp = (struct ppp_comp_stats *)&((struct ifpppcstatsreq *)data)->stats; - bzero(pcp, sizeof(struct ppp_comp_stats)); - /* XXX we need to fill in the compression stats */ + bcopy(&p->pii_cstats, pcp, sizeof(struct ppp_comp_stats)); break; - default : - error = EINVAL; - break; + default: + error = EINVAL; + break; } + return(error); }