]> git.ozlabs.org Git - ppp.git/blobdiff - pppd/sys-linux.c
remove a couple of ansi-C-isms.
[ppp.git] / pppd / sys-linux.c
index 3a5890aac284d4c18aab89d18ffb51edfa541f1a..a7fd168b0e8e06ec1b05e831cde69cb769e8d5bf 100644 (file)
@@ -964,6 +964,29 @@ get_idle_time(u, ip)
     return ioctl(ppp_fd, PPPIOCGIDLE, ip) >= 0;
 } 
 
+/********************************************************************
+ *
+ * get_ppp_stats - return statistics for the link.
+ */
+int
+get_ppp_stats(u, stats)
+    int u;
+    struct ppp_stats *stats;
+{
+    struct ifpppstatsreq req;
+
+    memset (&req, 0, sizeof (req));
+
+    req.stats_ptr = (caddr_t) &req.stats;
+    strlcpy(req.ifr__name, ifname, sizeof(req.ifr__name));
+    if (ioctl(sock_fd, SIOCGPPPSTATS, &req) < 0) {
+       error("Couldn't get PPP statistics: %m");
+       return 0;
+    }
+    *stats = req.stats;
+    return 1;
+} 
+
 /********************************************************************
  *
  * ccp_fatal_error - returns 1 if decompression was disabled as a