Skip to content

Latest commit

 

History

History
45 lines (29 loc) · 1.76 KB

bpf_msg_cork_bytes.md

File metadata and controls

45 lines (29 loc) · 1.76 KB
title description
Helper Function 'bpf_msg_cork_bytes'
This page documents the 'bpf_msg_cork_bytes' eBPF helper function, including its defintion, usage, program types that can use it, and examples.

Helper function bpf_msg_cork_bytes

:octicons-tag-24: v4.17

Definition

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

For socket policies, prevent the execution of the verdict eBPF program for message msg until bytes (byte number) have been accumulated.

This can be used when one needs a specific number of bytes before a verdict can be assigned, even if the data spans multiple sendmsg() or sendfile() calls. The extreme case would be a user calling sendmsg() repeatedly with 1-byte long message segments. Obviously, this is bad for performance, but it is still valid. If the eBPF program needs bytes bytes to validate a header, this helper can be used to prevent the eBPF program to be called again until bytes have been accumulated.

Returns

0

#!c static long (* const bpf_msg_cork_bytes)(struct sk_msg_md *msg, __u32 bytes) = (void *) 62;

Usage

!!! example "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

!!! example "Docs could be improved" This part of the docs is incomplete, contributions are very welcome