Commit 10f3f22c authored by yonghong-song's avatar yonghong-song Committed by GitHub

Merge pull request #1447 from yadutaf/fix-solisten

solisten.py maintenance
parents a3bfe09c 6e2eaf86
...@@ -46,10 +46,12 @@ parser.add_argument("-n", "--netns", default=0, type=int, ...@@ -46,10 +46,12 @@ parser.add_argument("-n", "--netns", default=0, type=int,
# BPF Program # BPF Program
bpf_text = """ bpf_text = """
#include <net/sock.h>
#include <net/inet_sock.h>
#include <net/net_namespace.h> #include <net/net_namespace.h>
#include <bcc/proto.h> #include <bcc/proto.h>
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wenum-conversion"
#include <net/inet_sock.h>
#pragma clang diagnostic pop
// Common structure for UDP/TCP IPv4/IPv6 // Common structure for UDP/TCP IPv4/IPv6
struct listen_evt_t { struct listen_evt_t {
...@@ -106,7 +108,6 @@ int kprobe__inet_listen(struct pt_regs *ctx, struct socket *sock, int backlog) ...@@ -106,7 +108,6 @@ int kprobe__inet_listen(struct pt_regs *ctx, struct socket *sock, int backlog)
// Get IP // Get IP
if (family == AF_INET) { if (family == AF_INET) {
evt.laddr[0] = inet->inet_rcv_saddr; evt.laddr[0] = inet->inet_rcv_saddr;
evt.laddr[0] = be32_to_cpu(evt.laddr[0]);
} else if (family == AF_INET6) { } else if (family == AF_INET6) {
bpf_probe_read(evt.laddr, sizeof(evt.laddr), bpf_probe_read(evt.laddr, sizeof(evt.laddr),
sk->__sk_common.skc_v6_rcv_saddr.in6_u.u6_addr32); sk->__sk_common.skc_v6_rcv_saddr.in6_u.u6_addr32);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment