From patchwork Sun Jan 24 11:38:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Lowe X-Patchwork-Id: 572235 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2001:1868:205::9]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41EC2140BED for ; Sun, 24 Jan 2016 22:39:12 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=lugatech-com.20150623.gappssmtp.com header.i=@lugatech-com.20150623.gappssmtp.com header.b=QLWlHqUq; dkim-atps=neutral Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1aNJ0a-00050i-Pj; Sun, 24 Jan 2016 11:39:04 +0000 Received: from mail-wm0-x233.google.com ([2a00:1450:400c:c09::233]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aNJ0Y-0004sJ-8y for hostap@lists.infradead.org; Sun, 24 Jan 2016 11:39:02 +0000 Received: by mail-wm0-x233.google.com with SMTP id u188so34329695wmu.1 for ; Sun, 24 Jan 2016 03:38:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lugatech-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=sLr+MadY9/tdPhHoibPwmVwcS6R2bVdDRz6cLVvXAhc=; b=QLWlHqUqwMLbvQkSl97WqznqxK1/AUDVFBP6Io21gdRm1C/FHgsXhdfoxETCjRnNjW Kl5HYQUgqQDjiDB8F7zIdfyd7KN6NOcf3dY9Wy74nYoox7iBI2Ti6b3Qon+Qn5LFo166 0/E66eQhuB/GQ9ZBUGkvNOA/JVFiHQeQe/KgagtReKuS81KaOY/zz+5sU121c2K+u62O YYhiVBodMUe8YuA+L9dGc/i1XHjHhMc7jlDKP5/QE6FYx+zjmWfR5+bom7OF8/EqMlLe fNzw+vLb9b++5HiIRW4gw8/tA2lk2qwETng8gAnl6U33LzNVBgu8KqEBsyza59glfGHd hB6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=sLr+MadY9/tdPhHoibPwmVwcS6R2bVdDRz6cLVvXAhc=; b=XX5XS5sbw4bUZpEaE1VsbGAH6HjM7U8TAQZbE3TyLZQc/wl1+gdr2PAv6whzIXrp/L E/ngVj6UvTNmmvJkkETWLYlSImbD4/psm/kk0/XATr00XzCctQWNulfvIHgJLtDzjWDR xyzdpUSkpnz3+Tw8BcBLUPSs5zNz8+VJNyfyHPOcp7EtsmghUYkZC6r7E+7AdTEvy2Xo DLTQhhZDfkVVu+mvmJUfeAfVpXrbgcm0slg6Ag7KO/JvLiuvOMFq0ePZ58TZlhxKvmXR muJsm/hysc2jHG+QUBIvtd/NKWBB1FJlKSr5csnUZkyw+0uYvPt0VK8GlWaq5U0VqYqE APrg== X-Gm-Message-State: AG10YOSgpSD+irkdr0hNlG/oxhmXTMGlJE9FbwHe9vlbVwENgtmJeknMlVweCbrhjJJIF94v+Ez5HjGvlYSOPw== MIME-Version: 1.0 X-Received: by 10.28.211.136 with SMTP id k130mr13278003wmg.84.1453635520798; Sun, 24 Jan 2016 03:38:40 -0800 (PST) Received: by 10.28.104.133 with HTTP; Sun, 24 Jan 2016 03:38:40 -0800 (PST) X-Originating-IP: [77.96.75.177] In-Reply-To: References: Date: Sun, 24 Jan 2016 11:38:40 +0000 Message-ID: Subject: Re: [PATCH] Event-Timestamp should be sent for all Accounting-Request packets From: Nick Lowe To: hostap@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160124_033902_470620_E47ED1D3 X-CRM114-Status: GOOD ( 13.24 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2a00:1450:400c:c09:0:0:0:233 listed in] [list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Attached without the whitespace broken... From 4084657ef56246294f043855255e1479a5ca9f92 Mon Sep 17 00:00:00 2001 From: Nick Lowe Date: Sun, 24 Jan 2016 10:45:29 +0000 Subject: [PATCH 3/3] Event-Timestamp should be sent for all Accounting-Request packets and only after the system clock has a sane value, not where there's a value close to the Unix time epoch. Signed-off-by: Nick Lowe --- src/ap/accounting.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/ap/accounting.c b/src/ap/accounting.c index e585b78..09cd431 100644 --- a/src/ap/accounting.c +++ b/src/ap/accounting.c @@ -41,6 +41,7 @@ static struct radius_msg * accounting_msg(struct hostapd_data *hapd, size_t len; int i; struct wpabuf *b; + struct os_time now; msg = radius_msg_new(RADIUS_CODE_ACCOUNTING_REQUEST, radius_client_get_id(hapd->radius)); @@ -157,6 +158,15 @@ static struct radius_msg * accounting_msg(struct hostapd_data *hapd, } } + os_get_time(&now); + if (now.sec > 1000000000) { + if (!radius_msg_add_attr_int32(msg, RADIUS_ATTR_EVENT_TIMESTAMP, + now.sec)) { + wpa_printf(MSG_INFO, "Could not add Event-Timestamp"); + goto fail; + } + } + return msg; fail: @@ -259,7 +269,6 @@ static void accounting_sta_report(struct hostapd_data *hapd, int cause = sta->acct_terminate_cause; struct hostap_sta_driver_data data; struct os_reltime now_r, diff; - struct os_time now; u32 gigawords; if (!hapd->conf->radius->acct_server) @@ -274,7 +283,6 @@ static void accounting_sta_report(struct hostapd_data *hapd, } os_get_reltime(&now_r); - os_get_time(&now); os_reltime_sub(&now_r, &sta->acct_session_start, &diff); if (!radius_msg_add_attr_int32(msg, RADIUS_ATTR_ACCT_SESSION_TIME, diff.sec)) { @@ -331,12 +339,6 @@ static void accounting_sta_report(struct hostapd_data *hapd, } } - if (!radius_msg_add_attr_int32(msg, RADIUS_ATTR_EVENT_TIMESTAMP, - now.sec)) { - wpa_printf(MSG_INFO, "Could not add Event-Timestamp"); - goto fail; - } - if (eloop_terminated()) cause = RADIUS_ACCT_TERMINATE_CAUSE_ADMIN_REBOOT; -- 2.5.0