PATCH: Accounting Gigawords
Gunter Burchardt
gbur
Wed Jul 14 00:07:35 PDT 2004
> I would prefer not to use long long in the driver for these counters.
> hostapd should be able to notice the roll over and have another variable
> for counting these. This would even match the RADIUS messages better,
> since the gigawords attribute seems to be this roll over counter.. No
> need to combine the numbers into a 64-bit counter anywhere in the driver
> or hostapd..
Ok - I did it this way.
> > + { RADIUS_ATTR_ACCT_OUTPUT_GIGAWORDS, "Acct-output-Gigawords",
> output -> Output (?)
fixed
regards
gunter
-------------- next part --------------
diff -Nur hostap.old/hostapd/accounting.c hostap/hostapd/accounting.c
--- hostap.old/hostapd/accounting.c 2004-06-17 06:28:44.000000000 +0200
+++ hostap/hostapd/accounting.c 2004-07-14 08:58:34.000000000 +0200
@@ -235,18 +235,42 @@
printf("Could not add Acct-Output-Packets\n");
goto fail;
}
+ if (sta->rx_bytes > data.rx_bytes)
+ sta->rx_gigawords++;
+ if (sta->tx_bytes > data.tx_bytes)
+ sta->tx_gigawords++;
+ sta->rx_bytes = data.rx_bytes;
+ sta->tx_bytes = data.tx_bytes;
if (!radius_msg_add_attr_int32(msg,
RADIUS_ATTR_ACCT_INPUT_OCTETS,
data.rx_bytes)) {
printf("Could not add Acct-Input-Octets\n");
goto fail;
}
+ if(sta->rx_gigawords)
+ {
+ if (!radius_msg_add_attr_int32(msg,
+ RADIUS_ATTR_ACCT_INPUT_GIGAWORDS,
+ sta->rx_gigawords)) {
+ printf("Could not add Acct-Input-Gigawords\n");
+ goto fail;
+ }
+ }
if (!radius_msg_add_attr_int32(msg,
RADIUS_ATTR_ACCT_OUTPUT_OCTETS,
data.tx_bytes)) {
printf("Could not add Acct-Output-Octets\n");
goto fail;
}
+ if(sta->tx_gigawords)
+ {
+ if (!radius_msg_add_attr_int32(msg,
+ RADIUS_ATTR_ACCT_OUTPUT_GIGAWORDS,
+ sta->tx_gigawords)) {
+ printf("Could not add Acct-Output-Gigawords\n");
+ goto fail;
+ }
+ }
}
if (eloop_terminated())
diff -Nur hostap.old/hostapd/ap.h hostap/hostapd/ap.h
--- hostap.old/hostapd/ap.h 2004-06-21 04:53:40.000000000 +0200
+++ hostap/hostapd/ap.h 2004-07-14 08:45:30.000000000 +0200
@@ -49,6 +49,11 @@
int acct_terminate_cause; /* Acct-Terminate-Cause */
int acct_interim_interval; /* Acct-Interim-Interval */
+ unsigned long rx_bytes;
+ unsigned long rx_gigawords;
+ unsigned long tx_bytes;
+ unsigned long tx_gigawords;
+
u8 *challenge; /* IEEE 802.11 Shared Key Authentication Challenge */
int pairwise; /* Pairwise cipher suite, WPA_CIPHER_* */
diff -Nur hostap.old/hostapd/radius.c hostap/hostapd/radius.c
--- hostap.old/hostapd/radius.c 2004-07-08 06:11:17.000000000 +0200
+++ hostap/hostapd/radius.c 2004-07-14 08:30:38.000000000 +0200
@@ -163,6 +163,10 @@
{ RADIUS_ATTR_ACCT_MULTI_SESSION_ID, "Acct-Multi-Session-Id",
RADIUS_ATTR_TEXT },
{ RADIUS_ATTR_ACCT_LINK_COUNT, "Acct-Link-Count", RADIUS_ATTR_INT32 },
+ { RADIUS_ATTR_ACCT_INPUT_GIGAWORDS, "Acct-Input-Gigawords",
+ RADIUS_ATTR_INT32 },
+ { RADIUS_ATTR_ACCT_OUTPUT_GIGAWORDS, "Acct-Output-Gigawords",
+ RADIUS_ATTR_INT32 },
{ RADIUS_ATTR_NAS_PORT_TYPE, "NAS-Port-Type", RADIUS_ATTR_INT32 },
{ RADIUS_ATTR_CONNECT_INFO, "Connect-Info", RADIUS_ATTR_TEXT },
{ RADIUS_ATTR_EAP_MESSAGE, "EAP-Message", RADIUS_ATTR_UNDIST },
diff -Nur hostap.old/hostapd/radius.h hostap/hostapd/radius.h
--- hostap.old/hostapd/radius.h 2004-07-08 06:11:17.000000000 +0200
+++ hostap/hostapd/radius.h 2004-07-14 08:32:38.000000000 +0200
@@ -56,6 +56,8 @@
RADIUS_ATTR_ACCT_TERMINATE_CAUSE = 49,
RADIUS_ATTR_ACCT_MULTI_SESSION_ID = 50,
RADIUS_ATTR_ACCT_LINK_COUNT = 51,
+ RADIUS_ATTR_ACCT_INPUT_GIGAWORDS=52,
+ RADIUS_ATTR_ACCT_OUTPUT_GIGAWORDS=53,
RADIUS_ATTR_NAS_PORT_TYPE = 61,
RADIUS_ATTR_CONNECT_INFO = 77,
RADIUS_ATTR_EAP_MESSAGE = 79,
More information about the Hostap
mailing list