Skip to content

Helper function bpf_skc_lookup_tcp

v5.2

Definition

Copyright (c) 2015 The Libbpf Authors. All rights reserved.

Look for TCP socket matching tuple, optionally in a child network namespace netns. The return value must be checked, and if non-NULL, released via bpf_sk_release().

This function is identical to bpf_sk_lookup_tcp(), except that it also returns timewait or request sockets. Use bpf_sk_fullsock() or bpf_tcp_sock() to access the full structure.

This helper is available only if the kernel was compiled with CONFIG_NET configuration option.

Returns

Pointer to struct bpf_sock, or NULL in case of failure. For sockets with reuseport option, the struct bpf_sock result is from reuse->socks[] using the hash of the tuple.

static struct bpf_sock *(* const bpf_skc_lookup_tcp)(void *ctx, struct bpf_sock_tuple *tuple, __u32 tuple_size, __u64 netns, __u64 flags) = (void *) 99;

Usage

Docs could be improved

This part of the docs is incomplete, contributions are very welcome

Program types

This helper call can be used in the following program types:

Example

Docs could be improved

This part of the docs is incomplete, contributions are very welcome