]>
Commit | Line | Data |
---|---|---|
baa04c37 AM |
1 | --- ppp-2.4.5/pppd/sys-linux.c~ 2013-02-16 23:11:59.688775791 +0100 |
2 | +++ ppp-2.4.5/pppd/sys-linux.c 2013-02-16 23:14:00.675182263 +0100 | |
3 | @@ -1364,20 +1364,22 @@ | |
4 | int u; | |
5 | struct pppd_stats *stats; | |
6 | { | |
7 | - struct ifpppstatsreq req; | |
8 | + struct ifreq req; | |
9 | + struct ppp_stats rstats; | |
10 | ||
11 | memset (&req, 0, sizeof (req)); | |
12 | + memset (&rstats, 0, sizeof (rstats)); | |
13 | ||
14 | - req.stats_ptr = (caddr_t) &req.stats; | |
15 | - strlcpy(req.ifr__name, ifname, sizeof(req.ifr__name)); | |
16 | + req.ifr_data = (caddr_t) &rstats; | |
17 | + strlcpy(req.ifr_name, ifname, sizeof(req.ifr_name)); | |
18 | if (ioctl(sock_fd, SIOCGPPPSTATS, &req) < 0) { | |
19 | error("Couldn't get PPP statistics: %m"); | |
20 | return 0; | |
21 | } | |
22 | - stats->bytes_in = req.stats.p.ppp_ibytes; | |
23 | - stats->bytes_out = req.stats.p.ppp_obytes; | |
24 | - stats->pkts_in = req.stats.p.ppp_ipackets; | |
25 | - stats->pkts_out = req.stats.p.ppp_opackets; | |
26 | + stats->bytes_in = rstats.p.ppp_ibytes; | |
27 | + stats->bytes_out = rstats.p.ppp_obytes; | |
28 | + stats->pkts_in = rstats.p.ppp_ipackets; | |
29 | + stats->pkts_out = rstats.p.ppp_opackets; | |
30 | return 1; | |
31 | } | |
32 | ||
33 | --- ppp-2.4.5/pppstats/pppstats.c~ 2013-02-16 23:15:47.231215213 +0100 | |
34 | +++ ppp-2.4.5/pppstats/pppstats.c 2013-02-16 23:17:58.624537526 +0100 | |
35 | @@ -143,12 +143,14 @@ | |
36 | get_ppp_stats(curp) | |
37 | struct ppp_stats *curp; | |
38 | { | |
39 | - struct ifpppstatsreq req; | |
40 | + struct ifreq req; | |
41 | + struct ppp_stats rstats; | |
42 | ||
43 | memset (&req, 0, sizeof (req)); | |
44 | + memset (&rstats, 0, sizeof (rstats)); | |
45 | ||
46 | #ifdef __linux__ | |
47 | - req.stats_ptr = (caddr_t) &req.stats; | |
48 | + req.ifr_data = (caddr_t) &rstats; | |
49 | #undef ifr_name | |
50 | #define ifr_name ifr__name | |
51 | #endif | |
52 | @@ -162,7 +164,7 @@ | |
53 | perror("couldn't get PPP statistics"); | |
54 | exit(1); | |
55 | } | |
56 | - *curp = req.stats; | |
57 | + *curp = rstats; | |
58 | } | |
59 | ||
60 | static void | |
61 | --- ppp-2.4.5/pppstats/pppstats.c~ 2013-02-16 23:20:18.148057503 +0100 | |
62 | +++ ppp-2.4.5/pppstats/pppstats.c 2013-02-16 23:20:27.984972162 +0100 | |
63 | @@ -149,11 +149,7 @@ | |
64 | memset (&req, 0, sizeof (req)); | |
65 | memset (&rstats, 0, sizeof (rstats)); | |
66 | ||
67 | -#ifdef __linux__ | |
68 | req.ifr_data = (caddr_t) &rstats; | |
69 | -#undef ifr_name | |
70 | -#define ifr_name ifr__name | |
71 | -#endif | |
72 | ||
73 | strncpy(req.ifr_name, interface, sizeof(req.ifr_name)); | |
74 | if (ioctl(s, SIOCGPPPSTATS, &req) < 0) { | |
75 | --- ppp-2.4.5/pppstats/pppstats.c~ 2013-02-16 23:20:49.762187752 +0100 | |
76 | +++ ppp-2.4.5/pppstats/pppstats.c 2013-02-16 23:23:53.923478616 +0100 | |
77 | @@ -167,15 +167,13 @@ | |
78 | get_ppp_cstats(csp) | |
79 | struct ppp_comp_stats *csp; | |
80 | { | |
81 | - struct ifpppcstatsreq creq; | |
82 | + struct ifreq creq; | |
83 | + struct ppp_comp_stats rstats; | |
84 | ||
85 | memset (&creq, 0, sizeof (creq)); | |
86 | + memset (&rstats, 0, sizeof (rstats)); | |
87 | ||
88 | -#ifdef __linux__ | |
89 | - creq.stats_ptr = (caddr_t) &creq.stats; | |
90 | -#undef ifr_name | |
91 | -#define ifr_name ifr__name | |
92 | -#endif | |
93 | + creq.ifr_data = (caddr_t) &rstats; | |
94 | ||
95 | strncpy(creq.ifr_name, interface, sizeof(creq.ifr_name)); | |
96 | if (ioctl(s, SIOCGPPPCSTATS, &creq) < 0) { | |
97 | @@ -192,28 +190,28 @@ | |
98 | } | |
99 | ||
100 | #ifdef __linux__ | |
101 | - if (creq.stats.c.bytes_out == 0) { | |
102 | - creq.stats.c.bytes_out = creq.stats.c.comp_bytes + creq.stats.c.inc_bytes; | |
103 | - creq.stats.c.in_count = creq.stats.c.unc_bytes; | |
104 | + if (rstats.c.bytes_out == 0) { | |
105 | + rstats.c.bytes_out = rstats.c.comp_bytes + rstats.c.inc_bytes; | |
106 | + rstats.c.in_count = rstats.c.unc_bytes; | |
107 | } | |
108 | - if (creq.stats.c.bytes_out == 0) | |
109 | - creq.stats.c.ratio = 0.0; | |
110 | + if (rstats.c.bytes_out == 0) | |
111 | + rstats.c.ratio = 0.0; | |
112 | else | |
113 | - creq.stats.c.ratio = 256.0 * creq.stats.c.in_count / | |
114 | - creq.stats.c.bytes_out; | |
115 | + rstats.c.ratio = 256.0 * rstats.c.in_count / | |
116 | + rstats.c.bytes_out; | |
117 | ||
118 | - if (creq.stats.d.bytes_out == 0) { | |
119 | - creq.stats.d.bytes_out = creq.stats.d.comp_bytes + creq.stats.d.inc_bytes; | |
120 | - creq.stats.d.in_count = creq.stats.d.unc_bytes; | |
121 | + if (rstats.d.bytes_out == 0) { | |
122 | + rstats.d.bytes_out = rstats.d.comp_bytes + rstats.d.inc_bytes; | |
123 | + rstats.d.in_count = rstats.d.unc_bytes; | |
124 | } | |
125 | - if (creq.stats.d.bytes_out == 0) | |
126 | - creq.stats.d.ratio = 0.0; | |
127 | + if (rstats.d.bytes_out == 0) | |
128 | + rstats.d.ratio = 0.0; | |
129 | else | |
130 | - creq.stats.d.ratio = 256.0 * creq.stats.d.in_count / | |
131 | - creq.stats.d.bytes_out; | |
132 | + rstats.d.ratio = 256.0 * rstats.d.in_count / | |
133 | + rstats.d.bytes_out; | |
134 | #endif | |
135 | ||
136 | - *csp = creq.stats; | |
137 | + *csp = rstats; | |
138 | } | |
139 | ||
140 | #else /* STREAMS */ |