Skip to content

Commit 7cb779a

Browse files
fomichevborkmann
authored andcommitted
bpf: Clarify error expectations from bpf_clone_redirect
Commit 151e887 ("veth: Fixing transmit return status for dropped packets") exposed the fact that bpf_clone_redirect is capable of returning raw NET_XMIT_XXX return codes. This is in the conflict with its UAPI doc which says the following: "0 on success, or a negative error in case of failure." Update the UAPI to reflect the fact that bpf_clone_redirect can return positive error numbers, but don't explicitly define their meaning. Reported-by: Daniel Borkmann <daniel@iogearbox.net> Signed-off-by: Stanislav Fomichev <sdf@google.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Link: https://lore.kernel.org/bpf/20230911194731.286342-1-sdf@google.com
1 parent 9458964 commit 7cb779a

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

  • include/uapi/linux
  • tools/include/uapi/linux

include/uapi/linux/bpf.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1962,7 +1962,9 @@ union bpf_attr {
19621962
* performed again, if the helper is used in combination with
19631963
* direct packet access.
19641964
* Return
1965-
* 0 on success, or a negative error in case of failure.
1965+
* 0 on success, or a negative error in case of failure. Positive
1966+
* error indicates a potential drop or congestion in the target
1967+
* device. The particular positive error codes are not defined.
19661968
*
19671969
* u64 bpf_get_current_pid_tgid(void)
19681970
* Description

tools/include/uapi/linux/bpf.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1962,7 +1962,9 @@ union bpf_attr {
19621962
* performed again, if the helper is used in combination with
19631963
* direct packet access.
19641964
* Return
1965-
* 0 on success, or a negative error in case of failure.
1965+
* 0 on success, or a negative error in case of failure. Positive
1966+
* error indicates a potential drop or congestion in the target
1967+
* device. The particular positive error codes are not defined.
19661968
*
19671969
* u64 bpf_get_current_pid_tgid(void)
19681970
* Description

0 commit comments

Comments
 (0)