Skip to content

Commit 99de01c

Browse files
committed
packet03: extend description of the Assignment 4
Add more information on what is expected in this assignment, namely, how to use the bpf_fib_lookup funciton and setup a map for the bpf_redirect_map function. Signed-off-by: Anton Protopopov <a.s.protopopov@gmail.com>
1 parent cb146f2 commit 99de01c

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

packet03-redirecting/README.org

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -232,12 +232,19 @@ and return =XDP_PASS= when packets destined to outer interfaces, but this
232232
doesn't cover all cases and wouldn't it be better to dynamically lookup
233233
where each packet should go?
234234

235-
This assignment teaches to use the =bpf_fib_lookup= helper. For the most
236-
part, reproduces the [[https://github.com/torvalds/linux/blob/master/samples/bpf/xdp_fwd_kern.c][xdp_fwd_kern.c]]
235+
This assignment teaches to use the =bpf_fib_lookup= helper. This function lets
236+
XDP and TC programs to access the kernel routing table and will return an
237+
ifindex of interface to forward packet to. As was noted the =bpf_redirect_map=
238+
function accepts virtual ports, so to use ifindexes you will need to update the
239+
=xdp_prog_user.c= program to setup 1-1 mapping between virtual ports and
240+
network devices where each virtual port corresponds to a device with the same
241+
ifindex.
242+
243+
The Assignment, for the most part, reproduces the
244+
[[https://github.com/torvalds/linux/blob/master/samples/bpf/xdp_fwd_kern.c][xdp_fwd_kern.c]]
237245
example from the Linux kernel, but was patched to update statistics as in other
238-
examples and to check all the return values from the =bpf_fib_lookup()= function.
239-
Don't forget to update the =xdp_prog_user.c= program to setup 1-1 mapping
240-
between virtual ports and network devices.
246+
examples and to check all the return values from the =bpf_fib_lookup()=
247+
function.
241248

242249
To test the router check that you can get a ping and/or establish
243250
a TCP connection between any two interfaces: inner-inner, inner-outer,

0 commit comments

Comments
 (0)