Module: kamailio Branch: master Commit: adfce1129913eb45c7c2d5854ce4b611b9b2e0e8 URL: https://github.com/kamailio/kamailio/commit/adfce1129913eb45c7c2d5854ce4b611...
Author: Alexandr Dubovikov alexandr.dubovikov@gmail.com Committer: GitHub noreply@github.com Date: 2016-07-07T12:57:19+02:00
Merge pull request #698 from sjthomason/sipcapture-timestamp-fix
Sipcapture timestamp fix
---
Modified: modules/sipcapture/hep.c Modified: modules/sipcapture/hep.h Modified: modules/siptrace/siptrace.c
---
Diff: https://github.com/kamailio/kamailio/commit/adfce1129913eb45c7c2d5854ce4b611... Patch: https://github.com/kamailio/kamailio/commit/adfce1129913eb45c7c2d5854ce4b611...
---
diff --git a/modules/sipcapture/hep.c b/modules/sipcapture/hep.c index 3114f2c..1ca2904 100644 --- a/modules/sipcapture/hep.c +++ b/modules/sipcapture/hep.c @@ -176,8 +176,8 @@ int hepv2_received(char *buf, unsigned int len, struct receive_info *ri){ hep_offset+=sizeof(struct hep_timehdr); heptime_tmp = (struct hep_timehdr*) hep_payload;
- heptime->tv_sec = heptime_tmp->tv_sec; - heptime->tv_usec = heptime_tmp->tv_usec; + heptime->tv_sec = to_le(heptime_tmp->tv_sec); + heptime->tv_usec = to_le(heptime_tmp->tv_usec); heptime->captid = heptime_tmp->captid; }
diff --git a/modules/sipcapture/hep.h b/modules/sipcapture/hep.h index c2433db..3135b6b 100644 --- a/modules/sipcapture/hep.h +++ b/modules/sipcapture/hep.h @@ -24,6 +24,13 @@ #ifndef _hep_h #define _hep_h
+#include "../../endianness.h" + +#ifdef __IS_BIG_ENDIAN +#define to_le(x) bswap32(x) +#else +#define to_le(x) (x) +#endif
#ifdef __OS_solaris typedef uint8_t u_int8_t; diff --git a/modules/siptrace/siptrace.c b/modules/siptrace/siptrace.c index 4594e25..078f1a9 100644 --- a/modules/siptrace/siptrace.c +++ b/modules/siptrace/siptrace.c @@ -1799,8 +1799,8 @@ static int trace_send_hep_duplicate(str *body, str *from, str *to, struct dest_i
if(hep_version == 2) {
- hep_time.tv_sec = tvb.tv_sec; - hep_time.tv_usec = tvb.tv_usec; + hep_time.tv_sec = to_le(tvb.tv_sec); + hep_time.tv_usec = to_le(tvb.tv_usec); hep_time.captid = hep_capture_id;
memcpy((void*)buffer+buflen, &hep_time, sizeof(struct hep_timehdr));