Skip to content

Helper function bpf_msg_redirect_hash

v4.18

The message redirect hash helper is used to redirect a message to a socket referenced by a hash map.

Definition

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

Returns SK_PASS on success, or SK_DROP on error.

static long (* const bpf_msg_redirect_hash)(struct sk_msg_md *msg, void *map, void *key, __u64 flags) = (void *) 71;

Usage

This helper is used in programs implementing policies at the socket level. If the message msg is allowed to pass (i.e. if the verdict eBPF program returns SK_PASS), redirect it to the socket referenced by map (of type BPF_MAP_TYPE_SOCKHASH) using hash key. Both ingress and egress interfaces can be used for redirection. The BPF_F_INGRESS value in flags is used to make the distinction (ingress path is selected if the flag is present, egress path otherwise). This is the only flag supported for now.

Program types

This helper call can be used in the following program types:

Map types

This helper call can be used with the following map types:

Example

Docs could be improved

This part of the docs is incomplete, contributions are very welcome