Skip to content

Commit

Permalink
Fix typo in BPF_MAP_TYPE_SOCKHASH
Browse files Browse the repository at this point in the history
  • Loading branch information
kxxt authored and dylandreimerink committed Dec 1, 2024
1 parent cef40ce commit 1fd02e4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion docs/linux/map-type/BPF_MAP_TYPE_SOCKHASH.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ The socket map is a specialized map type which hold network sockets as value.

## Usage

This map type can be use too lookup a pointer to a socket with the [bpf_map_lookup_elem](../helper-function/bpf_map_lookup_elem.md) helper function, which then can be passed to helpers such as [`bpf_sk_assign`](../helper-function/bpf_sk_assign.md) or the a map reference can be used directly in a range of helpers such as [`bpf_sk_redirect_map`](../helper-function/bpf_sk_redirect_map.md), [`bpf_msg_redirect_map`](../helper-function/bpf_msg_redirect_map.md) and [`bpf_sk_select_reuseport`](../helper-function/bpf_sk_select_reuseport.md). All of the above cases redirect a packet or connection in some way, the details differ depending on the program type and the helper function, so please visit the specific pages for details.
This map type can be used to lookup a pointer to a socket with the [bpf_map_lookup_elem](../helper-function/bpf_map_lookup_elem.md) helper function, which then can be passed to helpers such as [`bpf_sk_assign`](../helper-function/bpf_sk_assign.md) or the a map reference can be used directly in a range of helpers such as [`bpf_sk_redirect_map`](../helper-function/bpf_sk_redirect_map.md), [`bpf_msg_redirect_map`](../helper-function/bpf_msg_redirect_map.md) and [`bpf_sk_select_reuseport`](../helper-function/bpf_sk_select_reuseport.md). All of the above cases redirect a packet or connection in some way, the details differ depending on the program type and the helper function, so please visit the specific pages for details.

!!! note
Sockets returned by `bpf_map_lookup_elem` are ref-counted, so the caller must call [`bpf_sk_release`](../helper-function/bpf_sk_release.md) in all code paths where the returned socket is not NULL before exiting the program. This is enforced by the verifier which will throw a `Unreleased reference` error if socket pointers are not released.
Expand Down

0 comments on commit 1fd02e4

Please sign in to comment.