From owner-freebsd-bugs@FreeBSD.ORG Mon Jan 12 23:30:26 2004 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E7BC516A4CE for ; Mon, 12 Jan 2004 23:30:25 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id A197243D2D for ; Mon, 12 Jan 2004 23:30:18 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) i0D7UIFR030423 for ; Mon, 12 Jan 2004 23:30:18 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.10/8.12.10/Submit) id i0D7UIT1030419; Mon, 12 Jan 2004 23:30:18 -0800 (PST) (envelope-from gnats) Resent-Date: Mon, 12 Jan 2004 23:30:18 -0800 (PST) Resent-Message-Id: <200401130730.i0D7UIT1030419@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, boris@tagnet.ru Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3912016A4CE for ; Mon, 12 Jan 2004 23:25:58 -0800 (PST) Received: from ns.palladant.ru (c2950post-fe-0-6.tagnet.ru [80.78.104.38]) by mx1.FreeBSD.org (Postfix) with ESMTP id A6B3F43D53 for ; Mon, 12 Jan 2004 23:25:56 -0800 (PST) (envelope-from root@ns.palladant.ru) Received: from root by ns.palladant.ru with local (Exim 4.24; FreeBSD) id 1AgIvy-0006Ph-J7 for FreeBSD-gnats-submit@freebsd.org; Tue, 13 Jan 2004 12:25:54 +0500 Message-Id: Date: Tue, 13 Jan 2004 12:25:54 +0500 From: boris@tagnet.ru To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: bin/61294: [patch] PPP sends incorrect data to RADIUS where OctetsIn or OctetsOut are going over UINT32_MAX X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: boris@tagnet.ru List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Jan 2004 07:30:26 -0000 >Number: 61294 >Category: bin >Synopsis: [patch] PPP sends incorrect data to RADIUS where OctetsIn or OctetsOut are going over UINT32_MAX >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Jan 12 23:30:18 PST 2004 >Closed-Date: >Last-Modified: >Originator: Boris Kovalenko >Release: FreeBSD 5.1-RELEASE-p10 i386 >Organization: JSC Tagnet >Environment: System: FreeBSD ns.palladant.ru 5.1-RELEASE-p10 FreeBSD 5.1-RELEASE-p10 #3: Thu Nov 20 09:50:51 YEKT 2003 root@ns.palladant.ru:/usr/src/sys/i386/compile/PALLADA i386 >Description: When RADIUS is enabled in PPP it send its accounting data to RADIUS. OctetsIn and OctetsOut are defined as unsigned long long (UINT64) values, but RADIUS allows only UINT32 values, so we are loosing information when values goes over UINT32_MAX limit. RFC2869 defines two new RADIUS attributes Acct-Input-Gigawords and Acct-Output-Gigawords to tell the RADIUS how many times Acct-Input-Octets and Acct-Output-Octets has wrapped around UINT32_MAX. So we need to put this attributes in RADIUS request and also modify OctetsIn and OctetsOut as needed. >How-To-Repeat: Try to download more then 4G with PPP connection. This is really possible if use PPPoE. >Fix: Patches attached. --- radlib.h.diff begins here --- --- radlib.h.orig Tue Jan 13 09:01:15 2004 +++ radlib.h Tue Jan 13 11:29:44 2004 @@ -168,6 +168,9 @@ #define RAD_TERM_HOST_REQUEST 18 #define RAD_ACCT_MULTI_SESSION_ID 50 /* String */ #define RAD_ACCT_LINK_COUNT 51 /* Integer */ +/* RFC 2869 */ +#define RAD_ACCT_INPUT_GIGAWORDS 52 +#define RAD_ACCT_OUTPUT_GIGAWORDS 53 struct rad_handle; struct timeval; --- radlib.h.diff ends here --- --- radius.c.diff begins here --- --- radius.c.orig Sat Jun 28 21:37:04 2003 +++ radius.c Tue Jan 13 11:40:37 2004 @@ -27,6 +27,7 @@ * */ +#include #include #include @@ -1144,9 +1145,11 @@ if (acct_type == RAD_STOP) /* Show some statistics */ - if (rad_put_int(r->cx.rad, RAD_ACCT_INPUT_OCTETS, stats->OctetsIn) != 0 || + if (rad_put_int(r->cx.rad, RAD_ACCT_INPUT_OCTETS, stats->OctetsIn % UINT32_MAX) != 0 || rad_put_int(r->cx.rad, RAD_ACCT_INPUT_PACKETS, stats->PacketsIn) != 0 || - rad_put_int(r->cx.rad, RAD_ACCT_OUTPUT_OCTETS, stats->OctetsOut) != 0 || + rad_put_int(r->cx.rad, RAD_ACCT_OUTPUT_OCTETS, stats->OctetsOut % UINT32_MAX) != 0 || + rad_put_int(r->cx.rad, RAD_ACCT_INPUT_GIGAWORDS, stats->OctetsIn / UINT32_MAX) != 0 || + rad_put_int(r->cx.rad, RAD_ACCT_OUTPUT_GIGAWORDS, stats->OctetsOut / UINT32_MAX) != 0 || rad_put_int(r->cx.rad, RAD_ACCT_OUTPUT_PACKETS, stats->PacketsOut) != 0 || rad_put_int(r->cx.rad, RAD_ACCT_SESSION_TIME, throughput_uptime(stats)) --- radius.c.diff ends here --- >Release-Note: >Audit-Trail: >Unformatted: