Skip to content

Helper function bpf_sk_redirect_map


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


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

Returns SK_PASS on success, or SK_DROP on error.

static long (* const bpf_sk_redirect_map)(struct __sk_buff *skb, void *map, __u32 key, __u64 flags) = (void *) 52;


Redirect the packet to the socket referenced by map (of type BPF_MAP_TYPE_SOCKMAP) at index 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:


Docs could be improved

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