[packages/ppp] - struct ifpppstatsreq no longer there, replace by newer interfaces

arekm arekm at pld-linux.org
Sat Feb 16 23:31:29 CET 2013


commit baa04c370fc561343df2e8999fd1c861a1a5080c
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Sat Feb 16 23:31:26 2013 +0100

    - struct ifpppstatsreq no longer there, replace by newer interfaces

 ppp-ifpppstatsreq.patch | 140 ++++++++++++++++++++++++++++++++++++++++++++++++
 ppp.spec                |   2 +
 2 files changed, 142 insertions(+)
---
diff --git a/ppp.spec b/ppp.spec
index 8d5cf23..8c8b661 100644
--- a/ppp.spec
+++ b/ppp.spec
@@ -43,6 +43,7 @@ Patch9:		%{name}-lib64.patch
 Patch10:	%{name}-2.4.3-mppe-mppc-1.1.patch
 Patch11:	%{name}-llc.patch
 Patch12:	%{name}-llh.patch
+Patch13:	%{name}-ifpppstatsreq.patch 
 URL:		http://www.samba.org/ppp/
 BuildRequires:	autoconf
 BuildRequires:	automake
@@ -134,6 +135,7 @@ Wtyczka PPPoATM dla pppd.
 %patch10 -p1
 %patch11 -p1
 %patch12 -p1
+%patch13 -p1
 
 # use headers from llh instead of older supplied by ppp, incompatible with current llh
 %{__rm} include/linux/*.h
diff --git a/ppp-ifpppstatsreq.patch b/ppp-ifpppstatsreq.patch
new file mode 100644
index 0000000..d5a6281
--- /dev/null
+++ b/ppp-ifpppstatsreq.patch
@@ -0,0 +1,140 @@
+--- ppp-2.4.5/pppd/sys-linux.c~	2013-02-16 23:11:59.688775791 +0100
++++ ppp-2.4.5/pppd/sys-linux.c	2013-02-16 23:14:00.675182263 +0100
+@@ -1364,20 +1364,22 @@
+     int u;
+     struct pppd_stats *stats;
+ {
+-    struct ifpppstatsreq req;
++    struct ifreq req;
++    struct ppp_stats rstats;
+ 
+     memset (&req, 0, sizeof (req));
++    memset (&rstats, 0, sizeof (rstats));
+ 
+-    req.stats_ptr = (caddr_t) &req.stats;
+-    strlcpy(req.ifr__name, ifname, sizeof(req.ifr__name));
++    req.ifr_data = (caddr_t) &rstats;
++    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->bytes_in = req.stats.p.ppp_ibytes;
+-    stats->bytes_out = req.stats.p.ppp_obytes;
+-    stats->pkts_in = req.stats.p.ppp_ipackets;
+-    stats->pkts_out = req.stats.p.ppp_opackets;
++    stats->bytes_in = rstats.p.ppp_ibytes;
++    stats->bytes_out = rstats.p.ppp_obytes;
++    stats->pkts_in = rstats.p.ppp_ipackets;
++    stats->pkts_out = rstats.p.ppp_opackets;
+     return 1;
+ }
+ 
+--- ppp-2.4.5/pppstats/pppstats.c~	2013-02-16 23:15:47.231215213 +0100
++++ ppp-2.4.5/pppstats/pppstats.c	2013-02-16 23:17:58.624537526 +0100
+@@ -143,12 +143,14 @@
+ get_ppp_stats(curp)
+     struct ppp_stats *curp;
+ {
+-    struct ifpppstatsreq req;
++    struct ifreq req;
++    struct ppp_stats rstats; 
+ 
+     memset (&req, 0, sizeof (req));
++    memset (&rstats, 0, sizeof (rstats));
+ 
+ #ifdef __linux__
+-    req.stats_ptr = (caddr_t) &req.stats;
++    req.ifr_data = (caddr_t) &rstats;
+ #undef ifr_name
+ #define ifr_name ifr__name
+ #endif
+@@ -162,7 +164,7 @@
+ 	    perror("couldn't get PPP statistics");
+ 	exit(1);
+     }
+-    *curp = req.stats;
++    *curp = rstats;
+ }
+ 
+ static void
+--- ppp-2.4.5/pppstats/pppstats.c~	2013-02-16 23:20:18.148057503 +0100
++++ ppp-2.4.5/pppstats/pppstats.c	2013-02-16 23:20:27.984972162 +0100
+@@ -149,11 +149,7 @@
+     memset (&req, 0, sizeof (req));
+     memset (&rstats, 0, sizeof (rstats));
+ 
+-#ifdef __linux__
+     req.ifr_data = (caddr_t) &rstats;
+-#undef ifr_name
+-#define ifr_name ifr__name
+-#endif
+ 
+     strncpy(req.ifr_name, interface, sizeof(req.ifr_name));
+     if (ioctl(s, SIOCGPPPSTATS, &req) < 0) {
+--- ppp-2.4.5/pppstats/pppstats.c~	2013-02-16 23:20:49.762187752 +0100
++++ ppp-2.4.5/pppstats/pppstats.c	2013-02-16 23:23:53.923478616 +0100
+@@ -167,15 +167,13 @@
+ get_ppp_cstats(csp)
+     struct ppp_comp_stats *csp;
+ {
+-    struct ifpppcstatsreq creq;
++    struct ifreq creq;
++    struct ppp_comp_stats rstats;
+ 
+     memset (&creq, 0, sizeof (creq));
++    memset (&rstats, 0, sizeof (rstats));
+ 
+-#ifdef __linux__
+-    creq.stats_ptr = (caddr_t) &creq.stats;
+-#undef  ifr_name
+-#define ifr_name ifr__name
+-#endif
++    creq.ifr_data = (caddr_t) &rstats;
+ 
+     strncpy(creq.ifr_name, interface, sizeof(creq.ifr_name));
+     if (ioctl(s, SIOCGPPPCSTATS, &creq) < 0) {
+@@ -192,28 +190,28 @@
+     }
+ 
+ #ifdef __linux__
+-    if (creq.stats.c.bytes_out == 0) {
+-	creq.stats.c.bytes_out = creq.stats.c.comp_bytes + creq.stats.c.inc_bytes;
+-	creq.stats.c.in_count = creq.stats.c.unc_bytes;
++    if (rstats.c.bytes_out == 0) {
++	rstats.c.bytes_out = rstats.c.comp_bytes + rstats.c.inc_bytes;
++	rstats.c.in_count = rstats.c.unc_bytes;
+     }
+-    if (creq.stats.c.bytes_out == 0)
+-	creq.stats.c.ratio = 0.0;
++    if (rstats.c.bytes_out == 0)
++	rstats.c.ratio = 0.0;
+     else
+-	creq.stats.c.ratio = 256.0 * creq.stats.c.in_count /
+-			     creq.stats.c.bytes_out;
++	rstats.c.ratio = 256.0 * rstats.c.in_count /
++			     rstats.c.bytes_out;
+ 
+-    if (creq.stats.d.bytes_out == 0) {
+-	creq.stats.d.bytes_out = creq.stats.d.comp_bytes + creq.stats.d.inc_bytes;
+-	creq.stats.d.in_count = creq.stats.d.unc_bytes;
++    if (rstats.d.bytes_out == 0) {
++	rstats.d.bytes_out = rstats.d.comp_bytes + rstats.d.inc_bytes;
++	rstats.d.in_count = rstats.d.unc_bytes;
+     }
+-    if (creq.stats.d.bytes_out == 0)
+-	creq.stats.d.ratio = 0.0;
++    if (rstats.d.bytes_out == 0)
++	rstats.d.ratio = 0.0;
+     else
+-	creq.stats.d.ratio = 256.0 * creq.stats.d.in_count /
+-			     creq.stats.d.bytes_out;
++	rstats.d.ratio = 256.0 * rstats.d.in_count /
++			     rstats.d.bytes_out;
+ #endif
+ 
+-    *csp = creq.stats;
++    *csp = rstats;
+ }
+ 
+ #else	/* STREAMS */
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/ppp.git/commitdiff/baa04c370fc561343df2e8999fd1c861a1a5080c



More information about the pld-cvs-commit mailing list