This is an automated email from the ASF dual-hosted git repository.

liuhan pushed a commit to branch reduce-handle-connect-time
in repository https://gitbox.apache.org/repos/asf/skywalking-rover.git


The following commit(s) were added to refs/heads/reduce-handle-connect-time by 
this push:
     new ceeb327  add has_remote field
ceeb327 is described below

commit ceeb327c4e3503e6083fcea25223e563a7540b06
Author: mrproliu <[email protected]>
AuthorDate: Fri Dec 27 15:05:25 2024 +0800

    add has_remote field
---
 bpf/accesslog/common/connection.h          | 3 ++-
 bpf/accesslog/syscalls/connect_conntrack.c | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/bpf/accesslog/common/connection.h 
b/bpf/accesslog/common/connection.h
index 880826d..ac15fc8 100644
--- a/bpf/accesslog/common/connection.h
+++ b/bpf/accesslog/common/connection.h
@@ -27,7 +27,7 @@
 // syscall:connect
 struct connect_args_t {
     __u32 fd;
-    __u32 fix;
+    __u32 has_remote;
     struct sockaddr* addr;
     struct sock *sock;
     __u64 start_nacs;
@@ -200,6 +200,7 @@ static __always_inline void submit_new_connection(void* 
ctx, bool success, __u32
         event->conntrack_upstream_iph = (__u64)conntrack->iph;
         event->conntrack_upstream_ipl = (__u64)conntrack->ipl;
         event->conntrack_upstream_port = conntrack->port;
+        bpf_printk("update conntrack, conid: %lld", conid);
     }
     event->success = success;
 
diff --git a/bpf/accesslog/syscalls/connect_conntrack.c 
b/bpf/accesslog/syscalls/connect_conntrack.c
index b12e4c8..0f4308c 100644
--- a/bpf/accesslog/syscalls/connect_conntrack.c
+++ b/bpf/accesslog/syscalls/connect_conntrack.c
@@ -94,7 +94,7 @@ static __always_inline int nf_conn_aware(struct pt_regs* ctx, 
struct nf_conn *ct
     }
 
     // already contains the remote address
-    if (&(connect_args->remote) != NULL) {
+    if (connect_args->has_remote && &(connect_args->remote) != NULL) {
         bpf_printk("---test2222");
         return 0;
     }
@@ -133,6 +133,7 @@ static __always_inline int nf_conn_aware(struct pt_regs* 
ctx, struct nf_conn *ct
     remote.ipl = reply_conn.saddr_l;
     remote.port = reply_conn.sport;
     connect_args->remote = remote;
+    connect_args->has_remote = 1;
     bpf_map_update_elem(&conecting_args, &id, connect_args, 0);
     bpf_printk("---test success!!!!!!!!!!!!!!!!!!!!");
 

Reply via email to