Helper function bpf_store_hdr_opt
Definition
Copyright (c) 2015 The Libbpf Authors. All rights reserved.
Store header option. The data will be copied from buffer from with length len to the TCP header.
The buffer from should have the whole option that includes the kind, kind-length, and the actual option data. The len must be at least kind-length long. The kind-length does not have to be 4 byte aligned. The kernel will take care of the padding and setting the 4 bytes aligned value to th->doff.
This helper will check for duplicated option by searching the same option in the outgoing skb.
This helper can only be called during BPF_SOCK_OPS_WRITE_HDR_OPT_CB.
Returns
0 on success, or negative error in case of failure:
-EINVAL If param is invalid.
-ENOSPC if there is not enough space in the header. Nothing has been written
-EEXIST if the option already exists.
-EFAULT on failure to parse the existing header options.
-EPERM if the helper cannot be used under the current skops->op.
static long (* const bpf_store_hdr_opt)(struct bpf_sock_ops *skops, const void *from, __u32 len, __u64 flags) = (void *) 143;
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