diff --git a/src/Linux/mod_systemd.c b/src/Linux/mod_systemd.c index 429e706e..7157e95f 100644 --- a/src/Linux/mod_systemd.c +++ b/src/Linux/mod_systemd.c @@ -1152,7 +1152,7 @@ extern "C" { EVMod *mod = (EVMod *)magic; HSP_mod_SYSTEMD *mdata = (HSP_mod_SYSTEMD *)mod->data; char *protocol = NULL; - HSPListenSock search = { 0 }; + HSPListenSock search = { }; // use the seqNo as a "queryNo" to imply family and protocol since it does // not appear in the diag_msg sockid. switch(seqNo) { diff --git a/src/Linux/mod_tcp.c b/src/Linux/mod_tcp.c index b7446222..df7b11b2 100644 --- a/src/Linux/mod_tcp.c +++ b/src/Linux/mod_tcp.c @@ -134,28 +134,6 @@ extern "C" { return buf; } - /*_________________---------------------------__________________ - _________________ diag_sockid_print __________________ - -----------------___________________________------------------ - */ - - static char *diag_sockid_print(struct inet_diag_sockid *sockid) { - static char buf[256]; - snprintf(buf, 256, "%08x:%08x:%08x:%08x %u - %08x:%08x:%08x:%08x %u if:%u", - sockid->idiag_src[0], - sockid->idiag_src[1], - sockid->idiag_src[2], - sockid->idiag_src[3], - sockid->idiag_sport, - sockid->idiag_dst[0], - sockid->idiag_dst[1], - sockid->idiag_dst[2], - sockid->idiag_dst[3], - sockid->idiag_dport, - sockid->idiag_if); - return buf; - } - /*_________________---------------------------__________________ _________________ parse_diag_msg __________________ -----------------___________________________------------------ @@ -206,7 +184,7 @@ extern "C" { memcpy(&tcpi, RTA_DATA(attr), readLen); myDebug(1, "TCP diag: RTT=%uuS (variance=%uuS) [%s]", tcpi.tcpi_rtt, tcpi.tcpi_rttvar, - diag_sockid_print(&diag_msg->id)); + UTNLDiag_sockid_print(&diag_msg->id)); if(found) { myDebug(1, "found TCPSample: %s RTT:%uuS", tcpSamplePrint(found), tcpi.tcpi_rtt); HSPPendingSample *ps; diff --git a/src/Linux/util_netlink.c b/src/Linux/util_netlink.c index 24bb6469..59100f1d 100644 --- a/src/Linux/util_netlink.c +++ b/src/Linux/util_netlink.c @@ -8,6 +8,28 @@ extern "C" { #include "util_netlink.h" + /*_________________---------------------------__________________ + _________________ UTNLDiag_sockid_print __________________ + -----------------___________________________------------------ + */ + + char *UTNLDiag_sockid_print(struct inet_diag_sockid *sockid) { + static char buf[256]; + snprintf(buf, 256, "%08x:%08x:%08x:%08x %u - %08x:%08x:%08x:%08x %u if:%u", + sockid->idiag_src[0], + sockid->idiag_src[1], + sockid->idiag_src[2], + sockid->idiag_src[3], + sockid->idiag_sport, + sockid->idiag_dst[0], + sockid->idiag_dst[1], + sockid->idiag_dst[2], + sockid->idiag_dst[3], + sockid->idiag_dport, + sockid->idiag_if); + return buf; + } + /*_________________---------------------------__________________ _________________ UTNLDiag_send __________________ -----------------___________________________------------------ diff --git a/src/Linux/util_netlink.h b/src/Linux/util_netlink.h index 17b30b7c..2999120e 100644 --- a/src/Linux/util_netlink.h +++ b/src/Linux/util_netlink.h @@ -43,6 +43,8 @@ extern "C" { TCP_CLOSING } EnumKernelTCPState; + char *UTNLDiag_sockid_print(struct inet_diag_sockid *sockid); + int UTNLDiag_open(void); int UTNLDiag_send(int sockfd, void *req, int req_len, bool dump, uint32_t seqNo);