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 470d5cf rollback
470d5cf is described below
commit 470d5cfa6a677c31e437d505b104f26de42c009c
Author: mrproliu <[email protected]>
AuthorDate: Sat Dec 28 17:17:35 2024 +0800
rollback
---
bpf/accesslog/common/connection.h | 40 ++++++++-------------------------------
1 file changed, 8 insertions(+), 32 deletions(-)
diff --git a/bpf/accesslog/common/connection.h
b/bpf/accesslog/common/connection.h
index 9dce0cf..0a75214 100644
--- a/bpf/accesslog/common/connection.h
+++ b/bpf/accesslog/common/connection.h
@@ -24,18 +24,13 @@
#include "queue.h"
#include "socket_data.h"
-// The rewriting this file in the following points:
-// 1. Adding an identifier to indicate whether it has been filtered in active
connection (remote port=53).
-// 2. No longer sending a close message when the connection is filtered.
-
// syscall:connect
struct connect_args_t {
- __u64 start_nacs;
- __u64 randomid;
__u32 fd;
__u32 has_remote;
struct sockaddr* addr;
- struct sock* sock;
+ struct sock *sock;
+ __u64 start_nacs;
struct connect_track_remote remote;
};
@@ -98,8 +93,7 @@ struct socket_connect_event_t {
__u8 socket_family;
// is connect success or not
__u8 success;
- // difference with upstream, if filtered, then not upload other events
- __u32 filtered;
+ __u32 __pad0;
// upstream
__u32 remote_addr_v4;
@@ -137,8 +131,7 @@ struct active_connection_t {
__u8 ssl;
// skip data upload when the protocol break(such as HTTP2)
__u8 skip_data_upload;
- // difference with upstream, if filtered, then not upload other events
- __u8 connection_filtered;
+ __u8 pad0;
__u32 pad1;
};
struct {
@@ -173,8 +166,8 @@ static __inline bool family_should_trace(const __u32
family) {
return family != AF_UNKNOWN && family != AF_INET && family != AF_INET6 ?
false : true;
}
-static __always_inline void submit_new_connection(void* ctx, bool success,
__u32 func_name, __u32 tgid, __u32 fd, __u64 start_nacs, __u64 randomid,
- struct sockaddr* addr, const
struct socket* socket, struct connect_track_remote* conntrack, __u8 role, __u32
has_remote) {
+static __always_inline void submit_new_connection(void* ctx, bool success,
__u32 func_name, __u32 tgid, __u32 fd, __u64 start_nacs,
+ struct sockaddr* addr, const
struct socket* socket, struct connect_track_remote* conntrack, __u8 role) {
// send to the user-space the connection event
__u64 curr_nacs = bpf_ktime_get_ns();
struct socket_connect_event_t *event;
@@ -185,9 +178,6 @@ static __always_inline void submit_new_connection(void*
ctx, bool success, __u32
__u64 conid = gen_tgid_fd(tgid, fd);
__u64 random_id = bpf_get_prandom_u32();
- if (randomid != 0) {
- random_id = randomid;
- }
event->conid = conid;
event->random_id = random_id;
event->start_time = start_nacs;
@@ -210,7 +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, ipl: %lld, port: %d",
conid, conntrack->ipl, conntrack->port);
+ bpf_printk("update conntrack, conid: %lld, port: %d", conid,
conntrack->port);
}
event->success = success;
@@ -275,15 +265,6 @@ static __always_inline void submit_new_connection(void*
ctx, bool success, __u32
socket_family = AF_UNKNOWN;
}
- // judgement the connection should be filtered
- __u8 filtered = 0;
- if (event->remote_port == 53) {
- event->filtered = 1;
- filtered = 1;
- } else {
- event->filtered = 0;
- }
-
rover_submit_buf(ctx, &socket_connection_event_queue, event,
sizeof(*event));
if (success == false) {
return;
@@ -297,7 +278,6 @@ static __always_inline void submit_new_connection(void*
ctx, bool success, __u32
con.sockfd = fd;
con.role = role;
con.socket_family = socket_family;
- con.connection_filtered = filtered;
bpf_map_update_elem(&active_connection_map, &conid, &con, 0);
}
@@ -326,6 +306,7 @@ static __inline void submit_connection_when_not_exists(void
*ctx, __u64 id, stru
static __inline void notify_close_connection(void* ctx, __u64 conid, struct
active_connection_t* con, __u64 start_time, __u64 end_time, int ret) {
bpf_map_delete_elem(&socket_data_last_id_map, &conid);
+ bpf_map_delete_elem(&socket_data_id_generate_map, &conid);
struct socket_close_event_t *close_event;
close_event = rover_reserve_buf(&socket_close_event_queue,
sizeof(*close_event));
if (close_event == NULL) {
@@ -350,11 +331,6 @@ static __inline void submit_close_connection(void* ctx,
__u32 tgid, __u32 fd, __
if (con == NULL) {
return;
}
- // if the connection is filtered, then just delete the connection no notify
- if (con->connection_filtered) {
- bpf_map_delete_elem(&active_connection_map, &conid);
- return;
- }
notify_close_connection(ctx, conid, con, start_nacs, curr_nacs, ret);
bpf_map_delete_elem(&active_connection_map, &conid);
}
\ No newline at end of file