Update of /cvsroot/leaf/src/bering-uclibc/apps/ppp
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv31078

Modified Files:
        buildtool.cfg buildtool.mk ppp-2.4.4-ipv4zones-0.1.1.patch 
Added Files:
        ppp-2.4.4-gigawords.patch 
Log Message:
added ppp-2.4.4-gigawords.patch
provided by NiTr0



Index: ppp-2.4.4-ipv4zones-0.1.1.patch
===================================================================
RCS file: 
/cvsroot/leaf/src/bering-uclibc/apps/ppp/ppp-2.4.4-ipv4zones-0.1.1.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ppp-2.4.4-ipv4zones-0.1.1.patch     28 Jan 2009 16:55:34 -0000      1.1
--- ppp-2.4.4-ipv4zones-0.1.1.patch     6 Aug 2009 21:15:02 -0000       1.2
***************
*** 1,3 ****
! diff -Naur --exclude='*.orig' ppp-2.4.4.orig/include/linux/ppp_defs.h 
ppp-2.4.4/include/linux/ppp_defs.h
  --- ppp-2.4.4.orig/include/linux/ppp_defs.h   2002-12-06 11:49:15.000000000 
+0200
  +++ ppp-2.4.4/include/linux/ppp_defs.h        2008-12-03 16:21:40.000000000 
+0200
--- 1,3 ----
! diff -Naur -x Makefile ppp-2.4.4.orig/include/linux/ppp_defs.h 
ppp-2.4.4/include/linux/ppp_defs.h
  --- ppp-2.4.4.orig/include/linux/ppp_defs.h   2002-12-06 11:49:15.000000000 
+0200
  +++ ppp-2.4.4/include/linux/ppp_defs.h        2008-12-03 16:21:40.000000000 
+0200
***************
*** 15,19 ****
   
   struct vjstat {
! diff -Naur --exclude='*.orig' ppp-2.4.4.orig/pppd/Makefile.linux 
ppp-2.4.4/pppd/Makefile.linux
  --- ppp-2.4.4.orig/pppd/Makefile.linux        2008-12-03 16:20:43.000000000 
+0200
  +++ ppp-2.4.4/pppd/Makefile.linux     2008-12-03 16:21:40.000000000 +0200
--- 15,47 ----
   
   struct vjstat {
! diff -Naur -x Makefile ppp-2.4.4.orig/pppd/ipcp.c ppp-2.4.4/pppd/ipcp.c
! --- ppp-2.4.4.orig/pppd/ipcp.c        2005-08-26 02:59:34.000000000 +0300
! +++ ppp-2.4.4/pppd/ipcp.c     2009-05-28 18:46:51.000000000 +0300
! @@ -1834,12 +1834,14 @@
!       if (go->dnsaddr[1])
!           notice("secondary DNS address %I", go->dnsaddr[1]);
!      }
! -
! +    notice("Resetting link stats...");
!      reset_link_stats(f->unit);
! -
! +    
! +    notice("Calling np_up...");
!      np_up(f->unit, PPP_IP);
!      ipcp_is_up = 1;
!  
! +    notice("ip_up_notifier...");
!      notify(ip_up_notifier, 0);
!      if (ip_up_hook)
!       ip_up_hook();
! @@ -1848,6 +1850,7 @@
!       * Execute the ip-up script, like this:
!       *       /etc/ppp/ip-up interface tty speed local-IP remote-IP
!       */
! +    notice("Calling ifup...");
!      if (ipcp_script_state == s_down && ipcp_script_pid == 0) {
!       ipcp_script_state = s_up;
!       ipcp_script(_PATH_IPUP, 0);
! diff -Naur -x Makefile ppp-2.4.4.orig/pppd/Makefile.linux 
ppp-2.4.4/pppd/Makefile.linux
  --- ppp-2.4.4.orig/pppd/Makefile.linux        2008-12-03 16:20:43.000000000 
+0200
  +++ ppp-2.4.4/pppd/Makefile.linux     2008-12-03 16:21:40.000000000 +0200
***************
*** 37,41 ****
   # EAP SRP-SHA1
   ifdef USE_SRP
! diff -Naur --exclude='*.orig' 
ppp-2.4.4.orig/pppd/plugins/radius/etc/dictionary 
ppp-2.4.4/pppd/plugins/radius/etc/dictionary
  --- ppp-2.4.4.orig/pppd/plugins/radius/etc/dictionary 2002-11-09 
13:24:42.000000000 +0200
  +++ ppp-2.4.4/pppd/plugins/radius/etc/dictionary      2008-12-03 
16:22:29.000000000 +0200
--- 65,69 ----
   # EAP SRP-SHA1
   ifdef USE_SRP
! diff -Naur -x Makefile ppp-2.4.4.orig/pppd/plugins/radius/etc/dictionary 
ppp-2.4.4/pppd/plugins/radius/etc/dictionary
  --- ppp-2.4.4.orig/pppd/plugins/radius/etc/dictionary 2002-11-09 
13:24:42.000000000 +0200
  +++ ppp-2.4.4/pppd/plugins/radius/etc/dictionary      2008-12-03 
16:22:29.000000000 +0200
***************
*** 45,49 ****
   INCLUDE /etc/radiusclient/dictionary.microsoft
  +INCLUDE /etc/radiusclient/dictionary.pppd
! diff -Naur --exclude='*.orig' 
ppp-2.4.4.orig/pppd/plugins/radius/etc/dictionary.pppd 
ppp-2.4.4/pppd/plugins/radius/etc/dictionary.pppd
  --- ppp-2.4.4.orig/pppd/plugins/radius/etc/dictionary.pppd    1970-01-01 
03:00:00.000000000 +0300
  +++ ppp-2.4.4/pppd/plugins/radius/etc/dictionary.pppd 2008-12-03 
16:21:40.000000000 +0200
--- 73,77 ----
   INCLUDE /etc/radiusclient/dictionary.microsoft
  +INCLUDE /etc/radiusclient/dictionary.pppd
! diff -Naur -x Makefile ppp-2.4.4.orig/pppd/plugins/radius/etc/dictionary.pppd 
ppp-2.4.4/pppd/plugins/radius/etc/dictionary.pppd
  --- ppp-2.4.4.orig/pppd/plugins/radius/etc/dictionary.pppd    1970-01-01 
03:00:00.000000000 +0300
  +++ ppp-2.4.4/pppd/plugins/radius/etc/dictionary.pppd 2008-12-03 
16:21:40.000000000 +0200
***************
*** 71,75 ****
  +ATTRIBUTE    PPPD-Input-Packets-Zones-3      244     integer PPPD
  +ATTRIBUTE    PPPD-Output-Packets-Zones-3     245     integer PPPD
! diff -Naur --exclude='*.orig' 
ppp-2.4.4.orig/pppd/plugins/radius/Makefile.linux 
ppp-2.4.4/pppd/plugins/radius/Makefile.linux
  --- ppp-2.4.4.orig/pppd/plugins/radius/Makefile.linux 2006-06-04 
08:04:14.000000000 +0300
  +++ ppp-2.4.4/pppd/plugins/radius/Makefile.linux      2008-12-03 
16:21:40.000000000 +0200
--- 99,103 ----
  +ATTRIBUTE    PPPD-Input-Packets-Zones-3      244     integer PPPD
  +ATTRIBUTE    PPPD-Output-Packets-Zones-3     245     integer PPPD
! diff -Naur -x Makefile ppp-2.4.4.orig/pppd/plugins/radius/Makefile.linux 
ppp-2.4.4/pppd/plugins/radius/Makefile.linux
  --- ppp-2.4.4.orig/pppd/plugins/radius/Makefile.linux 2006-06-04 
08:04:14.000000000 +0300
  +++ ppp-2.4.4/pppd/plugins/radius/Makefile.linux      2008-12-03 
16:21:40.000000000 +0200
***************
*** 93,97 ****
   all: $(PLUGIN)
   
! diff -Naur --exclude='*.orig' ppp-2.4.4.orig/pppd/plugins/radius/radius.c 
ppp-2.4.4/pppd/plugins/radius/radius.c
  --- ppp-2.4.4.orig/pppd/plugins/radius/radius.c       2006-05-22 
03:01:40.000000000 +0300
  +++ ppp-2.4.4/pppd/plugins/radius/radius.c    2008-12-03 16:21:40.000000000 
+0200
--- 121,125 ----
   all: $(PLUGIN)
   
! diff -Naur -x Makefile ppp-2.4.4.orig/pppd/plugins/radius/radius.c 
ppp-2.4.4/pppd/plugins/radius/radius.c
  --- ppp-2.4.4.orig/pppd/plugins/radius/radius.c       2006-05-22 
03:01:40.000000000 +0300
  +++ ppp-2.4.4/pppd/plugins/radius/radius.c    2008-12-03 16:21:40.000000000 
+0200
***************
*** 148,152 ****
   
       if (*remote_number) {
! diff -Naur --exclude='*.orig' 
ppp-2.4.4.orig/pppd/plugins/radius/radiusclient.h 
ppp-2.4.4/pppd/plugins/radius/radiusclient.h
  --- ppp-2.4.4.orig/pppd/plugins/radius/radiusclient.h 2004-11-14 
09:26:26.000000000 +0200
  +++ ppp-2.4.4/pppd/plugins/radius/radiusclient.h      2008-12-03 
16:21:40.000000000 +0200
--- 176,180 ----
   
       if (*remote_number) {
! diff -Naur -x Makefile ppp-2.4.4.orig/pppd/plugins/radius/radiusclient.h 
ppp-2.4.4/pppd/plugins/radius/radiusclient.h
  --- ppp-2.4.4.orig/pppd/plugins/radius/radiusclient.h 2004-11-14 
09:26:26.000000000 +0200
  +++ ppp-2.4.4/pppd/plugins/radius/radiusclient.h      2008-12-03 
16:21:40.000000000 +0200
***************
*** 173,177 ****
   /* Server data structures */
   
! diff -Naur --exclude='*.orig' ppp-2.4.4.orig/pppd/pppd.h ppp-2.4.4/pppd/pppd.h
  --- ppp-2.4.4.orig/pppd/pppd.h        2008-12-03 16:20:43.000000000 +0200
  +++ ppp-2.4.4/pppd/pppd.h     2008-12-03 16:21:40.000000000 +0200
--- 201,205 ----
   /* Server data structures */
   
! diff -Naur -x Makefile ppp-2.4.4.orig/pppd/pppd.h ppp-2.4.4/pppd/pppd.h
  --- ppp-2.4.4.orig/pppd/pppd.h        2008-12-03 16:20:43.000000000 +0200
  +++ ppp-2.4.4/pppd/pppd.h     2008-12-03 16:21:40.000000000 +0200
***************
*** 189,193 ****
   
   /* Used for storing a sequence of words.  Usually malloced. */
! diff -Naur --exclude='*.orig' ppp-2.4.4.orig/pppd/sys-linux.c 
ppp-2.4.4/pppd/sys-linux.c
  --- ppp-2.4.4.orig/pppd/sys-linux.c   2005-08-27 01:44:35.000000000 +0300
  +++ ppp-2.4.4/pppd/sys-linux.c        2008-12-03 16:21:40.000000000 +0200
--- 217,221 ----
   
   /* Used for storing a sequence of words.  Usually malloced. */
! diff -Naur -x Makefile ppp-2.4.4.orig/pppd/sys-linux.c 
ppp-2.4.4/pppd/sys-linux.c
  --- ppp-2.4.4.orig/pppd/sys-linux.c   2005-08-27 01:44:35.000000000 +0300
  +++ ppp-2.4.4/pppd/sys-linux.c        2008-12-03 16:21:40.000000000 +0200

--- NEW FILE: ppp-2.4.4-gigawords.patch ---
diff -Npru ppp-2.4.4/pppd/main.c ppp-2.4.4-new/pppd/main.c
--- ppp-2.4.4/pppd/main.c       2006-06-04 06:52:50.000000000 +0300
+++ ppp-2.4.4-new/pppd/main.c   2009-05-28 22:05:53.000000000 +0300
@@ -1246,9 +1246,9 @@ update_link_stats(u)
 
     slprintf(numbuf, sizeof(numbuf), "%u", link_connect_time);
     script_setenv("CONNECT_TIME", numbuf, 0);
-    slprintf(numbuf, sizeof(numbuf), "%u", link_stats.bytes_out);
+    snprintf(numbuf, sizeof(numbuf), "%llu", link_stats.bytes_out);
     script_setenv("BYTES_SENT", numbuf, 0);
-    slprintf(numbuf, sizeof(numbuf), "%u", link_stats.bytes_in);
+    snprintf(numbuf, sizeof(numbuf), "%llu", link_stats.bytes_in);
     script_setenv("BYTES_RCVD", numbuf, 0);
 }
 
diff -Npru ppp-2.4.4/pppd/plugins/radius/avpair.c 
ppp-2.4.4-new/pppd/plugins/radius/avpair.c
--- ppp-2.4.4/pppd/plugins/radius/avpair.c      2004-11-14 09:26:26.000000000 
+0200
+++ ppp-2.4.4-new/pppd/plugins/radius/avpair.c  2009-05-28 22:06:03.000000000 
+0300
@@ -291,9 +291,19 @@ static void rc_extract_vendor_specific_a
     /* Set attrlen to length of data */
     attrlen -= 4;
     for (; attrlen; attrlen -= vlen+2, ptr += vlen) {
-       vtype = *ptr++;
-       vlen = *ptr++;
-       vlen -= 2;
+
+       if ( vendor_id == VENDOR_USR ) {
+               vlen = attrlen - 4;
+               vtype = (ptr[0] << 24) | (ptr[1] << 16) | (ptr[2] << 8) | 
ptr[3];
+               ptr += 4;
+               /* fixup */ 
+               attrlen -= 2;
+       } else {
+               vtype = *ptr++;
+               vlen = *ptr++;
+               vlen -= 2;
+       }
+
        if (vlen < 0 || vlen > attrlen - 2) {
            /* Do not log an error.  We are supposed to be able to cope with
               arbitrary vendor-specific gunk */
diff -Npru ppp-2.4.4/pppd/plugins/radius/etc/dictionary 
ppp-2.4.4-new/pppd/plugins/radius/etc/dictionary
--- ppp-2.4.4/pppd/plugins/radius/etc/dictionary        2008-12-03 
16:22:29.000000000 +0200
+++ ppp-2.4.4-new/pppd/plugins/radius/etc/dictionary    2009-05-28 
22:06:03.000000000 +0300
@@ -81,6 +81,8 @@ ATTRIBUTE     Acct-Authentic          45      integer
 ATTRIBUTE      Acct-Session-Time       46      integer
 ATTRIBUTE      Acct-Input-Packets      47      integer
 ATTRIBUTE      Acct-Output-Packets     48      integer
+ATTRIBUTE      Acct-Input-Gigawords    52      integer
+ATTRIBUTE      Acct-Output-Gigawords   53      integer
 ATTRIBUTE      Acct-Terminate-Cause    49      integer
 ATTRIBUTE       Chap-Challenge          60      string
 ATTRIBUTE      NAS-Port-Type           61      integer
diff -Npru ppp-2.4.4/pppd/plugins/radius/radius.c 
ppp-2.4.4-new/pppd/plugins/radius/radius.c
--- ppp-2.4.4/pppd/plugins/radius/radius.c      2008-12-03 16:21:40.000000000 
+0200
+++ ppp-2.4.4-new/pppd/plugins/radius/radius.c  2009-05-28 22:06:03.000000000 
+0300
@@ -963,18 +963,44 @@ radius_acct_stop(void)
 
 
     if (link_stats_valid) {
+       DICT_ATTR*      attr;
+       static char     bigint[64];
+
        av_type = link_connect_time;
        rc_avpair_add(&send, PW_ACCT_SESSION_TIME, &av_type, 0, VENDOR_NONE);
 
-       av_type = link_stats.bytes_out;
+       if ( (attr=rc_dict_findattr("Acct-Output-Octets-64")) ) {
+               snprintf(bigint,sizeof(bigint),"%llu",link_stats.bytes_out);
+               rc_avpair_add(&send,attr->value,bigint,0,attr->vendorcode);
+       }
+       av_type = (UINT4)link_stats.bytes_out;
        rc_avpair_add(&send, PW_ACCT_OUTPUT_OCTETS, &av_type, 0, VENDOR_NONE);
 
-       av_type = link_stats.bytes_in;
+       av_type = (UINT4)(link_stats.bytes_out >> 32);
+       rc_avpair_add(&send, PW_ACCT_OUTPUT_GIGAWORDS, &av_type, 0, 
VENDOR_NONE);
+         
+       if ( (attr=rc_dict_findattr("Acct-Input-Octets-64")) ) {
+               snprintf(bigint,sizeof(bigint),"%llu",link_stats.bytes_in);
+               rc_avpair_add(&send,attr->value,bigint,0,attr->vendorcode);
+       }
+       av_type = (UINT4)link_stats.bytes_in;
        rc_avpair_add(&send, PW_ACCT_INPUT_OCTETS, &av_type, 0, VENDOR_NONE);
 
+       av_type = (UINT4)(link_stats.bytes_in >> 32);
+        rc_avpair_add(&send, PW_ACCT_INPUT_GIGAWORDS, &av_type, 0, 
VENDOR_NONE);
+  
+        if ( (attr=rc_dict_findattr("Acct-Output-Packets-64")) ) {
+               snprintf(bigint,sizeof(bigint),"%llu",link_stats.pkts_out);
+               rc_avpair_add(&send,attr->value,bigint,0,attr->vendorcode);
+        }
+
        av_type = link_stats.pkts_out;
        rc_avpair_add(&send, PW_ACCT_OUTPUT_PACKETS, &av_type, 0, VENDOR_NONE);
-
+ 
+        if ( (attr=rc_dict_findattr("Acct-Input-Packets-64")) ) {
+                snprintf(bigint,sizeof(bigint),"%llu",link_stats.pkts_in);
+                rc_avpair_add(&send,attr->value,bigint,0,attr->vendorcode);
+        }
        av_type = link_stats.pkts_in;
        rc_avpair_add(&send, PW_ACCT_INPUT_PACKETS, &av_type, 0, VENDOR_NONE);
 
@@ -1128,20 +1154,45 @@ radius_acct_interim(void *ignored)
     update_link_stats(0);
 
     if (link_stats_valid) {
+       DICT_ATTR*      attr;
+       static char     bigint[64];
+ 
        link_stats_valid = 0; /* Force later code to update */
 
        av_type = link_connect_time;
        rc_avpair_add(&send, PW_ACCT_SESSION_TIME, &av_type, 0, VENDOR_NONE);
 
-       av_type = link_stats.bytes_out;
+       if ( (attr=rc_dict_findattr("Acct-Output-Octets-64")) ) {
+               snprintf(bigint,sizeof(bigint),"%llu",link_stats.bytes_out);
+               rc_avpair_add(&send,attr->value,bigint,0,attr->vendorcode);
+       }
+       av_type = (UINT4)link_stats.bytes_out;
        rc_avpair_add(&send, PW_ACCT_OUTPUT_OCTETS, &av_type, 0, VENDOR_NONE);
 
-       av_type = link_stats.bytes_in;
+       av_type = (UINT4)(link_stats.bytes_out >> 32);
+       rc_avpair_add(&send, PW_ACCT_OUTPUT_GIGAWORDS, &av_type, 0, 
VENDOR_NONE);
+         
+       if ( (attr=rc_dict_findattr("Acct-Input-Octets-64")) ) {
+               snprintf(bigint,sizeof(bigint),"%llu",link_stats.bytes_in);
+               rc_avpair_add(&send,attr->value,bigint,0,attr->vendorcode);
+       }
+       av_type = (UINT4)link_stats.bytes_in;
        rc_avpair_add(&send, PW_ACCT_INPUT_OCTETS, &av_type, 0, VENDOR_NONE);
 
+       av_type = (UINT4)(link_stats.bytes_in >> 32);
+       rc_avpair_add(&send, PW_ACCT_INPUT_GIGAWORDS, &av_type, 0, VENDOR_NONE);
+         
+       if ( (attr=rc_dict_findattr("Acct-Output-Packets-64")) ) {
+               snprintf(bigint,sizeof(bigint),"%llu",link_stats.pkts_out);
+               rc_avpair_add(&send,attr->value,bigint,0,attr->vendorcode);
+       }
        av_type = link_stats.pkts_out;
        rc_avpair_add(&send, PW_ACCT_OUTPUT_PACKETS, &av_type, 0, VENDOR_NONE);
 
+       if ( (attr=rc_dict_findattr("Acct-Input-Packets-64")) ) {
+               snprintf(bigint,sizeof(bigint),"%llu",link_stats.pkts_in);
+               rc_avpair_add(&send,attr->value,bigint,0,attr->vendorcode);
+       }
        av_type = link_stats.pkts_in;
        rc_avpair_add(&send, PW_ACCT_INPUT_PACKETS, &av_type, 0, VENDOR_NONE);
 
diff -Npru ppp-2.4.4/pppd/plugins/radius/radiusclient.h 
ppp-2.4.4-new/pppd/plugins/radius/radiusclient.h
--- ppp-2.4.4/pppd/plugins/radius/radiusclient.h        2008-12-03 
16:21:40.000000000 +0200
+++ ppp-2.4.4-new/pppd/plugins/radius/radiusclient.h    2009-05-28 
22:08:29.000000000 +0300
@@ -167,6 +167,8 @@ typedef struct pw_auth_hdr
 #define PW_ACCT_TERMINATE_CAUSE                49      /* integer */
 #define PW_ACCT_MULTI_SESSION_ID       50      /* string */
 #define PW_ACCT_LINK_COUNT             51      /* integer */
+#define PW_ACCT_INPUT_GIGAWORDS         52      /* integer */
+#define PW_ACCT_OUTPUT_GIGAWORDS        53      /* integer */
 
 /* From RFC 2869 */
 #define PW_ACCT_INTERIM_INTERVAL        85     /* integer */
@@ -300,6 +302,7 @@ typedef struct pw_auth_hdr
 #define VENDOR_NONE     (-1)
 #define VENDOR_MICROSOFT       311
 #define VENDOR_PPPD    1979
+#define VENDOR_USR     429
 
 /* Server data structures */
 
diff -Npru ppp-2.4.4/pppd/plugins/radius/sendserver.c 
ppp-2.4.4-new/pppd/plugins/radius/sendserver.c
--- ppp-2.4.4/pppd/plugins/radius/sendserver.c  2004-11-14 09:26:26.000000000 
+0200
+++ ppp-2.4.4-new/pppd/plugins/radius/sendserver.c      2009-05-28 
22:06:03.000000000 +0300
@@ -56,6 +56,14 @@ static int rc_pack_list (VALUE_PAIR *vp,
                *buf++ = (((unsigned int) vp->vendorcode) >> 8) & 255;
                *buf++ = ((unsigned int) vp->vendorcode) & 255;
 
+               /* Stolen from freeradius's source, that USR vendor
+               /* attributes are to handled otherwise */
+               if ( vp->vendorcode == VENDOR_USR ) {
+                       *buf++ = (vp->attribute >> 24) & 0xff;
+                       *buf++ = (vp->attribute >> 16) & 0xff;
+                       *buf++ = (vp->attribute >> 8) & 0xff;
+               }
+
                /* Insert vendor-type */
                *buf++ = vp->attribute;
 
@@ -64,7 +72,8 @@ static int rc_pack_list (VALUE_PAIR *vp,
                case PW_TYPE_STRING:
                    length = vp->lvalue;
                    *lenptr = length + 8;
-                   *buf++ = length+2;
+                   if ( vp->vendorcode != VENDOR_USR )
+                       *buf++ = length+2;
                    memcpy(buf, vp->strvalue, (size_t) length);
                    buf += length;
                    total_length += length+8;
@@ -73,7 +82,8 @@ static int rc_pack_list (VALUE_PAIR *vp,
                case PW_TYPE_IPADDR:
                    length = sizeof(UINT4);
                    *lenptr = length + 8;
-                   *buf++ = length+2;
+                   if ( vp->vendorcode != VENDOR_USR )
+                       *buf++ = length+2;
                    lvalue = htonl(vp->lvalue);
                    memcpy(buf, (char *) &lvalue, sizeof(UINT4));
                    buf += length;
@@ -82,6 +92,10 @@ static int rc_pack_list (VALUE_PAIR *vp,
                default:
                    break;
                }
+               if ( vp->vendorcode == VENDOR_USR ) {
+                       *lenptr += 2;
+                       total_length += 2;
+               }
            } else {
                *buf++ = vp->attribute;
                switch (vp->attribute) {
diff -Npru ppp-2.4.4/pppd/pppd.h ppp-2.4.4-new/pppd/pppd.h
--- ppp-2.4.4/pppd/pppd.h       2008-12-03 16:21:40.000000000 +0200
+++ ppp-2.4.4-new/pppd/pppd.h   2009-05-28 22:10:36.000000000 +0300
@@ -170,10 +170,10 @@ struct permitted_ip {
  * pppd needs.
  */
 struct pppd_stats {
-    unsigned int       bytes_in;
-    unsigned int       bytes_out;
-    unsigned int       pkts_in;
-    unsigned int       pkts_out;
+    unsigned long long bytes_in;
+    unsigned long long bytes_out;
+    unsigned long long pkts_in;
+    unsigned long long pkts_out;
 #ifdef CONFIG_PPP_IPV4ZONES
     unsigned int       pkts_out_zones[CONFIG_PPP_IPV4ZONES_COUNT];
     unsigned int       pkts_in_zones[CONFIG_PPP_IPV4ZONES_COUNT]; 
diff -Npru ppp-2.4.4/pppd/sys-linux.c ppp-2.4.4-new/pppd/sys-linux.c
--- ppp-2.4.4/pppd/sys-linux.c  2008-12-03 16:21:40.000000000 +0200
+++ ppp-2.4.4-new/pppd/sys-linux.c      2009-05-28 22:19:09.000000000 +0300
@@ -1332,6 +1332,10 @@ get_idle_time(u, ip)
  *
  * get_ppp_stats - return statistics for the link.
  */
+
+static struct ifpppstatsreq prev_stat_req;
+static struct pppd_stats static_stats;
+
 int
 get_ppp_stats(u, stats)
     int u;
@@ -1351,6 +1355,20 @@ get_ppp_stats(u, stats)
     stats->bytes_out = req.stats.p.ppp_obytes;
     stats->pkts_in = req.stats.p.ppp_ipackets;
     stats->pkts_out = req.stats.p.ppp_opackets;
+    // Calculate the elapsed bytes since the last query
+    static_stats.bytes_in +=
+        (req.stats.p.ppp_ibytes - prev_stat_req.stats.p.ppp_ibytes);
+    static_stats.bytes_out +=
+        (req.stats.p.ppp_obytes - prev_stat_req.stats.p.ppp_obytes);
+    static_stats.pkts_in +=
+        (req.stats.p.ppp_ipackets - prev_stat_req.stats.p.ppp_ipackets);
+    static_stats.pkts_out +=
+        (req.stats.p.ppp_opackets - prev_stat_req.stats.p.ppp_opackets);
+    // Store the current state
+    memcpy(&prev_stat_req,&req,sizeof(prev_stat_req));
+
+    // Give out the statistics
+    memcpy(stats,&static_stats,sizeof(static_stats));
 #ifdef CONFIG_PPP_IPV4ZONES
     memcpy(stats->pkts_out_zones, &req.stats.p.ppp_opackets_zones, 
sizeof(stats->pkts_out_zones));
     memcpy(stats->pkts_in_zones, &req.stats.p.ppp_ipackets_zones, 
sizeof(stats->pkts_in_zones));
@@ -2242,6 +2260,10 @@ int sifup(int u)
 {
     struct ifreq ifr;
 
+    // Initialize the 'previous stats struct'
+    memset(&prev_stat_req,0,sizeof(prev_stat_req));
+    // And the static statistics puffer
+    memset(&static_stats,0,sizeof(static_stats));
     memset (&ifr, '\0', sizeof (ifr));
     strlcpy(ifr.ifr_name, ifname, sizeof (ifr.ifr_name));
     if (ioctl(sock_fd, SIOCGIFFLAGS, (caddr_t) &ifr) < 0) {

Index: buildtool.cfg
===================================================================
RCS file: /cvsroot/leaf/src/bering-uclibc/apps/ppp/buildtool.cfg,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** buildtool.cfg       4 Feb 2009 08:22:48 -0000       1.17
--- buildtool.cfg       6 Aug 2009 21:15:02 -0000       1.18
***************
*** 1,4 ****
  <File buildtool.mk>
!   Server = cvs-sourceforge
    Revision = HEAD
    Directory = ppp
--- 1,4 ----
  <File buildtool.mk>
!   Server = local
    Revision = HEAD
    Directory = ppp
***************
*** 54,61 ****
  
  <File  ppp-2.4.4-ipv4zones-0.1.1.patch>
!    Server = cvs-sourceforge
!    Revision = HEAD
!    envname = PPP_PATCH6
!    Directory = ppp
  </File>
  
--- 54,68 ----
  
  <File  ppp-2.4.4-ipv4zones-0.1.1.patch>
!   Server = cvs-sourceforge
!   Revision = HEAD
!   envname = PPP_PATCH6
!   Directory = ppp
! </File>
! 
! <File  ppp-2.4.4-gigawords.patch>
!   Server = cvs-sourceforge
!   Revision = HEAD
!   envname = PPP_PATCH7
!   Directory = ppp
  </File>
  
***************
*** 141,145 ****
        <ppp>
                Version = 2.4.4
!               Revision = 4
  
                Help <<EOF
--- 148,152 ----
        <ppp>
                Version = 2.4.4
!               Revision = 5
  
                Help <<EOF
***************
*** 176,180 ****
  
                Version = 2.4.4
!               Revision = 4
  
                Help <<EOF
--- 183,187 ----
  
                Version = 2.4.4
!               Revision = 5
  
                Help <<EOF
***************
*** 210,214 ****
        <pppoe>
                Version = 2.4.4
!               Revision = 2
  
                Help <<EOF
--- 217,221 ----
        <pppoe>
                Version = 2.4.4
!               Revision = 5
  
                Help <<EOF
***************
*** 253,257 ****
        <pppoatm>
                Version = 2.4.4
!               Revision = 2
  
                Help <<EOF
--- 260,264 ----
        <pppoatm>
                Version = 2.4.4
!               Revision = 5
  
                Help <<EOF
***************
*** 296,300 ****
        <ppp-rad>
                Version = 2.4.4
!               Revision = 2
  
                Help <<EOF
--- 303,307 ----
        <ppp-rad>
                Version = 2.4.4
!               Revision = 5
  
                Help <<EOF
***************
*** 361,365 ****
        <pppol2tp>
                Version = 0.13
!               Revision = 1
  
                Help <<EOF
--- 368,372 ----
        <pppol2tp>
                Version = 0.13
!               Revision = 5
  
                Help <<EOF

Index: buildtool.mk
===================================================================
RCS file: /cvsroot/leaf/src/bering-uclibc/apps/ppp/buildtool.mk,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** buildtool.mk        28 Jan 2009 16:55:34 -0000      1.14
--- buildtool.mk        6 Aug 2009 21:15:02 -0000       1.15
***************
*** 11,16 ****
        cat $(PPP_PATCH3) | patch -d $(PPP_DIR) -p1
        cat $(PPP_PATCH4) | patch -d $(PPP_DIR) -p1
-       cat $(PPP_PATCH6) | patch -d $(PPP_DIR) -p1
        zcat $(PPP_PATCH5) | patch -d $(PPP_DIR) -p1
        touch $(PPP_DIR)/.source
  
--- 11,17 ----
        cat $(PPP_PATCH3) | patch -d $(PPP_DIR) -p1
        cat $(PPP_PATCH4) | patch -d $(PPP_DIR) -p1
        zcat $(PPP_PATCH5) | patch -d $(PPP_DIR) -p1
+       cat $(PPP_PATCH6) | patch -d $(PPP_DIR) -p1
+       cat $(PPP_PATCH7) | patch -d $(PPP_DIR) -p1
        touch $(PPP_DIR)/.source
  
***************
*** 62,65 ****
--- 63,67 ----
        cp -a $(PPP_DIR)/pppd/plugins/radius/etc/dictionary 
$(PPP_TARGET_DIR)/etc/radiusclient
        cp -a $(PPP_DIR)/pppd/plugins/radius/etc/dictionary.microsoft 
$(PPP_TARGET_DIR)/etc/radiusclient
+       cp -a $(PPP_DIR)/pppd/plugins/radius/etc/dictionary.pppd 
$(PPP_TARGET_DIR)/etc/radiusclient
        cp -a $(PPP_DIR)/pppd/plugins/radius/etc/servers 
$(PPP_TARGET_DIR)/etc/radiusclient
        cp -a $(PPP_DIR)/pppd/plugins/radius/etc/port-id-map 
$(PPP_TARGET_DIR)/etc/radiusclient


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
leaf-cvs-commits mailing list
leaf-cvs-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/leaf-cvs-commits

Reply via email to