diff --git a/bin/nfstat.c b/bin/nfstat.c index 4d9d886..9fd99e8 100644 --- a/bin/nfstat.c +++ b/bin/nfstat.c @@ -1,4 +1,5 @@ /* + * Copyright (c) 2017, Peter Haag * Copyright (c) 2014, Peter Haag * Copyright (c) 2009, Peter Haag * Copyright (c) 2004-2008, SWITCH - Teleinformatikdienste fuer Lehre und Forschung @@ -28,12 +29,6 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - * $Author: haag $ - * - * $Id: nfstat.c 69 2010-09-09 07:17:43Z haag $ - * - * $LastChangedRevision: 69 $ - * */ #include "config.h" @@ -1139,9 +1134,10 @@ struct tm *tbuff; case IS_IPADDR: tag_string[0] = tag ? TAG_CHAR : '\0'; if ( (StatData->record_flags & 0x1) != 0 ) { // IPv6 - StatData->stat_key[0] = htonll(StatData->stat_key[0]); - StatData->stat_key[1] = htonll(StatData->stat_key[1]); - inet_ntop(AF_INET6, StatData->stat_key, valstr, sizeof(valstr)); + uint64_t _key[2]; + _key[0] = htonll(StatData->stat_key[0]); + _key[1] = htonll(StatData->stat_key[1]); + inet_ntop(AF_INET6, _key, valstr, sizeof(valstr)); if ( ! Getv6Mode() ) condense_v6(valstr); @@ -1269,27 +1265,29 @@ struct tm *tbuff; static void PrintPipeStatLine(StatRecord_t *StatData, int type, int order_proto, int tag, int inout) { double duration; -uint64_t count_flows, count_packets, count_bytes; +uint64_t count_flows, count_packets, count_bytes, _key[2]; uint32_t pps, bps, bpp; uint32_t sa[4]; int af; sa[0] = sa[1] = sa[2] = sa[3] = 0; af = AF_UNSPEC; + _key[0] = StatData->stat_key[0]; + _key[1] = StatData->stat_key[1]; if ( type == IS_IPADDR ) { if ( (StatData->record_flags & 0x1) != 0 ) { // IPv6 - StatData->stat_key[0] = htonll(StatData->stat_key[0]); - StatData->stat_key[1] = htonll(StatData->stat_key[1]); + _key[0] = htonll(StatData->stat_key[0]); + _key[1] = htonll(StatData->stat_key[1]); af = PF_INET6; } else { // IPv4 af = PF_INET; } // Make sure Endian does not screw us up - sa[0] = ( StatData->stat_key[0] >> 32 ) & 0xffffffffLL; - sa[1] = StatData->stat_key[0] & 0xffffffffLL; - sa[2] = ( StatData->stat_key[1] >> 32 ) & 0xffffffffLL; - sa[3] = StatData->stat_key[1] & 0xffffffffLL; + sa[0] = ( _key[0] >> 32 ) & 0xffffffffLL; + sa[1] = _key[0] & 0xffffffffLL; + sa[2] = ( _key[1] >> 32 ) & 0xffffffffLL; + sa[3] = _key[1] & 0xffffffffLL; } duration = StatData->last - StatData->first; duration += ((double)StatData->msec_last - (double)StatData->msec_first) / 1000.0; @@ -1322,7 +1320,7 @@ int af; else printf("%i|%u|%u|%u|%u|%u|%llu|%llu|%llu|%llu|%u|%u|%u\n", af, StatData->first, StatData->msec_first ,StatData->last, StatData->msec_last, StatData->prot, - (long long unsigned)StatData->stat_key[1], (long long unsigned)count_flows, + (long long unsigned)_key[1], (long long unsigned)count_flows, (long long unsigned)count_packets, (long long unsigned)count_bytes, pps, bps, bpp); @@ -1345,9 +1343,10 @@ struct tm *tbuff; break; case IS_IPADDR: if ( (StatData->record_flags & 0x1) != 0 ) { // IPv6 - StatData->stat_key[0] = htonll(StatData->stat_key[0]); - StatData->stat_key[1] = htonll(StatData->stat_key[1]); - inet_ntop(AF_INET6, StatData->stat_key, valstr, sizeof(valstr)); + uint64_t _key[2]; + _key[0] = htonll(StatData->stat_key[0]); + _key[1] = htonll(StatData->stat_key[1]); + inet_ntop(AF_INET6, _key, valstr, sizeof(valstr)); } else { // IPv4 uint32_t ipv4; diff --git a/bin/nfstat.h b/bin/nfstat.h index 9b687a5..29e96c2 100644 --- a/bin/nfstat.h +++ b/bin/nfstat.h @@ -1,4 +1,5 @@ /* + * Copyright (c) 2017, Peter Haag * Copyright (c) 2014, Peter Haag * Copyright (c) 2009, Peter Haag * Copyright (c) 2004-2008, SWITCH - Teleinformatikdienste fuer Lehre und Forschung @@ -28,12 +29,6 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - * $Author: haag $ - * - * $Id: nfstat.h 39 2009-11-25 08:11:15Z haag $ - * - * $LastChangedRevision: 39 $ - * */ #ifndef _NFSTAT_H