Skip to content

Commit

Permalink
cleanup(network/ebpf): remove unreachable check (#34108)
Browse files Browse the repository at this point in the history
Co-authored-by: guyarb <guy20495@gmail.com>
  • Loading branch information
Andreagit97 and guyarb authored Mar 3, 2025
1 parent ac8aab1 commit 8cc3e19
Showing 1 changed file with 0 additions and 17 deletions.
17 changes: 0 additions & 17 deletions pkg/network/ebpf/c/protocols/http/http.h
Original file line number Diff line number Diff line change
Expand Up @@ -232,20 +232,6 @@ static __always_inline void http_process(http_event_t *event, skb_info_t *skb_in
}
}

// this function is called by the socket-filter program to decide whether or not we should inspect
// the contents of a certain packet, in order to avoid the cost of processing packets that are not
// of interest such as empty ACKs, or encrypted traffic.
static __always_inline bool http_allow_packet(conn_tuple_t *tuple, skb_info_t *skb_info) {
bool empty_payload = is_payload_empty(skb_info);
if (empty_payload) {
// if the payload data is empty or encrypted packet, we only
// process it if the packet represents a TCP termination
return skb_info->tcp_flags&(TCPHDR_FIN|TCPHDR_RST);
}

return true;
}

SEC("socket/http_filter")
int socket__http_filter(struct __sk_buff* skb) {
skb_info_t skb_info;
Expand All @@ -257,9 +243,6 @@ int socket__http_filter(struct __sk_buff* skb) {
return 0;
}

if (!http_allow_packet(&event.tuple, &skb_info)) {
return 0;
}
normalize_tuple(&event.tuple);

read_into_buffer_skb((char *)event.http.request_fragment, skb, skb_info.data_off);
Expand Down

0 comments on commit 8cc3e19

Please sign in to comment.