Helper function bpf_get_netns_cookie
Definition
Copyright (c) 2015 The Libbpf Authors. All rights reserved.
Retrieve the cookie (generated by the kernel) of the network namespace the input ctx is associated with. The network namespace cookie remains stable for its lifetime and provides a global identifier that can be assumed unique. If ctx is NULL, then the helper returns the cookie for the initial network namespace. The cookie itself is very similar to that of bpf_get_socket_cookie() helper, but for network namespaces instead of sockets.
Returns
A 8-byte long opaque number.
static __u64 (* const bpf_get_netns_cookie)(void *ctx) = (void *) 122;
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:
BPF_PROG_TYPE_CGROUP_SOCK
BPF_PROG_TYPE_CGROUP_SOCKOPT
BPF_PROG_TYPE_CGROUP_SOCK_ADDR
BPF_PROG_TYPE_SK_MSG
BPF_PROG_TYPE_SOCK_OPS
Example
Docs could be improved
This part of the docs is incomplete, contributions are very welcome