@@ -110,15 +110,9 @@ static inline void get_tcp_probe_info(struct bpf_tcp_sock *tcp_sock, struct tcp_
110110
111111// construct_orig_dst_info try to read the dst_info from map_of_sock_storage first
112112// if not found, use the tuple info for orig_dst
113- static inline void construct_orig_dst_info (struct bpf_sock * sk , struct tcp_probe_info * info )
113+ static inline void
114+ construct_orig_dst_info (struct bpf_sock * sk , struct sock_storage_data * storage , struct tcp_probe_info * info )
114115{
115- struct sock_storage_data * storage = NULL ;
116- storage = bpf_sk_storage_get (& map_of_sock_storage , sk , 0 , 0 );
117- if (!storage ) {
118- BPF_LOG (ERR , PROBE , "on close: bpf_sk_storage_get failed\n" );
119- return ;
120- }
121-
122116 if (sk -> family == AF_INET ) {
123117 info -> orig_dst .ipv4 .addr = storage -> sk_tuple .ipv4 .daddr ;
124118 info -> orig_dst .ipv4 .port = bpf_ntohs (storage -> sk_tuple .ipv4 .dport );
@@ -136,7 +130,6 @@ static inline void construct_orig_dst_info(struct bpf_sock *sk, struct tcp_probe
136130static inline void
137131tcp_report (struct bpf_sock * sk , struct bpf_tcp_sock * tcp_sock , struct sock_storage_data * storage , __u32 state )
138132{
139- // struct connect_info *info = NULL;
140133 struct tcp_probe_info * info = NULL ;
141134
142135 // store tuple
@@ -157,7 +150,7 @@ tcp_report(struct bpf_sock *sk, struct bpf_tcp_sock *tcp_sock, struct sock_stora
157150 (* info ).type = IPV4 ;
158151 }
159152
160- construct_orig_dst_info (sk , info );
153+ construct_orig_dst_info (sk , storage , info );
161154 info -> last_report_ns = bpf_ktime_get_ns ();
162155 info -> duration = info -> last_report_ns - storage -> connect_ns ;
163156 storage -> last_report_ns = info -> last_report_ns ;
0 commit comments