You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -91,7 +91,7 @@ The "Design Details" section below is for the real
91
91
nitty-gritty.
92
92
-->
93
93
94
-
TCP connection information will be collected using eBPF sockops, sk_msg and kprobes hooks, and stored in ebpf hash maps using socket cookie as a unique key for hashmap. RingBuffer map is used for sending connection info periodically to userspace.
94
+
TCP connection information will be collected using eBPF cgroup_skb hook. RingBuffer map is used for sending connection info periodically to userspace.
95
95
96
96
97
97
### Design Details
@@ -105,185 +105,69 @@ proposal will be implemented, this is the place to discuss them.
105
105
106
106
#### Collecting Metrics
107
107
108
-
Decelearing ebpf hash map in probe.h to store information about tcp_connections.
108
+
Decelearing ebpf cgroup_skb hooks, which will trigger when the traffic passes through the cgroup socket.
109
109
110
110
```
111
-
// Ebpf map to store active tcp connections
112
-
struct {
113
-
__uint(type, BPF_MAP_TYPE_HASH);
114
-
__type(key, __u64); // use sock_cookie as key
115
-
__type(value, struct tcp_probe_info);
116
-
__uint(max_entries, MAP_SIZE_OF_TCP_CONNS);
117
-
__uint(map_flags, BPF_F_NO_PREALLOC);
118
-
} map_of_tcp_conns SEC(".maps");
119
-
120
-
```
121
-
Sockpos ebpf hook is triggered at various socket events, we will use this hook to store and refresh connection information at the time of connection established, connection state change, retransmits (also trigger in packet losss).
122
-
Updating workload/sockops.c
123
-
124
-
```
125
-
SEC("sockops_active")
126
-
int sockops_active_prog(struct bpf_sock_ops *skops)
111
+
SEC("cgroup_skb/ingress")
112
+
int cgroup_skb_ingress_prog(struct __sk_buff *skb)
127
113
{
128
-
__u64 sock_cookie = bpf_get_socket_cookie(skops);
129
-
130
-
if (skops->family != AF_INET && skops->family != AF_INET6)
Sk_msg hook is triggered when the packet leaves the socket, we will be using sk_msg ebpf hook for refreshing sent bytes data, also we are triggering flush_conn function here to send the connection info to userspace using ringbuffer map.
225
-
Updating sendmsg_prog func in send_msg.c
226
-
227
-
```
228
-
SEC("sk_msg")
229
-
int sendmsg_prog(struct sk_msg_md *msg)
127
+
SEC("cgroup_skb/egress")
128
+
int cgroup_skb_egress_prog(struct __sk_buff *skb)
230
129
{
231
-
__u32 off = 0;
232
-
if (msg->family != AF_INET && msg->family != AF_INET6)
130
+
if (skb->family != AF_INET && skb->family != AF_INET6)
Observe_on_data function checks if the time elapsed after lsat_report is greaater than 5 sec. and if it is greater, it report's the conn_info to the ring_buffer and updates the last_report_ns.
264
145
265
-
For refreshing the received bytes by a connection, we will attach a kprobe on tcp_rcv_established.
266
-
Creating workload/kprobe.c
267
146
```
268
-
SEC("kprobe/tcp_rcv_established")
269
-
int bpf_tcp_rcv_established(struct pt_regs *ctx) {
We will update functions of tcp_probe.h to store and refresh the connection information on the hash map.
285
-
286
168
We will update the functions of metric.go for periodic updating the workload and service metrics, also we will create a new metric for long tcp connections.
0 commit comments