Skip to content

Commit

Permalink
tcplife: fix dport byte order (iovisor#1813)
Browse files Browse the repository at this point in the history
commit 95b3d8c fixed the dport filtering of the kprobes variant by
moving the network byte order to host byte order conversation before the
filtering. Before submitting the perf event the byte order of the dport
was again converted - this commit removes this double conversion.
  • Loading branch information
andreasgerstmayr authored and yonghong-song committed Jun 11, 2018
1 parent 7312cb6 commit 81de82c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tools/tcplife.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@
data4.daddr = sk->__sk_common.skc_daddr;
// a workaround until data4 compiles with separate lport/dport
data4.pid = pid;
data4.ports = ntohs(dport) + ((0ULL + lport) << 32);
data4.ports = dport + ((0ULL + lport) << 32);
if (mep == 0) {
bpf_get_current_comm(&data4.task, sizeof(data4.task));
} else {
Expand All @@ -219,7 +219,7 @@
bpf_probe_read(&data6.daddr, sizeof(data6.daddr),
sk->__sk_common.skc_v6_daddr.in6_u.u6_addr32);
// a workaround until data6 compiles with separate lport/dport
data6.ports = ntohs(dport) + ((0ULL + lport) << 32);
data6.ports = dport + ((0ULL + lport) << 32);
data6.pid = pid;
if (mep == 0) {
bpf_get_current_comm(&data6.task, sizeof(data6.task));
Expand Down

0 comments on commit 81de82c

Please sign in to comment.