Mercurial > hg > freeDiameter-dtls
changeset 1073:54d1cb00331a
Use float type to solve /0 issue
author | Sebastien Decugis <sdecugis@freediameter.net> |
---|---|
date | Thu, 02 May 2013 12:59:58 +0800 |
parents | 018a573b05f0 |
children | fcdcb562fea8 |
files | extensions/app_diameap/diameap_eap.c extensions/app_diameap/diameap_plugins.c extensions/app_diameap/libdiameap.h extensions/dbg_monitor/dbg_monitor.c |
diffstat | 4 files changed, 11 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/extensions/app_diameap/diameap_eap.c Thu May 02 12:20:30 2013 +0800 +++ b/extensions/app_diameap/diameap_eap.c Thu May 02 12:59:58 2013 +0800 @@ -372,7 +372,7 @@ case EAP_INTEGRITY_CHECK: if ((*eap_sm->selectedMethod->eap_method_check)(eap_sm, - eap_i->aaaEapRespData) == FALSE) + &eap_i->aaaEapRespData) == FALSE) { TRACE_DEBUG(INFO,"%s[EAP Protocol] Invalid EAP packet received {Type=%d, Vendor=%d}. Integrity check failed (non fatal error).",DIAMEAP_EXTENSION,eap_sm->currentMethod,eap_sm->currentVendor); //non_fata_error @@ -433,7 +433,7 @@ } } if ((*eap_sm->selectedMethod->eap_method_process)(eap_sm, - eap_i->aaaEapRespData)) + &eap_i->aaaEapRespData)) { TRACE_DEBUG(INFO,"%s[EAP Protocol] [%s plugin] Authentication process failed.",DIAMEAP_EXTENSION,eap_sm->selectedMethod->methodname); *non_fatal_error = TRUE;
--- a/extensions/app_diameap/diameap_plugins.c Thu May 02 12:20:30 2013 +0800 +++ b/extensions/app_diameap/diameap_plugins.c Thu May 02 12:59:58 2013 +0800 @@ -262,7 +262,7 @@ if (registerplugin->check) { plugin->eap_method_check = (boolean(*)(struct eap_state_machine *, - struct eap_packet)) dlsym(plugin->handler, + struct eap_packet*)) dlsym(plugin->handler, registerplugin->check); if (plugin->eap_method_check == NULL) { @@ -284,7 +284,7 @@ if (registerplugin->process) { plugin->eap_method_process = (int(*)(struct eap_state_machine *, - struct eap_packet)) dlsym(plugin->handler, + struct eap_packet*)) dlsym(plugin->handler, registerplugin->process); if (plugin->eap_method_process == NULL) {
--- a/extensions/app_diameap/libdiameap.h Thu May 02 12:20:30 2013 +0800 +++ b/extensions/app_diameap/libdiameap.h Thu May 02 12:59:58 2013 +0800 @@ -109,9 +109,9 @@ u8 identifier,struct eap_packet * eapPacket); /* address of the eap_method_buildReq method */ int (*eap_method_getTimeout)(struct eap_state_machine *smd, int * timeout); /* address of the eap_method_getTimeout method */ boolean (*eap_method_check)(struct eap_state_machine *smd, - struct eap_packet eapRespData); /* address of the eap_method_check method */ + struct eap_packet * eapRespData); /* address of the eap_method_check method */ int (*eap_method_process)(struct eap_state_machine *smd, - struct eap_packet eapRespData); /* address of the eap_method_process method */ + struct eap_packet * eapRespData); /* address of the eap_method_process method */ boolean (*eap_method_isDone)(struct eap_state_machine *smd); /* address of the eap_method_isDone method */ int (*eap_method_getKey)(struct eap_state_machine *smd, u8 ** msk,int *msklength, u8 ** emsk,int *emsklength); /* address of the eap_method_getKey method */
--- a/extensions/dbg_monitor/dbg_monitor.c Thu May 02 12:20:30 2013 +0800 +++ b/extensions/dbg_monitor/dbg_monitor.c Thu May 02 12:59:58 2013 +0800 @@ -55,14 +55,16 @@ static void display_info(char * queue_desc, char * peer, int current_count, int limit_count, int highest_count, long long total_count, struct timespec * total, struct timespec * blocking, struct timespec * last) { - long long throughput = (total_count * 1000000000) / ((total->tv_sec * 1000000000) + total->tv_nsec); + long long ms = (total->tv_sec * 1000000) + (total->tv_nsec / 1000); + long double throughput = (long double)total_count * 1000000; + throughput /= ms; if (peer) { - TRACE_DEBUG(INFO, "'%s'@'%s': cur:%d/%d, h:%d, T:%lld in %ld.%06lds (%llditems/s), blocked:%ld.%06lds, last processing:%ld.%06lds", + TRACE_DEBUG(INFO, "'%s'@'%s': cur:%d/%d, h:%d, T:%lld in %ld.%06lds (%.2LFitems/s), blocked:%ld.%06lds, last processing:%ld.%06lds", queue_desc, peer, current_count, limit_count, highest_count, total_count, total->tv_sec, total->tv_nsec, throughput, blocking->tv_sec, blocking->tv_nsec, last->tv_sec, last->tv_nsec); } else { - TRACE_DEBUG(INFO, "Global '%s': cur:%d/%d, h:%d, T:%lld in %ld.%06lds (%llditems/s), blocked:%ld.%06lds, last processing:%ld.%06lds", + TRACE_DEBUG(INFO, "Global '%s': cur:%d/%d, h:%d, T:%lld in %ld.%06lds (%.2LFitems/s), blocked:%ld.%06lds, last processing:%ld.%06lds", queue_desc, current_count, limit_count, highest_count, total_count, total->tv_sec, total->tv_nsec, throughput, blocking->tv_sec, blocking->tv_nsec, last->tv_sec, last->tv_nsec);