From b691e282e0abe77034a3b2e86a807124571f3f05 Mon Sep 17 00:00:00 2001 From: thiagoftsm Date: Tue, 28 Jul 2020 17:22:46 +0000 Subject: [PATCH] fix_port: Fix the field read on kernel-collector (#174) Fix the field read to get sport. --- kernel/network_viewer_kern.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/network_viewer_kern.c b/kernel/network_viewer_kern.c index 83d4f6ff..e6c0dbf5 100644 --- a/kernel/network_viewer_kern.c +++ b/kernel/network_viewer_kern.c @@ -220,7 +220,8 @@ static __u16 set_idx_value(netdata_socket_idx_t *nsi, struct inet_sock *is) //Read destination port bpf_probe_read(&nsi->dport, sizeof(u16), &is->inet_dport); - bpf_probe_read(&nsi->sport, sizeof(u16), &is->inet_sport); + bpf_probe_read(&nsi->sport, sizeof(u16), &is->inet_num); + nsi->sport = ntohs(nsi->sport); return family; }