Skip to content

Helper function bpf_skb_cgroup_id

v4.18

Definition

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

Return the cgroup v2 id of the socket associated with the skb. This is roughly similar to the bpf_get_cgroup_classid() helper for cgroup v1 by providing a tag resp. identifier that can be matched on or used for map lookups e.g. to implement policy. The cgroup v2 id of a given path in the hierarchy is exposed in user space through the f_handle API in order to get to the same 64-bit id.

This helper can be used on TC egress path, but not on ingress, and is available only if the kernel was compiled with the CONFIG_SOCK_CGROUP_DATA configuration option.

Returns

The id is returned or 0 in case the id could not be retrieved.

static __u64 (* const bpf_skb_cgroup_id)(struct __sk_buff *skb) = (void *) 79;

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