X-Git-Url: http://git.ozlabs.org/?p=ppp.git;a=blobdiff_plain;f=linux%2Fppp.c;h=6daff3c8a3aa57aa37b0e64c812b0feaf3e272c7;hp=af329c8d93d073d2af0e476495129bf5428b4a00;hb=528c6d493b74e1fb310f00f9ae9d5c840c61588d;hpb=80e8f1536f549b54573f0147d5cd3b895d81e2cc;ds=sidebyside diff --git a/linux/ppp.c b/linux/ppp.c index af329c8..6daff3c 100644 --- a/linux/ppp.c +++ b/linux/ppp.c @@ -1,7 +1,7 @@ /* PPP for Linux - $Id: ppp.c,v 1.3 1994/12/08 02:03:55 paulus Exp $ + $Id: ppp.c,v 1.4 1995/04/28 06:28:22 paulus Exp $ */ /* @@ -1994,10 +1994,36 @@ ppp_dev_ioctl_stats (struct ppp *ppp, struct ifreq *ifr) temp.vj.vjs_uncompressedin = ppp->slcomp->sls_i_uncompressed; temp.vj.vjs_compressedin = ppp->slcomp->sls_i_compressed; } + /* - * Frame data compression statistics + * Move the data to the caller's buffer */ + memcpy_tofs (result, &temp, sizeof (temp)); + } + return error; +} + #ifdef PPP_COMPRESS + +static int +ppp_dev_ioctl_stats (struct ppp *ppp, struct ifreq *ifr) +{ + struct ppp_comp_stats *result, temp; + int error; +/* + * Must have write access to the buffer. + */ + result = (struct ppp_comp_stats *) ifr->ifr_ifru.ifru_data; + error = verify_area (VERIFY_WRITE, + result, + sizeof (temp)); +/* + * Supply the information for the caller. Get the frame data compression + * statistics and move them out to the caller. + */ + if (error == 0) { + memset (&temp, 0, sizeof(temp)); + if (ppp->sc_xc_state != NULL) (*ppp->sc_xcomp->comp_stat) (ppp->sc_xc_state, &temp.c); @@ -2005,7 +2031,6 @@ ppp_dev_ioctl_stats (struct ppp *ppp, struct ifreq *ifr) if (ppp->sc_rc_state != NULL) (*ppp->sc_rcomp->decomp_stat) (ppp->sc_rc_state, &temp.d); -#endif /* PPP_COMPRESS */ /* * Move the data to the caller's buffer @@ -2015,6 +2040,8 @@ ppp_dev_ioctl_stats (struct ppp *ppp, struct ifreq *ifr) return error; } +#endif /* PPP_COMPRESS */ + /* * Callback from the network layer to process the sockioctl functions. */ @@ -2032,6 +2059,12 @@ ppp_dev_ioctl (struct device *dev, struct ifreq *ifr, int cmd) error = ppp_dev_ioctl_stats (ppp, ifr); break; +#ifdef PPP_COMPRESS + case SIOCGPPPCSTATS: + error = ppp_dev_ioctl_cstats (ppp, ifr); + break; +#endif /* PPP_COMPRESS */ + case SIOCGPPPVER: error = ppp_dev_ioctl_version (ppp, ifr); break;