From: Vadim Kochan <[email protected]> It might be a case that local host is a dst peer and the process might be found by dst port.
Signed-off-by: Vadim Kochan <[email protected]> --- flowtop.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flowtop.c b/flowtop.c index 59da529..cdf1018 100644 --- a/flowtop.c +++ b/flowtop.c @@ -431,7 +431,7 @@ static void walk_processes(struct flow_entry *n) closedir(dir); } -static int get_port_inode(uint16_t port, int proto, int is_ip6) +static int get_port_inode(uint16_t sp, uint16_t dp, int proto, int is_ip6) { int ret = -ENOENT; char path[128], buff[1024]; @@ -454,7 +454,7 @@ static int get_port_inode(uint16_t port, int proto, int is_ip6) buff[sizeof(buff) - 1] = 0; if (sscanf(buff, "%*u: %*X:%X %*X:%*X %*X %*X:%*X %*X:%*X " "%*X %*u %*u %u", &lport, &inode) == 2) { - if ((uint16_t) lport == port) { + if ((uint16_t) lport == sp || (uint16_t) lport == dp) { ret = inode; break; } @@ -675,7 +675,7 @@ static void flow_entry_get_extended(struct flow_entry *n) flow_entry_get_extended_geo(n, flow_entry_dst); /* Lookup application */ - n->inode = get_port_inode(n->port_src, n->l4_proto, + n->inode = get_port_inode(n->port_src, n->port_dst, n->l4_proto, n->l3_proto == AF_INET6); if (n->inode > 0) walk_processes(n); -- 2.4.2 -- You received this message because you are subscribed to the Google Groups "netsniff-ng" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
