summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorwangmenglan <[email protected]>2023-07-13 15:24:50 +0800
committerwangmenglan <[email protected]>2023-07-13 17:52:29 +0800
commit1a7dba0b651506d0bab24e37834d087b7ace831f (patch)
treeb898a72cdcbe4a7de8b273322b62d50f81486f82 /common
parent23d05e7feebda452070780bec7c3db4114a97430 (diff)
🐞 fix(TSG-14170): Health Check support None
Diffstat (limited to 'common')
-rw-r--r--common/include/utils.h4
-rw-r--r--common/src/utils.cpp5
2 files changed, 5 insertions, 4 deletions
diff --git a/common/include/utils.h b/common/include/utils.h
index d0d6bcf..78a6edd 100644
--- a/common/include/utils.h
+++ b/common/include/utils.h
@@ -116,6 +116,10 @@ int get_ip_by_device_name(const char *dev_name, char *ip_buff);
int get_mac_by_device_name(const char *dev_name, char *mac_buff);
int str_to_mac(const char *str, char *mac_buff);
+#define CHECKSUM_CARRY(x) (x = (x >> 16) + (x & 0xffff), (~(x + (x >> 16)) & 0xffff))
+
+int checksum(uint16_t *addr, int len);
+
#ifdef __cpluscplus
}
#endif
diff --git a/common/src/utils.cpp b/common/src/utils.cpp
index 314cf45..6b0f0a7 100644
--- a/common/src/utils.cpp
+++ b/common/src/utils.cpp
@@ -156,10 +156,7 @@ void throughput_metrics_inc(struct throughput_metrics *iterm, uint64_t n_pkts, u
/******************************************************************************
* protocol
******************************************************************************/
-
-#define CHECKSUM_CARRY(x) (x = (x >> 16) + (x & 0xffff), (~(x + (x >> 16)) & 0xffff))
-
-static int checksum(uint16_t *addr, int len)
+int checksum(uint16_t *addr, int len)
{
int sum = 0;
int nleft = len;