Skip to content

Helper function bpf_redirect_neigh

v5.10

Definition

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

Redirect the packet to another net device of index ifindex and fill in L2 addresses from neighboring subsystem. This helper is somewhat similar to bpf_redirect(), except that it populates L2 addresses as well, meaning, internally, the helper relies on the neighbor lookup for the L2 address of the nexthop.

The helper will perform a FIB lookup based on the skb's networking header to get the address of the next hop, unless this is supplied by the caller in the params argument. The plen argument indicates the len of params and should be set to 0 if params is NULL.

The flags argument is reserved and must be 0. The helper is currently only supported for tc BPF program types, and enabled for IPv4 and IPv6 protocols.

Returns

The helper returns TC_ACT_REDIRECT on success or TC_ACT_SHOT on error.

static long (* const bpf_redirect_neigh)(__u32 ifindex, struct bpf_redir_neigh *params, int plen, __u64 flags) = (void *) 152;

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